idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
27,800 | public void startDocument ( ) throws SAXException { if ( DEBUG ) System . out . println ( "TransformerHandlerImpl#startDocument" ) ; m_insideParse = true ; if ( m_contentHandler != null ) { if ( m_incremental ) { m_transformer . setSourceTreeDocForThread ( m_dtm . getDocument ( ) ) ; int cpriority = Thread . currentThread ( ) . getPriority ( ) ; m_transformer . runTransformThread ( cpriority ) ; } m_contentHandler . startDocument ( ) ; } } | Filter a start document event . |
27,801 | public void endDocument ( ) throws SAXException { if ( DEBUG ) System . out . println ( "TransformerHandlerImpl#endDocument" ) ; m_insideParse = false ; if ( m_contentHandler != null ) { m_contentHandler . endDocument ( ) ; } if ( m_incremental ) { m_transformer . waitTransformThread ( ) ; } else { m_transformer . setSourceTreeDocForThread ( m_dtm . getDocument ( ) ) ; m_transformer . run ( ) ; } } | Filter an end document event . |
27,802 | public void startPrefixMapping ( String prefix , String uri ) throws SAXException { if ( DEBUG ) System . out . println ( "TransformerHandlerImpl#startPrefixMapping: " + prefix + ", " + uri ) ; if ( m_contentHandler != null ) { m_contentHandler . startPrefixMapping ( prefix , uri ) ; } } | Filter a start Namespace prefix mapping event . |
27,803 | public void endPrefixMapping ( String prefix ) throws SAXException { if ( DEBUG ) System . out . println ( "TransformerHandlerImpl#endPrefixMapping: " + prefix ) ; if ( m_contentHandler != null ) { m_contentHandler . endPrefixMapping ( prefix ) ; } } | Filter an end Namespace prefix mapping event . |
27,804 | public void skippedEntity ( String name ) throws SAXException { if ( DEBUG ) System . out . println ( "TransformerHandlerImpl#skippedEntity: " + name ) ; if ( m_contentHandler != null ) { m_contentHandler . skippedEntity ( name ) ; } } | Filter a skipped entity event . |
27,805 | public void warning ( SAXParseException e ) throws SAXException { javax . xml . transform . ErrorListener errorListener = m_transformer . getErrorListener ( ) ; if ( errorListener instanceof ErrorHandler ) { ( ( ErrorHandler ) errorListener ) . warning ( e ) ; } else { try { errorListener . warning ( new javax . xml . transform . TransformerException ( e ) ) ; } catch ( javax . xml . transform . TransformerException te ) { throw e ; } } } | Filter a warning event . |
27,806 | public void error ( SAXParseException e ) throws SAXException { javax . xml . transform . ErrorListener errorListener = m_transformer . getErrorListener ( ) ; if ( errorListener instanceof ErrorHandler ) { ( ( ErrorHandler ) errorListener ) . error ( e ) ; if ( null != m_errorHandler ) m_errorHandler . error ( e ) ; } else { try { errorListener . error ( new javax . xml . transform . TransformerException ( e ) ) ; if ( null != m_errorHandler ) m_errorHandler . error ( e ) ; } catch ( javax . xml . transform . TransformerException te ) { throw e ; } } } | Filter an error event . |
27,807 | public void fatalError ( SAXParseException e ) throws SAXException { if ( null != m_errorHandler ) { try { m_errorHandler . fatalError ( e ) ; } catch ( SAXParseException se ) { } } javax . xml . transform . ErrorListener errorListener = m_transformer . getErrorListener ( ) ; if ( errorListener instanceof ErrorHandler ) { ( ( ErrorHandler ) errorListener ) . fatalError ( e ) ; if ( null != m_errorHandler ) m_errorHandler . fatalError ( e ) ; } else { try { errorListener . fatalError ( new javax . xml . transform . TransformerException ( e ) ) ; if ( null != m_errorHandler ) m_errorHandler . fatalError ( e ) ; } catch ( javax . xml . transform . TransformerException te ) { throw e ; } } } | Filter a fatal error event . |
27,808 | public void startEntity ( String name ) throws SAXException { if ( DEBUG ) System . out . println ( "TransformerHandlerImpl#startEntity: " + name ) ; if ( null != m_lexicalHandler ) { m_lexicalHandler . startEntity ( name ) ; } } | Report the beginning of an entity in content . |
27,809 | public void endCDATA ( ) throws SAXException { if ( DEBUG ) System . out . println ( "TransformerHandlerImpl#endCDATA" ) ; if ( null != m_lexicalHandler ) { m_lexicalHandler . endCDATA ( ) ; } } | Report the end of a CDATA section . |
27,810 | public double getGreenwichSidereal ( ) { if ( siderealTime == INVALID ) { double UT = normalize ( ( double ) time / HOUR_MS , 24 ) ; siderealTime = normalize ( getSiderealOffset ( ) + UT * 1.002737909 , 24 ) ; } return siderealTime ; } | Returns the current Greenwich sidereal time measured in hours |
27,811 | private long lstToUT ( double lst ) { double lt = normalize ( ( lst - getSiderealOffset ( ) ) * 0.9972695663 , 24 ) ; long base = DAY_MS * ( ( time + fGmtOffset ) / DAY_MS ) - fGmtOffset ; return base + ( long ) ( lt * HOUR_MS ) ; } | Converts local sidereal time to Universal Time . |
27,812 | public final Equatorial eclipticToEquatorial ( double eclipLong , double eclipLat ) { double obliq = eclipticObliquity ( ) ; double sinE = Math . sin ( obliq ) ; double cosE = Math . cos ( obliq ) ; double sinL = Math . sin ( eclipLong ) ; double cosL = Math . cos ( eclipLong ) ; double sinB = Math . sin ( eclipLat ) ; double cosB = Math . cos ( eclipLat ) ; double tanB = Math . tan ( eclipLat ) ; return new Equatorial ( Math . atan2 ( sinL * cosE - tanB * sinE , cosL ) , Math . asin ( sinB * cosE + cosB * sinE * sinL ) ) ; } | Convert from ecliptic to equatorial coordinates . |
27,813 | public long getSunTime ( double desired , boolean next ) { return timeOfAngle ( new AngleFunc ( ) { public double eval ( ) { return getSunLongitude ( ) ; } } , desired , TROPICAL_YEAR , MINUTE_MS , next ) ; } | Find the next time at which the sun s ecliptic longitude will have the desired value . |
27,814 | public Equatorial getMoonPosition ( ) { if ( moonPosition == null ) { double sunLong = getSunLongitude ( ) ; double day = getJulianDay ( ) - JD_EPOCH ; double meanLongitude = norm2PI ( 13.1763966 * PI / 180 * day + moonL0 ) ; double meanAnomalyMoon = norm2PI ( meanLongitude - 0.1114041 * PI / 180 * day - moonP0 ) ; double evection = 1.2739 * PI / 180 * Math . sin ( 2 * ( meanLongitude - sunLong ) - meanAnomalyMoon ) ; double annual = 0.1858 * PI / 180 * Math . sin ( meanAnomalySun ) ; double a3 = 0.3700 * PI / 180 * Math . sin ( meanAnomalySun ) ; meanAnomalyMoon += evection - annual - a3 ; double center = 6.2886 * PI / 180 * Math . sin ( meanAnomalyMoon ) ; double a4 = 0.2140 * PI / 180 * Math . sin ( 2 * meanAnomalyMoon ) ; moonLongitude = meanLongitude + evection + center - annual + a4 ; double variation = 0.6583 * PI / 180 * Math . sin ( 2 * ( moonLongitude - sunLong ) ) ; moonLongitude += variation ; double nodeLongitude = norm2PI ( moonN0 - 0.0529539 * PI / 180 * day ) ; nodeLongitude -= 0.16 * PI / 180 * Math . sin ( meanAnomalySun ) ; double y = Math . sin ( moonLongitude - nodeLongitude ) ; double x = Math . cos ( moonLongitude - nodeLongitude ) ; moonEclipLong = Math . atan2 ( y * Math . cos ( moonI ) , x ) + nodeLongitude ; double moonEclipLat = Math . asin ( y * Math . sin ( moonI ) ) ; moonPosition = eclipticToEquatorial ( moonEclipLong , moonEclipLat ) ; } return moonPosition ; } | The position of the moon at the time set on this object in equatorial coordinates . |
27,815 | public void verify ( PublicKey key , Provider sigProvider ) throws CRLException , NoSuchAlgorithmException , InvalidKeyException , SignatureException { throw new UnsupportedOperationException ( "X509CRL instance doesn't not support X509CRL#verify(PublicKey, Provider)" ) ; } | Verifies that this CRL was signed using the private key that corresponds to the given public key . This method uses the signature verification engine supplied by the given provider . Note that the specified Provider object does not have to be registered in the provider list . |
27,816 | public X509CRLEntry getRevokedCertificate ( X509Certificate certificate ) { X500Principal certIssuer = certificate . getIssuerX500Principal ( ) ; X500Principal crlIssuer = getIssuerX500Principal ( ) ; if ( certIssuer . equals ( crlIssuer ) == false ) { return null ; } return getRevokedCertificate ( certificate . getSerialNumber ( ) ) ; } | Get the CRL entry if any for the given certificate . |
27,817 | private void addToSpanNotSet ( int c ) { if ( Utility . sameObjects ( spanNotSet , null ) || Utility . sameObjects ( spanNotSet , spanSet ) ) { if ( spanSet . contains ( c ) ) { return ; } spanNotSet = spanSet . cloneAsThawed ( ) ; } spanNotSet . add ( c ) ; } | Adds a starting or ending string character to the spanNotSet so that a character span ends before any string . |
27,818 | public int span ( CharSequence s , int start , SpanCondition spanCondition ) { if ( spanCondition == SpanCondition . NOT_CONTAINED ) { return spanNot ( s , start , null ) ; } int spanLimit = spanSet . span ( s , start , SpanCondition . CONTAINED ) ; if ( spanLimit == s . length ( ) ) { return spanLimit ; } return spanWithStrings ( s , start , spanLimit , spanCondition ) ; } | Spans a string . |
27,819 | public int spanAndCount ( CharSequence s , int start , SpanCondition spanCondition , OutputInt outCount ) { if ( spanCondition == SpanCondition . NOT_CONTAINED ) { return spanNot ( s , start , outCount ) ; } if ( spanCondition == SpanCondition . CONTAINED ) { return spanContainedAndCount ( s , start , outCount ) ; } int stringsLength = strings . size ( ) ; int length = s . length ( ) ; int pos = start ; int rest = length - start ; int count = 0 ; while ( rest != 0 ) { int cpLength = spanOne ( spanSet , s , pos , rest ) ; int maxInc = ( cpLength > 0 ) ? cpLength : 0 ; for ( int i = 0 ; i < stringsLength ; ++ i ) { String string = strings . get ( i ) ; int length16 = string . length ( ) ; if ( maxInc < length16 && length16 <= rest && matches16CPB ( s , pos , length , string , length16 ) ) { maxInc = length16 ; } } if ( maxInc == 0 ) { outCount . value = count ; return pos ; } ++ count ; pos += maxInc ; rest -= maxInc ; } outCount . value = count ; return pos ; } | Spans a string and counts the smallest number of set elements on any path across the span . |
27,820 | private static boolean matches16 ( CharSequence s , int start , final String t , int length ) { int end = start + length ; while ( length -- > 0 ) { if ( s . charAt ( -- end ) != t . charAt ( length ) ) { return false ; } } return true ; } | Compare strings without any argument checks . Requires length > 0 . |
27,821 | static int spanOne ( final UnicodeSet set , CharSequence s , int start , int length ) { char c = s . charAt ( start ) ; if ( c >= 0xd800 && c <= 0xdbff && length >= 2 ) { char c2 = s . charAt ( start + 1 ) ; if ( android . icu . text . UTF16 . isTrailSurrogate ( c2 ) ) { int supplementary = Character . toCodePoint ( c , c2 ) ; return set . contains ( supplementary ) ? 2 : - 2 ; } } return set . contains ( c ) ? 1 : - 1 ; } | Does the set contain the next code point? If so return its length ; otherwise return its negative length . |
27,822 | private boolean isOutsideDocElem ( ) { return ( null == m_docFrag ) && m_elemStack . size ( ) == 0 && ( null == m_currentNode || m_currentNode . getNodeType ( ) == Node . DOCUMENT_NODE ) ; } | Tell if the current node is outside the document element . |
27,823 | public void startPrefixMapping ( String prefix , String uri ) throws org . xml . sax . SAXException { if ( null == prefix || prefix . equals ( "" ) ) prefix = "xmlns" ; else prefix = "xmlns:" + prefix ; m_prefixMappings . addElement ( prefix ) ; m_prefixMappings . addElement ( uri ) ; } | Begin the scope of a prefix - URI Namespace mapping . |
27,824 | void build ( String namespace , String name , String nameAlias , XSLTElementDef [ ] elements , XSLTAttributeDef [ ] attributes , XSLTElementProcessor contentHandler , Class classObject ) { this . m_namespace = namespace ; this . m_name = name ; this . m_nameAlias = nameAlias ; this . m_elements = elements ; this . m_attributes = attributes ; setElementProcessor ( contentHandler ) ; this . m_classObject = classObject ; if ( hasRequired ( ) && m_elements != null ) { int n = m_elements . length ; for ( int i = 0 ; i < n ; i ++ ) { XSLTElementDef def = m_elements [ i ] ; if ( def != null && def . getRequired ( ) ) { if ( m_requiredFound == null ) m_requiredFound = new Hashtable ( ) ; m_requiredFound . put ( def . getName ( ) , "xsl:" + def . getName ( ) ) ; } } } } | Construct an instance of XSLTElementDef . |
27,825 | private static boolean equalsMayBeNull ( Object obj1 , Object obj2 ) { return ( obj2 == obj1 ) || ( ( null != obj1 ) && ( null != obj2 ) && obj2 . equals ( obj1 ) ) ; } | Tell if two objects are equal when either one may be null . If both are null they are considered equal . |
27,826 | XSLTElementProcessor getProcessorFor ( String uri , String localName ) { XSLTElementProcessor elemDef = null ; if ( null == m_elements ) return null ; int n = m_elements . length ; int order = - 1 ; boolean multiAllowed = true ; for ( int i = 0 ; i < n ; i ++ ) { XSLTElementDef def = m_elements [ i ] ; if ( def . m_name . equals ( "*" ) ) { if ( ! equalsMayBeNullOrZeroLen ( uri , Constants . S_XSLNAMESPACEURL ) ) { elemDef = def . m_elementProcessor ; order = def . getOrder ( ) ; multiAllowed = def . getMultiAllowed ( ) ; } } else if ( def . QNameEquals ( uri , localName ) ) { if ( def . getRequired ( ) ) this . setRequiredFound ( def . getName ( ) , true ) ; order = def . getOrder ( ) ; multiAllowed = def . getMultiAllowed ( ) ; elemDef = def . m_elementProcessor ; break ; } } if ( elemDef != null && this . isOrdered ( ) ) { int lastOrder = getLastOrder ( ) ; if ( order > lastOrder ) setLastOrder ( order ) ; else if ( order == lastOrder && ! multiAllowed ) { return null ; } else if ( order < lastOrder && order > 0 ) { return null ; } } return elemDef ; } | Given a namespace URI and a local name get the processor for the element or return null if not allowed . |
27,827 | XSLTElementProcessor getProcessorForUnknown ( String uri , String localName ) { if ( null == m_elements ) return null ; int n = m_elements . length ; for ( int i = 0 ; i < n ; i ++ ) { XSLTElementDef def = m_elements [ i ] ; if ( def . m_name . equals ( "unknown" ) && uri . length ( ) > 0 ) { return def . m_elementProcessor ; } } return null ; } | Given an unknown element get the processor for the element . |
27,828 | XSLTAttributeDef getAttributeDef ( String uri , String localName ) { XSLTAttributeDef defaultDef = null ; XSLTAttributeDef [ ] attrDefs = getAttributes ( ) ; int nAttrDefs = attrDefs . length ; for ( int k = 0 ; k < nAttrDefs ; k ++ ) { XSLTAttributeDef attrDef = attrDefs [ k ] ; String uriDef = attrDef . getNamespace ( ) ; String nameDef = attrDef . getName ( ) ; if ( nameDef . equals ( "*" ) && ( equalsMayBeNullOrZeroLen ( uri , uriDef ) || ( uriDef != null && uriDef . equals ( "*" ) && uri != null && uri . length ( ) > 0 ) ) ) { return attrDef ; } else if ( nameDef . equals ( "*" ) && ( uriDef == null ) ) { defaultDef = attrDef ; } else if ( equalsMayBeNullOrZeroLen ( uri , uriDef ) && localName . equals ( nameDef ) ) { return attrDef ; } } if ( null == defaultDef ) { if ( uri . length ( ) > 0 && ! equalsMayBeNullOrZeroLen ( uri , Constants . S_XSLNAMESPACEURL ) ) { return XSLTAttributeDef . m_foreignAttr ; } } return defaultDef ; } | Given a namespace URI and a local name return the element s attribute definition if it has one . |
27,829 | void setRequiredFound ( String elem , boolean found ) { if ( m_requiredFound . get ( elem ) != null ) m_requiredFound . remove ( elem ) ; } | Set this required element found . |
27,830 | String getRequiredElem ( ) { if ( m_requiredFound == null ) return null ; Enumeration elems = m_requiredFound . elements ( ) ; String s = "" ; boolean first = true ; while ( elems . hasMoreElements ( ) ) { if ( first ) first = false ; else s = s + ", " ; s = s + ( String ) elems . nextElement ( ) ; } return s ; } | Get required elements that were not found . |
27,831 | public String getPrefix ( PackageElement packageElement ) { if ( packageElement == null ) { return "" ; } String packageName = packageElement . getQualifiedName ( ) . toString ( ) ; String prefix = getPrefix ( packageName ) ; if ( prefix != null ) { return prefix ; } prefix = packageLookup . getObjectiveCName ( packageName ) ; if ( prefix == null ) { prefix = NameTable . camelCaseQualifiedName ( packageName ) ; } addPrefix ( packageName , prefix ) ; return prefix ; } | Return the prefix for a specified package . If a prefix was specified for the package then that prefix is returned . Otherwise a camel - cased prefix is created from the package name . |
27,832 | public void addPrefixesFile ( String filename ) throws IOException { try ( Reader r = Files . newBufferedReader ( Paths . get ( filename ) , StandardCharsets . UTF_8 ) ) { addPrefixProperties ( r ) ; } } | Add a file map of packages to their respective prefixes using the Properties file format . |
27,833 | private DerValue readRFC1421Cert ( InputStream in ) throws IOException { DerValue der = null ; String line = null ; BufferedReader certBufferedReader = new BufferedReader ( new InputStreamReader ( in , "ASCII" ) ) ; try { line = certBufferedReader . readLine ( ) ; } catch ( IOException ioe1 ) { throw new IOException ( "Unable to read InputStream: " + ioe1 . getMessage ( ) ) ; } if ( line . equals ( X509Factory . BEGIN_CERT ) ) { BASE64Decoder decoder = new BASE64Decoder ( ) ; ByteArrayOutputStream decstream = new ByteArrayOutputStream ( ) ; try { while ( ( line = certBufferedReader . readLine ( ) ) != null ) { if ( line . equals ( X509Factory . END_CERT ) ) { der = new DerValue ( decstream . toByteArray ( ) ) ; break ; } else { decstream . write ( decoder . decodeBuffer ( line ) ) ; } } } catch ( IOException ioe2 ) { throw new IOException ( "Unable to read InputStream: " + ioe2 . getMessage ( ) ) ; } } else { throw new IOException ( "InputStream is not RFC1421 hex-encoded " + "DER bytes" ) ; } return der ; } | read input stream as HEX - encoded DER - encoded bytes |
27,834 | public Object get ( String name ) throws CertificateParsingException { X509AttributeName attr = new X509AttributeName ( name ) ; String id = attr . getPrefix ( ) ; if ( ! ( id . equalsIgnoreCase ( NAME ) ) ) { throw new CertificateParsingException ( "Invalid root of " + "attribute name, expected [" + NAME + "], received " + "[" + id + "]" ) ; } attr = new X509AttributeName ( attr . getSuffix ( ) ) ; id = attr . getPrefix ( ) ; if ( id . equalsIgnoreCase ( INFO ) ) { if ( info == null ) { return null ; } if ( attr . getSuffix ( ) != null ) { try { return info . get ( attr . getSuffix ( ) ) ; } catch ( IOException e ) { throw new CertificateParsingException ( e . toString ( ) ) ; } catch ( CertificateException e ) { throw new CertificateParsingException ( e . toString ( ) ) ; } } else { return info ; } } else if ( id . equalsIgnoreCase ( ALG_ID ) ) { return ( algId ) ; } else if ( id . equalsIgnoreCase ( SIGNATURE ) ) { if ( signature != null ) return signature . clone ( ) ; else return null ; } else if ( id . equalsIgnoreCase ( SIGNED_CERT ) ) { if ( signedCert != null ) return signedCert . clone ( ) ; else return null ; } else { throw new CertificateParsingException ( "Attribute name not " + "recognized or get() not allowed for the same: " + id ) ; } } | Return the requested attribute from the certificate . |
27,835 | public void set ( String name , Object obj ) throws CertificateException , IOException { if ( readOnly ) throw new CertificateException ( "cannot over-write existing" + " certificate" ) ; X509AttributeName attr = new X509AttributeName ( name ) ; String id = attr . getPrefix ( ) ; if ( ! ( id . equalsIgnoreCase ( NAME ) ) ) { throw new CertificateException ( "Invalid root of attribute name," + " expected [" + NAME + "], received " + id ) ; } attr = new X509AttributeName ( attr . getSuffix ( ) ) ; id = attr . getPrefix ( ) ; if ( id . equalsIgnoreCase ( INFO ) ) { if ( attr . getSuffix ( ) == null ) { if ( ! ( obj instanceof X509CertInfo ) ) { throw new CertificateException ( "Attribute value should" + " be of type X509CertInfo." ) ; } info = ( X509CertInfo ) obj ; signedCert = null ; } else { info . set ( attr . getSuffix ( ) , obj ) ; signedCert = null ; } } else { throw new CertificateException ( "Attribute name not recognized or " + "set() not allowed for the same: " + id ) ; } } | Set the requested attribute in the certificate . |
27,836 | public void delete ( String name ) throws CertificateException , IOException { if ( readOnly ) throw new CertificateException ( "cannot over-write existing" + " certificate" ) ; X509AttributeName attr = new X509AttributeName ( name ) ; String id = attr . getPrefix ( ) ; if ( ! ( id . equalsIgnoreCase ( NAME ) ) ) { throw new CertificateException ( "Invalid root of attribute name," + " expected [" + NAME + "], received " + id ) ; } attr = new X509AttributeName ( attr . getSuffix ( ) ) ; id = attr . getPrefix ( ) ; if ( id . equalsIgnoreCase ( INFO ) ) { if ( attr . getSuffix ( ) != null ) { info = null ; } else { info . delete ( attr . getSuffix ( ) ) ; } } else if ( id . equalsIgnoreCase ( ALG_ID ) ) { algId = null ; } else if ( id . equalsIgnoreCase ( SIGNATURE ) ) { signature = null ; } else if ( id . equalsIgnoreCase ( SIGNED_CERT ) ) { signedCert = null ; } else { throw new CertificateException ( "Attribute name not recognized or " + "delete() not allowed for the same: " + id ) ; } } | Delete the requested attribute from the certificate . |
27,837 | public PublicKey getPublicKey ( ) { if ( info == null ) return null ; try { PublicKey key = ( PublicKey ) info . get ( CertificateX509Key . NAME + DOT + CertificateX509Key . KEY ) ; return key ; } catch ( Exception e ) { return null ; } } | Gets the publickey from this certificate . |
27,838 | public int getVersion ( ) { if ( info == null ) return - 1 ; try { int vers = ( ( Integer ) info . get ( CertificateVersion . NAME + DOT + CertificateVersion . VERSION ) ) . intValue ( ) ; return vers + 1 ; } catch ( Exception e ) { return - 1 ; } } | Gets the version number from the certificate . |
27,839 | public BigInteger getSerialNumber ( ) { SerialNumber ser = getSerialNumberObject ( ) ; return ser != null ? ser . getNumber ( ) : null ; } | Gets the serial number from the certificate . |
27,840 | public SerialNumber getSerialNumberObject ( ) { if ( info == null ) return null ; try { SerialNumber ser = ( SerialNumber ) info . get ( CertificateSerialNumber . NAME + DOT + CertificateSerialNumber . NUMBER ) ; return ser ; } catch ( Exception e ) { return null ; } } | Gets the serial number from the certificate as a SerialNumber object . |
27,841 | public Principal getSubjectDN ( ) { if ( info == null ) return null ; try { Principal subject = ( Principal ) info . get ( X509CertInfo . SUBJECT + DOT + X509CertInfo . DN_NAME ) ; return subject ; } catch ( Exception e ) { return null ; } } | Gets the subject distinguished name from the certificate . |
27,842 | public X500Principal getSubjectX500Principal ( ) { if ( info == null ) { return null ; } try { X500Principal subject = ( X500Principal ) info . get ( X509CertInfo . SUBJECT + DOT + "x500principal" ) ; return subject ; } catch ( Exception e ) { return null ; } } | Get subject name as X500Principal . Overrides implementation in X509Certificate with a slightly more efficient version that is also aware of X509CertImpl mutability . |
27,843 | public Principal getIssuerDN ( ) { if ( info == null ) return null ; try { Principal issuer = ( Principal ) info . get ( X509CertInfo . ISSUER + DOT + X509CertInfo . DN_NAME ) ; return issuer ; } catch ( Exception e ) { return null ; } } | Gets the issuer distinguished name from the certificate . |
27,844 | public X500Principal getIssuerX500Principal ( ) { if ( info == null ) { return null ; } try { X500Principal issuer = ( X500Principal ) info . get ( X509CertInfo . ISSUER + DOT + "x500principal" ) ; return issuer ; } catch ( Exception e ) { return null ; } } | Get issuer name as X500Principal . Overrides implementation in X509Certificate with a slightly more efficient version that is also aware of X509CertImpl mutability . |
27,845 | public Date getNotBefore ( ) { if ( info == null ) return null ; try { Date d = ( Date ) info . get ( CertificateValidity . NAME + DOT + CertificateValidity . NOT_BEFORE ) ; return d ; } catch ( Exception e ) { return null ; } } | Gets the notBefore date from the validity period of the certificate . |
27,846 | public Date getNotAfter ( ) { if ( info == null ) return null ; try { Date d = ( Date ) info . get ( CertificateValidity . NAME + DOT + CertificateValidity . NOT_AFTER ) ; return d ; } catch ( Exception e ) { return null ; } } | Gets the notAfter date from the validity period of the certificate . |
27,847 | public String getSigAlgOID ( ) { if ( algId == null ) return null ; ObjectIdentifier oid = algId . getOID ( ) ; return ( oid . toString ( ) ) ; } | Gets the signature algorithm OID string from the certificate . For example the string 1 . 2 . 840 . 10040 . 4 . 3 |
27,848 | public boolean [ ] getIssuerUniqueID ( ) { if ( info == null ) return null ; try { UniqueIdentity id = ( UniqueIdentity ) info . get ( X509CertInfo . ISSUER_ID ) ; if ( id == null ) return null ; else return ( id . getId ( ) ) ; } catch ( Exception e ) { return null ; } } | Gets the Issuer Unique Identity from the certificate . |
27,849 | public boolean [ ] getSubjectUniqueID ( ) { if ( info == null ) return null ; try { UniqueIdentity id = ( UniqueIdentity ) info . get ( X509CertInfo . SUBJECT_ID ) ; if ( id == null ) return null ; else return ( id . getId ( ) ) ; } catch ( Exception e ) { return null ; } } | Gets the Subject Unique Identity from the certificate . |
27,850 | public KeyIdentifier getSubjectKeyId ( ) { SubjectKeyIdentifierExtension ski = getSubjectKeyIdentifierExtension ( ) ; if ( ski != null ) { try { return ( KeyIdentifier ) ski . get ( SubjectKeyIdentifierExtension . KEY_ID ) ; } catch ( IOException ioe ) { } } return null ; } | Returns the subject s key identifier or null |
27,851 | public boolean hasUnsupportedCriticalExtension ( ) { if ( info == null ) return false ; try { CertificateExtensions exts = ( CertificateExtensions ) info . get ( CertificateExtensions . NAME ) ; if ( exts == null ) return false ; return exts . hasUnsupportedCriticalExtension ( ) ; } catch ( Exception e ) { return false ; } } | Return true if a critical extension is found that is not supported otherwise return false . |
27,852 | public Extension getExtension ( ObjectIdentifier oid ) { if ( info == null ) { return null ; } try { CertificateExtensions extensions ; try { extensions = ( CertificateExtensions ) info . get ( CertificateExtensions . NAME ) ; } catch ( CertificateException ce ) { return null ; } if ( extensions == null ) { return null ; } else { Extension ex = extensions . getExtension ( oid . toString ( ) ) ; if ( ex != null ) { return ex ; } for ( Extension ex2 : extensions . getAllExtensions ( ) ) { if ( ex2 . getExtensionId ( ) . equals ( ( Object ) oid ) ) { return ex2 ; } } return null ; } } catch ( IOException ioe ) { return null ; } } | Gets the extension identified by the given ObjectIdentifier |
27,853 | public byte [ ] getExtensionValue ( String oid ) { try { ObjectIdentifier findOID = new ObjectIdentifier ( oid ) ; String extAlias = OIDMap . getName ( findOID ) ; Extension certExt = null ; CertificateExtensions exts = ( CertificateExtensions ) info . get ( CertificateExtensions . NAME ) ; if ( extAlias == null ) { if ( exts == null ) { return null ; } for ( Extension ex : exts . getAllExtensions ( ) ) { ObjectIdentifier inCertOID = ex . getExtensionId ( ) ; if ( inCertOID . equals ( ( Object ) findOID ) ) { certExt = ex ; break ; } } } else { try { certExt = ( Extension ) this . get ( extAlias ) ; } catch ( CertificateException e ) { } } if ( certExt == null ) { if ( exts != null ) { certExt = exts . getUnparseableExtensions ( ) . get ( oid ) ; } if ( certExt == null ) { return null ; } } byte [ ] extData = certExt . getExtensionValue ( ) ; if ( extData == null ) { return null ; } DerOutputStream out = new DerOutputStream ( ) ; out . putOctetString ( extData ) ; return out . toByteArray ( ) ; } catch ( Exception e ) { return null ; } } | Gets the DER encoded extension identified by the given oid String . |
27,854 | public synchronized List < String > getExtendedKeyUsage ( ) throws CertificateParsingException { if ( readOnly && extKeyUsage != null ) { return extKeyUsage ; } else { ExtendedKeyUsageExtension ext = getExtendedKeyUsageExtension ( ) ; if ( ext == null ) { return null ; } extKeyUsage = Collections . unmodifiableList ( ext . getExtendedKeyUsage ( ) ) ; return extKeyUsage ; } } | This method are the overridden implementation of getExtendedKeyUsage method in X509Certificate in the Sun provider . It is better performance - wise since it returns cached values . |
27,855 | public static List < String > getExtendedKeyUsage ( X509Certificate cert ) throws CertificateParsingException { try { byte [ ] ext = cert . getExtensionValue ( EXTENDED_KEY_USAGE_OID ) ; if ( ext == null ) return null ; DerValue val = new DerValue ( ext ) ; byte [ ] data = val . getOctetString ( ) ; ExtendedKeyUsageExtension ekuExt = new ExtendedKeyUsageExtension ( Boolean . FALSE , data ) ; return Collections . unmodifiableList ( ekuExt . getExtendedKeyUsage ( ) ) ; } catch ( IOException ioe ) { throw new CertificateParsingException ( ioe ) ; } } | This static method is the default implementation of the getExtendedKeyUsage method in X509Certificate . A X509Certificate provider generally should overwrite this to provide among other things caching for better performance . |
27,856 | private static Collection < List < ? > > cloneAltNames ( Collection < List < ? > > altNames ) { boolean mustClone = false ; for ( List < ? > nameEntry : altNames ) { if ( nameEntry . get ( 1 ) instanceof byte [ ] ) { mustClone = true ; } } if ( mustClone ) { List < List < ? > > namesCopy = new ArrayList < > ( ) ; for ( List < ? > nameEntry : altNames ) { Object nameObject = nameEntry . get ( 1 ) ; if ( nameObject instanceof byte [ ] ) { List < Object > nameEntryCopy = new ArrayList < > ( nameEntry ) ; nameEntryCopy . set ( 1 , ( ( byte [ ] ) nameObject ) . clone ( ) ) ; namesCopy . add ( Collections . unmodifiableList ( nameEntryCopy ) ) ; } else { namesCopy . add ( nameEntry ) ; } } return Collections . unmodifiableCollection ( namesCopy ) ; } else { return altNames ; } } | only partially generified due to javac bug |
27,857 | private static X500Principal getX500Principal ( X509Certificate cert , boolean getIssuer ) throws Exception { byte [ ] encoded = cert . getEncoded ( ) ; DerInputStream derIn = new DerInputStream ( encoded ) ; DerValue tbsCert = derIn . getSequence ( 3 ) [ 0 ] ; DerInputStream tbsIn = tbsCert . data ; DerValue tmp ; tmp = tbsIn . getDerValue ( ) ; if ( tmp . isContextSpecific ( ( byte ) 0 ) ) { tmp = tbsIn . getDerValue ( ) ; } tmp = tbsIn . getDerValue ( ) ; tmp = tbsIn . getDerValue ( ) ; if ( getIssuer == false ) { tmp = tbsIn . getDerValue ( ) ; tmp = tbsIn . getDerValue ( ) ; } byte [ ] principalBytes = tmp . toByteArray ( ) ; return new X500Principal ( principalBytes ) ; } | Extract the subject or issuer X500Principal from an X509Certificate . Parses the encoded form of the cert to preserve the principal s ASN . 1 encoding . |
27,858 | public static X509CertImpl toImpl ( X509Certificate cert ) throws CertificateException { if ( cert instanceof X509CertImpl ) { return ( X509CertImpl ) cert ; } else { return X509Factory . intern ( cert ) ; } } | Utility method to convert an arbitrary instance of X509Certificate to a X509CertImpl . Does a cast if possible otherwise reparses the encoding . |
27,859 | public static boolean isSelfIssued ( X509Certificate cert ) { X500Principal subject = cert . getSubjectX500Principal ( ) ; X500Principal issuer = cert . getIssuerX500Principal ( ) ; return subject . equals ( issuer ) ; } | Utility method to test if a certificate is self - issued . This is the case iff the subject and issuer X500Principals are equal . |
27,860 | public static boolean isSelfSigned ( X509Certificate cert , String sigProvider ) { if ( isSelfIssued ( cert ) ) { try { if ( sigProvider == null ) { cert . verify ( cert . getPublicKey ( ) ) ; } else { cert . verify ( cert . getPublicKey ( ) , sigProvider ) ; } return true ; } catch ( Exception e ) { } } return false ; } | Utility method to test if a certificate is self - signed . This is the case iff the subject and issuer X500Principals are equal AND the certificate s subject public key can be used to verify the certificate . In case of exception returns false . |
27,861 | private String getCertificateFingerPrint ( String mdAlg ) { String fingerPrint = "" ; try { byte [ ] encCertInfo = getEncoded ( ) ; MessageDigest md = MessageDigest . getInstance ( mdAlg ) ; byte [ ] digest = md . digest ( encCertInfo ) ; StringBuffer buf = new StringBuffer ( ) ; for ( int i = 0 ; i < digest . length ; i ++ ) { byte2hex ( digest [ i ] , buf ) ; } fingerPrint = buf . toString ( ) ; } catch ( NoSuchAlgorithmException | CertificateEncodingException e ) { } return fingerPrint ; } | Gets the requested finger print of the certificate . The result only contains 0 - 9 and A - F . No small case no colon . |
27,862 | private static void byte2hex ( byte b , StringBuffer buf ) { char [ ] hexChars = { '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , 'A' , 'B' , 'C' , 'D' , 'E' , 'F' } ; int high = ( ( b & 0xf0 ) >> 4 ) ; int low = ( b & 0x0f ) ; buf . append ( hexChars [ high ] ) ; buf . append ( hexChars [ low ] ) ; } | Converts a byte to hex digit and writes to the supplied buffer |
27,863 | public String getComment ( ) { synchronized ( this ) { ensureOpen ( ) ; byte [ ] bcomm = getCommentBytes ( jzfile ) ; if ( bcomm == null ) return null ; return zc . toString ( bcomm , bcomm . length ) ; } } | Returns the zip file comment or null if none . |
27,864 | public ZipEntry getEntry ( String name ) { if ( name == null ) { throw new NullPointerException ( "name" ) ; } long jzentry = 0 ; synchronized ( this ) { ensureOpen ( ) ; jzentry = getEntry ( jzfile , zc . getBytes ( name ) , true ) ; if ( jzentry != 0 ) { ZipEntry ze = getZipEntry ( name , jzentry ) ; freeEntry ( jzfile , jzentry ) ; return ze ; } } return null ; } | Returns the zip file entry for the specified name or null if not found . |
27,865 | public Enumeration < ? extends ZipEntry > entries ( ) { ensureOpen ( ) ; return new Enumeration < ZipEntry > ( ) { private int i = 0 ; public boolean hasMoreElements ( ) { synchronized ( ZipFile . this ) { ensureOpen ( ) ; return i < total ; } } public ZipEntry nextElement ( ) throws NoSuchElementException { synchronized ( ZipFile . this ) { ensureOpen ( ) ; if ( i >= total ) { throw new NoSuchElementException ( ) ; } long jzentry = getNextEntry ( jzfile , i ++ ) ; if ( jzentry == 0 ) { String message ; if ( closeRequested ) { message = "ZipFile concurrently closed" ; } else { message = getZipMessage ( ZipFile . this . jzfile ) ; } throw new ZipError ( "jzentry == 0" + ",\n jzfile = " + ZipFile . this . jzfile + ",\n total = " + ZipFile . this . total + ",\n name = " + ZipFile . this . name + ",\n i = " + i + ",\n message = " + message ) ; } ZipEntry ze = getZipEntry ( null , jzentry ) ; freeEntry ( jzfile , jzentry ) ; return ze ; } } } ; } | Returns an enumeration of the ZIP file entries . |
27,866 | public void encode ( DerOutputStream out ) throws IOException { DerOutputStream tmp = new DerOutputStream ( ) ; policyIdentifier . encode ( tmp ) ; if ( ! policyQualifiers . isEmpty ( ) ) { DerOutputStream tmp2 = new DerOutputStream ( ) ; for ( PolicyQualifierInfo pq : policyQualifiers ) { tmp2 . write ( pq . getEncoded ( ) ) ; } tmp . write ( DerValue . tag_Sequence , tmp2 ) ; } out . write ( DerValue . tag_Sequence , tmp ) ; } | Write the PolicyInformation to the DerOutputStream . |
27,867 | private Object readResolve ( ) throws ObjectStreamException { switch ( index ) { case 6 : return SECOND ; case 5 : return MINUTE ; case 4 : return HOUR ; case 3 : return DAY ; case 2 : return WEEK ; case 1 : return MONTH ; case 0 : return YEAR ; default : throw new InvalidObjectException ( "Bad index: " + index ) ; } } | For backward compatibility only |
27,868 | public final DoubleStream asDoubleStream ( ) { return new DoublePipeline . StatelessOp < Long > ( this , StreamShape . LONG_VALUE , StreamOpFlag . NOT_SORTED | StreamOpFlag . NOT_DISTINCT ) { public Sink < Long > opWrapSink ( int flags , Sink < Double > sink ) { return new Sink . ChainedLong < Double > ( sink ) { public void accept ( long t ) { downstream . accept ( ( double ) t ) ; } } ; } } ; } | Stateless intermediate ops from LongStream |
27,869 | public final LongStream limit ( long maxSize ) { if ( maxSize < 0 ) throw new IllegalArgumentException ( Long . toString ( maxSize ) ) ; return SliceOps . makeLong ( this , 0 , maxSize ) ; } | Stateful intermediate ops from LongStream |
27,870 | final int getIndexValue ( ) { if ( anteContextLength == pattern . length ( ) ) { return - 1 ; } int c = UTF16 . charAt ( pattern , anteContextLength ) ; return data . lookupMatcher ( c ) == null ? ( c & 0xFF ) : - 1 ; } | Internal method . Returns 8 - bit index value for this rule . This is the low byte of the first character of the key unless the first character of the key is a set . If it s a set or otherwise can match multiple keys the index value is - 1 . |
27,871 | final boolean matchesIndexValue ( int v ) { UnicodeMatcher m = ( key != null ) ? key : postContext ; return ( m != null ) ? m . matchesIndexValue ( v ) : true ; } | Internal method . Returns true if this rule matches the given index value . The index value is an 8 - bit integer 0 .. 255 representing the low byte of the first character of the key . It matches this rule if it matches the first character of the key or if the first character of the key is a set and the set contains any character with a low byte equal to the index value . If the rule contains only ante context as in foo ) > bar then it will match any key . |
27,872 | public int matchAndReplace ( Replaceable text , Transliterator . Position pos , boolean incremental ) { if ( segments != null ) { for ( int i = 0 ; i < segments . length ; ++ i ) { ( ( StringMatcher ) segments [ i ] ) . resetMatch ( ) ; } } int keyLimit ; int [ ] intRef = new int [ 1 ] ; int oText ; int minOText ; int anteLimit = posBefore ( text , pos . contextStart ) ; int match ; intRef [ 0 ] = posBefore ( text , pos . start ) ; if ( anteContext != null ) { match = anteContext . matches ( text , intRef , anteLimit , false ) ; if ( match != UnicodeMatcher . U_MATCH ) { return UnicodeMatcher . U_MISMATCH ; } } oText = intRef [ 0 ] ; minOText = posAfter ( text , oText ) ; if ( ( ( flags & ANCHOR_START ) != 0 ) && oText != anteLimit ) { return UnicodeMatcher . U_MISMATCH ; } intRef [ 0 ] = pos . start ; if ( key != null ) { match = key . matches ( text , intRef , pos . limit , incremental ) ; if ( match != UnicodeMatcher . U_MATCH ) { return match ; } } keyLimit = intRef [ 0 ] ; if ( postContext != null ) { if ( incremental && keyLimit == pos . limit ) { return UnicodeMatcher . U_PARTIAL_MATCH ; } match = postContext . matches ( text , intRef , pos . contextLimit , incremental ) ; if ( match != UnicodeMatcher . U_MATCH ) { return match ; } } oText = intRef [ 0 ] ; if ( ( ( flags & ANCHOR_END ) ) != 0 ) { if ( oText != pos . contextLimit ) { return UnicodeMatcher . U_MISMATCH ; } if ( incremental ) { return UnicodeMatcher . U_PARTIAL_MATCH ; } } int newLength = output . replace ( text , pos . start , keyLimit , intRef ) ; int lenDelta = newLength - ( keyLimit - pos . start ) ; int newStart = intRef [ 0 ] ; oText += lenDelta ; pos . limit += lenDelta ; pos . contextLimit += lenDelta ; pos . start = Math . max ( minOText , Math . min ( Math . min ( oText , pos . limit ) , newStart ) ) ; return UnicodeMatcher . U_MATCH ; } | Attempt a match and replacement at the given position . Return the degree of match between this rule and the given text . The degree of match may be mismatch a partial match or a full match . A mismatch means at least one character of the text does not match the context or key . A partial match means some context and key characters match but the text is not long enough to match all of them . A full match means all context and key characters match . |
27,873 | public String toRule ( boolean escapeUnprintable ) { StringBuffer rule = new StringBuffer ( ) ; StringBuffer quoteBuf = new StringBuffer ( ) ; boolean emitBraces = ( anteContext != null ) || ( postContext != null ) ; if ( ( flags & ANCHOR_START ) != 0 ) { rule . append ( '^' ) ; } Utility . appendToRule ( rule , anteContext , escapeUnprintable , quoteBuf ) ; if ( emitBraces ) { Utility . appendToRule ( rule , '{' , true , escapeUnprintable , quoteBuf ) ; } Utility . appendToRule ( rule , key , escapeUnprintable , quoteBuf ) ; if ( emitBraces ) { Utility . appendToRule ( rule , '}' , true , escapeUnprintable , quoteBuf ) ; } Utility . appendToRule ( rule , postContext , escapeUnprintable , quoteBuf ) ; if ( ( flags & ANCHOR_END ) != 0 ) { rule . append ( '$' ) ; } Utility . appendToRule ( rule , " > " , true , escapeUnprintable , quoteBuf ) ; Utility . appendToRule ( rule , output . toReplacerPattern ( escapeUnprintable ) , true , escapeUnprintable , quoteBuf ) ; Utility . appendToRule ( rule , ';' , true , escapeUnprintable , quoteBuf ) ; return rule . toString ( ) ; } | Create a source string that represents this rule . Append it to the given string . |
27,874 | void addSourceTargetSet ( UnicodeSet filter , UnicodeSet sourceSet , UnicodeSet targetSet , UnicodeSet revisiting ) { int limit = anteContextLength + keyLength ; UnicodeSet tempSource = new UnicodeSet ( ) ; UnicodeSet temp = new UnicodeSet ( ) ; for ( int i = anteContextLength ; i < limit ; ) { int ch = UTF16 . charAt ( pattern , i ) ; i += UTF16 . getCharCount ( ch ) ; UnicodeMatcher matcher = data . lookupMatcher ( ch ) ; if ( matcher == null ) { if ( ! filter . contains ( ch ) ) { return ; } tempSource . add ( ch ) ; } else { try { if ( ! filter . containsSome ( ( UnicodeSet ) matcher ) ) { return ; } matcher . addMatchSetTo ( tempSource ) ; } catch ( ClassCastException e ) { temp . clear ( ) ; matcher . addMatchSetTo ( temp ) ; if ( ! filter . containsSome ( temp ) ) { return ; } tempSource . addAll ( temp ) ; } } } sourceSet . addAll ( tempSource ) ; output . addReplacementSetTo ( targetSet ) ; } | However following code applying the filter won t catch that case . |
27,875 | public Enumeration < URL > findResources ( final String name ) throws IOException { if ( name == null ) { return null ; } return Collections . enumeration ( urls ) ; } | Returns all known URLs which point to the specified resource . |
27,876 | public static < E extends Enum < E > > EnumSet < E > noneOf ( Class < E > elementType ) { Enum < ? > [ ] universe = getUniverse ( elementType ) ; if ( universe == null ) throw new ClassCastException ( elementType + " not an enum" ) ; if ( universe . length <= 64 ) return new RegularEnumSet < > ( elementType , universe ) ; else return new JumboEnumSet < > ( elementType , universe ) ; } | Creates an empty enum set with the specified element type . |
27,877 | public static < E extends Enum < E > > EnumSet < E > allOf ( Class < E > elementType ) { EnumSet < E > result = noneOf ( elementType ) ; result . addAll ( ) ; return result ; } | Creates an enum set containing all of the elements in the specified element type . |
27,878 | public static < E extends Enum < E > > EnumSet < E > of ( E e ) { EnumSet < E > result = noneOf ( e . getDeclaringClass ( ) ) ; result . add ( e ) ; return result ; } | Creates an enum set initially containing the specified element . |
27,879 | public static < E extends Enum < E > > EnumSet < E > of ( E e1 , E e2 ) { EnumSet < E > result = noneOf ( e1 . getDeclaringClass ( ) ) ; result . add ( e1 ) ; result . add ( e2 ) ; return result ; } | Creates an enum set initially containing the specified elements . |
27,880 | public static < E extends Enum < E > > EnumSet < E > of ( E first , E ... rest ) { EnumSet < E > result = noneOf ( first . getDeclaringClass ( ) ) ; result . add ( first ) ; for ( E e : rest ) result . add ( e ) ; return result ; } | Creates an enum set initially containing the specified elements . This factory whose parameter list uses the varargs feature may be used to create an enum set initially containing an arbitrary number of elements but it is likely to run slower than the overloadings that do not use varargs . |
27,881 | public static < E extends Enum < E > > EnumSet < E > range ( E from , E to ) { if ( from . compareTo ( to ) > 0 ) throw new IllegalArgumentException ( from + " > " + to ) ; EnumSet < E > result = noneOf ( from . getDeclaringClass ( ) ) ; result . addRange ( from , to ) ; return result ; } | Creates an enum set initially containing all of the elements in the range defined by the two specified endpoints . The returned set will contain the endpoints themselves which may be identical but must not be out of order . |
27,882 | private static < E extends Enum < E > > E [ ] getUniverse ( Class < E > elementType ) { return java . lang . JavaLangAccess . getEnumConstantsShared ( elementType ) ; } | Returns all of the values comprising E . The result is uncloned cached and shared by all callers . |
27,883 | public String certToString ( ) { StringBuilder sb = new StringBuilder ( ) ; X509CertImpl x509Cert = null ; try { x509Cert = X509CertImpl . toImpl ( cert ) ; } catch ( CertificateException ce ) { if ( debug != null ) { debug . println ( "Vertex.certToString() unexpected exception" ) ; ce . printStackTrace ( ) ; } return sb . toString ( ) ; } sb . append ( "Issuer: " ) . append ( x509Cert . getIssuerX500Principal ( ) ) . append ( "\n" ) ; sb . append ( "Subject: " ) . append ( x509Cert . getSubjectX500Principal ( ) ) . append ( "\n" ) ; sb . append ( "SerialNum: " ) . append ( x509Cert . getSerialNumber ( ) . toString ( 16 ) ) . append ( "\n" ) ; sb . append ( "Expires: " ) . append ( x509Cert . getNotAfter ( ) . toString ( ) ) . append ( "\n" ) ; boolean [ ] iUID = x509Cert . getIssuerUniqueID ( ) ; if ( iUID != null ) { sb . append ( "IssuerUID: " ) ; for ( boolean b : iUID ) { sb . append ( b ? 1 : 0 ) ; } sb . append ( "\n" ) ; } boolean [ ] sUID = x509Cert . getSubjectUniqueID ( ) ; if ( sUID != null ) { sb . append ( "SubjectUID: " ) ; for ( boolean b : sUID ) { sb . append ( b ? 1 : 0 ) ; } sb . append ( "\n" ) ; } try { SubjectKeyIdentifierExtension sKeyID = x509Cert . getSubjectKeyIdentifierExtension ( ) ; if ( sKeyID != null ) { KeyIdentifier keyID = sKeyID . get ( SubjectKeyIdentifierExtension . KEY_ID ) ; sb . append ( "SubjKeyID: " ) . append ( keyID . toString ( ) ) ; } AuthorityKeyIdentifierExtension aKeyID = x509Cert . getAuthorityKeyIdentifierExtension ( ) ; if ( aKeyID != null ) { KeyIdentifier keyID = ( KeyIdentifier ) aKeyID . get ( AuthorityKeyIdentifierExtension . KEY_ID ) ; sb . append ( "AuthKeyID: " ) . append ( keyID . toString ( ) ) ; } } catch ( IOException e ) { if ( debug != null ) { debug . println ( "Vertex.certToString() unexpected exception" ) ; e . printStackTrace ( ) ; } } return sb . toString ( ) ; } | Return string representation of this vertex s certificate information . |
27,884 | public String throwableToString ( ) { StringBuilder sb = new StringBuilder ( "Exception: " ) ; if ( throwable != null ) sb . append ( throwable . toString ( ) ) ; else sb . append ( "null" ) ; sb . append ( "\n" ) ; return sb . toString ( ) ; } | return Vertex throwable as String compatible with the way toString returns other information |
27,885 | private boolean removeUnreachable ( Block block ) { List < Statement > stmts = block . getStatements ( ) ; for ( int i = 0 ; i < stmts . size ( ) ; i ++ ) { Statement stmt = stmts . get ( i ) ; if ( stmt instanceof ReturnStatement || ( stmt instanceof Block && removeUnreachable ( ( Block ) stmt ) ) ) { stmts . subList ( i + 1 , stmts . size ( ) ) . clear ( ) ; return true ; } } return false ; } | Removes all unreachable statements that occur after a return statement in the given Block . Also recurses into child blocks . |
27,886 | public void endVisit ( PrefixExpression node ) { Boolean value = getReplaceableValue ( node . getOperand ( ) ) ; if ( node . getOperator ( ) == PrefixExpression . Operator . NOT && value != null ) { node . replaceWith ( new BooleanLiteral ( ! value , typeUtil ) ) ; } } | Invert ! boolean constant expressions . |
27,887 | public void endVisit ( ParenthesizedExpression node ) { if ( getReplaceableValue ( node . getExpression ( ) ) != null ) { node . replaceWith ( node . getExpression ( ) . copy ( ) ) ; } } | Remove parentheses around constant booleans . |
27,888 | private Boolean getKnownValue ( Expression expr ) { Object value = expr . getConstantValue ( ) ; if ( value instanceof Boolean ) { return ( Boolean ) value ; } switch ( expr . getKind ( ) ) { case BOOLEAN_LITERAL : return ( ( BooleanLiteral ) expr ) . booleanValue ( ) ; case INFIX_EXPRESSION : { InfixExpression infixExpr = ( InfixExpression ) expr ; InfixExpression . Operator op = infixExpr . getOperator ( ) ; if ( op == CONDITIONAL_AND || op == CONDITIONAL_OR ) { List < Expression > operands = infixExpr . getOperands ( ) ; Boolean lastOperand = getKnownValue ( operands . get ( operands . size ( ) - 1 ) ) ; if ( lastOperand != null && lastOperand . booleanValue ( ) == ( op == CONDITIONAL_OR ) ) { return lastOperand ; } } return null ; } case PARENTHESIZED_EXPRESSION : return getKnownValue ( ( ( ParenthesizedExpression ) expr ) . getExpression ( ) ) ; default : return null ; } } | Returns TRUE of FALSE if expr is a boolean expression and its value is known statically . The caller should be careful when replacing this expression as it may have side effects . |
27,889 | private Statement getSideEffects ( Expression expr ) { Expression sideEffectsExpr = extractSideEffects ( expr ) ; return sideEffectsExpr == null ? null : new ExpressionStatement ( sideEffectsExpr ) ; } | Extracts side effects from the given expression and returns the statement to insert . |
27,890 | private Expression extractSideEffects ( Expression expr ) { if ( expr . getConstantValue ( ) instanceof Boolean ) { return null ; } switch ( expr . getKind ( ) ) { case INFIX_EXPRESSION : { List < Expression > operands = ( ( InfixExpression ) expr ) . getOperands ( ) ; Expression lastOperand = operands . remove ( operands . size ( ) - 1 ) ; lastOperand = extractSideEffects ( lastOperand ) ; if ( lastOperand != null ) { operands . add ( lastOperand ) ; } if ( operands . size ( ) == 1 ) { return operands . remove ( 0 ) ; } return TreeUtil . remove ( expr ) ; } case PARENTHESIZED_EXPRESSION : { Expression sideEffects = extractSideEffects ( ( ( ParenthesizedExpression ) expr ) . getExpression ( ) ) ; if ( sideEffects != null ) { return ParenthesizedExpression . parenthesize ( sideEffects ) ; } return null ; } default : return null ; } } | Returns an expression containing the side effects of the given expression . The evaluated result of the expression may differ from the original . |
27,891 | private static int initializeClockSkew ( ) { Integer tmp = Integer . getInteger ( "com.sun.security.ocsp.clockSkew" ) ; if ( tmp == null || tmp < 0 ) { return DEFAULT_MAX_CLOCK_SKEW ; } return tmp * 1000 ; } | Initialize the maximum allowable clock skew by getting the OCSP clock skew system property . If the property has not been set or if its value is negative set the skew to the default . |
27,892 | static double computeFinalSum ( double [ ] summands ) { double tmp = summands [ 0 ] + summands [ 1 ] ; double simpleSum = summands [ summands . length - 1 ] ; if ( Double . isNaN ( tmp ) && Double . isInfinite ( simpleSum ) ) return simpleSum ; else return tmp ; } | If the compensated sum is spuriously NaN from accumulating one or more same - signed infinite values return the correctly - signed infinity stored in the simple sum . |
27,893 | public void setPattern ( String pattern ) { if ( pattern == null || pattern . length ( ) <= 0 ) { throw new IllegalArgumentException ( "Pattern to search for can not be null or of length 0" ) ; } pattern_ . text_ = pattern ; initialize ( ) ; } | Set the pattern to search for . The iterator s position will not be changed by this method . |
27,894 | private static int getMask ( int strength ) { switch ( strength ) { case Collator . PRIMARY : return PRIMARYORDERMASK ; case Collator . SECONDARY : return SECONDARYORDERMASK | PRIMARYORDERMASK ; default : return TERTIARYORDERMASK | SECONDARYORDERMASK | PRIMARYORDERMASK ; } } | Getting the mask for collation strength |
27,895 | private int getCE ( int sourcece ) { sourcece &= ceMask_ ; if ( toShift_ ) { if ( variableTop_ > sourcece ) { if ( strength_ >= Collator . QUATERNARY ) { sourcece &= PRIMARYORDERMASK ; } else { sourcece = CollationElementIterator . IGNORABLE ; } } } else if ( strength_ >= Collator . QUATERNARY && sourcece == CollationElementIterator . IGNORABLE ) { sourcece = 0xFFFF ; } return sourcece ; } | Getting the modified collation elements taking into account the collation attributes . |
27,896 | private int initializePatternPCETable ( ) { long [ ] pcetable = new long [ INITIAL_ARRAY_SIZE_ ] ; int pcetablesize = pcetable . length ; int patternlength = pattern_ . text_ . length ( ) ; CollationElementIterator coleiter = utilIter_ ; if ( coleiter == null ) { coleiter = new CollationElementIterator ( pattern_ . text_ , collator_ ) ; utilIter_ = coleiter ; } else { coleiter . setText ( pattern_ . text_ ) ; } int offset = 0 ; int result = 0 ; long pce ; CollationPCE iter = new CollationPCE ( coleiter ) ; while ( ( pce = iter . nextProcessed ( null ) ) != CollationPCE . PROCESSED_NULLORDER ) { long [ ] temp = addToLongArray ( pcetable , offset , pcetablesize , pce , patternlength - coleiter . getOffset ( ) + 1 ) ; offset ++ ; pcetable = temp ; } pcetable [ offset ] = 0 ; pattern_ . PCE_ = pcetable ; pattern_ . PCELength_ = offset ; return result ; } | Initializing the pce table for a pattern . Stores non - ignorable collation keys . Table size will be estimated by the size of the pattern text . Table expansion will be perform as we go along . Adding 1 to ensure that the table size definitely increases . |
27,897 | private boolean checkIdentical ( int start , int end ) { if ( strength_ != Collator . IDENTICAL ) { return true ; } String textstr = getString ( targetText , start , end - start ) ; if ( Normalizer . quickCheck ( textstr , Normalizer . NFD , 0 ) == Normalizer . NO ) { textstr = Normalizer . decompose ( textstr , false ) ; } String patternstr = pattern_ . text_ ; if ( Normalizer . quickCheck ( patternstr , Normalizer . NFD , 0 ) == Normalizer . NO ) { patternstr = Normalizer . decompose ( patternstr , false ) ; } return textstr . equals ( patternstr ) ; } | Checks for identical match |
27,898 | private static final String getString ( CharacterIterator text , int start , int length ) { StringBuilder result = new StringBuilder ( length ) ; int offset = text . getIndex ( ) ; text . setIndex ( start ) ; for ( int i = 0 ; i < length ; i ++ ) { result . append ( text . current ( ) ) ; text . next ( ) ; } text . setIndex ( offset ) ; return result . toString ( ) ; } | Gets a substring out of a CharacterIterator |
27,899 | private void addAllNamesIntoTrie ( ) { for ( Map . Entry < String , ZNames > entry : _tzNamesMap . entrySet ( ) ) { entry . getValue ( ) . addAsTimeZoneIntoTrie ( entry . getKey ( ) , _namesTrie ) ; } for ( Map . Entry < String , ZNames > entry : _mzNamesMap . entrySet ( ) ) { entry . getValue ( ) . addAsMetaZoneIntoTrie ( entry . getKey ( ) , _namesTrie ) ; } } | Caller must synchronize . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.