idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
26,100
private File generate ( String pattern , int generation , int unique ) throws IOException { File file = null ; String word = "" ; int ix = 0 ; boolean sawg = false ; boolean sawu = false ; while ( ix < pattern . length ( ) ) { char ch = pattern . charAt ( ix ) ; ix ++ ; char ch2 = 0 ; if ( ix < pattern . length ( ) ) { ch2 = Character . toLowerCase ( pattern . charAt ( ix ) ) ; } if ( ch == '/' ) { if ( file == null ) { file = new File ( word ) ; } else { file = new File ( file , word ) ; } word = "" ; continue ; } else if ( ch == '%' ) { if ( ch2 == 't' ) { String tmpDir = System . getProperty ( "java.io.tmpdir" ) ; if ( tmpDir == null ) { tmpDir = System . getProperty ( "user.home" ) ; } file = new File ( tmpDir ) ; ix ++ ; word = "" ; continue ; } else if ( ch2 == 'h' ) { file = new File ( System . getProperty ( "user.home" ) ) ; ix ++ ; word = "" ; continue ; } else if ( ch2 == 'g' ) { word = word + generation ; sawg = true ; ix ++ ; continue ; } else if ( ch2 == 'u' ) { word = word + unique ; sawu = true ; ix ++ ; continue ; } else if ( ch2 == '%' ) { word = word + "%" ; ix ++ ; continue ; } } word = word + ch ; } if ( count > 1 && ! sawg ) { word = word + "." + generation ; } if ( unique > 0 && ! sawu ) { word = word + "." + unique ; } if ( word . length ( ) > 0 ) { if ( file == null ) { file = new File ( word ) ; } else { file = new File ( file , word ) ; } } return file ; }
Generate a filename from a pattern .
26,101
private synchronized void rotate ( ) { Level oldLevel = getLevel ( ) ; setLevel ( Level . OFF ) ; super . close ( ) ; for ( int i = count - 2 ; i >= 0 ; i -- ) { File f1 = files [ i ] ; File f2 = files [ i + 1 ] ; if ( f1 . exists ( ) ) { if ( f2 . exists ( ) ) { f2 . delete ( ) ; } f1 . renameTo ( f2 ) ; } } try { open ( files [ 0 ] , false ) ; } catch ( IOException ix ) { reportError ( null , ix , ErrorManager . OPEN_FAILURE ) ; } setLevel ( oldLevel ) ; }
Rotate the set of output files
26,102
public synchronized void close ( ) throws SecurityException { super . close ( ) ; if ( lockFileName == null ) { return ; } try { lockStream . close ( ) ; } catch ( Exception ex ) { } synchronized ( locks ) { locks . remove ( lockFileName ) ; } new File ( lockFileName ) . delete ( ) ; lockFileName = null ; lockStream = null ; }
Close all the files .
26,103
protected void decodeAtom ( PushbackInputStream inStream , OutputStream outStream , int rem ) throws java . io . IOException { int i ; byte a = - 1 , b = - 1 , c = - 1 , d = - 1 ; if ( rem < 2 ) { throw new CEFormatException ( "BASE64Decoder: Not enough bytes for an atom." ) ; } do { i = inStream . read ( ) ; if ( i == - 1 ) { throw new CEStreamExhausted ( ) ; } } while ( i == '\n' || i == '\r' ) ; decode_buffer [ 0 ] = ( byte ) i ; i = readFully ( inStream , decode_buffer , 1 , rem - 1 ) ; if ( i == - 1 ) { throw new CEStreamExhausted ( ) ; } if ( rem > 3 && decode_buffer [ 3 ] == '=' ) { rem = 3 ; } if ( rem > 2 && decode_buffer [ 2 ] == '=' ) { rem = 2 ; } switch ( rem ) { case 4 : d = pem_convert_array [ decode_buffer [ 3 ] & 0xff ] ; case 3 : c = pem_convert_array [ decode_buffer [ 2 ] & 0xff ] ; case 2 : b = pem_convert_array [ decode_buffer [ 1 ] & 0xff ] ; a = pem_convert_array [ decode_buffer [ 0 ] & 0xff ] ; break ; } switch ( rem ) { case 2 : outStream . write ( ( byte ) ( ( ( a << 2 ) & 0xfc ) | ( ( b >>> 4 ) & 3 ) ) ) ; break ; case 3 : outStream . write ( ( byte ) ( ( ( a << 2 ) & 0xfc ) | ( ( b >>> 4 ) & 3 ) ) ) ; outStream . write ( ( byte ) ( ( ( b << 4 ) & 0xf0 ) | ( ( c >>> 2 ) & 0xf ) ) ) ; break ; case 4 : outStream . write ( ( byte ) ( ( ( a << 2 ) & 0xfc ) | ( ( b >>> 4 ) & 3 ) ) ) ; outStream . write ( ( byte ) ( ( ( b << 4 ) & 0xf0 ) | ( ( c >>> 2 ) & 0xf ) ) ) ; outStream . write ( ( byte ) ( ( ( c << 6 ) & 0xc0 ) | ( d & 0x3f ) ) ) ; break ; } return ; }
Decode one BASE64 atom into 1 2 or 3 bytes of data .
26,104
synchronized void receive ( int c ) throws IOException { if ( ! connected ) { throw new IOException ( "Pipe not connected" ) ; } else if ( closedByWriter || closedByReader ) { throw new IOException ( "Pipe closed" ) ; } else if ( readSide != null && ! readSide . isAlive ( ) ) { throw new IOException ( "Read end dead" ) ; } writeSide = Thread . currentThread ( ) ; while ( in == out ) { if ( ( readSide != null ) && ! readSide . isAlive ( ) ) { throw new IOException ( "Pipe broken" ) ; } notifyAll ( ) ; try { wait ( 1000 ) ; } catch ( InterruptedException ex ) { throw new java . io . InterruptedIOException ( ) ; } } if ( in < 0 ) { in = 0 ; out = 0 ; } buffer [ in ++ ] = ( char ) c ; if ( in >= buffer . length ) { in = 0 ; } }
Receives a char of data . This method will block if no input is available .
26,105
public synchronized boolean ready ( ) throws IOException { if ( ! connected ) { throw new IOException ( "Pipe not connected" ) ; } else if ( closedByReader ) { throw new IOException ( "Pipe closed" ) ; } else if ( writeSide != null && ! writeSide . isAlive ( ) && ! closedByWriter && ( in < 0 ) ) { throw new IOException ( "Write end dead" ) ; } if ( in < 0 ) { return false ; } else { return true ; } }
Tell whether this stream is ready to be read . A piped character stream is ready if the circular buffer is not empty .
26,106
synchronized public void addDTM ( DTM dtm , int id , int offset ) { if ( id >= IDENT_MAX_DTMS ) { throw new DTMException ( XMLMessages . createXMLMessage ( XMLErrorResources . ER_NO_DTMIDS_AVAIL , null ) ) ; } int oldlen = m_dtms . length ; if ( oldlen <= id ) { int newlen = Math . min ( ( id + 256 ) , IDENT_MAX_DTMS ) ; DTM new_m_dtms [ ] = new DTM [ newlen ] ; System . arraycopy ( m_dtms , 0 , new_m_dtms , 0 , oldlen ) ; m_dtms = new_m_dtms ; int new_m_dtm_offsets [ ] = new int [ newlen ] ; System . arraycopy ( m_dtm_offsets , 0 , new_m_dtm_offsets , 0 , oldlen ) ; m_dtm_offsets = new_m_dtm_offsets ; } m_dtms [ id ] = dtm ; m_dtm_offsets [ id ] = offset ; dtm . documentRegistration ( ) ; }
Add a DTM to the DTM table .
26,107
synchronized public int getFirstFreeDTMID ( ) { int n = m_dtms . length ; for ( int i = 1 ; i < n ; i ++ ) { if ( null == m_dtms [ i ] ) { return i ; } } return n ; }
Get the first free DTM ID available . %OPT% Linear search is inefficient!
26,108
synchronized public DTM getDTM ( int nodeHandle ) { try { return m_dtms [ nodeHandle >>> IDENT_DTM_NODE_BITS ] ; } catch ( java . lang . ArrayIndexOutOfBoundsException e ) { if ( nodeHandle == DTM . NULL ) return null ; else throw e ; } }
Return the DTM object containing a representation of this node .
26,109
synchronized public int getDTMIdentity ( DTM dtm ) { if ( dtm instanceof DTMDefaultBase ) { DTMDefaultBase dtmdb = ( DTMDefaultBase ) dtm ; if ( dtmdb . getManager ( ) == this ) return dtmdb . getDTMIDs ( ) . elementAt ( 0 ) ; else return - 1 ; } int n = m_dtms . length ; for ( int i = 0 ; i < n ; i ++ ) { DTM tdtm = m_dtms [ i ] ; if ( tdtm == dtm && m_dtm_offsets [ i ] == 0 ) return i << IDENT_DTM_NODE_BITS ; } return - 1 ; }
Given a DTM find the ID number in the DTM tables which addresses the start of the document . If overflow addressing is in use other DTM IDs may also be assigned to this DTM .
26,110
static Class getClassForName ( String className ) throws ClassNotFoundException { if ( className . equals ( "org.apache.xalan.xslt.extensions.Redirect" ) ) { className = "org.apache.xalan.lib.Redirect" ; } return ObjectFactory . findProviderClass ( className , ObjectFactory . findClassLoader ( ) , true ) ; }
This method loads a class using the context class loader if we re running under Java2 or higher .
26,111
private static void set32x64Bits ( int [ ] table , int start , int limit ) { assert ( 64 == table . length ) ; int lead = start >> 6 ; int trail = start & 0x3f ; int bits = 1 << lead ; if ( ( start + 1 ) == limit ) { table [ trail ] |= bits ; return ; } int limitLead = limit >> 6 ; int limitTrail = limit & 0x3f ; if ( lead == limitLead ) { while ( trail < limitTrail ) { table [ trail ++ ] |= bits ; } } else { if ( trail > 0 ) { do { table [ trail ++ ] |= bits ; } while ( trail < 64 ) ; ++ lead ; } if ( lead < limitLead ) { bits = ~ ( ( 1 << lead ) - 1 ) ; if ( limitLead < 0x20 ) { bits &= ( 1 << limitLead ) - 1 ; } for ( trail = 0 ; trail < 64 ; ++ trail ) { table [ trail ] |= bits ; } } bits = 1 << limitLead ; for ( trail = 0 ; trail < limitTrail ; ++ trail ) { table [ trail ] |= bits ; } } }
Set bits in a bit rectangle in vertical bit organization . start<limit< = 0x800
26,112
protected Object writeReplace ( ) throws java . io . ObjectStreamException { try { return new CertificateRep ( type , getEncoded ( ) ) ; } catch ( CertificateException e ) { throw new java . io . NotSerializableException ( "java.security.cert.Certificate: " + type + ": " + e . getMessage ( ) ) ; } }
Replace the Certificate to be serialized .
26,113
public InputStream getInputStream ( ) throws IOException { if ( closed ) { throw new IllegalStateException ( "JarURLConnection InputStream has been closed" ) ; } connect ( ) ; if ( jarInput != null ) { return jarInput ; } if ( jarEntry == null ) { throw new IOException ( "Jar entry not specified" ) ; } return jarInput = new JarURLConnectionInputStream ( jarFile . getInputStream ( jarEntry ) , jarFile ) ; }
Creates an input stream for reading from this URL Connection .
26,114
public int subtreeDepth ( ) throws UnsupportedOperationException { String subtree = name ; int i = 1 ; int atNdx = subtree . lastIndexOf ( '@' ) ; if ( atNdx >= 0 ) { i ++ ; subtree = subtree . substring ( atNdx + 1 ) ; } for ( ; subtree . lastIndexOf ( '.' ) >= 0 ; i ++ ) { subtree = subtree . substring ( 0 , subtree . lastIndexOf ( '.' ) ) ; } return i ; }
Return subtree depth of this name for purposes of determining NameConstraints minimum and maximum bounds .
26,115
public String getISO3Country ( ) throws MissingResourceException { final String region = baseLocale . getRegion ( ) ; if ( region . length ( ) == 3 ) { return baseLocale . getRegion ( ) ; } else if ( region . isEmpty ( ) ) { return "" ; } String country3 = ICU . getISO3Country ( "en-" + region ) ; if ( ! region . isEmpty ( ) && country3 . isEmpty ( ) ) { throw new MissingResourceException ( "Couldn't find 3-letter country code for " + baseLocale . getRegion ( ) , "FormatData_" + toString ( ) , "ShortCountry" ) ; } return country3 ; }
Returns a three - letter abbreviation for this locale s country . If the country matches an ISO 3166 - 1 alpha - 2 code the corresponding ISO 3166 - 1 alpha - 3 uppercase code is returned . If the locale doesn t specify a country this will be the empty string .
26,116
private static boolean isUnM49AreaCode ( String code ) { if ( code . length ( ) != 3 ) { return false ; } for ( int i = 0 ; i < 3 ; ++ i ) { final char character = code . charAt ( i ) ; if ( ! ( character >= '0' && character <= '9' ) ) { return false ; } } return true ; }
A UN M . 49 is a 3 digit numeric code .
26,117
private static String formatList ( String [ ] stringList , String listPattern , String listCompositionPattern ) { if ( listPattern == null || listCompositionPattern == null ) { StringBuffer result = new StringBuffer ( ) ; for ( int i = 0 ; i < stringList . length ; ++ i ) { if ( i > 0 ) result . append ( ',' ) ; result . append ( stringList [ i ] ) ; } return result . toString ( ) ; } if ( stringList . length > 3 ) { MessageFormat format = new MessageFormat ( listCompositionPattern ) ; stringList = composeList ( format , stringList ) ; } Object [ ] args = new Object [ stringList . length + 1 ] ; System . arraycopy ( stringList , 0 , args , 1 , stringList . length ) ; args [ 0 ] = new Integer ( stringList . length ) ; MessageFormat format = new MessageFormat ( listPattern ) ; return format . format ( args ) ; }
Format a list using given pattern strings . If either of the patterns is null then a the list is formatted by concatenation with the delimiter .
26,118
private static String [ ] composeList ( MessageFormat format , String [ ] list ) { if ( list . length <= 3 ) return list ; String [ ] listItems = { list [ 0 ] , list [ 1 ] } ; String newItem = format . format ( listItems ) ; String [ ] newList = new String [ list . length - 1 ] ; System . arraycopy ( list , 2 , newList , 1 , newList . length - 1 ) ; newList [ 0 ] = newItem ; return composeList ( format , newList ) ; }
Given a list of strings return a list shortened to three elements . Shorten it by applying the given format to the first two elements recursively .
26,119
public boolean hasExpired ( ) { if ( maxAge == 0 ) return true ; if ( maxAge == MAX_AGE_UNSPECIFIED ) return false ; long deltaSecond = ( System . currentTimeMillis ( ) - whenCreated ) / 1000 ; if ( deltaSecond > maxAge ) return true ; else return false ; }
Reports whether this http cookie has expired or not .
26,120
public final void put ( String key , int value ) { if ( ( m_firstFree + 1 ) >= m_mapSize ) { m_mapSize += m_blocksize ; String newMap [ ] = new String [ m_mapSize ] ; System . arraycopy ( m_map , 0 , newMap , 0 , m_firstFree + 1 ) ; m_map = newMap ; int newValues [ ] = new int [ m_mapSize ] ; System . arraycopy ( m_values , 0 , newValues , 0 , m_firstFree + 1 ) ; m_values = newValues ; } m_map [ m_firstFree ] = key ; m_values [ m_firstFree ] = value ; m_firstFree ++ ; }
Append a string onto the vector .
26,121
public final String [ ] keys ( ) { String [ ] keysArr = new String [ m_firstFree ] ; for ( int i = 0 ; i < m_firstFree ; i ++ ) { keysArr [ i ] = m_map [ i ] ; } return keysArr ; }
Return array of keys in the table .
26,122
public void init ( boolean forward ) throws CertPathValidatorException { if ( forward ) { throw new CertPathValidatorException ( "forward checking not supported" ) ; } certIndex = 1 ; explicitPolicy = ( expPolicyRequired ? 0 : certPathLen + 1 ) ; policyMapping = ( polMappingInhibited ? 0 : certPathLen + 1 ) ; inhibitAnyPolicy = ( anyPolicyInhibited ? 0 : certPathLen + 1 ) ; }
Initializes the internal state of the checker from parameters specified in the constructor
26,123
public void check ( Certificate cert , Collection < String > unresCritExts ) throws CertPathValidatorException { checkPolicy ( ( X509Certificate ) cert ) ; if ( unresCritExts != null && ! unresCritExts . isEmpty ( ) ) { unresCritExts . remove ( CertificatePolicies_Id . toString ( ) ) ; unresCritExts . remove ( PolicyMappings_Id . toString ( ) ) ; unresCritExts . remove ( PolicyConstraints_Id . toString ( ) ) ; unresCritExts . remove ( InhibitAnyPolicy_Id . toString ( ) ) ; } }
Performs the policy processing checks on the certificate using its internal state .
26,124
private void checkPolicy ( X509Certificate currCert ) throws CertPathValidatorException { String msg = "certificate policies" ; if ( debug != null ) { debug . println ( "PolicyChecker.checkPolicy() ---checking " + msg + "..." ) ; debug . println ( "PolicyChecker.checkPolicy() certIndex = " + certIndex ) ; debug . println ( "PolicyChecker.checkPolicy() BEFORE PROCESSING: " + "explicitPolicy = " + explicitPolicy ) ; debug . println ( "PolicyChecker.checkPolicy() BEFORE PROCESSING: " + "policyMapping = " + policyMapping ) ; debug . println ( "PolicyChecker.checkPolicy() BEFORE PROCESSING: " + "inhibitAnyPolicy = " + inhibitAnyPolicy ) ; debug . println ( "PolicyChecker.checkPolicy() BEFORE PROCESSING: " + "policyTree = " + rootNode ) ; } X509CertImpl currCertImpl = null ; try { currCertImpl = X509CertImpl . toImpl ( currCert ) ; } catch ( CertificateException ce ) { throw new CertPathValidatorException ( ce ) ; } boolean finalCert = ( certIndex == certPathLen ) ; rootNode = processPolicies ( certIndex , initPolicies , explicitPolicy , policyMapping , inhibitAnyPolicy , rejectPolicyQualifiers , rootNode , currCertImpl , finalCert ) ; if ( ! finalCert ) { explicitPolicy = mergeExplicitPolicy ( explicitPolicy , currCertImpl , finalCert ) ; policyMapping = mergePolicyMapping ( policyMapping , currCertImpl ) ; inhibitAnyPolicy = mergeInhibitAnyPolicy ( inhibitAnyPolicy , currCertImpl ) ; } certIndex ++ ; if ( debug != null ) { debug . println ( "PolicyChecker.checkPolicy() AFTER PROCESSING: " + "explicitPolicy = " + explicitPolicy ) ; debug . println ( "PolicyChecker.checkPolicy() AFTER PROCESSING: " + "policyMapping = " + policyMapping ) ; debug . println ( "PolicyChecker.checkPolicy() AFTER PROCESSING: " + "inhibitAnyPolicy = " + inhibitAnyPolicy ) ; debug . println ( "PolicyChecker.checkPolicy() AFTER PROCESSING: " + "policyTree = " + rootNode ) ; debug . println ( "PolicyChecker.checkPolicy() " + msg + " verified" ) ; } }
Internal method to run through all the checks .
26,125
static int mergeInhibitAnyPolicy ( int inhibitAnyPolicy , X509CertImpl currCert ) throws CertPathValidatorException { if ( ( inhibitAnyPolicy > 0 ) && ! X509CertImpl . isSelfIssued ( currCert ) ) { inhibitAnyPolicy -- ; } try { InhibitAnyPolicyExtension inhAnyPolExt = ( InhibitAnyPolicyExtension ) currCert . getExtension ( InhibitAnyPolicy_Id ) ; if ( inhAnyPolExt == null ) return inhibitAnyPolicy ; int skipCerts = inhAnyPolExt . get ( InhibitAnyPolicyExtension . SKIP_CERTS ) . intValue ( ) ; if ( debug != null ) debug . println ( "PolicyChecker.mergeInhibitAnyPolicy() " + "skipCerts Index from cert = " + skipCerts ) ; if ( skipCerts != - 1 ) { if ( skipCerts < inhibitAnyPolicy ) { inhibitAnyPolicy = skipCerts ; } } } catch ( IOException e ) { if ( debug != null ) { debug . println ( "PolicyChecker.mergeInhibitAnyPolicy " + "unexpected exception" ) ; e . printStackTrace ( ) ; } throw new CertPathValidatorException ( e ) ; } return inhibitAnyPolicy ; }
Merges the specified inhibitAnyPolicy value with the SkipCerts value of the InhibitAnyPolicy extension obtained from the certificate .
26,126
private static PolicyNodeImpl removeInvalidNodes ( PolicyNodeImpl rootNode , int certIndex , Set < String > initPolicies , CertificatePoliciesExtension currCertPolicies ) throws CertPathValidatorException { List < PolicyInformation > policyInfo = null ; try { policyInfo = currCertPolicies . get ( CertificatePoliciesExtension . POLICIES ) ; } catch ( IOException ioe ) { throw new CertPathValidatorException ( "Exception while " + "retrieving policyOIDs" , ioe ) ; } boolean childDeleted = false ; for ( PolicyInformation curPolInfo : policyInfo ) { String curPolicy = curPolInfo . getPolicyIdentifier ( ) . getIdentifier ( ) . toString ( ) ; if ( debug != null ) debug . println ( "PolicyChecker.processPolicies() " + "processing policy second time: " + curPolicy ) ; Set < PolicyNodeImpl > validNodes = rootNode . getPolicyNodesValid ( certIndex , curPolicy ) ; for ( PolicyNodeImpl curNode : validNodes ) { PolicyNodeImpl parentNode = ( PolicyNodeImpl ) curNode . getParent ( ) ; if ( parentNode . getValidPolicy ( ) . equals ( ANY_POLICY ) ) { if ( ( ! initPolicies . contains ( curPolicy ) ) && ( ! curPolicy . equals ( ANY_POLICY ) ) ) { if ( debug != null ) debug . println ( "PolicyChecker.processPolicies() " + "before deleting: policy tree = " + rootNode ) ; parentNode . deleteChild ( curNode ) ; childDeleted = true ; if ( debug != null ) debug . println ( "PolicyChecker.processPolicies() " + "after deleting: policy tree = " + rootNode ) ; } } } } if ( childDeleted ) { rootNode . prune ( certIndex ) ; if ( ! rootNode . getChildren ( ) . hasNext ( ) ) { rootNode = null ; } } return rootNode ; }
Removes those nodes which do not intersect with the initial policies specified by the user .
26,127
PolicyNode getPolicyTree ( ) { if ( rootNode == null ) return null ; else { PolicyNodeImpl policyTree = rootNode . copyTree ( ) ; policyTree . setImmutable ( ) ; return policyTree ; } }
Gets the root node of the valid policy tree or null if the valid policy tree is null . Marks each node of the returned tree immutable and thread - safe .
26,128
private static void checkFromToBounds ( int arrayLength , int origin , int fence ) { if ( origin > fence ) { throw new ArrayIndexOutOfBoundsException ( "origin(" + origin + ") > fence(" + fence + ")" ) ; } if ( origin < 0 ) { throw new ArrayIndexOutOfBoundsException ( origin ) ; } if ( fence > arrayLength ) { throw new ArrayIndexOutOfBoundsException ( fence ) ; } }
Validate inclusive start index and exclusive end index against the length of an array .
26,129
public static String toASCII ( String s , int flags ) { String [ ] parts = SEPARATORS_REGEX . split ( s ) ; for ( int i = 0 ; i < parts . length ; i ++ ) { if ( nonASCII ( parts [ i ] ) ) { parts [ i ] = PUNYCODE_PREFIX + encode ( parts [ i ] ) ; } } return String . join ( "." , parts ) ; }
Convert a Unicode string to IDN .
26,130
private static boolean nonASCII ( String s ) { for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) > 0x7F ) { return true ; } } return false ; }
Returns true if a string contains any non - ASCII characters .
26,131
private static String encode ( String s ) { int n = INITIAL_N ; int delta = 0 ; int bias = INITIAL_BIAS ; StringBuffer output = new StringBuffer ( ) ; int b = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char c = s . charAt ( i ) ; if ( basicCodePoint ( c ) ) { output . append ( c ) ; b ++ ; } } if ( b > 0 ) { output . append ( DELIMITER ) ; } int h = b ; while ( h < s . length ( ) ) { int m = Integer . MAX_VALUE ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { int c = s . charAt ( i ) ; if ( c >= n && c < m ) { m = c ; } } if ( m - n > ( Integer . MAX_VALUE - delta ) / ( h + 1 ) ) { throw new IllegalArgumentException ( "encoding overflow" ) ; } delta = delta + ( m - n ) * ( h + 1 ) ; n = m ; for ( int j = 0 ; j < s . length ( ) ; j ++ ) { int c = s . charAt ( j ) ; if ( c < n ) { delta ++ ; if ( 0 == delta ) { throw new IllegalArgumentException ( "encoding overflow" ) ; } } if ( c == n ) { int q = delta ; for ( int k = BASE ; ; k += BASE ) { int t ; if ( k <= bias ) { t = TMIN ; } else if ( k >= bias + TMAX ) { t = TMAX ; } else { t = k - bias ; } if ( q < t ) { break ; } output . append ( ( char ) encodeDigit ( t + ( q - t ) % ( BASE - t ) ) ) ; q = ( q - t ) / ( BASE - t ) ; } output . append ( ( char ) encodeDigit ( q ) ) ; bias = adapt ( delta , h + 1 , h == b ) ; delta = 0 ; h ++ ; } } delta ++ ; n ++ ; } return output . toString ( ) ; }
Encodes a Unicode string to Punycode ASCII .
26,132
public static String toUnicode ( String s , int flags ) { String [ ] parts = SEPARATORS_REGEX . split ( s ) ; for ( int i = 0 ; i < parts . length ; i ++ ) { if ( parts [ i ] . startsWith ( PUNYCODE_PREFIX ) ) { parts [ i ] = decode ( parts [ i ] . substring ( PUNYCODE_PREFIX . length ( ) ) ) ; } } return String . join ( "." , parts ) ; }
Convert an IDN - formatted ASCII string to Unicode .
26,133
public int next ( ) { if ( dir_ > 1 ) { if ( otherHalf_ != 0 ) { int oh = otherHalf_ ; otherHalf_ = 0 ; return oh ; } } else if ( dir_ == 1 ) { dir_ = 2 ; } else if ( dir_ == 0 ) { dir_ = 2 ; } else { throw new IllegalStateException ( "Illegal change of direction" ) ; } iter_ . clearCEsIfNoneRemaining ( ) ; long ce = iter_ . nextCE ( ) ; if ( ce == Collation . NO_CE ) { return NULLORDER ; } long p = ce >>> 32 ; int lower32 = ( int ) ce ; int firstHalf = getFirstHalf ( p , lower32 ) ; int secondHalf = getSecondHalf ( p , lower32 ) ; if ( secondHalf != 0 ) { otherHalf_ = secondHalf | 0xc0 ; } return firstHalf ; }
Get the next collation element in the source string .
26,134
public int previous ( ) { if ( dir_ < 0 ) { if ( otherHalf_ != 0 ) { int oh = otherHalf_ ; otherHalf_ = 0 ; return oh ; } } else if ( dir_ == 0 ) { iter_ . resetToOffset ( string_ . length ( ) ) ; dir_ = - 1 ; } else if ( dir_ == 1 ) { dir_ = - 1 ; } else { throw new IllegalStateException ( "Illegal change of direction" ) ; } if ( offsets_ == null ) { offsets_ = new UVector32 ( ) ; } int limitOffset = iter_ . getCEsLength ( ) == 0 ? iter_ . getOffset ( ) : 0 ; long ce = iter_ . previousCE ( offsets_ ) ; if ( ce == Collation . NO_CE ) { return NULLORDER ; } long p = ce >>> 32 ; int lower32 = ( int ) ce ; int firstHalf = getFirstHalf ( p , lower32 ) ; int secondHalf = getSecondHalf ( p , lower32 ) ; if ( secondHalf != 0 ) { if ( offsets_ . isEmpty ( ) ) { offsets_ . addElement ( iter_ . getOffset ( ) ) ; offsets_ . addElement ( limitOffset ) ; } otherHalf_ = firstHalf ; return secondHalf | 0xc0 ; } return firstHalf ; }
Get the previous collation element in the source string .
26,135
public void setText ( String source ) { string_ = source ; CollationIterator newIter ; boolean numeric = rbc_ . settings . readOnly ( ) . isNumeric ( ) ; if ( rbc_ . settings . readOnly ( ) . dontCheckFCD ( ) ) { newIter = new UTF16CollationIterator ( rbc_ . data , numeric , string_ , 0 ) ; } else { newIter = new FCDUTF16CollationIterator ( rbc_ . data , numeric , string_ , 0 ) ; } iter_ = newIter ; otherHalf_ = 0 ; dir_ = 0 ; }
Set a new source string for iteration and reset the offset to the beginning of the text .
26,136
public void setText ( UCharacterIterator source ) { string_ = source . getText ( ) ; UCharacterIterator src ; try { src = ( UCharacterIterator ) source . clone ( ) ; } catch ( CloneNotSupportedException e ) { setText ( source . getText ( ) ) ; return ; } src . setToStart ( ) ; CollationIterator newIter ; boolean numeric = rbc_ . settings . readOnly ( ) . isNumeric ( ) ; if ( rbc_ . settings . readOnly ( ) . dontCheckFCD ( ) ) { newIter = new IterCollationIterator ( rbc_ . data , numeric , src ) ; } else { newIter = new FCDIterCollationIterator ( rbc_ . data , numeric , src , 0 ) ; } iter_ = newIter ; otherHalf_ = 0 ; dir_ = 0 ; }
Set a new source string iterator for iteration and reset the offset to the beginning of the text .
26,137
public void message ( SourceLocator srcLctr , String msg , boolean terminate ) throws TransformerException { ErrorListener errHandler = m_transformer . getErrorListener ( ) ; if ( null != errHandler ) { errHandler . warning ( new TransformerException ( msg , srcLctr ) ) ; } else { if ( terminate ) throw new TransformerException ( msg , srcLctr ) ; else System . out . println ( msg ) ; } }
Warn the user of a problem . This is public for access by extensions .
26,138
public void updateState ( TrustAnchor anchor , BuilderParams buildParams ) throws CertificateException , IOException , CertPathValidatorException { trustAnchor = anchor ; X509Certificate trustedCert = anchor . getTrustedCert ( ) ; if ( trustedCert != null ) { updateState ( trustedCert ) ; } else { X500Principal caName = anchor . getCA ( ) ; updateState ( anchor . getCAPublicKey ( ) , caName ) ; } boolean revCheckerAdded = false ; for ( PKIXCertPathChecker checker : userCheckers ) { if ( checker instanceof AlgorithmChecker ) { ( ( AlgorithmChecker ) checker ) . trySetTrustAnchor ( anchor ) ; } else if ( checker instanceof PKIXRevocationChecker ) { if ( revCheckerAdded ) { throw new CertPathValidatorException ( "Only one PKIXRevocationChecker can be specified" ) ; } if ( checker instanceof RevocationChecker ) { ( ( RevocationChecker ) checker ) . init ( anchor , buildParams ) ; } ( ( PKIXRevocationChecker ) checker ) . init ( false ) ; revCheckerAdded = true ; } } if ( buildParams . revocationEnabled ( ) && ! revCheckerAdded ) { revChecker = new RevocationChecker ( anchor , buildParams ) ; revChecker . init ( false ) ; } init = false ; }
Update the state with the specified trust anchor .
26,139
public void addNode ( int n ) { if ( ! m_mutable ) throw new RuntimeException ( XSLMessages . createXPATHMessage ( XPATHErrorResources . ER_NODESETDTM_NOT_MUTABLE , null ) ) ; this . addElement ( n ) ; }
Add a node to the NodeSetDTM . Not all types of NodeSetDTMs support this operation
26,140
public void setItem ( int node , int index ) { if ( ! m_mutable ) throw new RuntimeException ( XSLMessages . createXPATHMessage ( XPATHErrorResources . ER_NODESETDTM_NOT_MUTABLE , null ) ) ; super . setElementAt ( node , index ) ; }
Same as setElementAt .
26,141
public static int getEuropeanDigit ( int ch ) { if ( ( ch > 0x7a && ch < 0xff21 ) || ch < 0x41 || ( ch > 0x5a && ch < 0x61 ) || ch > 0xff5a || ( ch > 0xff3a && ch < 0xff41 ) ) { return - 1 ; } if ( ch <= 0x7a ) { return ch + 10 - ( ( ch <= 0x5a ) ? 0x41 : 0x61 ) ; } if ( ch <= 0xff3a ) { return ch + 10 - 0xff21 ; } return ch + 10 - 0xff41 ; }
Returns the digit values of characters like A - Z normal half - width and full - width . This method assumes that the other digit characters are checked by the calling method .
26,142
public void encode ( DerOutputStream outStrm ) throws CRLException { try { if ( revokedCert == null ) { DerOutputStream tmp = new DerOutputStream ( ) ; serialNumber . encode ( tmp ) ; if ( revocationDate . getTime ( ) < YR_2050 ) { tmp . putUTCTime ( revocationDate ) ; } else { tmp . putGeneralizedTime ( revocationDate ) ; } if ( extensions != null ) extensions . encode ( tmp , isExplicit ) ; DerOutputStream seq = new DerOutputStream ( ) ; seq . write ( DerValue . tag_Sequence , tmp ) ; revokedCert = seq . toByteArray ( ) ; } outStrm . write ( revokedCert ) ; } catch ( IOException e ) { throw new CRLException ( "Encoding error: " + e . toString ( ) ) ; } }
Encodes the revoked certificate to an output stream .
26,143
public CRLReason getRevocationReason ( ) { Extension ext = getExtension ( PKIXExtensions . ReasonCode_Id ) ; if ( ext == null ) { return null ; } CRLReasonCodeExtension rcExt = ( CRLReasonCodeExtension ) ext ; return rcExt . getReasonCode ( ) ; }
This method is the overridden implementation of the getRevocationReason method in X509CRLEntry . It is better performance - wise since it returns cached values .
26,144
public static CRLReason getRevocationReason ( X509CRLEntry crlEntry ) { try { byte [ ] ext = crlEntry . getExtensionValue ( "2.5.29.21" ) ; if ( ext == null ) { return null ; } DerValue val = new DerValue ( ext ) ; byte [ ] data = val . getOctetString ( ) ; CRLReasonCodeExtension rcExt = new CRLReasonCodeExtension ( Boolean . FALSE , data ) ; return rcExt . getReasonCode ( ) ; } catch ( IOException ioe ) { return null ; } }
This static method is the default implementation of the getRevocationReason method in X509CRLEntry .
26,145
public Integer getReasonCode ( ) throws IOException { Object obj = getExtension ( PKIXExtensions . ReasonCode_Id ) ; if ( obj == null ) return null ; CRLReasonCodeExtension reasonCode = ( CRLReasonCodeExtension ) obj ; return reasonCode . get ( CRLReasonCodeExtension . REASON ) ; }
get Reason Code from CRL entry .
26,146
public Extension getExtension ( ObjectIdentifier oid ) { if ( extensions == null ) return null ; return extensions . get ( OIDMap . getName ( oid ) ) ; }
get an extension
26,147
public static X509CRLEntryImpl toImpl ( X509CRLEntry entry ) throws CRLException { if ( entry instanceof X509CRLEntryImpl ) { return ( X509CRLEntryImpl ) entry ; } else { return new X509CRLEntryImpl ( entry . getEncoded ( ) ) ; } }
Utility method to convert an arbitrary instance of X509CRLEntry to a X509CRLEntryImpl . Does a cast if possible otherwise reparses the encoding .
26,148
public Map < String , java . security . cert . Extension > getExtensions ( ) { if ( extensions == null ) { return Collections . emptyMap ( ) ; } Collection < Extension > exts = extensions . getAllExtensions ( ) ; Map < String , java . security . cert . Extension > map = new TreeMap < > ( ) ; for ( Extension ext : exts ) { map . put ( ext . getId ( ) , ext ) ; } return map ; }
Returns all extensions for this entry in a map
26,149
public final boolean isCryptoAllowed ( Key key ) throws ExemptionMechanismException { boolean ret = false ; if ( done && ( key != null ) ) { ret = keyStored . equals ( key ) ; } return ret ; }
Returns whether the result blob has been generated successfully by this exemption mechanism .
26,150
public final void init ( Key key ) throws InvalidKeyException , ExemptionMechanismException { done = false ; initialized = false ; keyStored = key ; exmechSpi . engineInit ( key ) ; initialized = true ; }
Initializes this exemption mechanism with a key .
26,151
public final byte [ ] genExemptionBlob ( ) throws IllegalStateException , ExemptionMechanismException { if ( ! initialized ) { throw new IllegalStateException ( "ExemptionMechanism not initialized" ) ; } byte [ ] blob = exmechSpi . engineGenExemptionBlob ( ) ; done = true ; return blob ; }
Generates the exemption mechanism key blob .
26,152
public void accept ( double value ) { ++ count ; simpleSum += value ; sumWithCompensation ( value ) ; min = Math . min ( min , value ) ; max = Math . max ( max , value ) ; }
Records another value into the summary information .
26,153
void createImpl ( ) throws SocketException { if ( impl == null ) setImpl ( ) ; try { impl . create ( true ) ; created = true ; } catch ( IOException e ) { throw new SocketException ( e . getMessage ( ) ) ; } }
Creates the socket implementation .
26,154
public Socket accept ( ) throws IOException { if ( isClosed ( ) ) throw new SocketException ( "Socket is closed" ) ; if ( ! isBound ( ) ) throw new SocketException ( "Socket is not bound yet" ) ; Socket s = new Socket ( ( SocketImpl ) null ) ; implAccept ( s ) ; return s ; }
Listens for a connection to be made to this socket and accepts it . The method blocks until a connection is made .
26,155
public boolean getReuseAddress ( ) throws SocketException { if ( isClosed ( ) ) throw new SocketException ( "Socket is closed" ) ; return ( ( Boolean ) ( getImpl ( ) . getOption ( SocketOptions . SO_REUSEADDR ) ) ) . booleanValue ( ) ; }
Tests if SO_REUSEADDR is enabled .
26,156
static final int tableSizeFor ( int cap ) { int n = cap - 1 ; n |= n >>> 1 ; n |= n >>> 2 ; n |= n >>> 4 ; n |= n >>> 8 ; n |= n >>> 16 ; return ( n < 0 ) ? 1 : ( n >= MAXIMUM_CAPACITY ) ? MAXIMUM_CAPACITY : n + 1 ; }
Returns a power of two size for the given target capacity .
26,157
final void putMapEntries ( Map < ? extends K , ? extends V > m , boolean evict ) { int s = m . size ( ) ; if ( s > 0 ) { if ( table == null ) { float ft = ( ( float ) s / loadFactor ) + 1.0F ; int t = ( ( ft < ( float ) MAXIMUM_CAPACITY ) ? ( int ) ft : MAXIMUM_CAPACITY ) ; if ( t > threshold ) threshold = tableSizeFor ( t ) ; } else if ( s > threshold ) resize ( ) ; for ( Map . Entry < ? extends K , ? extends V > e : m . entrySet ( ) ) { K key = e . getKey ( ) ; V value = e . getValue ( ) ; putVal ( hash ( key ) , key , value , false , evict ) ; } } }
Implements Map . putAll and Map constructor
26,158
final Node < K , V > getNode ( int hash , Object key ) { Node < K , V > [ ] tab ; Node < K , V > first , e ; int n ; K k ; if ( ( tab = table ) != null && ( n = tab . length ) > 0 && ( first = tab [ ( n - 1 ) & hash ] ) != null ) { if ( first . hash == hash && ( ( k = first . key ) == key || ( key != null && key . equals ( k ) ) ) ) return first ; if ( ( e = first . next ) != null ) { if ( first instanceof TreeNode ) return ( ( TreeNode < K , V > ) first ) . getTreeNode ( hash , key ) ; do { if ( e . hash == hash && ( ( k = e . key ) == key || ( key != null && key . equals ( k ) ) ) ) return e ; } while ( ( e = e . next ) != null ) ; } } return null ; }
Implements Map . get and related methods
26,159
final V putVal ( int hash , K key , V value , boolean onlyIfAbsent , boolean evict ) { Node < K , V > [ ] tab ; Node < K , V > p ; int n , i ; if ( ( tab = table ) == null || ( n = tab . length ) == 0 ) n = ( tab = resize ( ) ) . length ; if ( ( p = tab [ i = ( n - 1 ) & hash ] ) == null ) tab [ i ] = newNode ( hash , key , value , null ) ; else { Node < K , V > e ; K k ; if ( p . hash == hash && ( ( k = p . key ) == key || ( key != null && key . equals ( k ) ) ) ) e = p ; else if ( p instanceof TreeNode ) e = ( ( TreeNode < K , V > ) p ) . putTreeVal ( this , tab , hash , key , value ) ; else { for ( int binCount = 0 ; ; ++ binCount ) { if ( ( e = p . next ) == null ) { p . next = newNode ( hash , key , value , null ) ; if ( binCount >= TREEIFY_THRESHOLD - 1 ) treeifyBin ( tab , hash ) ; break ; } if ( e . hash == hash && ( ( k = e . key ) == key || ( key != null && key . equals ( k ) ) ) ) break ; p = e ; } } if ( e != null ) { V oldValue = e . value ; if ( ! onlyIfAbsent || oldValue == null ) e . value = value ; afterNodeAccess ( e ) ; return oldValue ; } } ++ modCount ; if ( ++ size > threshold ) resize ( ) ; afterNodeInsertion ( evict ) ; return null ; }
Implements Map . put and related methods
26,160
final Node < K , V > [ ] resize ( ) { Node < K , V > [ ] oldTab = table ; int oldCap = ( oldTab == null ) ? 0 : oldTab . length ; int oldThr = threshold ; int newCap , newThr = 0 ; if ( oldCap > 0 ) { if ( oldCap >= MAXIMUM_CAPACITY ) { threshold = Integer . MAX_VALUE ; return oldTab ; } else if ( ( newCap = oldCap << 1 ) < MAXIMUM_CAPACITY && oldCap >= DEFAULT_INITIAL_CAPACITY ) newThr = oldThr << 1 ; } else if ( oldThr > 0 ) newCap = oldThr ; else { newCap = DEFAULT_INITIAL_CAPACITY ; newThr = ( int ) ( DEFAULT_LOAD_FACTOR * DEFAULT_INITIAL_CAPACITY ) ; } if ( newThr == 0 ) { float ft = ( float ) newCap * loadFactor ; newThr = ( newCap < MAXIMUM_CAPACITY && ft < ( float ) MAXIMUM_CAPACITY ? ( int ) ft : Integer . MAX_VALUE ) ; } threshold = newThr ; @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) Node < K , V > [ ] newTab = ( Node < K , V > [ ] ) new Node [ newCap ] ; table = newTab ; if ( oldTab != null ) { for ( int j = 0 ; j < oldCap ; ++ j ) { Node < K , V > e ; if ( ( e = oldTab [ j ] ) != null ) { oldTab [ j ] = null ; if ( e . next == null ) newTab [ e . hash & ( newCap - 1 ) ] = e ; else if ( e instanceof TreeNode ) ( ( TreeNode < K , V > ) e ) . split ( this , newTab , j , oldCap ) ; else { Node < K , V > loHead = null , loTail = null ; Node < K , V > hiHead = null , hiTail = null ; Node < K , V > next ; do { next = e . next ; if ( ( e . hash & oldCap ) == 0 ) { if ( loTail == null ) loHead = e ; else loTail . next = e ; loTail = e ; } else { if ( hiTail == null ) hiHead = e ; else hiTail . next = e ; hiTail = e ; } } while ( ( e = next ) != null ) ; if ( loTail != null ) { loTail . next = null ; newTab [ j ] = loHead ; } if ( hiTail != null ) { hiTail . next = null ; newTab [ j + oldCap ] = hiHead ; } } } } } return newTab ; }
Initializes or doubles table size . If null allocates in accord with initial capacity target held in field threshold . Otherwise because we are using power - of - two expansion the elements from each bin must either stay at same index or move with a power of two offset in the new table .
26,161
final void treeifyBin ( Node < K , V > [ ] tab , int hash ) { int n , index ; Node < K , V > e ; if ( tab == null || ( n = tab . length ) < MIN_TREEIFY_CAPACITY ) resize ( ) ; else if ( ( e = tab [ index = ( n - 1 ) & hash ] ) != null ) { TreeNode < K , V > hd = null , tl = null ; do { TreeNode < K , V > p = replacementTreeNode ( e , null ) ; if ( tl == null ) hd = p ; else { p . prev = tl ; tl . next = p ; } tl = p ; } while ( ( e = e . next ) != null ) ; if ( ( tab [ index ] = hd ) != null ) hd . treeify ( tab ) ; } }
Replaces all linked nodes in bin at index for given hash unless table is too small in which case resizes instead .
26,162
final Node < K , V > removeNode ( int hash , Object key , Object value , boolean matchValue , boolean movable ) { Node < K , V > [ ] tab ; Node < K , V > p ; int n , index ; if ( ( tab = table ) != null && ( n = tab . length ) > 0 && ( p = tab [ index = ( n - 1 ) & hash ] ) != null ) { Node < K , V > node = null , e ; K k ; V v ; if ( p . hash == hash && ( ( k = p . key ) == key || ( key != null && key . equals ( k ) ) ) ) node = p ; else if ( ( e = p . next ) != null ) { if ( p instanceof TreeNode ) node = ( ( TreeNode < K , V > ) p ) . getTreeNode ( hash , key ) ; else { do { if ( e . hash == hash && ( ( k = e . key ) == key || ( key != null && key . equals ( k ) ) ) ) { node = e ; break ; } p = e ; } while ( ( e = e . next ) != null ) ; } } if ( node != null && ( ! matchValue || ( v = node . value ) == value || ( value != null && value . equals ( v ) ) ) ) { if ( node instanceof TreeNode ) ( ( TreeNode < K , V > ) node ) . removeTreeNode ( this , tab , movable ) ; else if ( node == p ) tab [ index ] = node . next ; else p . next = node . next ; ++ modCount ; -- size ; afterNodeRemoval ( node ) ; return node ; } } return null ; }
Implements Map . remove and related methods
26,163
private static void addInternal ( String name , ObjectIdentifier oid , Class clazz ) { OIDInfo info = new OIDInfo ( name , oid , clazz ) ; oidMap . put ( oid , info ) ; nameMap . put ( name , info ) ; }
Add attributes to the table . For internal use in the static initializer .
26,164
public static void addAttribute ( String name , String oid , Class < ? > clazz ) throws CertificateException { ObjectIdentifier objId ; try { objId = new ObjectIdentifier ( oid ) ; } catch ( IOException ioe ) { throw new CertificateException ( "Invalid Object identifier: " + oid ) ; } OIDInfo info = new OIDInfo ( name , objId , clazz ) ; if ( oidMap . put ( objId , info ) != null ) { throw new CertificateException ( "Object identifier already exists: " + oid ) ; } if ( nameMap . put ( name , info ) != null ) { throw new CertificateException ( "Name already exists: " + name ) ; } }
Add a name to lookup table .
26,165
public static String getName ( ObjectIdentifier oid ) { OIDInfo info = oidMap . get ( oid ) ; return ( info == null ) ? null : info . name ; }
Return user friendly name associated with the OID .
26,166
public static ObjectIdentifier getOID ( String name ) { OIDInfo info = nameMap . get ( name ) ; return ( info == null ) ? null : info . oid ; }
Return Object identifier for user friendly name .
26,167
public static Class < ? > getClass ( String name ) throws CertificateException { OIDInfo info = nameMap . get ( name ) ; return ( info == null ) ? null : info . getClazz ( ) ; }
Return the java class object associated with the user friendly name .
26,168
public static Class < ? > getClass ( ObjectIdentifier oid ) throws CertificateException { OIDInfo info = oidMap . get ( oid ) ; return ( info == null ) ? null : info . getClazz ( ) ; }
Return the java class object associated with the object identifier .
26,169
private long toEpochNano ( ) { long nod = time . toNanoOfDay ( ) ; long offsetNanos = offset . getTotalSeconds ( ) * NANOS_PER_SECOND ; return nod - offsetNanos ; }
Converts this time to epoch nanos based on 1970 - 01 - 01Z .
26,170
public boolean visit ( Assignment node ) { Expression lhs = node . getLeftHandSide ( ) ; TypeMirror lhsType = lhs . getTypeMirror ( ) ; if ( lhs instanceof ArrayAccess && ! lhsType . getKind ( ) . isPrimitive ( ) ) { FunctionInvocation newAssignment = newArrayAssignment ( node , ( ArrayAccess ) lhs , lhsType ) ; node . replaceWith ( newAssignment ) ; newAssignment . accept ( this ) ; return false ; } return true ; }
rhs is an array creation we can optimize with SetAndConsume .
26,171
private static int [ ] findCodeFromLocale ( ULocale locale ) { int [ ] result = getCodesFromLocale ( locale ) ; if ( result != null ) { return result ; } ULocale likely = ULocale . addLikelySubtags ( locale ) ; return getCodesFromLocale ( likely ) ; }
Helper function to find the code from locale .
26,172
public static final int [ ] getCode ( String nameOrAbbrOrLocale ) { boolean triedCode = false ; if ( nameOrAbbrOrLocale . indexOf ( '_' ) < 0 && nameOrAbbrOrLocale . indexOf ( '-' ) < 0 ) { int propNum = UCharacter . getPropertyValueEnumNoThrow ( UProperty . SCRIPT , nameOrAbbrOrLocale ) ; if ( propNum != UProperty . UNDEFINED ) { return new int [ ] { propNum } ; } triedCode = true ; } int [ ] scripts = findCodeFromLocale ( new ULocale ( nameOrAbbrOrLocale ) ) ; if ( scripts != null ) { return scripts ; } if ( ! triedCode ) { int propNum = UCharacter . getPropertyValueEnumNoThrow ( UProperty . SCRIPT , nameOrAbbrOrLocale ) ; if ( propNum != UProperty . UNDEFINED ) { return new int [ ] { propNum } ; } } return null ; }
Gets the script codes associated with the given locale or ISO 15924 abbreviation or name . Returns MALAYAM given Malayam OR Mlym . Returns LATIN given en OR en_US
26,173
public static final int getScript ( int codepoint ) { if ( codepoint >= UCharacter . MIN_VALUE & codepoint <= UCharacter . MAX_VALUE ) { int scriptX = UCharacterProperty . INSTANCE . getAdditional ( codepoint , 0 ) & UCharacterProperty . SCRIPT_X_MASK ; if ( scriptX < UCharacterProperty . SCRIPT_X_WITH_COMMON ) { return scriptX ; } else if ( scriptX < UCharacterProperty . SCRIPT_X_WITH_INHERITED ) { return UScript . COMMON ; } else if ( scriptX < UCharacterProperty . SCRIPT_X_WITH_OTHER ) { return UScript . INHERITED ; } else { return UCharacterProperty . INSTANCE . m_scriptExtensions_ [ scriptX & UCharacterProperty . SCRIPT_MASK_ ] ; } } else { throw new IllegalArgumentException ( Integer . toString ( codepoint ) ) ; } }
Gets the script code associated with the given codepoint . Returns UScript . MALAYAM given 0x0D02
26,174
public static final boolean hasScript ( int c , int sc ) { int scriptX = UCharacterProperty . INSTANCE . getAdditional ( c , 0 ) & UCharacterProperty . SCRIPT_X_MASK ; if ( scriptX < UCharacterProperty . SCRIPT_X_WITH_COMMON ) { return sc == scriptX ; } char [ ] scriptExtensions = UCharacterProperty . INSTANCE . m_scriptExtensions_ ; int scx = scriptX & UCharacterProperty . SCRIPT_MASK_ ; if ( scriptX >= UCharacterProperty . SCRIPT_X_WITH_OTHER ) { scx = scriptExtensions [ scx + 1 ] ; } if ( sc > 0x7fff ) { return false ; } while ( sc > scriptExtensions [ scx ] ) { ++ scx ; } return sc == ( scriptExtensions [ scx ] & 0x7fff ) ; }
Do the Script_Extensions of code point c contain script sc? If c does not have explicit Script_Extensions then this tests whether c has the Script property value sc .
26,175
public static final String getName ( int scriptCode ) { return UCharacter . getPropertyValueName ( UProperty . SCRIPT , scriptCode , UProperty . NameChoice . LONG ) ; }
Returns the long Unicode script name if there is one . Otherwise returns the 4 - letter ISO 15924 script code . Returns Malayam given MALAYALAM .
26,176
public static final String getShortName ( int scriptCode ) { return UCharacter . getPropertyValueName ( UProperty . SCRIPT , scriptCode , UProperty . NameChoice . SHORT ) ; }
Returns the 4 - letter ISO 15924 script code which is the same as the short Unicode script name if Unicode has names for the script . Returns Mlym given MALAYALAM .
26,177
public static final String getSampleString ( int script ) { int sampleChar = ScriptMetadata . getScriptProps ( script ) & 0x1fffff ; if ( sampleChar != 0 ) { return new StringBuilder ( ) . appendCodePoint ( sampleChar ) . toString ( ) ; } return "" ; }
Returns the script sample character string . This string normally consists of one code point but might be longer . The string is empty if the script is not encoded .
26,178
protected Object readResolve ( ) throws InvalidObjectException { if ( this . getClass ( ) != TextAttribute . class ) { throw new InvalidObjectException ( "subclass didn't correctly implement readResolve" ) ; } TextAttribute instance = ( TextAttribute ) instanceMap . get ( getName ( ) ) ; if ( instance != null ) { return instance ; } else { throw new InvalidObjectException ( "unknown attribute name" ) ; } }
Resolves instances being deserialized to the predefined constants .
26,179
public void beginEntry ( JarEntry je , ManifestEntryVerifier mev ) throws IOException { if ( je == null ) return ; if ( debug != null ) { debug . println ( "beginEntry " + je . getName ( ) ) ; } String name = je . getName ( ) ; if ( parsingMeta ) { String uname = name . toUpperCase ( Locale . ENGLISH ) ; if ( ( uname . startsWith ( "META-INF/" ) || uname . startsWith ( "/META-INF/" ) ) ) { if ( je . isDirectory ( ) ) { mev . setEntry ( null , je ) ; return ; } if ( SignatureFileVerifier . isBlockOrSF ( uname ) ) { parsingBlockOrSF = true ; baos . reset ( ) ; mev . setEntry ( null , je ) ; } return ; } } if ( parsingMeta ) { doneWithMeta ( ) ; } if ( je . isDirectory ( ) ) { mev . setEntry ( null , je ) ; return ; } if ( name . startsWith ( "./" ) ) name = name . substring ( 2 ) ; if ( name . startsWith ( "/" ) ) name = name . substring ( 1 ) ; if ( sigFileSigners . get ( name ) != null ) { mev . setEntry ( name , je ) ; return ; } mev . setEntry ( null , je ) ; return ; }
This method scans to see which entry we re parsing and keeps various state information depending on what type of file is being parsed .
26,180
public void update ( int b , ManifestEntryVerifier mev ) throws IOException { if ( b != - 1 ) { if ( parsingBlockOrSF ) { baos . write ( b ) ; } else { mev . update ( ( byte ) b ) ; } } else { processEntry ( mev ) ; } }
update a single byte .
26,181
public void update ( int n , byte [ ] b , int off , int len , ManifestEntryVerifier mev ) throws IOException { if ( n != - 1 ) { if ( parsingBlockOrSF ) { baos . write ( b , off , n ) ; } else { mev . update ( b , off , n ) ; } } else { processEntry ( mev ) ; } }
update an array of bytes .
26,182
public java . security . cert . Certificate [ ] getCerts ( String name ) { return mapSignersToCertArray ( getCodeSigners ( name ) ) ; }
Return an array of java . security . cert . Certificate objects for the given file in the jar .
26,183
void doneWithMeta ( ) { parsingMeta = false ; anyToVerify = ! sigFileSigners . isEmpty ( ) ; baos = null ; sigFileData = null ; pendingBlocks = null ; signerCache = null ; manDig = null ; if ( sigFileSigners . containsKey ( JarFile . MANIFEST_NAME ) ) { verifiedSigners . put ( JarFile . MANIFEST_NAME , sigFileSigners . remove ( JarFile . MANIFEST_NAME ) ) ; } }
called to let us know we have processed all the META - INF entries and if we re - read one of them don t re - process it . Also gets rid of any data structures we needed when parsing META - INF entries .
26,184
static boolean isSigningRelated ( String name ) { name = name . toUpperCase ( Locale . ENGLISH ) ; if ( ! name . startsWith ( "META-INF/" ) ) { return false ; } name = name . substring ( 9 ) ; if ( name . indexOf ( '/' ) != - 1 ) { return false ; } if ( name . endsWith ( ".DSA" ) || name . endsWith ( ".RSA" ) || name . endsWith ( ".SF" ) || name . endsWith ( ".EC" ) || name . startsWith ( "SIG-" ) || name . equals ( "MANIFEST.MF" ) ) { return true ; } return false ; }
true if file is part of the signature mechanism itself
26,185
public char charAt ( int pos ) { int startChunk = pos >>> m_chunkBits ; if ( startChunk == 0 && m_innerFSB != null ) return m_innerFSB . charAt ( pos & m_chunkMask ) ; else return m_array [ startChunk ] [ pos & m_chunkMask ] ; }
Get a single character from the string buffer .
26,186
static int sendNormalizedSAXcharacters ( char ch [ ] , int start , int length , org . xml . sax . ContentHandler handler , int edgeTreatmentFlags ) throws org . xml . sax . SAXException { boolean processingLeadingWhitespace = ( ( edgeTreatmentFlags & SUPPRESS_LEADING_WS ) != 0 ) ; boolean seenWhitespace = ( ( edgeTreatmentFlags & CARRY_WS ) != 0 ) ; int currPos = start ; int limit = start + length ; if ( processingLeadingWhitespace ) { for ( ; currPos < limit && XMLCharacterRecognizer . isWhiteSpace ( ch [ currPos ] ) ; currPos ++ ) { } if ( currPos == limit ) { return edgeTreatmentFlags ; } } while ( currPos < limit ) { int startNonWhitespace = currPos ; for ( ; currPos < limit && ! XMLCharacterRecognizer . isWhiteSpace ( ch [ currPos ] ) ; currPos ++ ) { } if ( startNonWhitespace != currPos ) { if ( seenWhitespace ) { handler . characters ( SINGLE_SPACE , 0 , 1 ) ; seenWhitespace = false ; } handler . characters ( ch , startNonWhitespace , currPos - startNonWhitespace ) ; } int startWhitespace = currPos ; for ( ; currPos < limit && XMLCharacterRecognizer . isWhiteSpace ( ch [ currPos ] ) ; currPos ++ ) { } if ( startWhitespace != currPos ) { seenWhitespace = true ; } } return ( seenWhitespace ? CARRY_WS : 0 ) | ( edgeTreatmentFlags & SUPPRESS_TRAILING_WS ) ; }
Internal method to directly normalize and dispatch the character array . This version is aware of the fact that it may be called several times in succession if the data is made up of multiple chunks and thus must actively manage the handling of leading and trailing whitespace .
26,187
public static void sendNormalizedSAXcharacters ( char ch [ ] , int start , int length , org . xml . sax . ContentHandler handler ) throws org . xml . sax . SAXException { sendNormalizedSAXcharacters ( ch , start , length , handler , SUPPRESS_BOTH ) ; }
Directly normalize and dispatch the character array .
26,188
final < R > R evaluate ( TerminalOp < E_OUT , R > terminalOp ) { assert getOutputShape ( ) == terminalOp . inputShape ( ) ; if ( linkedOrConsumed ) throw new IllegalStateException ( MSG_STREAM_LINKED ) ; linkedOrConsumed = true ; return isParallel ( ) ? terminalOp . evaluateParallel ( this , sourceSpliterator ( terminalOp . getOpFlags ( ) ) ) : terminalOp . evaluateSequential ( this , sourceSpliterator ( terminalOp . getOpFlags ( ) ) ) ; }
Evaluate the pipeline with a terminal operation to produce a result .
26,189
@ SuppressWarnings ( "unchecked" ) public final Node < E_OUT > evaluateToArrayNode ( IntFunction < E_OUT [ ] > generator ) { if ( linkedOrConsumed ) throw new IllegalStateException ( MSG_STREAM_LINKED ) ; linkedOrConsumed = true ; if ( isParallel ( ) && previousStage != null && opIsStateful ( ) ) { depth = 0 ; return opEvaluateParallel ( previousStage , previousStage . sourceSpliterator ( 0 ) , generator ) ; } else { return evaluate ( sourceSpliterator ( 0 ) , true , generator ) ; } }
Collect the elements output from the pipeline stage .
26,190
@ SuppressWarnings ( "unchecked" ) final Spliterator < E_OUT > sourceStageSpliterator ( ) { if ( this != sourceStage ) throw new IllegalStateException ( ) ; if ( linkedOrConsumed ) throw new IllegalStateException ( MSG_STREAM_LINKED ) ; linkedOrConsumed = true ; if ( sourceStage . sourceSpliterator != null ) { @ SuppressWarnings ( "unchecked" ) Spliterator < E_OUT > s = sourceStage . sourceSpliterator ; sourceStage . sourceSpliterator = null ; return s ; } else if ( sourceStage . sourceSupplier != null ) { @ SuppressWarnings ( "unchecked" ) Spliterator < E_OUT > s = ( Spliterator < E_OUT > ) sourceStage . sourceSupplier . get ( ) ; sourceStage . sourceSupplier = null ; return s ; } else { throw new IllegalStateException ( MSG_CONSUMED ) ; } }
Gets the source stage spliterator if this pipeline stage is the source stage . The pipeline is consumed after this method is called and returns successfully .
26,191
@ SuppressWarnings ( "unchecked" ) public Spliterator < E_OUT > spliterator ( ) { if ( linkedOrConsumed ) throw new IllegalStateException ( MSG_STREAM_LINKED ) ; linkedOrConsumed = true ; if ( this == sourceStage ) { if ( sourceStage . sourceSpliterator != null ) { @ SuppressWarnings ( "unchecked" ) Spliterator < E_OUT > s = ( Spliterator < E_OUT > ) sourceStage . sourceSpliterator ; sourceStage . sourceSpliterator = null ; return s ; } else if ( sourceStage . sourceSupplier != null ) { @ SuppressWarnings ( "unchecked" ) Supplier < Spliterator < E_OUT > > s = ( Supplier < Spliterator < E_OUT > > ) sourceStage . sourceSupplier ; sourceStage . sourceSupplier = null ; return lazySpliterator ( s ) ; } else { throw new IllegalStateException ( MSG_CONSUMED ) ; } } else { return wrap ( this , ( ) -> sourceSpliterator ( 0 ) , isParallel ( ) ) ; } }
Primitive specialization use co - variant overrides hence is not final
26,192
@ SuppressWarnings ( "unchecked" ) private Spliterator < ? > sourceSpliterator ( int terminalFlags ) { Spliterator < ? > spliterator = null ; if ( sourceStage . sourceSpliterator != null ) { spliterator = sourceStage . sourceSpliterator ; sourceStage . sourceSpliterator = null ; } else if ( sourceStage . sourceSupplier != null ) { spliterator = ( Spliterator < ? > ) sourceStage . sourceSupplier . get ( ) ; sourceStage . sourceSupplier = null ; } else { throw new IllegalStateException ( MSG_CONSUMED ) ; } if ( isParallel ( ) && sourceStage . sourceAnyStateful ) { int depth = 1 ; for ( @ SuppressWarnings ( "rawtypes" ) AbstractPipeline u = sourceStage , p = sourceStage . nextStage , e = this ; u != e ; u = p , p = p . nextStage ) { int thisOpFlags = p . sourceOrOpFlags ; if ( p . opIsStateful ( ) ) { depth = 0 ; if ( StreamOpFlag . SHORT_CIRCUIT . isKnown ( thisOpFlags ) ) { thisOpFlags = thisOpFlags & ~ StreamOpFlag . IS_SHORT_CIRCUIT ; } spliterator = p . opEvaluateParallelLazy ( u , spliterator ) ; thisOpFlags = spliterator . hasCharacteristics ( Spliterator . SIZED ) ? ( thisOpFlags & ~ StreamOpFlag . NOT_SIZED ) | StreamOpFlag . IS_SIZED : ( thisOpFlags & ~ StreamOpFlag . IS_SIZED ) | StreamOpFlag . NOT_SIZED ; } p . depth = depth ++ ; p . combinedFlags = StreamOpFlag . combineOpFlags ( thisOpFlags , u . combinedFlags ) ; } } if ( terminalFlags != 0 ) { combinedFlags = StreamOpFlag . combineOpFlags ( terminalFlags , combinedFlags ) ; } return spliterator ; }
Get the source spliterator for this pipeline stage . For a sequential or stateless parallel pipeline this is the source spliterator . For a stateful parallel pipeline this is a spliterator describing the results of all computations up to and including the most recent stateful operation .
26,193
public boolean isPsuedoVarRef ( ) { java . lang . String ns = m_qname . getNamespaceURI ( ) ; if ( ( null != ns ) && ns . equals ( PSUEDOVARNAMESPACE ) ) { if ( m_qname . getLocalName ( ) . startsWith ( "#" ) ) return true ; } return false ; }
Tell if this is a psuedo variable reference declared by Xalan instead of by the user .
26,194
private int checkExponent ( int length ) { if ( length >= nDigits || length < 0 ) return decExponent ; for ( int i = 0 ; i < length ; i ++ ) if ( digits [ i ] != '9' ) return decExponent ; return decExponent + ( digits [ length ] >= '5' ? 1 : 0 ) ; }
Given the desired number of digits predict the result s exponent .
26,195
private char [ ] applyPrecision ( int length ) { char [ ] result = new char [ nDigits ] ; for ( int i = 0 ; i < result . length ; i ++ ) result [ i ] = '0' ; if ( length >= nDigits || length < 0 ) { System . arraycopy ( digits , 0 , result , 0 , nDigits ) ; return result ; } if ( length == 0 ) { if ( digits [ 0 ] >= '5' ) { result [ 0 ] = '1' ; } return result ; } int i = length ; int q = digits [ i ] ; if ( q >= '5' && i > 0 ) { q = digits [ -- i ] ; if ( q == '9' ) { while ( q == '9' && i > 0 ) { q = digits [ -- i ] ; } if ( q == '9' ) { result [ 0 ] = '1' ; return result ; } } result [ i ] = ( char ) ( q + 1 ) ; } while ( -- i >= 0 ) { result [ i ] = digits [ i ] ; } return result ; }
rounds at a particular precision .
26,196
protected int getArg0AsNode ( XPathContext xctxt ) throws javax . xml . transform . TransformerException { return ( null == m_arg0 ) ? xctxt . getCurrentNode ( ) : m_arg0 . asNode ( xctxt ) ; }
Execute the first argument expression that is expected to return a nodeset . If the argument is null then return the current context node .
26,197
protected XMLString getArg0AsString ( XPathContext xctxt ) throws javax . xml . transform . TransformerException { if ( null == m_arg0 ) { int currentNode = xctxt . getCurrentNode ( ) ; if ( DTM . NULL == currentNode ) return XString . EMPTYSTRING ; else { DTM dtm = xctxt . getDTM ( currentNode ) ; return dtm . getStringValue ( currentNode ) ; } } else return m_arg0 . execute ( xctxt ) . xstr ( ) ; }
Execute the first argument expression that is expected to return a string . If the argument is null then get the string value from the current context node .
26,198
protected double getArg0AsNumber ( XPathContext xctxt ) throws javax . xml . transform . TransformerException { if ( null == m_arg0 ) { int currentNode = xctxt . getCurrentNode ( ) ; if ( DTM . NULL == currentNode ) return 0 ; else { DTM dtm = xctxt . getDTM ( currentNode ) ; XMLString str = dtm . getStringValue ( currentNode ) ; return str . toDouble ( ) ; } } else return m_arg0 . execute ( xctxt ) . num ( ) ; }
Execute the first argument expression that is expected to return a number . If the argument is null then get the number value from the current context node .
26,199
protected void setKey ( BitArray key ) { this . bitStringKey = ( BitArray ) key . clone ( ) ; this . key = key . toByteArray ( ) ; int remaining = key . length ( ) % 8 ; this . unusedBits = ( ( remaining == 0 ) ? 0 : 8 - remaining ) ; }
Sets the key in the BitArray form .