idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
26,300
private Source getSourceFromUriResolver ( StylesheetHandler handler ) throws TransformerException { Source s = null ; TransformerFactoryImpl processor = handler . getStylesheetProcessor ( ) ; URIResolver uriresolver = processor . getURIResolver ( ) ; if ( uriresolver != null ) { String href = getHref ( ) ; String base = handler . getBaseIdentifier ( ) ; s = uriresolver . resolve ( href , base ) ; } return s ; }
Get the Source object for the included or imported stylesheet module obtained from the user s URIResolver if there is no user provided URIResolver null is returned .
26,301
private String getBaseURIOfIncludedStylesheet ( StylesheetHandler handler , Source s ) throws TransformerException { String baseURI ; String idFromUriResolverSource ; if ( s != null && ( idFromUriResolverSource = s . getSystemId ( ) ) != null ) { baseURI = idFromUriResolverSource ; } else { baseURI = SystemIDResolver . getAbsoluteURI ( getHref ( ) , handler . getBaseIdentifier ( ) ) ; } return baseURI ; }
Get the base URI of the included or imported stylesheet if the user provided a URIResolver then get the Source object for the stylsheet from it and get the systemId from that Source object otherwise try to recover by using the SysteIDResolver to figure out the base URI .
26,302
public static String get ( String name , String def ) { String val = null ; final String fname = name ; if ( System . getSecurityManager ( ) != null ) { try { val = AccessController . doPrivileged ( new PrivilegedAction < String > ( ) { public String run ( ) { return System . getProperty ( fname ) ; } } ) ; } catch ( AccessControlException e ) { } } else { val = System . getProperty ( name ) ; } if ( val == null ) { val = CONFIG_PROPS . getProperty ( name , def ) ; } return val ; }
Get ICU configuration property value for the given name .
26,303
public void write ( int c ) throws IOException { synchronized ( lock ) { if ( writeBuffer == null ) { writeBuffer = new char [ WRITE_BUFFER_SIZE ] ; } writeBuffer [ 0 ] = ( char ) c ; write ( writeBuffer , 0 , 1 ) ; } }
Writes a single character . The character to be written is contained in the 16 low - order bits of the given integer value ; the 16 high - order bits are ignored .
26,304
public void write ( String str , int off , int len ) throws IOException { synchronized ( lock ) { char cbuf [ ] ; if ( len <= WRITE_BUFFER_SIZE ) { if ( writeBuffer == null ) { writeBuffer = new char [ WRITE_BUFFER_SIZE ] ; } cbuf = writeBuffer ; } else { cbuf = new char [ len ] ; } str . getChars ( off , ( off + len ) , cbuf , 0 ) ; write ( cbuf , 0 , len ) ; } }
Writes a portion of a string .
26,305
public static LocaleDisplayNames getInstance ( ULocale locale , DialectHandling dialectHandling ) { LocaleDisplayNames result = null ; if ( FACTORY_DIALECTHANDLING != null ) { try { result = ( LocaleDisplayNames ) FACTORY_DIALECTHANDLING . invoke ( null , locale , dialectHandling ) ; } catch ( InvocationTargetException e ) { } catch ( IllegalAccessException e ) { } } if ( result == null ) { result = new LastResortLocaleDisplayNames ( locale , dialectHandling ) ; } return result ; }
Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale using the provided dialectHandling .
26,306
public static LocaleDisplayNames getInstance ( ULocale locale , DisplayContext ... contexts ) { LocaleDisplayNames result = null ; if ( FACTORY_DISPLAYCONTEXT != null ) { try { result = ( LocaleDisplayNames ) FACTORY_DISPLAYCONTEXT . invoke ( null , locale , contexts ) ; } catch ( InvocationTargetException e ) { } catch ( IllegalAccessException e ) { } } if ( result == null ) { result = new LastResortLocaleDisplayNames ( locale , contexts ) ; } return result ; }
Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale using the provided DisplayContext settings
26,307
public List < UiListItem > getUiList ( Set < ULocale > localeSet , boolean inSelf , Comparator < Object > collator ) { return getUiListCompareWholeItems ( localeSet , UiListItem . getComparator ( collator , inSelf ) ) ; }
Return a list of information used to construct a UI list of locale names .
26,308
public static boolean isValidIANAEncoding ( String ianaEncoding ) { if ( ianaEncoding != null ) { int length = ianaEncoding . length ( ) ; if ( length > 0 ) { char c = ianaEncoding . charAt ( 0 ) ; if ( ( c >= 'A' && c <= 'Z' ) || ( c >= 'a' && c <= 'z' ) ) { for ( int i = 1 ; i < length ; i ++ ) { c = ianaEncoding . charAt ( i ) ; if ( ( c < 'A' || c > 'Z' ) && ( c < 'a' || c > 'z' ) && ( c < '0' || c > '9' ) && c != '.' && c != '_' && c != '-' ) { return false ; } } return true ; } } } return false ; }
Returns true if the encoding name is a valid IANA encoding . This method does not verify that there is a decoder available for this encoding only that the characters are valid for an IANA encoding name .
26,309
public static boolean isValidJavaEncoding ( String javaEncoding ) { if ( javaEncoding != null ) { int length = javaEncoding . length ( ) ; if ( length > 0 ) { for ( int i = 1 ; i < length ; i ++ ) { char c = javaEncoding . charAt ( i ) ; if ( ( c < 'A' || c > 'Z' ) && ( c < 'a' || c > 'z' ) && ( c < '0' || c > '9' ) && c != '.' && c != '_' && c != '-' ) { return false ; } } return true ; } } return false ; }
Returns true if the encoding name is a valid Java encoding . This method does not verify that there is a decoder available for this encoding only that the characters are valid for an Java encoding name .
26,310
public void encodeInfo ( OutputStream out ) throws CRLException { try { DerOutputStream tmp = new DerOutputStream ( ) ; DerOutputStream rCerts = new DerOutputStream ( ) ; DerOutputStream seq = new DerOutputStream ( ) ; if ( version != 0 ) tmp . putInteger ( version ) ; infoSigAlgId . encode ( tmp ) ; if ( ( version == 0 ) && ( issuer . toString ( ) == null ) ) throw new CRLException ( "Null Issuer DN not allowed in v1 CRL" ) ; issuer . encode ( tmp ) ; if ( thisUpdate . getTime ( ) < YR_2050 ) tmp . putUTCTime ( thisUpdate ) ; else tmp . putGeneralizedTime ( thisUpdate ) ; if ( nextUpdate != null ) { if ( nextUpdate . getTime ( ) < YR_2050 ) tmp . putUTCTime ( nextUpdate ) ; else tmp . putGeneralizedTime ( nextUpdate ) ; } if ( ! revokedList . isEmpty ( ) ) { for ( X509CRLEntry entry : revokedList ) { ( ( X509CRLEntryImpl ) entry ) . encode ( rCerts ) ; } tmp . write ( DerValue . tag_Sequence , rCerts ) ; } if ( extensions != null ) extensions . encode ( tmp , isExplicit ) ; seq . write ( DerValue . tag_Sequence , tmp ) ; tbsCertList = seq . toByteArray ( ) ; out . write ( tbsCertList ) ; } catch ( IOException e ) { throw new CRLException ( "Encoding error: " + e . getMessage ( ) ) ; } }
Encodes the to - be - signed CRL to the OutputStream .
26,311
public void verify ( PublicKey key ) throws CRLException , NoSuchAlgorithmException , InvalidKeyException , NoSuchProviderException , SignatureException { verify ( key , "" ) ; }
Verifies that this CRL was signed using the private key that corresponds to the given public key .
26,312
public synchronized void verify ( PublicKey key , String sigProvider ) throws CRLException , NoSuchAlgorithmException , InvalidKeyException , NoSuchProviderException , SignatureException { if ( sigProvider == null ) { sigProvider = "" ; } if ( ( verifiedPublicKey != null ) && verifiedPublicKey . equals ( key ) ) { if ( sigProvider . equals ( verifiedProvider ) ) { return ; } } if ( signedCRL == null ) { throw new CRLException ( "Uninitialized CRL" ) ; } Signature sigVerf = null ; if ( sigProvider . length ( ) == 0 ) { sigVerf = Signature . getInstance ( sigAlgId . getName ( ) ) ; } else { sigVerf = Signature . getInstance ( sigAlgId . getName ( ) , sigProvider ) ; } sigVerf . initVerify ( key ) ; if ( tbsCertList == null ) { throw new CRLException ( "Uninitialized CRL" ) ; } sigVerf . update ( tbsCertList , 0 , tbsCertList . length ) ; if ( ! sigVerf . verify ( signature ) ) { throw new SignatureException ( "Signature does not match." ) ; } verifiedPublicKey = key ; verifiedProvider = sigProvider ; }
Verifies that this CRL was signed using the private key that corresponds to the given public key and that the signature verification was computed by the given provider .
26,313
public boolean isRevoked ( Certificate cert ) { if ( revokedMap . isEmpty ( ) || ( ! ( cert instanceof X509Certificate ) ) ) { return false ; } X509Certificate xcert = ( X509Certificate ) cert ; X509IssuerSerial issuerSerial = new X509IssuerSerial ( xcert ) ; return revokedMap . containsKey ( issuerSerial ) ; }
Checks whether the given certificate is on this CRL .
26,314
public X509CRLEntry getRevokedCertificate ( BigInteger serialNumber ) { if ( revokedMap . isEmpty ( ) ) { return null ; } X509IssuerSerial issuerSerial = new X509IssuerSerial ( getIssuerX500Principal ( ) , serialNumber ) ; return revokedMap . get ( issuerSerial ) ; }
Gets the CRL entry with the given serial number from this CRL .
26,315
public X509CRLEntry getRevokedCertificate ( X509Certificate cert ) { if ( revokedMap . isEmpty ( ) ) { return null ; } X509IssuerSerial issuerSerial = new X509IssuerSerial ( cert ) ; return revokedMap . get ( issuerSerial ) ; }
Gets the CRL entry for the given certificate .
26,316
public byte [ ] getSignature ( ) { if ( signature == null ) return null ; byte [ ] dup = new byte [ signature . length ] ; System . arraycopy ( signature , 0 , dup , 0 , dup . length ) ; return dup ; }
Gets the raw Signature bits from the CRL .
26,317
public KeyIdentifier getAuthKeyId ( ) throws IOException { AuthorityKeyIdentifierExtension aki = getAuthKeyIdExtension ( ) ; if ( aki != null ) { KeyIdentifier keyId = ( KeyIdentifier ) aki . get ( AuthorityKeyIdentifierExtension . KEY_ID ) ; return keyId ; } else { return null ; } }
return the AuthorityKeyIdentifier if any .
26,318
public AuthorityKeyIdentifierExtension getAuthKeyIdExtension ( ) throws IOException { Object obj = getExtension ( PKIXExtensions . AuthorityKey_Id ) ; return ( AuthorityKeyIdentifierExtension ) obj ; }
return the AuthorityKeyIdentifierExtension if any .
26,319
public CRLNumberExtension getCRLNumberExtension ( ) throws IOException { Object obj = getExtension ( PKIXExtensions . CRLNumber_Id ) ; return ( CRLNumberExtension ) obj ; }
return the CRLNumberExtension if any .
26,320
public BigInteger getCRLNumber ( ) throws IOException { CRLNumberExtension numExt = getCRLNumberExtension ( ) ; if ( numExt != null ) { BigInteger num = numExt . get ( CRLNumberExtension . NUMBER ) ; return num ; } else { return null ; } }
return the CRL number from the CRLNumberExtension if any .
26,321
public DeltaCRLIndicatorExtension getDeltaCRLIndicatorExtension ( ) throws IOException { Object obj = getExtension ( PKIXExtensions . DeltaCRLIndicator_Id ) ; return ( DeltaCRLIndicatorExtension ) obj ; }
return the DeltaCRLIndicatorExtension if any .
26,322
public BigInteger getBaseCRLNumber ( ) throws IOException { DeltaCRLIndicatorExtension dciExt = getDeltaCRLIndicatorExtension ( ) ; if ( dciExt != null ) { BigInteger num = dciExt . get ( DeltaCRLIndicatorExtension . NUMBER ) ; return num ; } else { return null ; } }
return the base CRL number from the DeltaCRLIndicatorExtension if any .
26,323
public IssuerAlternativeNameExtension getIssuerAltNameExtension ( ) throws IOException { Object obj = getExtension ( PKIXExtensions . IssuerAlternativeName_Id ) ; return ( IssuerAlternativeNameExtension ) obj ; }
return the IssuerAlternativeNameExtension if any .
26,324
public IssuingDistributionPointExtension getIssuingDistributionPointExtension ( ) throws IOException { Object obj = getExtension ( PKIXExtensions . IssuingDistributionPoint_Id ) ; return ( IssuingDistributionPointExtension ) obj ; }
return the IssuingDistributionPointExtension if any .
26,325
public static X500Principal getIssuerX500Principal ( X509CRL crl ) { try { byte [ ] encoded = crl . getEncoded ( ) ; DerInputStream derIn = new DerInputStream ( encoded ) ; DerValue tbsCert = derIn . getSequence ( 3 ) [ 0 ] ; DerInputStream tbsIn = tbsCert . data ; DerValue tmp ; byte nextByte = ( byte ) tbsIn . peekByte ( ) ; if ( nextByte == DerValue . tag_Integer ) { tmp = tbsIn . getDerValue ( ) ; } tmp = tbsIn . getDerValue ( ) ; tmp = tbsIn . getDerValue ( ) ; byte [ ] principalBytes = tmp . toByteArray ( ) ; return new X500Principal ( principalBytes ) ; } catch ( Exception e ) { throw new RuntimeException ( "Could not parse issuer" , e ) ; } }
Extract the issuer X500Principal from an X509CRL . Parses the encoded form of the CRL to preserve the principal s ASN . 1 encoding .
26,326
public static X509CRLImpl toImpl ( X509CRL crl ) throws CRLException { if ( crl instanceof X509CRLImpl ) { return ( X509CRLImpl ) crl ; } else { return X509Factory . intern ( crl ) ; } }
Utility method to convert an arbitrary instance of X509CRL to a X509CRLImpl . Does a cast if possible otherwise reparses the encoding .
26,327
private X500Principal getCertIssuer ( X509CRLEntryImpl entry , X500Principal prevCertIssuer ) throws IOException { CertificateIssuerExtension ciExt = entry . getCertificateIssuerExtension ( ) ; if ( ciExt != null ) { GeneralNames names = ciExt . get ( CertificateIssuerExtension . ISSUER ) ; X500Name issuerDN = ( X500Name ) names . get ( 0 ) . getName ( ) ; return issuerDN . asX500Principal ( ) ; } else { return prevCertIssuer ; } }
Returns the X500 certificate issuer DN of a CRL entry .
26,328
public final int get ( int codePoint ) { int value ; int ix ; if ( codePoint >= 0 ) { if ( codePoint < 0x0d800 || ( codePoint > 0x0dbff && codePoint <= 0x0ffff ) ) { ix = index [ codePoint >> UTRIE2_SHIFT_2 ] ; ix = ( ix << UTRIE2_INDEX_SHIFT ) + ( codePoint & UTRIE2_DATA_MASK ) ; value = data32 [ ix ] ; return value ; } if ( codePoint <= 0xffff ) { ix = index [ UTRIE2_LSCP_INDEX_2_OFFSET + ( ( codePoint - 0xd800 ) >> UTRIE2_SHIFT_2 ) ] ; ix = ( ix << UTRIE2_INDEX_SHIFT ) + ( codePoint & UTRIE2_DATA_MASK ) ; value = data32 [ ix ] ; return value ; } if ( codePoint < highStart ) { ix = ( UTRIE2_INDEX_1_OFFSET - UTRIE2_OMITTED_BMP_INDEX_1_LENGTH ) + ( codePoint >> UTRIE2_SHIFT_1 ) ; ix = index [ ix ] ; ix += ( codePoint >> UTRIE2_SHIFT_2 ) & UTRIE2_INDEX_2_MASK ; ix = index [ ix ] ; ix = ( ix << UTRIE2_INDEX_SHIFT ) + ( codePoint & UTRIE2_DATA_MASK ) ; value = data32 [ ix ] ; return value ; } if ( codePoint <= 0x10ffff ) { value = data32 [ highValueIndex ] ; return value ; } } return errorValue ; }
Get the value for a code point as stored in the Trie2 .
26,329
public int getFromU16SingleLead ( char codeUnit ) { int value ; int ix ; ix = index [ codeUnit >> UTRIE2_SHIFT_2 ] ; ix = ( ix << UTRIE2_INDEX_SHIFT ) + ( codeUnit & UTRIE2_DATA_MASK ) ; value = data32 [ ix ] ; return value ; }
Get a Trie2 value for a UTF - 16 code unit .
26,330
public int serialize ( OutputStream os ) throws IOException { DataOutputStream dos = new DataOutputStream ( os ) ; int bytesWritten = 0 ; bytesWritten += serializeHeader ( dos ) ; for ( int i = 0 ; i < dataLength ; i ++ ) { dos . writeInt ( data32 [ i ] ) ; } bytesWritten += dataLength * 4 ; return bytesWritten ; }
Serialize a Trie2_32 onto an OutputStream .
26,331
public void addIterator ( DTMIterator expr ) { if ( null == m_iterators ) { m_iterators = new DTMIterator [ 1 ] ; m_iterators [ 0 ] = expr ; } else { DTMIterator [ ] exprs = m_iterators ; int len = m_iterators . length ; m_iterators = new DTMIterator [ len + 1 ] ; System . arraycopy ( exprs , 0 , m_iterators , 0 , len ) ; m_iterators [ len ] = expr ; } expr . nextNode ( ) ; if ( expr instanceof Expression ) ( ( Expression ) expr ) . exprSetParent ( this ) ; }
Add an iterator to the union list .
26,332
public static LocPathIterator createUnionIterator ( Compiler compiler , int opPos ) throws javax . xml . transform . TransformerException { UnionPathIterator upi = new UnionPathIterator ( compiler , opPos ) ; int nPaths = upi . m_exprs . length ; boolean isAllChildIterators = true ; for ( int i = 0 ; i < nPaths ; i ++ ) { LocPathIterator lpi = upi . m_exprs [ i ] ; if ( lpi . getAxis ( ) != Axis . CHILD ) { isAllChildIterators = false ; break ; } else { if ( HasPositionalPredChecker . check ( lpi ) ) { isAllChildIterators = false ; break ; } } } if ( isAllChildIterators ) { UnionChildIterator uci = new UnionChildIterator ( ) ; for ( int i = 0 ; i < nPaths ; i ++ ) { PredicatedNodeTest lpi = upi . m_exprs [ i ] ; uci . addNodeTest ( lpi ) ; } return uci ; } else return upi ; }
This will return an iterator capable of handling the union of paths given .
26,333
protected LocPathIterator createDTMIterator ( Compiler compiler , int opPos ) throws javax . xml . transform . TransformerException { LocPathIterator lpi = ( LocPathIterator ) WalkerFactory . newDTMIterator ( compiler , opPos , ( compiler . getLocationPathDepth ( ) <= 0 ) ) ; return lpi ; }
Create a new location path iterator .
26,334
protected void loadLocationPaths ( Compiler compiler , int opPos , int count ) throws javax . xml . transform . TransformerException { int steptype = compiler . getOp ( opPos ) ; if ( steptype == OpCodes . OP_LOCATIONPATH ) { loadLocationPaths ( compiler , compiler . getNextOpPos ( opPos ) , count + 1 ) ; m_exprs [ count ] = createDTMIterator ( compiler , opPos ) ; m_exprs [ count ] . exprSetParent ( this ) ; } else { switch ( steptype ) { case OpCodes . OP_VARIABLE : case OpCodes . OP_EXTFUNCTION : case OpCodes . OP_FUNCTION : case OpCodes . OP_GROUP : loadLocationPaths ( compiler , compiler . getNextOpPos ( opPos ) , count + 1 ) ; WalkingIterator iter = new WalkingIterator ( compiler . getNamespaceContext ( ) ) ; iter . exprSetParent ( this ) ; if ( compiler . getLocationPathDepth ( ) <= 0 ) iter . setIsTopLevel ( true ) ; iter . m_firstWalker = new org . apache . xpath . axes . FilterExprWalker ( iter ) ; iter . m_firstWalker . init ( compiler , opPos , steptype ) ; m_exprs [ count ] = iter ; break ; default : m_exprs = new LocPathIterator [ count ] ; } } }
Initialize the location path iterators . Recursive .
26,335
private static boolean isSameClassPackage ( ClassLoader loader1 , String name1 , ClassLoader loader2 , String name2 ) { if ( loader1 != loader2 ) { return false ; } else { int lastDot1 = name1 . lastIndexOf ( '.' ) ; int lastDot2 = name2 . lastIndexOf ( '.' ) ; if ( ( lastDot1 == - 1 ) || ( lastDot2 == - 1 ) ) { return ( lastDot1 == lastDot2 ) ; } else { int idx1 = 0 ; int idx2 = 0 ; if ( name1 . charAt ( idx1 ) == '[' ) { do { idx1 ++ ; } while ( name1 . charAt ( idx1 ) == '[' ) ; if ( name1 . charAt ( idx1 ) != 'L' ) { throw new InternalError ( "Illegal class name " + name1 ) ; } } if ( name2 . charAt ( idx2 ) == '[' ) { do { idx2 ++ ; } while ( name2 . charAt ( idx2 ) == '[' ) ; if ( name2 . charAt ( idx2 ) != 'L' ) { throw new InternalError ( "Illegal class name " + name2 ) ; } } int length1 = lastDot1 - idx1 ; int length2 = lastDot2 - idx2 ; if ( length1 != length2 ) { return false ; } return name1 . regionMatches ( false , idx1 , name2 , idx2 , length1 ) ; } } }
Returns true if two classes are in the same package ; classloader and classname information is enough to determine a class s package
26,336
protected int handleGetLimit ( int field , int limitType ) { if ( field == ERA ) { if ( limitType == MINIMUM || limitType == GREATEST_MINIMUM ) { return BEFORE_MINGUO ; } else { return MINGUO ; } } return super . handleGetLimit ( field , limitType ) ; }
Override GregorianCalendar . There is only one Taiwan ERA . We should really handle YEAR YEAR_WOY and EXTENDED_YEAR here too to implement the 1 .. 5000000 range but it s not critical .
26,337
public void setParent ( XMLReader parent ) { super . setParent ( parent ) ; if ( null != parent . getContentHandler ( ) ) this . setContentHandler ( parent . getContentHandler ( ) ) ; setupParse ( ) ; }
Set the parent reader .
26,338
protected int updateSelectedKeys ( ) { int numKeysUpdated = 0 ; for ( int i = channelOffset ; i < totalChannels ; i ++ ) { int rOps = pollWrapper . getReventOps ( i ) ; if ( rOps != 0 ) { SelectionKeyImpl sk = channelArray [ i ] ; pollWrapper . putReventOps ( i , 0 ) ; if ( selectedKeys . contains ( sk ) ) { if ( sk . channel . translateAndSetReadyOps ( rOps , sk ) ) { numKeysUpdated ++ ; } } else { sk . channel . translateAndSetReadyOps ( rOps , sk ) ; if ( ( sk . nioReadyOps ( ) & sk . nioInterestOps ( ) ) != 0 ) { selectedKeys . add ( sk ) ; numKeysUpdated ++ ; } } } } return numKeysUpdated ; }
Copy the information in the pollfd structs into the opss of the corresponding Channels . Add the ready keys to the ready queue .
26,339
private Node enq ( Node node ) { for ( ; ; ) { Node oldTail = tail ; if ( oldTail != null ) { U . putObject ( node , Node . PREV , oldTail ) ; if ( compareAndSetTail ( oldTail , node ) ) { oldTail . next = node ; return oldTail ; } } else { initializeSyncQueue ( ) ; } } }
Inserts node into queue initializing if necessary . See picture above .
26,340
private Node addWaiter ( Node mode ) { Node node = new Node ( mode ) ; for ( ; ; ) { Node oldTail = tail ; if ( oldTail != null ) { U . putObject ( node , Node . PREV , oldTail ) ; if ( compareAndSetTail ( oldTail , node ) ) { oldTail . next = node ; return node ; } } else { initializeSyncQueue ( ) ; } } }
Creates and enqueues node for current thread and given mode .
26,341
private void setHead ( Node node ) { head = node ; node . thread = null ; node . prev = null ; }
Sets head of queue to be node thus dequeuing . Called only by acquire methods . Also nulls out unused fields for sake of GC and to suppress unnecessary signals and traversals .
26,342
private void unparkSuccessor ( Node node ) { int ws = node . waitStatus ; if ( ws < 0 ) node . compareAndSetWaitStatus ( ws , 0 ) ; Node s = node . next ; if ( s == null || s . waitStatus > 0 ) { s = null ; for ( Node p = tail ; p != node && p != null ; p = p . prev ) if ( p . waitStatus <= 0 ) s = p ; } if ( s != null ) LockSupport . unpark ( s . thread ) ; }
Wakes up node s successor if one exists .
26,343
private void cancelAcquire ( Node node ) { if ( node == null ) return ; node . thread = null ; Node pred = node . prev ; while ( pred . waitStatus > 0 ) node . prev = pred = pred . prev ; Node predNext = pred . next ; node . waitStatus = Node . CANCELLED ; if ( node == tail && compareAndSetTail ( node , pred ) ) { pred . compareAndSetNext ( predNext , null ) ; } else { int ws ; if ( pred != head && ( ( ws = pred . waitStatus ) == Node . SIGNAL || ( ws <= 0 && pred . compareAndSetWaitStatus ( ws , Node . SIGNAL ) ) ) && pred . thread != null ) { Node next = node . next ; if ( next != null && next . waitStatus <= 0 ) pred . compareAndSetNext ( predNext , next ) ; } else { unparkSuccessor ( node ) ; } node . next = node ; } }
Cancels an ongoing attempt to acquire .
26,344
private static boolean shouldParkAfterFailedAcquire ( Node pred , Node node ) { int ws = pred . waitStatus ; if ( ws == Node . SIGNAL ) return true ; if ( ws > 0 ) { do { node . prev = pred = pred . prev ; } while ( pred . waitStatus > 0 ) ; pred . next = node ; } else { pred . compareAndSetWaitStatus ( ws , Node . SIGNAL ) ; } return false ; }
Checks and updates status for a node that failed to acquire . Returns true if thread should block . This is the main signal control in all acquire loops . Requires that pred == node . prev .
26,345
final boolean acquireQueued ( final Node node , int arg ) { try { boolean interrupted = false ; for ( ; ; ) { final Node p = node . predecessor ( ) ; if ( p == head && tryAcquire ( arg ) ) { setHead ( node ) ; p . next = null ; return interrupted ; } if ( shouldParkAfterFailedAcquire ( p , node ) && parkAndCheckInterrupt ( ) ) interrupted = true ; } } catch ( Throwable t ) { cancelAcquire ( node ) ; throw t ; } }
Acquires in exclusive uninterruptible mode for thread already in queue . Used by condition wait methods as well as acquire .
26,346
private void doAcquireSharedInterruptibly ( int arg ) throws InterruptedException { final Node node = addWaiter ( Node . SHARED ) ; try { for ( ; ; ) { final Node p = node . predecessor ( ) ; if ( p == head ) { int r = tryAcquireShared ( arg ) ; if ( r >= 0 ) { setHeadAndPropagate ( node , r ) ; p . next = null ; return ; } } if ( shouldParkAfterFailedAcquire ( p , node ) && parkAndCheckInterrupt ( ) ) throw new InterruptedException ( ) ; } } catch ( Throwable t ) { cancelAcquire ( node ) ; throw t ; } }
Acquires in shared interruptible mode .
26,347
private boolean doAcquireSharedNanos ( int arg , long nanosTimeout ) throws InterruptedException { if ( nanosTimeout <= 0L ) return false ; final long deadline = System . nanoTime ( ) + nanosTimeout ; final Node node = addWaiter ( Node . SHARED ) ; try { for ( ; ; ) { final Node p = node . predecessor ( ) ; if ( p == head ) { int r = tryAcquireShared ( arg ) ; if ( r >= 0 ) { setHeadAndPropagate ( node , r ) ; p . next = null ; return true ; } } nanosTimeout = deadline - System . nanoTime ( ) ; if ( nanosTimeout <= 0L ) { cancelAcquire ( node ) ; return false ; } if ( shouldParkAfterFailedAcquire ( p , node ) && nanosTimeout > SPIN_FOR_TIMEOUT_THRESHOLD ) LockSupport . parkNanos ( this , nanosTimeout ) ; if ( Thread . interrupted ( ) ) throw new InterruptedException ( ) ; } } catch ( Throwable t ) { cancelAcquire ( node ) ; throw t ; } }
Acquires in shared timed mode .
26,348
private Thread fullGetFirstQueuedThread ( ) { Node h , s ; Thread st ; if ( ( ( h = head ) != null && ( s = h . next ) != null && s . prev == head && ( st = s . thread ) != null ) || ( ( h = head ) != null && ( s = h . next ) != null && s . prev == head && ( st = s . thread ) != null ) ) return st ; Thread firstThread = null ; for ( Node p = tail ; p != null && p != head ; p = p . prev ) { Thread t = p . thread ; if ( t != null ) firstThread = t ; } return firstThread ; }
Version of getFirstQueuedThread called when fastpath fails .
26,349
public final boolean isQueued ( Thread thread ) { if ( thread == null ) throw new NullPointerException ( ) ; for ( Node p = tail ; p != null ; p = p . prev ) if ( p . thread == thread ) return true ; return false ; }
Returns true if the given thread is currently queued .
26,350
public final boolean hasQueuedPredecessors ( ) { Node t = tail ; Node h = head ; Node s ; return h != t && ( ( s = h . next ) == null || s . thread != Thread . currentThread ( ) ) ; }
Queries whether any threads have been waiting to acquire longer than the current thread .
26,351
public final int getQueueLength ( ) { int n = 0 ; for ( Node p = tail ; p != null ; p = p . prev ) { if ( p . thread != null ) ++ n ; } return n ; }
Returns an estimate of the number of threads waiting to acquire . The value is only an estimate because the number of threads may change dynamically while this method traverses internal data structures . This method is designed for use in monitoring system state not for synchronization control .
26,352
final boolean isOnSyncQueue ( Node node ) { if ( node . waitStatus == Node . CONDITION || node . prev == null ) return false ; if ( node . next != null ) return true ; return findNodeFromTail ( node ) ; }
Returns true if a node always one that was initially placed on a condition queue is now waiting to reacquire on sync queue .
26,353
private boolean findNodeFromTail ( Node node ) { for ( Node p = tail ; ; ) { if ( p == node ) return true ; if ( p == null ) return false ; p = p . prev ; } }
Returns true if node is on sync queue by searching backwards from tail . Called only when needed by isOnSyncQueue .
26,354
final boolean transferForSignal ( Node node ) { if ( ! node . compareAndSetWaitStatus ( Node . CONDITION , 0 ) ) return false ; Node p = enq ( node ) ; int ws = p . waitStatus ; if ( ws > 0 || ! p . compareAndSetWaitStatus ( ws , Node . SIGNAL ) ) LockSupport . unpark ( node . thread ) ; return true ; }
Transfers a node from a condition queue onto sync queue . Returns true if successful .
26,355
final boolean transferAfterCancelledWait ( Node node ) { if ( node . compareAndSetWaitStatus ( Node . CONDITION , 0 ) ) { enq ( node ) ; return true ; } while ( ! isOnSyncQueue ( node ) ) Thread . yield ( ) ; return false ; }
Transfers node if necessary to sync queue after a cancelled wait . Returns true if thread was cancelled before being signalled .
26,356
public final Collection < Thread > getWaitingThreads ( ConditionObject condition ) { if ( ! owns ( condition ) ) throw new IllegalArgumentException ( "Not owner" ) ; return condition . getWaitingThreads ( ) ; }
Returns a collection containing those threads that may be waiting on the given condition associated with this synchronizer . Because the actual set of threads may change dynamically while constructing this result the returned collection is only a best - effort estimate . The elements of the returned collection are in no particular order .
26,357
private final void initializeSyncQueue ( ) { Node h ; if ( U . compareAndSwapObject ( this , HEAD , null , ( h = new Node ( ) ) ) ) tail = h ; }
Initializes head and tail fields on first contention .
26,358
private final boolean compareAndSetTail ( Node expect , Node update ) { return U . compareAndSwapObject ( this , TAIL , expect , update ) ; }
CASes tail field .
26,359
public void close ( ) { try { synchronized ( lock ) { if ( out == null ) return ; out . close ( ) ; out = null ; } } catch ( IOException x ) { trouble = true ; } }
Closes the stream and releases any system resources associated with it . Closing a previously closed stream has no effect .
26,360
public boolean checkError ( ) { if ( out != null ) { flush ( ) ; } if ( out instanceof java . io . PrintWriter ) { PrintWriter pw = ( PrintWriter ) out ; return pw . checkError ( ) ; } else if ( psOut != null ) { return psOut . checkError ( ) ; } return trouble ; }
Flushes the stream if it s not closed and checks its error state .
26,361
public void write ( char buf [ ] , int off , int len ) { try { synchronized ( lock ) { ensureOpen ( ) ; out . write ( buf , off , len ) ; } } catch ( InterruptedIOException x ) { Thread . currentThread ( ) . interrupt ( ) ; } catch ( IOException x ) { trouble = true ; } }
Writes A Portion of an array of characters .
26,362
public PrintWriter format ( Locale l , String format , Object ... args ) { try { synchronized ( lock ) { ensureOpen ( ) ; if ( ( formatter == null ) || ( formatter . locale ( ) != l ) ) formatter = new Formatter ( WeakProxy . forObject ( this ) , l ) ; formatter . format ( l , format , args ) ; if ( autoFlush ) out . flush ( ) ; } } catch ( InterruptedIOException x ) { Thread . currentThread ( ) . interrupt ( ) ; } catch ( IOException x ) { trouble = true ; } return this ; }
Writes a formatted string to this writer using the specified format string and arguments . If automatic flushing is enabled calls to this method will flush the output buffer .
26,363
public void joinGroup ( SocketAddress mcastaddr , NetworkInterface netIf ) throws IOException { if ( isClosed ( ) ) throw new SocketException ( "Socket is closed" ) ; if ( mcastaddr == null || ! ( mcastaddr instanceof InetSocketAddress ) ) throw new IllegalArgumentException ( "Unsupported address type" ) ; if ( oldImpl ) throw new UnsupportedOperationException ( ) ; checkAddress ( ( ( InetSocketAddress ) mcastaddr ) . getAddress ( ) , "joinGroup" ) ; SecurityManager security = System . getSecurityManager ( ) ; if ( security != null ) { security . checkMulticast ( ( ( InetSocketAddress ) mcastaddr ) . getAddress ( ) ) ; } if ( ! ( ( InetSocketAddress ) mcastaddr ) . getAddress ( ) . isMulticastAddress ( ) ) { throw new SocketException ( "Not a multicast address" ) ; } getImpl ( ) . joinGroup ( mcastaddr , netIf ) ; }
Joins the specified multicast group at the specified interface .
26,364
public void setInterface ( InetAddress inf ) throws SocketException { if ( isClosed ( ) ) { throw new SocketException ( "Socket is closed" ) ; } checkAddress ( inf , "setInterface" ) ; synchronized ( infLock ) { getImpl ( ) . setOption ( SocketOptions . IP_MULTICAST_IF , inf ) ; infAddress = inf ; interfaceSet = true ; } }
Set the multicast network interface used by methods whose behavior would be affected by the value of the network interface . Useful for multihomed hosts .
26,365
public InetAddress getInterface ( ) throws SocketException { if ( isClosed ( ) ) { throw new SocketException ( "Socket is closed" ) ; } synchronized ( infLock ) { InetAddress ia = ( InetAddress ) getImpl ( ) . getOption ( SocketOptions . IP_MULTICAST_IF ) ; if ( infAddress == null ) { return ia ; } if ( ia . equals ( infAddress ) ) { return ia ; } try { NetworkInterface ni = NetworkInterface . getByInetAddress ( ia ) ; Enumeration < InetAddress > addrs = ni . getInetAddresses ( ) ; while ( addrs . hasMoreElements ( ) ) { InetAddress addr = addrs . nextElement ( ) ; if ( addr . equals ( infAddress ) ) { return infAddress ; } } infAddress = null ; return ia ; } catch ( Exception e ) { return ia ; } } }
Retrieve the address of the network interface used for multicast packets .
26,366
public void setNetworkInterface ( NetworkInterface netIf ) throws SocketException { synchronized ( infLock ) { getImpl ( ) . setOption ( SocketOptions . IP_MULTICAST_IF2 , netIf ) ; infAddress = null ; interfaceSet = true ; } }
Specify the network interface for outgoing multicast datagrams sent on this socket .
26,367
public NetworkInterface getNetworkInterface ( ) throws SocketException { Integer niIndex = ( Integer ) getImpl ( ) . getOption ( SocketOptions . IP_MULTICAST_IF2 ) ; if ( niIndex == 0 ) { InetAddress [ ] addrs = new InetAddress [ 1 ] ; addrs [ 0 ] = InetAddress . anyLocalAddress ( ) ; return new NetworkInterface ( addrs [ 0 ] . getHostName ( ) , 0 , addrs ) ; } else { return NetworkInterface . getByIndex ( niIndex ) ; } }
Get the multicast network interface set .
26,368
public static SelectorProvider provider ( ) { synchronized ( lock ) { if ( provider != null ) return provider ; if ( loadProviderFromProperty ( ) ) { return provider ; } if ( loadProviderAsService ( ) ) { return provider ; } provider = sun . nio . ch . DefaultSelectorProvider . create ( ) ; return provider ; } }
Returns the system - wide default selector provider for this invocation of the Java virtual machine .
26,369
void flushBuffer ( ) throws IOException { synchronized ( lock ) { ensureOpen ( ) ; if ( nextChar == 0 ) return ; out . write ( cb , 0 , nextChar ) ; nextChar = 0 ; } }
Flushes the output buffer to the underlying character stream without flushing the stream itself . This method is non - private only so that it may be invoked by PrintStream .
26,370
public void write ( char cbuf [ ] , int off , int len ) throws IOException { synchronized ( lock ) { ensureOpen ( ) ; if ( ( off < 0 ) || ( off > cbuf . length ) || ( len < 0 ) || ( ( off + len ) > cbuf . length ) || ( ( off + len ) < 0 ) ) { throw new IndexOutOfBoundsException ( ) ; } else if ( len == 0 ) { return ; } if ( len >= nChars ) { flushBuffer ( ) ; out . write ( cbuf , off , len ) ; return ; } int b = off , t = off + len ; while ( b < t ) { int d = min ( nChars - nextChar , t - b ) ; System . arraycopy ( cbuf , b , cb , nextChar , d ) ; b += d ; nextChar += d ; if ( nextChar >= nChars ) flushBuffer ( ) ; } } }
Writes a portion of an array of characters .
26,371
public void write ( String s , int off , int len ) throws IOException { synchronized ( lock ) { ensureOpen ( ) ; int b = off , t = off + len ; while ( b < t ) { int d = min ( nChars - nextChar , t - b ) ; s . getChars ( b , b + d , cb , nextChar ) ; b += d ; nextChar += d ; if ( nextChar >= nChars ) flushBuffer ( ) ; } } }
Writes a portion of a String .
26,372
private static int getTypeModifiers ( TypeElement type ) { int modifiers = ElementUtil . fromModifierSet ( type . getModifiers ( ) ) ; if ( type . getKind ( ) . isInterface ( ) ) { modifiers |= java . lang . reflect . Modifier . INTERFACE | java . lang . reflect . Modifier . ABSTRACT | java . lang . reflect . Modifier . STATIC ; } if ( ElementUtil . isSynthetic ( type ) ) { modifiers |= ElementUtil . ACC_SYNTHETIC ; } if ( ElementUtil . isAnnotationType ( type ) ) { modifiers |= ElementUtil . ACC_ANNOTATION ; } if ( ElementUtil . isEnum ( type ) ) { modifiers |= ElementUtil . ACC_ENUM ; } if ( ElementUtil . isAnonymous ( type ) ) { modifiers |= ElementUtil . ACC_ANONYMOUS ; } return modifiers ; }
Returns the modifiers for a specified type including internal ones . All class modifiers are defined in the JVM specification table 4 . 1 .
26,373
private static int getMethodModifiers ( ExecutableElement method ) { int modifiers = ElementUtil . fromModifierSet ( method . getModifiers ( ) ) ; if ( method . isVarArgs ( ) ) { modifiers |= ElementUtil . ACC_VARARGS ; } if ( ElementUtil . isSynthetic ( method ) ) { modifiers |= ElementUtil . ACC_SYNTHETIC ; } return modifiers ; }
Returns the modifiers for a specified method including internal ones . All method modifiers are defined in the JVM specification table 4 . 5 .
26,374
private static int getFieldModifiers ( VariableElement var ) { int modifiers = ElementUtil . fromModifierSet ( var . getModifiers ( ) ) ; if ( ElementUtil . isSynthetic ( var ) ) { modifiers |= ElementUtil . ACC_SYNTHETIC ; } if ( ElementUtil . isEnumConstant ( var ) ) { modifiers |= ElementUtil . ACC_ENUM ; } return modifiers ; }
Returns the modifiers for a specified field including internal ones . All method modifiers are defined in the JVM specification table 4 . 4 .
26,375
public void setMethodDefaults ( String method ) { String defaultMethod = m_properties . getProperty ( OutputKeys . METHOD ) ; if ( ( null == defaultMethod ) || ! defaultMethod . equals ( method ) || defaultMethod . equals ( "xml" ) ) { Properties savedProps = m_properties ; Properties newDefaults = OutputPropertiesFactory . getDefaultMethodProperties ( method ) ; m_properties = new Properties ( newDefaults ) ; copyFrom ( savedProps , false ) ; } }
Reset the default properties based on the method .
26,376
public void setQNameProperties ( String key , Vector v ) { int s = v . size ( ) ; FastStringBuffer fsb = new FastStringBuffer ( 9 , 9 ) ; for ( int i = 0 ; i < s ; i ++ ) { QName qname = ( QName ) v . elementAt ( i ) ; fsb . append ( qname . toNamespacedString ( ) ) ; if ( i < s - 1 ) fsb . append ( ' ' ) ; } m_properties . put ( key , fsb . toString ( ) ) ; }
Set an output property with a QName list value . The QNames will be turned into strings with the namespace in curly brackets .
26,377
public void copyFrom ( Properties src , boolean shouldResetDefaults ) { Enumeration keys = src . keys ( ) ; while ( keys . hasMoreElements ( ) ) { String key = ( String ) keys . nextElement ( ) ; if ( ! isLegalPropertyKey ( key ) ) throw new IllegalArgumentException ( XSLMessages . createMessage ( XSLTErrorResources . ER_OUTPUT_PROPERTY_NOT_RECOGNIZED , new Object [ ] { key } ) ) ; Object oldValue = m_properties . get ( key ) ; if ( null == oldValue ) { String val = ( String ) src . get ( key ) ; if ( shouldResetDefaults && key . equals ( OutputKeys . METHOD ) ) { setMethodDefaults ( val ) ; } m_properties . put ( key , val ) ; } else if ( key . equals ( OutputKeys . CDATA_SECTION_ELEMENTS ) ) { m_properties . put ( key , ( String ) oldValue + " " + ( String ) src . get ( key ) ) ; } } }
Copy the keys and values from the source to this object . This will not copy the default values . This is meant to be used by going from a higher precedence object to a lower precedence object so that if a key already exists this method will not reset it .
26,378
static String validatePrefix ( String prefix , boolean namespaceAware , String namespaceURI ) { if ( ! namespaceAware ) { throw new DOMException ( DOMException . NAMESPACE_ERR , prefix ) ; } if ( prefix != null ) { if ( namespaceURI == null || ! DocumentImpl . isXMLIdentifier ( prefix ) || "xml" . equals ( prefix ) && ! "http://www.w3.org/XML/1998/namespace" . equals ( namespaceURI ) || "xmlns" . equals ( prefix ) && ! "http://www.w3.org/2000/xmlns/" . equals ( namespaceURI ) ) { throw new DOMException ( DOMException . NAMESPACE_ERR , prefix ) ; } } return prefix ; }
Validates the element or attribute namespace prefix on this node .
26,379
private NodeImpl getNamespacingElement ( ) { switch ( this . getNodeType ( ) ) { case ELEMENT_NODE : return this ; case DOCUMENT_NODE : return ( NodeImpl ) ( ( Document ) this ) . getDocumentElement ( ) ; case ENTITY_NODE : case NOTATION_NODE : case DOCUMENT_FRAGMENT_NODE : case DOCUMENT_TYPE_NODE : return null ; case ATTRIBUTE_NODE : return ( NodeImpl ) ( ( Attr ) this ) . getOwnerElement ( ) ; case TEXT_NODE : case CDATA_SECTION_NODE : case ENTITY_REFERENCE_NODE : case PROCESSING_INSTRUCTION_NODE : case COMMENT_NODE : return getContainingElement ( ) ; default : throw new DOMException ( DOMException . NOT_SUPPORTED_ERR , "Unsupported node type " + getNodeType ( ) ) ; } }
Returns the element whose namespace definitions apply to this node . Use this element when mapping prefixes to URIs and vice versa .
26,380
private NodeImpl getContainingElement ( ) { for ( Node p = getParentNode ( ) ; p != null ; p = p . getParentNode ( ) ) { if ( p . getNodeType ( ) == ELEMENT_NODE ) { return ( NodeImpl ) p ; } } return null ; }
Returns the nearest ancestor element that contains this node .
26,381
public void registerExtension ( String namespace ) { if ( namespaceIndex ( namespace , m_extensions ) == - 1 ) { int predef = namespaceIndex ( namespace , m_predefExtensions ) ; if ( predef != - 1 ) m_extensions . add ( m_predefExtensions . get ( predef ) ) ; else if ( ! ( m_unregisteredExtensions . contains ( namespace ) ) ) m_unregisteredExtensions . add ( namespace ) ; } }
If necessary register the extension namespace found compiling a function or creating an extension element .
26,382
public void registerExtension ( ExtensionNamespaceSupport extNsSpt ) { String namespace = extNsSpt . getNamespace ( ) ; if ( namespaceIndex ( namespace , m_extensions ) == - 1 ) { m_extensions . add ( extNsSpt ) ; if ( m_unregisteredExtensions . contains ( namespace ) ) m_unregisteredExtensions . remove ( namespace ) ; } }
Register the extension namespace for an ElemExtensionDecl or ElemFunction and prepare a support object to launch the appropriate ExtensionHandler at transformation runtime .
26,383
public int namespaceIndex ( String namespace , Vector extensions ) { for ( int i = 0 ; i < extensions . size ( ) ; i ++ ) { if ( ( ( ExtensionNamespaceSupport ) extensions . get ( i ) ) . getNamespace ( ) . equals ( namespace ) ) return i ; } return - 1 ; }
Get the index for a namespace entry in the extension namespace Vector - 1 if no such entry yet exists .
26,384
public void registerUnregisteredNamespaces ( ) { for ( int i = 0 ; i < m_unregisteredExtensions . size ( ) ; i ++ ) { String ns = ( String ) m_unregisteredExtensions . get ( i ) ; ExtensionNamespaceSupport extNsSpt = defineJavaNamespace ( ns ) ; if ( extNsSpt != null ) m_extensions . add ( extNsSpt ) ; } }
Attempt to register any unregistered extension namespaces .
26,385
private void setPredefinedNamespaces ( ) { String uri = Constants . S_EXTENSIONS_JAVA_URL ; String handlerClassName = "org.apache.xalan.extensions.ExtensionHandlerJavaPackage" ; String lang = "javapackage" ; String lib = "" ; m_predefExtensions . add ( new ExtensionNamespaceSupport ( uri , handlerClassName , new Object [ ] { uri , lang , lib } ) ) ; uri = Constants . S_EXTENSIONS_OLD_JAVA_URL ; m_predefExtensions . add ( new ExtensionNamespaceSupport ( uri , handlerClassName , new Object [ ] { uri , lang , lib } ) ) ; uri = Constants . S_EXTENSIONS_LOTUSXSL_JAVA_URL ; m_predefExtensions . add ( new ExtensionNamespaceSupport ( uri , handlerClassName , new Object [ ] { uri , lang , lib } ) ) ; uri = Constants . S_BUILTIN_EXTENSIONS_URL ; handlerClassName = "org.apache.xalan.extensions.ExtensionHandlerJavaClass" ; lang = "javaclass" ; lib = "org.apache.xalan.lib.Extensions" ; m_predefExtensions . add ( new ExtensionNamespaceSupport ( uri , handlerClassName , new Object [ ] { uri , lang , lib } ) ) ; uri = Constants . S_BUILTIN_OLD_EXTENSIONS_URL ; m_predefExtensions . add ( new ExtensionNamespaceSupport ( uri , handlerClassName , new Object [ ] { uri , lang , lib } ) ) ; uri = Constants . S_EXTENSIONS_REDIRECT_URL ; lib = "org.apache.xalan.lib.Redirect" ; m_predefExtensions . add ( new ExtensionNamespaceSupport ( uri , handlerClassName , new Object [ ] { uri , lang , lib } ) ) ; uri = Constants . S_EXTENSIONS_PIPE_URL ; lib = "org.apache.xalan.lib.PipeDocument" ; m_predefExtensions . add ( new ExtensionNamespaceSupport ( uri , handlerClassName , new Object [ ] { uri , lang , lib } ) ) ; uri = Constants . S_EXTENSIONS_SQL_URL ; lib = "org.apache.xalan.lib.sql.XConnection" ; m_predefExtensions . add ( new ExtensionNamespaceSupport ( uri , handlerClassName , new Object [ ] { uri , lang , lib } ) ) ; uri = Constants . S_EXSLT_COMMON_URL ; lib = "org.apache.xalan.lib.ExsltCommon" ; m_predefExtensions . add ( new ExtensionNamespaceSupport ( uri , handlerClassName , new Object [ ] { uri , lang , lib } ) ) ; uri = Constants . S_EXSLT_MATH_URL ; lib = "org.apache.xalan.lib.ExsltMath" ; m_predefExtensions . add ( new ExtensionNamespaceSupport ( uri , handlerClassName , new Object [ ] { uri , lang , lib } ) ) ; uri = Constants . S_EXSLT_SETS_URL ; lib = "org.apache.xalan.lib.ExsltSets" ; m_predefExtensions . add ( new ExtensionNamespaceSupport ( uri , handlerClassName , new Object [ ] { uri , lang , lib } ) ) ; uri = Constants . S_EXSLT_DATETIME_URL ; lib = "org.apache.xalan.lib.ExsltDatetime" ; m_predefExtensions . add ( new ExtensionNamespaceSupport ( uri , handlerClassName , new Object [ ] { uri , lang , lib } ) ) ; uri = Constants . S_EXSLT_DYNAMIC_URL ; lib = "org.apache.xalan.lib.ExsltDynamic" ; m_predefExtensions . add ( new ExtensionNamespaceSupport ( uri , handlerClassName , new Object [ ] { uri , lang , lib } ) ) ; uri = Constants . S_EXSLT_STRINGS_URL ; lib = "org.apache.xalan.lib.ExsltStrings" ; m_predefExtensions . add ( new ExtensionNamespaceSupport ( uri , handlerClassName , new Object [ ] { uri , lang , lib } ) ) ; }
Set up a Vector for predefined extension namespaces .
26,386
protected ExpressionNode getExpressionOwner ( ExpressionNode ex ) { ExpressionNode parent = ex . exprGetParent ( ) ; while ( ( null != parent ) && ( parent instanceof Expression ) ) parent = parent . exprGetParent ( ) ; return parent ; }
Get the first non - Expression parent of this node .
26,387
public String getMessage ( ) { String lastMessage = super . getMessage ( ) ; Throwable exception = m_exception ; while ( null != exception ) { String nextMessage = exception . getMessage ( ) ; if ( null != nextMessage ) lastMessage = nextMessage ; if ( exception instanceof TransformerException ) { TransformerException se = ( TransformerException ) exception ; Throwable prev = exception ; exception = se . getException ( ) ; if ( prev == exception ) break ; } else { exception = null ; } } return ( null != lastMessage ) ? lastMessage : "" ; }
Find the most contained message .
26,388
private static void checkEventType ( String eventSetName , Method listenerMethod ) throws IntrospectionException { Class < ? > [ ] params = listenerMethod . getParameterTypes ( ) ; String firstParamTypeName = null ; String eventTypeName = prepareEventTypeName ( eventSetName ) ; if ( params . length > 0 ) { firstParamTypeName = extractShortClassName ( params [ 0 ] . getName ( ) ) ; } if ( firstParamTypeName == null || ! firstParamTypeName . equals ( eventTypeName ) ) { throw new IntrospectionException ( "Listener method " + listenerMethod . getName ( ) + " should have parameter of type " + eventTypeName ) ; } }
Checks that given listener method has an argument of the valid type .
26,389
public void setCdataSectionElements ( java . util . Vector newValue ) { m_outputProperties . setQNameProperties ( OutputKeys . CDATA_SECTION_ELEMENTS , newValue ) ; }
Set the cdata - section - elements property from the attribute value .
26,390
public void setMethod ( org . apache . xml . utils . QName newValue ) { m_outputProperties . setQNameProperty ( OutputKeys . METHOD , newValue ) ; }
Set the method property from the attribute value .
26,391
public void setForeignAttr ( String attrUri , String attrLocalName , String attrRawName , String attrValue ) { QName key = new QName ( attrUri , attrLocalName ) ; m_outputProperties . setProperty ( key , attrValue ) ; }
Set a foreign property from the attribute value .
26,392
public CharsTrie saveState ( State state ) { state . chars = chars_ ; state . root = root_ ; state . pos = pos_ ; state . remainingMatchLength = remainingMatchLength_ ; return this ; }
Saves the state of this trie .
26,393
public CharsTrie resetToState ( State state ) { if ( chars_ == state . chars && chars_ != null && root_ == state . root ) { pos_ = state . pos ; remainingMatchLength_ = state . remainingMatchLength ; } else { throw new IllegalArgumentException ( "incompatible trie state" ) ; } return this ; }
Resets this trie to the saved state .
26,394
public Result current ( ) { int pos = pos_ ; if ( pos < 0 ) { return Result . NO_MATCH ; } else { int node ; return ( remainingMatchLength_ < 0 && ( node = chars_ . charAt ( pos ) ) >= kMinValueLead ) ? valueResults_ [ node >> 15 ] : Result . NO_VALUE ; } }
Determines whether the string so far matches whether it has a value and whether another input char can continue a matching string .
26,395
public Result next ( int inUnit ) { int pos = pos_ ; if ( pos < 0 ) { return Result . NO_MATCH ; } int length = remainingMatchLength_ ; if ( length >= 0 ) { if ( inUnit == chars_ . charAt ( pos ++ ) ) { remainingMatchLength_ = -- length ; pos_ = pos ; int node ; return ( length < 0 && ( node = chars_ . charAt ( pos ) ) >= kMinValueLead ) ? valueResults_ [ node >> 15 ] : Result . NO_VALUE ; } else { stop ( ) ; return Result . NO_MATCH ; } } return nextImpl ( pos , inUnit ) ; }
Traverses the trie from the current state for this input char .
26,396
public Result nextForCodePoint ( int cp ) { return cp <= 0xffff ? next ( cp ) : ( next ( UTF16 . getLeadSurrogate ( cp ) ) . hasNext ( ) ? next ( UTF16 . getTrailSurrogate ( cp ) ) : Result . NO_MATCH ) ; }
Traverses the trie from the current state for the one or two UTF - 16 code units for this input code point .
26,397
public long getUniqueValue ( ) { int pos = pos_ ; if ( pos < 0 ) { return 0 ; } long uniqueValue = findUniqueValue ( chars_ , pos + remainingMatchLength_ + 1 , 0 ) ; return ( uniqueValue << 31 ) >> 31 ; }
Determines whether all strings reachable from the current state map to the same value and if so returns that value .
26,398
public static Iterator iterator ( CharSequence trieChars , int offset , int maxStringLength ) { return new Iterator ( trieChars , offset , - 1 , maxStringLength ) ; }
Iterates from the root of a char - serialized BytesTrie .
26,399
private static int readValue ( CharSequence chars , int pos , int leadUnit ) { int value ; if ( leadUnit < kMinTwoUnitValueLead ) { value = leadUnit ; } else if ( leadUnit < kThreeUnitValueLead ) { value = ( ( leadUnit - kMinTwoUnitValueLead ) << 16 ) | chars . charAt ( pos ) ; } else { value = ( chars . charAt ( pos ) << 16 ) | chars . charAt ( pos + 1 ) ; } return value ; }
pos is already after the leadUnit and the lead unit has bit 15 reset .