id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
35,200 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/StylesheetRoot.java | StylesheetRoot.initDefaultRule | private void initDefaultRule(ErrorListener errorListener) throws TransformerException
{
// Then manufacture a default
m_defaultRule = new ElemTemplate();
m_defaultRule.setStylesheet(this);
XPath defMatch = new XPath("*", this, this, XPath.MATCH, errorListener);
m_defaultRule.setMatch(defMatch);
ElemApplyTemplates childrenElement = new ElemApplyTemplates();
childrenElement.setIsDefaultTemplate(true);
childrenElement.setSelect(m_selectDefault);
m_defaultRule.appendChild(childrenElement);
m_startRule = m_defaultRule;
// -----------------------------
m_defaultTextRule = new ElemTemplate();
m_defaultTextRule.setStylesheet(this);
defMatch = new XPath("text() | @*", this, this, XPath.MATCH, errorListener);
m_defaultTextRule.setMatch(defMatch);
ElemValueOf elemValueOf = new ElemValueOf();
m_defaultTextRule.appendChild(elemValueOf);
XPath selectPattern = new XPath(".", this, this, XPath.SELECT, errorListener);
elemValueOf.setSelect(selectPattern);
//--------------------------------
m_defaultRootRule = new ElemTemplate();
m_defaultRootRule.setStylesheet(this);
defMatch = new XPath("/", this, this, XPath.MATCH, errorListener);
m_defaultRootRule.setMatch(defMatch);
childrenElement = new ElemApplyTemplates();
childrenElement.setIsDefaultTemplate(true);
m_defaultRootRule.appendChild(childrenElement);
childrenElement.setSelect(m_selectDefault);
} | java | private void initDefaultRule(ErrorListener errorListener) throws TransformerException
{
// Then manufacture a default
m_defaultRule = new ElemTemplate();
m_defaultRule.setStylesheet(this);
XPath defMatch = new XPath("*", this, this, XPath.MATCH, errorListener);
m_defaultRule.setMatch(defMatch);
ElemApplyTemplates childrenElement = new ElemApplyTemplates();
childrenElement.setIsDefaultTemplate(true);
childrenElement.setSelect(m_selectDefault);
m_defaultRule.appendChild(childrenElement);
m_startRule = m_defaultRule;
// -----------------------------
m_defaultTextRule = new ElemTemplate();
m_defaultTextRule.setStylesheet(this);
defMatch = new XPath("text() | @*", this, this, XPath.MATCH, errorListener);
m_defaultTextRule.setMatch(defMatch);
ElemValueOf elemValueOf = new ElemValueOf();
m_defaultTextRule.appendChild(elemValueOf);
XPath selectPattern = new XPath(".", this, this, XPath.SELECT, errorListener);
elemValueOf.setSelect(selectPattern);
//--------------------------------
m_defaultRootRule = new ElemTemplate();
m_defaultRootRule.setStylesheet(this);
defMatch = new XPath("/", this, this, XPath.MATCH, errorListener);
m_defaultRootRule.setMatch(defMatch);
childrenElement = new ElemApplyTemplates();
childrenElement.setIsDefaultTemplate(true);
m_defaultRootRule.appendChild(childrenElement);
childrenElement.setSelect(m_selectDefault);
} | [
"private",
"void",
"initDefaultRule",
"(",
"ErrorListener",
"errorListener",
")",
"throws",
"TransformerException",
"{",
"// Then manufacture a default",
"m_defaultRule",
"=",
"new",
"ElemTemplate",
"(",
")",
";",
"m_defaultRule",
".",
"setStylesheet",
"(",
"this",
")",... | Create the default rule if needed.
@throws TransformerException | [
"Create",
"the",
"default",
"rule",
"if",
"needed",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/StylesheetRoot.java#L1067-L1118 |
35,201 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java | TransformerHandlerImpl.clearCoRoutine | protected void clearCoRoutine(SAXException ex)
{
if(null != ex)
m_transformer.setExceptionThrown(ex);
if(m_dtm instanceof SAX2DTM)
{
if(DEBUG)
System.err.println("In clearCoRoutine...");
try
{
SAX2DTM sax2dtm = ((SAX2DTM)m_dtm);
if(null != m_contentHandler
&& m_contentHandler instanceof IncrementalSAXSource_Filter)
{
IncrementalSAXSource_Filter sp =
(IncrementalSAXSource_Filter)m_contentHandler;
// This should now be all that's needed.
sp.deliverMoreNodes(false);
}
sax2dtm.clearCoRoutine(true);
m_contentHandler = null;
m_dtdHandler = null;
m_entityResolver = null;
m_errorHandler = null;
m_lexicalHandler = null;
}
catch(Throwable throwable)
{
throwable.printStackTrace();
}
if(DEBUG)
System.err.println("...exiting clearCoRoutine");
}
} | java | protected void clearCoRoutine(SAXException ex)
{
if(null != ex)
m_transformer.setExceptionThrown(ex);
if(m_dtm instanceof SAX2DTM)
{
if(DEBUG)
System.err.println("In clearCoRoutine...");
try
{
SAX2DTM sax2dtm = ((SAX2DTM)m_dtm);
if(null != m_contentHandler
&& m_contentHandler instanceof IncrementalSAXSource_Filter)
{
IncrementalSAXSource_Filter sp =
(IncrementalSAXSource_Filter)m_contentHandler;
// This should now be all that's needed.
sp.deliverMoreNodes(false);
}
sax2dtm.clearCoRoutine(true);
m_contentHandler = null;
m_dtdHandler = null;
m_entityResolver = null;
m_errorHandler = null;
m_lexicalHandler = null;
}
catch(Throwable throwable)
{
throwable.printStackTrace();
}
if(DEBUG)
System.err.println("...exiting clearCoRoutine");
}
} | [
"protected",
"void",
"clearCoRoutine",
"(",
"SAXException",
"ex",
")",
"{",
"if",
"(",
"null",
"!=",
"ex",
")",
"m_transformer",
".",
"setExceptionThrown",
"(",
"ex",
")",
";",
"if",
"(",
"m_dtm",
"instanceof",
"SAX2DTM",
")",
"{",
"if",
"(",
"DEBUG",
")... | Do what needs to be done to shut down the CoRoutine management. | [
"Do",
"what",
"needs",
"to",
"be",
"done",
"to",
"shut",
"down",
"the",
"CoRoutine",
"management",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java#L124-L160 |
35,202 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java | TransformerHandlerImpl.resolveEntity | public InputSource resolveEntity(String publicId, String systemId)
throws SAXException, IOException
{
if (m_entityResolver != null)
{
return m_entityResolver.resolveEntity(publicId, systemId);
}
else
{
return null;
}
} | java | public InputSource resolveEntity(String publicId, String systemId)
throws SAXException, IOException
{
if (m_entityResolver != null)
{
return m_entityResolver.resolveEntity(publicId, systemId);
}
else
{
return null;
}
} | [
"public",
"InputSource",
"resolveEntity",
"(",
"String",
"publicId",
",",
"String",
"systemId",
")",
"throws",
"SAXException",
",",
"IOException",
"{",
"if",
"(",
"m_entityResolver",
"!=",
"null",
")",
"{",
"return",
"m_entityResolver",
".",
"resolveEntity",
"(",
... | Filter an external entity resolution.
@param publicId The entity's public identifier, or null.
@param systemId The entity's system identifier.
@return A new InputSource or null for the default.
@throws IOException
@throws SAXException The client may throw
an exception during processing.
@throws java.io.IOException The client may throw an
I/O-related exception while obtaining the
new InputSource.
@see org.xml.sax.EntityResolver#resolveEntity | [
"Filter",
"an",
"external",
"entity",
"resolution",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java#L248-L260 |
35,203 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java | TransformerHandlerImpl.notationDecl | public void notationDecl(String name, String publicId, String systemId)
throws SAXException
{
if (m_dtdHandler != null)
{
m_dtdHandler.notationDecl(name, publicId, systemId);
}
} | java | public void notationDecl(String name, String publicId, String systemId)
throws SAXException
{
if (m_dtdHandler != null)
{
m_dtdHandler.notationDecl(name, publicId, systemId);
}
} | [
"public",
"void",
"notationDecl",
"(",
"String",
"name",
",",
"String",
"publicId",
",",
"String",
"systemId",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"m_dtdHandler",
"!=",
"null",
")",
"{",
"m_dtdHandler",
".",
"notationDecl",
"(",
"name",
",",
"publ... | Filter a notation declaration event.
@param name The notation name.
@param publicId The notation's public identifier, or null.
@param systemId The notation's system identifier, or null.
@throws SAXException The client may throw
an exception during processing.
@see org.xml.sax.DTDHandler#notationDecl | [
"Filter",
"a",
"notation",
"declaration",
"event",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java#L276-L284 |
35,204 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java | TransformerHandlerImpl.setDocumentLocator | public void setDocumentLocator(Locator locator)
{
if (DEBUG)
System.out.println("TransformerHandlerImpl#setDocumentLocator: "
+ locator.getSystemId());
this.m_locator = locator;
if(null == m_baseSystemID)
{
setSystemId(locator.getSystemId());
}
if (m_contentHandler != null)
{
m_contentHandler.setDocumentLocator(locator);
}
} | java | public void setDocumentLocator(Locator locator)
{
if (DEBUG)
System.out.println("TransformerHandlerImpl#setDocumentLocator: "
+ locator.getSystemId());
this.m_locator = locator;
if(null == m_baseSystemID)
{
setSystemId(locator.getSystemId());
}
if (m_contentHandler != null)
{
m_contentHandler.setDocumentLocator(locator);
}
} | [
"public",
"void",
"setDocumentLocator",
"(",
"Locator",
"locator",
")",
"{",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"TransformerHandlerImpl#setDocumentLocator: \"",
"+",
"locator",
".",
"getSystemId",
"(",
")",
")",
";",
"this",
... | Filter a new document locator event.
@param locator The document locator.
@see org.xml.sax.ContentHandler#setDocumentLocator | [
"Filter",
"a",
"new",
"document",
"locator",
"event",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java#L318-L336 |
35,205 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java | TransformerHandlerImpl.startDocument | public void startDocument() throws SAXException
{
if (DEBUG)
System.out.println("TransformerHandlerImpl#startDocument");
m_insideParse = true;
// Thread listener = new Thread(m_transformer);
if (m_contentHandler != null)
{
//m_transformer.setTransformThread(listener);
if(m_incremental)
{
m_transformer.setSourceTreeDocForThread(m_dtm.getDocument());
int cpriority = Thread.currentThread().getPriority();
// runTransformThread is equivalent with the 2.0.1 code,
// except that the Thread may come from a pool.
m_transformer.runTransformThread( cpriority );
}
// This is now done _last_, because IncrementalSAXSource_Filter
// will immediately go into a "wait until events are requested"
// pause. I believe that will close our timing window.
// %REVIEW%
m_contentHandler.startDocument();
}
//listener.setDaemon(false);
//listener.start();
} | java | public void startDocument() throws SAXException
{
if (DEBUG)
System.out.println("TransformerHandlerImpl#startDocument");
m_insideParse = true;
// Thread listener = new Thread(m_transformer);
if (m_contentHandler != null)
{
//m_transformer.setTransformThread(listener);
if(m_incremental)
{
m_transformer.setSourceTreeDocForThread(m_dtm.getDocument());
int cpriority = Thread.currentThread().getPriority();
// runTransformThread is equivalent with the 2.0.1 code,
// except that the Thread may come from a pool.
m_transformer.runTransformThread( cpriority );
}
// This is now done _last_, because IncrementalSAXSource_Filter
// will immediately go into a "wait until events are requested"
// pause. I believe that will close our timing window.
// %REVIEW%
m_contentHandler.startDocument();
}
//listener.setDaemon(false);
//listener.start();
} | [
"public",
"void",
"startDocument",
"(",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"TransformerHandlerImpl#startDocument\"",
")",
";",
"m_insideParse",
"=",
"true",
";",
"// Thread listener = new Thread(... | Filter a start document event.
@throws SAXException The client may throw
an exception during processing.
@see org.xml.sax.ContentHandler#startDocument | [
"Filter",
"a",
"start",
"document",
"event",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java#L345-L379 |
35,206 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java | TransformerHandlerImpl.endDocument | 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();
}
/* Thread transformThread = m_transformer.getTransformThread();
if (null != transformThread)
{
try
{
// This should wait until the transformThread is considered not alive.
transformThread.join();
if (!m_transformer.hasTransformThreadErrorCatcher())
{
Exception e = m_transformer.getExceptionThrown();
if (null != e)
throw new org.xml.sax.SAXException(e);
}
m_transformer.setTransformThread(null);
}
catch (InterruptedException ie){}
}*/
} | java | 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();
}
/* Thread transformThread = m_transformer.getTransformThread();
if (null != transformThread)
{
try
{
// This should wait until the transformThread is considered not alive.
transformThread.join();
if (!m_transformer.hasTransformThreadErrorCatcher())
{
Exception e = m_transformer.getExceptionThrown();
if (null != e)
throw new org.xml.sax.SAXException(e);
}
m_transformer.setTransformThread(null);
}
catch (InterruptedException ie){}
}*/
} | [
"public",
"void",
"endDocument",
"(",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"TransformerHandlerImpl#endDocument\"",
")",
";",
"m_insideParse",
"=",
"false",
";",
"if",
"(",
"m_contentHandler",
... | Filter an end document event.
@throws SAXException The client may throw
an exception during processing.
@see org.xml.sax.ContentHandler#endDocument | [
"Filter",
"an",
"end",
"document",
"event",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java#L388-L432 |
35,207 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java | TransformerHandlerImpl.startPrefixMapping | 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);
}
} | java | 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);
}
} | [
"public",
"void",
"startPrefixMapping",
"(",
"String",
"prefix",
",",
"String",
"uri",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"TransformerHandlerImpl#startPrefixMapping: \"",
"+",
"prefix",
"+",
... | Filter a start Namespace prefix mapping event.
@param prefix The Namespace prefix.
@param uri The Namespace URI.
@throws SAXException The client may throw
an exception during processing.
@see org.xml.sax.ContentHandler#startPrefixMapping | [
"Filter",
"a",
"start",
"Namespace",
"prefix",
"mapping",
"event",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java#L443-L455 |
35,208 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java | TransformerHandlerImpl.endPrefixMapping | public void endPrefixMapping(String prefix) throws SAXException
{
if (DEBUG)
System.out.println("TransformerHandlerImpl#endPrefixMapping: "
+ prefix);
if (m_contentHandler != null)
{
m_contentHandler.endPrefixMapping(prefix);
}
} | java | public void endPrefixMapping(String prefix) throws SAXException
{
if (DEBUG)
System.out.println("TransformerHandlerImpl#endPrefixMapping: "
+ prefix);
if (m_contentHandler != null)
{
m_contentHandler.endPrefixMapping(prefix);
}
} | [
"public",
"void",
"endPrefixMapping",
"(",
"String",
"prefix",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"TransformerHandlerImpl#endPrefixMapping: \"",
"+",
"prefix",
")",
";",
"if",
"(",
"m_content... | Filter an end Namespace prefix mapping event.
@param prefix The Namespace prefix.
@throws SAXException The client may throw
an exception during processing.
@see org.xml.sax.ContentHandler#endPrefixMapping | [
"Filter",
"an",
"end",
"Namespace",
"prefix",
"mapping",
"event",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java#L465-L476 |
35,209 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java | TransformerHandlerImpl.skippedEntity | public void skippedEntity(String name) throws SAXException
{
if (DEBUG)
System.out.println("TransformerHandlerImpl#skippedEntity: " + name);
if (m_contentHandler != null)
{
m_contentHandler.skippedEntity(name);
}
} | java | public void skippedEntity(String name) throws SAXException
{
if (DEBUG)
System.out.println("TransformerHandlerImpl#skippedEntity: " + name);
if (m_contentHandler != null)
{
m_contentHandler.skippedEntity(name);
}
} | [
"public",
"void",
"skippedEntity",
"(",
"String",
"name",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"TransformerHandlerImpl#skippedEntity: \"",
"+",
"name",
")",
";",
"if",
"(",
"m_contentHandler",
... | Filter a skipped entity event.
@param name The name of the skipped entity.
@throws SAXException The client may throw
an exception during processing.
@see org.xml.sax.ContentHandler#skippedEntity | [
"Filter",
"a",
"skipped",
"entity",
"event",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java#L606-L616 |
35,210 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java | TransformerHandlerImpl.warning | public void warning(SAXParseException e) throws SAXException
{
// This is not great, but we really would rather have the error
// handler be the error listener if it is a error handler. Coroutine's fatalError
// can't really be configured, so I think this is the best thing right now
// for error reporting. Possibly another JAXP 1.1 hole. -sb
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;
}
}
} | java | public void warning(SAXParseException e) throws SAXException
{
// This is not great, but we really would rather have the error
// handler be the error listener if it is a error handler. Coroutine's fatalError
// can't really be configured, so I think this is the best thing right now
// for error reporting. Possibly another JAXP 1.1 hole. -sb
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;
}
}
} | [
"public",
"void",
"warning",
"(",
"SAXParseException",
"e",
")",
"throws",
"SAXException",
"{",
"// This is not great, but we really would rather have the error ",
"// handler be the error listener if it is a error handler. Coroutine's fatalError ",
"// can't really be configured, so I thin... | Filter a warning event.
@param e The nwarning as an exception.
@throws SAXException The client may throw
an exception during processing.
@see org.xml.sax.ErrorHandler#warning | [
"Filter",
"a",
"warning",
"event",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java#L630-L652 |
35,211 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java | TransformerHandlerImpl.error | public void error(SAXParseException e) throws SAXException
{
// %REVIEW% I don't think this should be called. -sb
// clearCoRoutine(e);
// This is not great, but we really would rather have the error
// handler be the error listener if it is a error handler. Coroutine's fatalError
// can't really be configured, so I think this is the best thing right now
// for error reporting. Possibly another JAXP 1.1 hole. -sb
javax.xml.transform.ErrorListener errorListener = m_transformer.getErrorListener();
if(errorListener instanceof ErrorHandler)
{
((ErrorHandler)errorListener).error(e);
if(null != m_errorHandler)
m_errorHandler.error(e); // may not be called.
}
else
{
try
{
errorListener.error(new javax.xml.transform.TransformerException(e));
if(null != m_errorHandler)
m_errorHandler.error(e); // may not be called.
}
catch(javax.xml.transform.TransformerException te)
{
throw e;
}
}
} | java | public void error(SAXParseException e) throws SAXException
{
// %REVIEW% I don't think this should be called. -sb
// clearCoRoutine(e);
// This is not great, but we really would rather have the error
// handler be the error listener if it is a error handler. Coroutine's fatalError
// can't really be configured, so I think this is the best thing right now
// for error reporting. Possibly another JAXP 1.1 hole. -sb
javax.xml.transform.ErrorListener errorListener = m_transformer.getErrorListener();
if(errorListener instanceof ErrorHandler)
{
((ErrorHandler)errorListener).error(e);
if(null != m_errorHandler)
m_errorHandler.error(e); // may not be called.
}
else
{
try
{
errorListener.error(new javax.xml.transform.TransformerException(e));
if(null != m_errorHandler)
m_errorHandler.error(e); // may not be called.
}
catch(javax.xml.transform.TransformerException te)
{
throw e;
}
}
} | [
"public",
"void",
"error",
"(",
"SAXParseException",
"e",
")",
"throws",
"SAXException",
"{",
"// %REVIEW% I don't think this should be called. -sb",
"// clearCoRoutine(e);",
"// This is not great, but we really would rather have the error ",
"// handler be the error listener if it is a e... | Filter an error event.
@param e The error as an exception.
@throws SAXException The client may throw
an exception during processing.
@see org.xml.sax.ErrorHandler#error | [
"Filter",
"an",
"error",
"event",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java#L662-L691 |
35,212 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java | TransformerHandlerImpl.fatalError | public void fatalError(SAXParseException e) throws SAXException
{
if(null != m_errorHandler)
{
try
{
m_errorHandler.fatalError(e);
}
catch(SAXParseException se)
{
// ignore
}
// clearCoRoutine(e);
}
// This is not great, but we really would rather have the error
// handler be the error listener if it is a error handler. Coroutine's fatalError
// can't really be configured, so I think this is the best thing right now
// for error reporting. Possibly another JAXP 1.1 hole. -sb
javax.xml.transform.ErrorListener errorListener = m_transformer.getErrorListener();
if(errorListener instanceof ErrorHandler)
{
((ErrorHandler)errorListener).fatalError(e);
if(null != m_errorHandler)
m_errorHandler.fatalError(e); // may not be called.
}
else
{
try
{
errorListener.fatalError(new javax.xml.transform.TransformerException(e));
if(null != m_errorHandler)
m_errorHandler.fatalError(e); // may not be called.
}
catch(javax.xml.transform.TransformerException te)
{
throw e;
}
}
} | java | public void fatalError(SAXParseException e) throws SAXException
{
if(null != m_errorHandler)
{
try
{
m_errorHandler.fatalError(e);
}
catch(SAXParseException se)
{
// ignore
}
// clearCoRoutine(e);
}
// This is not great, but we really would rather have the error
// handler be the error listener if it is a error handler. Coroutine's fatalError
// can't really be configured, so I think this is the best thing right now
// for error reporting. Possibly another JAXP 1.1 hole. -sb
javax.xml.transform.ErrorListener errorListener = m_transformer.getErrorListener();
if(errorListener instanceof ErrorHandler)
{
((ErrorHandler)errorListener).fatalError(e);
if(null != m_errorHandler)
m_errorHandler.fatalError(e); // may not be called.
}
else
{
try
{
errorListener.fatalError(new javax.xml.transform.TransformerException(e));
if(null != m_errorHandler)
m_errorHandler.fatalError(e); // may not be called.
}
catch(javax.xml.transform.TransformerException te)
{
throw e;
}
}
} | [
"public",
"void",
"fatalError",
"(",
"SAXParseException",
"e",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"null",
"!=",
"m_errorHandler",
")",
"{",
"try",
"{",
"m_errorHandler",
".",
"fatalError",
"(",
"e",
")",
";",
"}",
"catch",
"(",
"SAXParseException... | Filter a fatal error event.
@param e The error as an exception.
@throws SAXException The client may throw
an exception during processing.
@see org.xml.sax.ErrorHandler#fatalError | [
"Filter",
"a",
"fatal",
"error",
"event",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java#L701-L741 |
35,213 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java | TransformerHandlerImpl.startEntity | public void startEntity(String name) throws SAXException
{
if (DEBUG)
System.out.println("TransformerHandlerImpl#startEntity: " + name);
if (null != m_lexicalHandler)
{
m_lexicalHandler.startEntity(name);
}
} | java | public void startEntity(String name) throws SAXException
{
if (DEBUG)
System.out.println("TransformerHandlerImpl#startEntity: " + name);
if (null != m_lexicalHandler)
{
m_lexicalHandler.startEntity(name);
}
} | [
"public",
"void",
"startEntity",
"(",
"String",
"name",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"TransformerHandlerImpl#startEntity: \"",
"+",
"name",
")",
";",
"if",
"(",
"null",
"!=",
"m_lex... | Report the beginning of an entity in content.
<p><strong>NOTE:</entity> entity references in attribute
values -- and the start and end of the document entity --
are never reported.</p>
<p>The start and end of the external DTD subset are reported
using the pseudo-name "[dtd]". All other events must be
properly nested within start/end entity events.</p>
<p>Note that skipped entities will be reported through the
{@link org.xml.sax.ContentHandler#skippedEntity skippedEntity}
event, which is part of the ContentHandler interface.</p>
@param name The name of the entity. If it is a parameter
entity, the name will begin with '%'.
@throws SAXException The application may raise an exception.
@see #endEntity
@see org.xml.sax.ext.DeclHandler#internalEntityDecl
@see org.xml.sax.ext.DeclHandler#externalEntityDecl | [
"Report",
"the",
"beginning",
"of",
"an",
"entity",
"in",
"content",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java#L822-L832 |
35,214 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java | TransformerHandlerImpl.endCDATA | public void endCDATA() throws SAXException
{
if (DEBUG)
System.out.println("TransformerHandlerImpl#endCDATA");
if (null != m_lexicalHandler)
{
m_lexicalHandler.endCDATA();
}
} | java | public void endCDATA() throws SAXException
{
if (DEBUG)
System.out.println("TransformerHandlerImpl#endCDATA");
if (null != m_lexicalHandler)
{
m_lexicalHandler.endCDATA();
}
} | [
"public",
"void",
"endCDATA",
"(",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"TransformerHandlerImpl#endCDATA\"",
")",
";",
"if",
"(",
"null",
"!=",
"m_lexicalHandler",
")",
"{",
"m_lexicalHandler... | Report the end of a CDATA section.
@throws SAXException The application may raise an exception.
@see #startCDATA | [
"Report",
"the",
"end",
"of",
"a",
"CDATA",
"section",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java#L881-L891 |
35,215 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/CalendarAstronomer.java | CalendarAstronomer.getGreenwichSidereal | public double getGreenwichSidereal() {
if (siderealTime == INVALID) {
// See page 86 of "Practial Astronomy with your Calculator",
// by Peter Duffet-Smith, for details on the algorithm.
double UT = normalize((double)time/HOUR_MS, 24);
siderealTime = normalize(getSiderealOffset() + UT*1.002737909, 24);
}
return siderealTime;
} | java | public double getGreenwichSidereal() {
if (siderealTime == INVALID) {
// See page 86 of "Practial Astronomy with your Calculator",
// by Peter Duffet-Smith, for details on the algorithm.
double UT = normalize((double)time/HOUR_MS, 24);
siderealTime = normalize(getSiderealOffset() + UT*1.002737909, 24);
}
return siderealTime;
} | [
"public",
"double",
"getGreenwichSidereal",
"(",
")",
"{",
"if",
"(",
"siderealTime",
"==",
"INVALID",
")",
"{",
"// See page 86 of \"Practial Astronomy with your Calculator\",",
"// by Peter Duffet-Smith, for details on the algorithm.",
"double",
"UT",
"=",
"normalize",
"(",
... | Returns the current Greenwich sidereal time, measured in hours
@hide draft / provisional / internal are hidden on Android | [
"Returns",
"the",
"current",
"Greenwich",
"sidereal",
"time",
"measured",
"in",
"hours"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/CalendarAstronomer.java#L364-L374 |
35,216 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/CalendarAstronomer.java | CalendarAstronomer.lstToUT | private long lstToUT(double lst) {
// Convert to local mean time
double lt = normalize((lst - getSiderealOffset()) * 0.9972695663, 24);
// Then find local midnight on this day
long base = DAY_MS * ((time + fGmtOffset)/DAY_MS) - fGmtOffset;
//out(" lt =" + lt + " hours");
//out(" base=" + new Date(base));
return base + (long)(lt * HOUR_MS);
} | java | private long lstToUT(double lst) {
// Convert to local mean time
double lt = normalize((lst - getSiderealOffset()) * 0.9972695663, 24);
// Then find local midnight on this day
long base = DAY_MS * ((time + fGmtOffset)/DAY_MS) - fGmtOffset;
//out(" lt =" + lt + " hours");
//out(" base=" + new Date(base));
return base + (long)(lt * HOUR_MS);
} | [
"private",
"long",
"lstToUT",
"(",
"double",
"lst",
")",
"{",
"// Convert to local mean time",
"double",
"lt",
"=",
"normalize",
"(",
"(",
"lst",
"-",
"getSiderealOffset",
"(",
")",
")",
"*",
"0.9972695663",
",",
"24",
")",
";",
"// Then find local midnight on t... | Converts local sidereal time to Universal Time.
@param lst The Local Sidereal Time, in hours since sidereal midnight
on this object's current date.
@return The corresponding Universal Time, in milliseconds since
1 Jan 1970, GMT. | [
"Converts",
"local",
"sidereal",
"time",
"to",
"Universal",
"Time",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/CalendarAstronomer.java#L403-L414 |
35,217 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/CalendarAstronomer.java | CalendarAstronomer.eclipticToEquatorial | public final Equatorial eclipticToEquatorial(double eclipLong, double eclipLat)
{
// See page 42 of "Practial Astronomy with your Calculator",
// by Peter Duffet-Smith, for details on the algorithm.
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) );
} | java | public final Equatorial eclipticToEquatorial(double eclipLong, double eclipLat)
{
// See page 42 of "Practial Astronomy with your Calculator",
// by Peter Duffet-Smith, for details on the algorithm.
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) );
} | [
"public",
"final",
"Equatorial",
"eclipticToEquatorial",
"(",
"double",
"eclipLong",
",",
"double",
"eclipLat",
")",
"{",
"// See page 42 of \"Practial Astronomy with your Calculator\",",
"// by Peter Duffet-Smith, for details on the algorithm.",
"double",
"obliq",
"=",
"eclipticOb... | Convert from ecliptic to equatorial coordinates.
@param eclipLong The ecliptic longitude
@param eclipLat The ecliptic latitude
@return The corresponding point in equatorial coordinates.
@hide draft / provisional / internal are hidden on Android | [
"Convert",
"from",
"ecliptic",
"to",
"equatorial",
"coordinates",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/CalendarAstronomer.java#L442-L460 |
35,218 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/CalendarAstronomer.java | CalendarAstronomer.getSunTime | public long getSunTime(double desired, boolean next)
{
return timeOfAngle( new AngleFunc() { @Override
public double eval() { return getSunLongitude(); } },
desired,
TROPICAL_YEAR,
MINUTE_MS,
next);
} | java | public long getSunTime(double desired, boolean next)
{
return timeOfAngle( new AngleFunc() { @Override
public double eval() { return getSunLongitude(); } },
desired,
TROPICAL_YEAR,
MINUTE_MS,
next);
} | [
"public",
"long",
"getSunTime",
"(",
"double",
"desired",
",",
"boolean",
"next",
")",
"{",
"return",
"timeOfAngle",
"(",
"new",
"AngleFunc",
"(",
")",
"{",
"@",
"Override",
"public",
"double",
"eval",
"(",
")",
"{",
"return",
"getSunLongitude",
"(",
")",
... | Find the next time at which the sun's ecliptic longitude will have
the desired value.
@hide draft / provisional / internal are hidden on Android | [
"Find",
"the",
"next",
"time",
"at",
"which",
"the",
"sun",
"s",
"ecliptic",
"longitude",
"will",
"have",
"the",
"desired",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/CalendarAstronomer.java#L662-L670 |
35,219 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/CalendarAstronomer.java | CalendarAstronomer.getMoonPosition | public Equatorial getMoonPosition()
{
//
// See page 142 of "Practial Astronomy with your Calculator",
// by Peter Duffet-Smith, for details on the algorithm.
//
if (moonPosition == null) {
// Calculate the solar longitude. Has the side effect of
// filling in "meanAnomalySun" as well.
double sunLong = getSunLongitude();
//
// Find the # of days since the epoch of our orbital parameters.
// TODO: Convert the time of day portion into ephemeris time
//
double day = getJulianDay() - JD_EPOCH; // Days since epoch
// Calculate the mean longitude and anomaly of the moon, based on
// a circular orbit. Similar to the corresponding solar calculation.
double meanLongitude = norm2PI(13.1763966*PI/180*day + moonL0);
double meanAnomalyMoon = norm2PI(meanLongitude - 0.1114041*PI/180 * day - moonP0);
//
// Calculate the following corrections:
// Evection: the sun's gravity affects the moon's eccentricity
// Annual Eqn: variation in the effect due to earth-sun distance
// A3: correction factor (for ???)
//
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;
//
// More correction factors:
// center equation of the center correction
// a4 yet another error correction (???)
//
// TODO: Skip the equation of the center correction and solve Kepler's eqn?
//
double center = 6.2886*PI/180 * Math.sin(meanAnomalyMoon);
double a4 = 0.2140*PI/180 * Math.sin(2 * meanAnomalyMoon);
// Now find the moon's corrected longitude
moonLongitude = meanLongitude + evection + center - annual + a4;
//
// And finally, find the variation, caused by the fact that the sun's
// gravitational pull on the moon varies depending on which side of
// the earth the moon is on
//
double variation = 0.6583*PI/180 * Math.sin(2*(moonLongitude - sunLong));
moonLongitude += variation;
//
// What we've calculated so far is the moon's longitude in the plane
// of its own orbit. Now map to the ecliptic to get the latitude
// and longitude. First we need to find the longitude of the ascending
// node, the position on the ecliptic where it is crossed by the moon's
// orbit as it crosses from the southern to the northern hemisphere.
//
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;
} | java | public Equatorial getMoonPosition()
{
//
// See page 142 of "Practial Astronomy with your Calculator",
// by Peter Duffet-Smith, for details on the algorithm.
//
if (moonPosition == null) {
// Calculate the solar longitude. Has the side effect of
// filling in "meanAnomalySun" as well.
double sunLong = getSunLongitude();
//
// Find the # of days since the epoch of our orbital parameters.
// TODO: Convert the time of day portion into ephemeris time
//
double day = getJulianDay() - JD_EPOCH; // Days since epoch
// Calculate the mean longitude and anomaly of the moon, based on
// a circular orbit. Similar to the corresponding solar calculation.
double meanLongitude = norm2PI(13.1763966*PI/180*day + moonL0);
double meanAnomalyMoon = norm2PI(meanLongitude - 0.1114041*PI/180 * day - moonP0);
//
// Calculate the following corrections:
// Evection: the sun's gravity affects the moon's eccentricity
// Annual Eqn: variation in the effect due to earth-sun distance
// A3: correction factor (for ???)
//
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;
//
// More correction factors:
// center equation of the center correction
// a4 yet another error correction (???)
//
// TODO: Skip the equation of the center correction and solve Kepler's eqn?
//
double center = 6.2886*PI/180 * Math.sin(meanAnomalyMoon);
double a4 = 0.2140*PI/180 * Math.sin(2 * meanAnomalyMoon);
// Now find the moon's corrected longitude
moonLongitude = meanLongitude + evection + center - annual + a4;
//
// And finally, find the variation, caused by the fact that the sun's
// gravitational pull on the moon varies depending on which side of
// the earth the moon is on
//
double variation = 0.6583*PI/180 * Math.sin(2*(moonLongitude - sunLong));
moonLongitude += variation;
//
// What we've calculated so far is the moon's longitude in the plane
// of its own orbit. Now map to the ecliptic to get the latitude
// and longitude. First we need to find the longitude of the ascending
// node, the position on the ecliptic where it is crossed by the moon's
// orbit as it crosses from the southern to the northern hemisphere.
//
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;
} | [
"public",
"Equatorial",
"getMoonPosition",
"(",
")",
"{",
"//",
"// See page 142 of \"Practial Astronomy with your Calculator\",",
"// by Peter Duffet-Smith, for details on the algorithm.",
"//",
"if",
"(",
"moonPosition",
"==",
"null",
")",
"{",
"// Calculate the solar longitude. ... | The position of the moon at the time set on this
object, in equatorial coordinates.
@hide draft / provisional / internal are hidden on Android | [
"The",
"position",
"of",
"the",
"moon",
"at",
"the",
"time",
"set",
"on",
"this",
"object",
"in",
"equatorial",
"coordinates",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/CalendarAstronomer.java#L1007-L1084 |
35,220 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/X509CRL.java | X509CRL.verify | public void verify(PublicKey key, Provider sigProvider)
throws CRLException, NoSuchAlgorithmException,
InvalidKeyException, SignatureException {
// BEGIN Android-changed
// TODO(user): was X509CRLImpl.verify(this, key, sigProvider);
// As the javadoc says, this "default implementation" was introduced as to avoid breaking
// providers that generate concrete subclasses of this class.
// The method X509Impl in the original definition calls this method, thus entering an
// infinite loop. This strange behaviour was checked to be not specific to libcore by
// running a test with vogar --mode=jvm .
throw new UnsupportedOperationException(
"X509CRL instance doesn't not support X509CRL#verify(PublicKey, Provider)");
// END Android-changed
} | java | public void verify(PublicKey key, Provider sigProvider)
throws CRLException, NoSuchAlgorithmException,
InvalidKeyException, SignatureException {
// BEGIN Android-changed
// TODO(user): was X509CRLImpl.verify(this, key, sigProvider);
// As the javadoc says, this "default implementation" was introduced as to avoid breaking
// providers that generate concrete subclasses of this class.
// The method X509Impl in the original definition calls this method, thus entering an
// infinite loop. This strange behaviour was checked to be not specific to libcore by
// running a test with vogar --mode=jvm .
throw new UnsupportedOperationException(
"X509CRL instance doesn't not support X509CRL#verify(PublicKey, Provider)");
// END Android-changed
} | [
"public",
"void",
"verify",
"(",
"PublicKey",
"key",
",",
"Provider",
"sigProvider",
")",
"throws",
"CRLException",
",",
"NoSuchAlgorithmException",
",",
"InvalidKeyException",
",",
"SignatureException",
"{",
"// BEGIN Android-changed",
"// TODO(user): was X509CRLImpl.verify(... | 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.
This method was added to version 1.8 of the Java Platform Standard
Edition. In order to maintain backwards compatibility with existing
service providers, this method is not {@code abstract}
and it provides a default implementation.
@param key the PublicKey used to carry out the verification.
@param sigProvider the signature provider.
@exception NoSuchAlgorithmException on unsupported signature
algorithms.
@exception InvalidKeyException on incorrect key.
@exception SignatureException on signature errors.
@exception CRLException on encoding errors.
@since 1.8 | [
"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",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/X509CRL.java#L241-L254 |
35,221 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/X509CRL.java | X509CRL.getRevokedCertificate | public X509CRLEntry getRevokedCertificate(X509Certificate certificate) {
X500Principal certIssuer = certificate.getIssuerX500Principal();
X500Principal crlIssuer = getIssuerX500Principal();
if (certIssuer.equals(crlIssuer) == false) {
return null;
}
return getRevokedCertificate(certificate.getSerialNumber());
} | java | public X509CRLEntry getRevokedCertificate(X509Certificate certificate) {
X500Principal certIssuer = certificate.getIssuerX500Principal();
X500Principal crlIssuer = getIssuerX500Principal();
if (certIssuer.equals(crlIssuer) == false) {
return null;
}
return getRevokedCertificate(certificate.getSerialNumber());
} | [
"public",
"X509CRLEntry",
"getRevokedCertificate",
"(",
"X509Certificate",
"certificate",
")",
"{",
"X500Principal",
"certIssuer",
"=",
"certificate",
".",
"getIssuerX500Principal",
"(",
")",
";",
"X500Principal",
"crlIssuer",
"=",
"getIssuerX500Principal",
"(",
")",
";... | Get the CRL entry, if any, for the given certificate.
<p>This method can be used to lookup CRL entries in indirect CRLs,
that means CRLs that contain entries from issuers other than the CRL
issuer. The default implementation will only return entries for
certificates issued by the CRL issuer. Subclasses that wish to
support indirect CRLs should override this method.
@param certificate the certificate for which a CRL entry is to be looked
up
@return the entry for the given certificate, or null if no such entry
exists in this CRL.
@exception NullPointerException if certificate is null
@since 1.5 | [
"Get",
"the",
"CRL",
"entry",
"if",
"any",
"for",
"the",
"given",
"certificate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/X509CRL.java#L381-L388 |
35,222 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UnicodeSetStringSpan.java | UnicodeSetStringSpan.addToSpanNotSet | private void addToSpanNotSet(int c) {
if (Utility.sameObjects(spanNotSet, null) || Utility.sameObjects(spanNotSet, spanSet)) {
if (spanSet.contains(c)) {
return; // Nothing to do.
}
spanNotSet = spanSet.cloneAsThawed();
}
spanNotSet.add(c);
} | java | private void addToSpanNotSet(int c) {
if (Utility.sameObjects(spanNotSet, null) || Utility.sameObjects(spanNotSet, spanSet)) {
if (spanSet.contains(c)) {
return; // Nothing to do.
}
spanNotSet = spanSet.cloneAsThawed();
}
spanNotSet.add(c);
} | [
"private",
"void",
"addToSpanNotSet",
"(",
"int",
"c",
")",
"{",
"if",
"(",
"Utility",
".",
"sameObjects",
"(",
"spanNotSet",
",",
"null",
")",
"||",
"Utility",
".",
"sameObjects",
"(",
"spanNotSet",
",",
"spanSet",
")",
")",
"{",
"if",
"(",
"spanSet",
... | Adds a starting or ending string character to the spanNotSet
so that a character span ends before any string. | [
"Adds",
"a",
"starting",
"or",
"ending",
"string",
"character",
"to",
"the",
"spanNotSet",
"so",
"that",
"a",
"character",
"span",
"ends",
"before",
"any",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UnicodeSetStringSpan.java#L250-L258 |
35,223 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UnicodeSetStringSpan.java | UnicodeSetStringSpan.span | 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);
} | java | 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);
} | [
"public",
"int",
"span",
"(",
"CharSequence",
"s",
",",
"int",
"start",
",",
"SpanCondition",
"spanCondition",
")",
"{",
"if",
"(",
"spanCondition",
"==",
"SpanCondition",
".",
"NOT_CONTAINED",
")",
"{",
"return",
"spanNot",
"(",
"s",
",",
"start",
",",
"n... | Spans a string.
@param s The string to be spanned
@param start The start index that the span begins
@param spanCondition The span condition
@return the limit (exclusive end) of the span | [
"Spans",
"a",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UnicodeSetStringSpan.java#L371-L380 |
35,224 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UnicodeSetStringSpan.java | UnicodeSetStringSpan.spanAndCount | public int spanAndCount(CharSequence s, int start, SpanCondition spanCondition,
OutputInt outCount) {
if (spanCondition == SpanCondition.NOT_CONTAINED) {
return spanNot(s, start, outCount);
}
// Consider strings; they may overlap with the span,
// and they may result in a smaller count that with just code points.
if (spanCondition == SpanCondition.CONTAINED) {
return spanContainedAndCount(s, start, outCount);
}
// SIMPLE (not synchronized, does not use offsets)
int stringsLength = strings.size();
int length = s.length();
int pos = start;
int rest = length - start;
int count = 0;
while (rest != 0) {
// Try to match the next code point.
int cpLength = spanOne(spanSet, s, pos, rest);
int maxInc = (cpLength > 0) ? cpLength : 0;
// Try to match all of the strings.
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;
}
}
// We are done if there is no match beyond pos.
if (maxInc == 0) {
outCount.value = count;
return pos;
}
// Continue from the longest match.
++count;
pos += maxInc;
rest -= maxInc;
}
outCount.value = count;
return pos;
} | java | public int spanAndCount(CharSequence s, int start, SpanCondition spanCondition,
OutputInt outCount) {
if (spanCondition == SpanCondition.NOT_CONTAINED) {
return spanNot(s, start, outCount);
}
// Consider strings; they may overlap with the span,
// and they may result in a smaller count that with just code points.
if (spanCondition == SpanCondition.CONTAINED) {
return spanContainedAndCount(s, start, outCount);
}
// SIMPLE (not synchronized, does not use offsets)
int stringsLength = strings.size();
int length = s.length();
int pos = start;
int rest = length - start;
int count = 0;
while (rest != 0) {
// Try to match the next code point.
int cpLength = spanOne(spanSet, s, pos, rest);
int maxInc = (cpLength > 0) ? cpLength : 0;
// Try to match all of the strings.
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;
}
}
// We are done if there is no match beyond pos.
if (maxInc == 0) {
outCount.value = count;
return pos;
}
// Continue from the longest match.
++count;
pos += maxInc;
rest -= maxInc;
}
outCount.value = count;
return pos;
} | [
"public",
"int",
"spanAndCount",
"(",
"CharSequence",
"s",
",",
"int",
"start",
",",
"SpanCondition",
"spanCondition",
",",
"OutputInt",
"outCount",
")",
"{",
"if",
"(",
"spanCondition",
"==",
"SpanCondition",
".",
"NOT_CONTAINED",
")",
"{",
"return",
"spanNot",... | Spans a string and counts the smallest number of set elements on any path across the span.
<p>For proper counting, we cannot ignore strings that are fully contained in code point spans.
<p>If the set does not have any fully-contained strings, then we could optimize this
like span(), but such sets are likely rare, and this is at least still linear.
@param s The string to be spanned
@param start The start index that the span begins
@param spanCondition The span condition
@param outCount The count
@return the limit (exclusive end) of the span | [
"Spans",
"a",
"string",
"and",
"counts",
"the",
"smallest",
"number",
"of",
"set",
"elements",
"on",
"any",
"path",
"across",
"the",
"span",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UnicodeSetStringSpan.java#L559-L600 |
35,225 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UnicodeSetStringSpan.java | UnicodeSetStringSpan.matches16 | 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;
} | java | 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;
} | [
"private",
"static",
"boolean",
"matches16",
"(",
"CharSequence",
"s",
",",
"int",
"start",
",",
"final",
"String",
"t",
",",
"int",
"length",
")",
"{",
"int",
"end",
"=",
"start",
"+",
"length",
";",
"while",
"(",
"length",
"--",
">",
"0",
")",
"{",... | Compare strings without any argument checks. Requires length>0. | [
"Compare",
"strings",
"without",
"any",
"argument",
"checks",
".",
"Requires",
"length",
">",
"0",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UnicodeSetStringSpan.java#L944-L952 |
35,226 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UnicodeSetStringSpan.java | UnicodeSetStringSpan.spanOne | 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;
} | java | 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;
} | [
"static",
"int",
"spanOne",
"(",
"final",
"UnicodeSet",
"set",
",",
"CharSequence",
"s",
",",
"int",
"start",
",",
"int",
"length",
")",
"{",
"char",
"c",
"=",
"s",
".",
"charAt",
"(",
"start",
")",
";",
"if",
"(",
"c",
">=",
"0xd800",
"&&",
"c",
... | Does the set contain the next code point?
If so, return its length; otherwise return its negative length. | [
"Does",
"the",
"set",
"contain",
"the",
"next",
"code",
"point?",
"If",
"so",
"return",
"its",
"length",
";",
"otherwise",
"return",
"its",
"negative",
"length",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UnicodeSetStringSpan.java#L976-L986 |
35,227 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/DOMBuilder.java | DOMBuilder.isOutsideDocElem | private boolean isOutsideDocElem()
{
return (null == m_docFrag) && m_elemStack.size() == 0 && (null == m_currentNode || m_currentNode.getNodeType() == Node.DOCUMENT_NODE);
} | java | private boolean isOutsideDocElem()
{
return (null == m_docFrag) && m_elemStack.size() == 0 && (null == m_currentNode || m_currentNode.getNodeType() == Node.DOCUMENT_NODE);
} | [
"private",
"boolean",
"isOutsideDocElem",
"(",
")",
"{",
"return",
"(",
"null",
"==",
"m_docFrag",
")",
"&&",
"m_elemStack",
".",
"size",
"(",
")",
"==",
"0",
"&&",
"(",
"null",
"==",
"m_currentNode",
"||",
"m_currentNode",
".",
"getNodeType",
"(",
")",
... | Tell if the current node is outside the document element.
@return true if the current node is outside the document element. | [
"Tell",
"if",
"the",
"current",
"node",
"is",
"outside",
"the",
"document",
"element",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/DOMBuilder.java#L594-L597 |
35,228 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/DOMBuilder.java | DOMBuilder.startPrefixMapping | 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);
} | java | 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);
} | [
"public",
"void",
"startPrefixMapping",
"(",
"String",
"prefix",
",",
"String",
"uri",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"if",
"(",
"null",
"==",
"prefix",
"||",
"prefix",
".",
"equals",
"(",
"\"\"",
")",
")",
"pre... | Begin the scope of a prefix-URI Namespace mapping.
<p>The information from this event is not necessary for
normal Namespace processing: the SAX XML reader will
automatically replace prefixes for element and attribute
names when the http://xml.org/sax/features/namespaces
feature is true (the default).</p>
<p>There are cases, however, when applications need to
use prefixes in character data or in attribute values,
where they cannot safely be expanded automatically; the
start/endPrefixMapping event supplies the information
to the application to expand prefixes in those contexts
itself, if necessary.</p>
<p>Note that start/endPrefixMapping events are not
guaranteed to be properly nested relative to each-other:
all startPrefixMapping events will occur before the
corresponding startElement event, and all endPrefixMapping
events will occur after the corresponding endElement event,
but their order is not guaranteed.</p>
@param prefix The Namespace prefix being declared.
@param uri The Namespace URI the prefix is mapped to.
@see #endPrefixMapping
@see #startElement | [
"Begin",
"the",
"scope",
"of",
"a",
"prefix",
"-",
"URI",
"Namespace",
"mapping",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/DOMBuilder.java#L755-L763 |
35,229 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTElementDef.java | XSLTElementDef.build | 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());
}
}
}
} | java | 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());
}
}
}
} | [
"void",
"build",
"(",
"String",
"namespace",
",",
"String",
"name",
",",
"String",
"nameAlias",
",",
"XSLTElementDef",
"[",
"]",
"elements",
",",
"XSLTAttributeDef",
"[",
"]",
"attributes",
",",
"XSLTElementProcessor",
"contentHandler",
",",
"Class",
"classObject"... | Construct an instance of XSLTElementDef.
@param namespace The Namespace URI, "*", or null.
@param name The local name (without prefix), "*", or null.
@param nameAlias A potential alias for the name, or null.
@param elements An array of allowed child element defs, or null.
@param attributes An array of allowed attribute defs, or null.
@param contentHandler The element processor for this element.
@param classObject The class of the object that this element def should produce. | [
"Construct",
"an",
"instance",
"of",
"XSLTElementDef",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTElementDef.java#L263-L293 |
35,230 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTElementDef.java | XSLTElementDef.equalsMayBeNull | private static boolean equalsMayBeNull(Object obj1, Object obj2)
{
return (obj2 == obj1)
|| ((null != obj1) && (null != obj2) && obj2.equals(obj1));
} | java | private static boolean equalsMayBeNull(Object obj1, Object obj2)
{
return (obj2 == obj1)
|| ((null != obj1) && (null != obj2) && obj2.equals(obj1));
} | [
"private",
"static",
"boolean",
"equalsMayBeNull",
"(",
"Object",
"obj1",
",",
"Object",
"obj2",
")",
"{",
"return",
"(",
"obj2",
"==",
"obj1",
")",
"||",
"(",
"(",
"null",
"!=",
"obj1",
")",
"&&",
"(",
"null",
"!=",
"obj2",
")",
"&&",
"obj2",
".",
... | Tell if two objects are equal, when either one may be null.
If both are null, they are considered equal.
@param obj1 A reference to the first object, or null.
@param obj2 A reference to the second object, or null.
@return true if the to objects are equal by both being null or
because obj2.equals(obj1) returns true. | [
"Tell",
"if",
"two",
"objects",
"are",
"equal",
"when",
"either",
"one",
"may",
"be",
"null",
".",
"If",
"both",
"are",
"null",
"they",
"are",
"considered",
"equal",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTElementDef.java#L305-L309 |
35,231 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTElementDef.java | XSLTElementDef.getProcessorFor | XSLTElementProcessor getProcessorFor(String uri, String localName)
{
XSLTElementProcessor elemDef = null; // return value
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];
// A "*" signals that the element allows literal result
// elements, so just assign the def, and continue to
// see if anything else matches.
if (def.m_name.equals("*"))
{
// Don't allow xsl elements
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;
} | java | XSLTElementProcessor getProcessorFor(String uri, String localName)
{
XSLTElementProcessor elemDef = null; // return value
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];
// A "*" signals that the element allows literal result
// elements, so just assign the def, and continue to
// see if anything else matches.
if (def.m_name.equals("*"))
{
// Don't allow xsl elements
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;
} | [
"XSLTElementProcessor",
"getProcessorFor",
"(",
"String",
"uri",
",",
"String",
"localName",
")",
"{",
"XSLTElementProcessor",
"elemDef",
"=",
"null",
";",
"// return value",
"if",
"(",
"null",
"==",
"m_elements",
")",
"return",
"null",
";",
"int",
"n",
"=",
"... | Given a namespace URI, and a local name, get the processor
for the element, or return null if not allowed.
@param uri The Namespace URI, or an empty string.
@param localName The local name (without prefix), or empty string if not namespace processing.
@return The element processor that matches the arguments, or null. | [
"Given",
"a",
"namespace",
"URI",
"and",
"a",
"local",
"name",
"get",
"the",
"processor",
"for",
"the",
"element",
"or",
"return",
"null",
"if",
"not",
"allowed",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTElementDef.java#L462-L518 |
35,232 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTElementDef.java | XSLTElementDef.getProcessorForUnknown | XSLTElementProcessor getProcessorForUnknown(String uri, String localName)
{
// XSLTElementProcessor lreDef = null; // return value
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;
} | java | XSLTElementProcessor getProcessorForUnknown(String uri, String localName)
{
// XSLTElementProcessor lreDef = null; // return value
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;
} | [
"XSLTElementProcessor",
"getProcessorForUnknown",
"(",
"String",
"uri",
",",
"String",
"localName",
")",
"{",
"// XSLTElementProcessor lreDef = null; // return value",
"if",
"(",
"null",
"==",
"m_elements",
")",
"return",
"null",
";",
"int",
"n",
"=",
"m_elements",
".... | Given an unknown element, get the processor
for the element.
@param uri The Namespace URI, or an empty string.
@param localName The local name (without prefix), or empty string if not namespace processing.
@return normally a {@link ProcessorUnknown} reference.
@see ProcessorUnknown | [
"Given",
"an",
"unknown",
"element",
"get",
"the",
"processor",
"for",
"the",
"element",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTElementDef.java#L530-L550 |
35,233 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTElementDef.java | XSLTElementDef.getAttributeDef | 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))
{
// In this case, all attributes are legal, so return
// this as the last resort.
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;
} | java | 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))
{
// In this case, all attributes are legal, so return
// this as the last resort.
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;
} | [
"XSLTAttributeDef",
"getAttributeDef",
"(",
"String",
"uri",
",",
"String",
"localName",
")",
"{",
"XSLTAttributeDef",
"defaultDef",
"=",
"null",
";",
"XSLTAttributeDef",
"[",
"]",
"attrDefs",
"=",
"getAttributes",
"(",
")",
";",
"int",
"nAttrDefs",
"=",
"attrDe... | Given a namespace URI, and a local name, return the element's
attribute definition, if it has one.
@param uri The Namespace URI, or an empty string.
@param localName The local name (without prefix), or empty string if not namespace processing.
@return The attribute def that matches the arguments, or null. | [
"Given",
"a",
"namespace",
"URI",
"and",
"a",
"local",
"name",
"return",
"the",
"element",
"s",
"attribute",
"definition",
"if",
"it",
"has",
"one",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTElementDef.java#L576-L617 |
35,234 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTElementDef.java | XSLTElementDef.setRequiredFound | void setRequiredFound(String elem, boolean found)
{
if (m_requiredFound.get(elem) != null)
m_requiredFound.remove(elem);
} | java | void setRequiredFound(String elem, boolean found)
{
if (m_requiredFound.get(elem) != null)
m_requiredFound.remove(elem);
} | [
"void",
"setRequiredFound",
"(",
"String",
"elem",
",",
"boolean",
"found",
")",
"{",
"if",
"(",
"m_requiredFound",
".",
"get",
"(",
"elem",
")",
"!=",
"null",
")",
"m_requiredFound",
".",
"remove",
"(",
"elem",
")",
";",
"}"
] | Set this required element found. | [
"Set",
"this",
"required",
"element",
"found",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTElementDef.java#L705-L709 |
35,235 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTElementDef.java | XSLTElementDef.getRequiredElem | 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;
} | java | 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;
} | [
"String",
"getRequiredElem",
"(",
")",
"{",
"if",
"(",
"m_requiredFound",
"==",
"null",
")",
"return",
"null",
";",
"Enumeration",
"elems",
"=",
"m_requiredFound",
".",
"elements",
"(",
")",
";",
"String",
"s",
"=",
"\"\"",
";",
"boolean",
"first",
"=",
... | Get required elements that were not found.
@return required elements that were not found. | [
"Get",
"required",
"elements",
"that",
"were",
"not",
"found",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTElementDef.java#L728-L744 |
35,236 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/PackagePrefixes.java | PackagePrefixes.getPrefix | 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;
} | java | 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;
} | [
"public",
"String",
"getPrefix",
"(",
"PackageElement",
"packageElement",
")",
"{",
"if",
"(",
"packageElement",
"==",
"null",
")",
"{",
"return",
"\"\"",
";",
"}",
"String",
"packageName",
"=",
"packageElement",
".",
"getQualifiedName",
"(",
")",
".",
"toStri... | 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. | [
"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... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/PackagePrefixes.java#L113-L129 |
35,237 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/PackagePrefixes.java | PackagePrefixes.addPrefixesFile | public void addPrefixesFile(String filename) throws IOException {
try (Reader r = Files.newBufferedReader(Paths.get(filename), StandardCharsets.UTF_8)) {
addPrefixProperties(r);
}
} | java | public void addPrefixesFile(String filename) throws IOException {
try (Reader r = Files.newBufferedReader(Paths.get(filename), StandardCharsets.UTF_8)) {
addPrefixProperties(r);
}
} | [
"public",
"void",
"addPrefixesFile",
"(",
"String",
"filename",
")",
"throws",
"IOException",
"{",
"try",
"(",
"Reader",
"r",
"=",
"Files",
".",
"newBufferedReader",
"(",
"Paths",
".",
"get",
"(",
"filename",
")",
",",
"StandardCharsets",
".",
"UTF_8",
")",
... | Add a file map of packages to their respective prefixes, using the Properties file format. | [
"Add",
"a",
"file",
"map",
"of",
"packages",
"to",
"their",
"respective",
"prefixes",
"using",
"the",
"Properties",
"file",
"format",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/PackagePrefixes.java#L134-L138 |
35,238 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.readRFC1421Cert | 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)) {
/* stream appears to be hex-encoded bytes */
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;
} | java | 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)) {
/* stream appears to be hex-encoded bytes */
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;
} | [
"private",
"DerValue",
"readRFC1421Cert",
"(",
"InputStream",
"in",
")",
"throws",
"IOException",
"{",
"DerValue",
"der",
"=",
"null",
";",
"String",
"line",
"=",
"null",
";",
"BufferedReader",
"certBufferedReader",
"=",
"new",
"BufferedReader",
"(",
"new",
"Inp... | read input stream as HEX-encoded DER-encoded bytes
@param in InputStream to read
@returns DerValue corresponding to decoded HEX-encoded bytes
@throws IOException if stream can not be interpreted as RFC1421
encoded bytes | [
"read",
"input",
"stream",
"as",
"HEX",
"-",
"encoded",
"DER",
"-",
"encoded",
"bytes"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L254-L287 |
35,239 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.get | 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);
}
} | java | 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);
}
} | [
"public",
"Object",
"get",
"(",
"String",
"name",
")",
"throws",
"CertificateParsingException",
"{",
"X509AttributeName",
"attr",
"=",
"new",
"X509AttributeName",
"(",
"name",
")",
";",
"String",
"id",
"=",
"attr",
".",
"getPrefix",
"(",
")",
";",
"if",
"(",... | Return the requested attribute from the certificate.
Note that the X509CertInfo is not cloned for performance reasons.
Callers must ensure that they do not modify it. All other
attributes are cloned.
@param name the name of the attribute.
@exception CertificateParsingException on invalid attribute identifier. | [
"Return",
"the",
"requested",
"attribute",
"from",
"the",
"certificate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L661-L704 |
35,240 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.set | public void set(String name, Object obj)
throws CertificateException, IOException {
// check if immutable
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; //reset this as certificate data has changed
} else {
info.set(attr.getSuffix(), obj);
signedCert = null; //reset this as certificate data has changed
}
} else {
throw new CertificateException("Attribute name not recognized or " +
"set() not allowed for the same: " + id);
}
} | java | public void set(String name, Object obj)
throws CertificateException, IOException {
// check if immutable
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; //reset this as certificate data has changed
} else {
info.set(attr.getSuffix(), obj);
signedCert = null; //reset this as certificate data has changed
}
} else {
throw new CertificateException("Attribute name not recognized or " +
"set() not allowed for the same: " + id);
}
} | [
"public",
"void",
"set",
"(",
"String",
"name",
",",
"Object",
"obj",
")",
"throws",
"CertificateException",
",",
"IOException",
"{",
"// check if immutable",
"if",
"(",
"readOnly",
")",
"throw",
"new",
"CertificateException",
"(",
"\"cannot over-write existing\"",
... | Set the requested attribute in the certificate.
@param name the name of the attribute.
@param obj the value of the attribute.
@exception CertificateException on invalid attribute identifier.
@exception IOException on encoding error of attribute. | [
"Set",
"the",
"requested",
"attribute",
"in",
"the",
"certificate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L714-L746 |
35,241 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.delete | public void delete(String name)
throws CertificateException, IOException {
// check if immutable
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);
}
} | java | public void delete(String name)
throws CertificateException, IOException {
// check if immutable
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);
}
} | [
"public",
"void",
"delete",
"(",
"String",
"name",
")",
"throws",
"CertificateException",
",",
"IOException",
"{",
"// check if immutable",
"if",
"(",
"readOnly",
")",
"throw",
"new",
"CertificateException",
"(",
"\"cannot over-write existing\"",
"+",
"\" certificate\""... | Delete the requested attribute from the certificate.
@param name the name of the attribute.
@exception CertificateException on invalid attribute identifier.
@exception IOException on other errors. | [
"Delete",
"the",
"requested",
"attribute",
"from",
"the",
"certificate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L755-L788 |
35,242 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.getPublicKey | 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;
}
} | java | 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;
}
} | [
"public",
"PublicKey",
"getPublicKey",
"(",
")",
"{",
"if",
"(",
"info",
"==",
"null",
")",
"return",
"null",
";",
"try",
"{",
"PublicKey",
"key",
"=",
"(",
"PublicKey",
")",
"info",
".",
"get",
"(",
"CertificateX509Key",
".",
"NAME",
"+",
"DOT",
"+",
... | Gets the publickey from this certificate.
@return the publickey. | [
"Gets",
"the",
"publickey",
"from",
"this",
"certificate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L841-L851 |
35,243 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.getVersion | 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;
}
} | java | 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;
}
} | [
"public",
"int",
"getVersion",
"(",
")",
"{",
"if",
"(",
"info",
"==",
"null",
")",
"return",
"-",
"1",
";",
"try",
"{",
"int",
"vers",
"=",
"(",
"(",
"Integer",
")",
"info",
".",
"get",
"(",
"CertificateVersion",
".",
"NAME",
"+",
"DOT",
"+",
"C... | Gets the version number from the certificate.
@return the version number, i.e. 1, 2 or 3. | [
"Gets",
"the",
"version",
"number",
"from",
"the",
"certificate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L858-L868 |
35,244 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.getSerialNumber | public BigInteger getSerialNumber() {
SerialNumber ser = getSerialNumberObject();
return ser != null ? ser.getNumber() : null;
} | java | public BigInteger getSerialNumber() {
SerialNumber ser = getSerialNumberObject();
return ser != null ? ser.getNumber() : null;
} | [
"public",
"BigInteger",
"getSerialNumber",
"(",
")",
"{",
"SerialNumber",
"ser",
"=",
"getSerialNumberObject",
"(",
")",
";",
"return",
"ser",
"!=",
"null",
"?",
"ser",
".",
"getNumber",
"(",
")",
":",
"null",
";",
"}"
] | Gets the serial number from the certificate.
@return the serial number. | [
"Gets",
"the",
"serial",
"number",
"from",
"the",
"certificate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L875-L879 |
35,245 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.getSerialNumberObject | 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;
}
} | java | 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;
}
} | [
"public",
"SerialNumber",
"getSerialNumberObject",
"(",
")",
"{",
"if",
"(",
"info",
"==",
"null",
")",
"return",
"null",
";",
"try",
"{",
"SerialNumber",
"ser",
"=",
"(",
"SerialNumber",
")",
"info",
".",
"get",
"(",
"CertificateSerialNumber",
".",
"NAME",
... | Gets the serial number from the certificate as
a SerialNumber object.
@return the serial number. | [
"Gets",
"the",
"serial",
"number",
"from",
"the",
"certificate",
"as",
"a",
"SerialNumber",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L887-L898 |
35,246 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.getSubjectDN | 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;
}
} | java | 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;
}
} | [
"public",
"Principal",
"getSubjectDN",
"(",
")",
"{",
"if",
"(",
"info",
"==",
"null",
")",
"return",
"null",
";",
"try",
"{",
"Principal",
"subject",
"=",
"(",
"Principal",
")",
"info",
".",
"get",
"(",
"X509CertInfo",
".",
"SUBJECT",
"+",
"DOT",
"+",... | Gets the subject distinguished name from the certificate.
@return the subject name. | [
"Gets",
"the",
"subject",
"distinguished",
"name",
"from",
"the",
"certificate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L906-L916 |
35,247 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.getSubjectX500Principal | 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;
}
} | java | 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;
}
} | [
"public",
"X500Principal",
"getSubjectX500Principal",
"(",
")",
"{",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"X500Principal",
"subject",
"=",
"(",
"X500Principal",
")",
"info",
".",
"get",
"(",
"X509CertInfo",
"."... | Get subject name as X500Principal. Overrides implementation in
X509Certificate with a slightly more efficient version that is
also aware of X509CertImpl mutability. | [
"Get",
"subject",
"name",
"as",
"X500Principal",
".",
"Overrides",
"implementation",
"in",
"X509Certificate",
"with",
"a",
"slightly",
"more",
"efficient",
"version",
"that",
"is",
"also",
"aware",
"of",
"X509CertImpl",
"mutability",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L923-L935 |
35,248 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.getIssuerDN | 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;
}
} | java | 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;
}
} | [
"public",
"Principal",
"getIssuerDN",
"(",
")",
"{",
"if",
"(",
"info",
"==",
"null",
")",
"return",
"null",
";",
"try",
"{",
"Principal",
"issuer",
"=",
"(",
"Principal",
")",
"info",
".",
"get",
"(",
"X509CertInfo",
".",
"ISSUER",
"+",
"DOT",
"+",
... | Gets the issuer distinguished name from the certificate.
@return the issuer name. | [
"Gets",
"the",
"issuer",
"distinguished",
"name",
"from",
"the",
"certificate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L942-L952 |
35,249 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.getIssuerX500Principal | 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;
}
} | java | 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;
}
} | [
"public",
"X500Principal",
"getIssuerX500Principal",
"(",
")",
"{",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"X500Principal",
"issuer",
"=",
"(",
"X500Principal",
")",
"info",
".",
"get",
"(",
"X509CertInfo",
".",
... | Get issuer name as X500Principal. Overrides implementation in
X509Certificate with a slightly more efficient version that is
also aware of X509CertImpl mutability. | [
"Get",
"issuer",
"name",
"as",
"X500Principal",
".",
"Overrides",
"implementation",
"in",
"X509Certificate",
"with",
"a",
"slightly",
"more",
"efficient",
"version",
"that",
"is",
"also",
"aware",
"of",
"X509CertImpl",
"mutability",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L959-L971 |
35,250 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.getNotBefore | 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;
}
} | java | 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;
}
} | [
"public",
"Date",
"getNotBefore",
"(",
")",
"{",
"if",
"(",
"info",
"==",
"null",
")",
"return",
"null",
";",
"try",
"{",
"Date",
"d",
"=",
"(",
"Date",
")",
"info",
".",
"get",
"(",
"CertificateValidity",
".",
"NAME",
"+",
"DOT",
"+",
"CertificateVa... | Gets the notBefore date from the validity period of the certificate.
@return the start date of the validity period. | [
"Gets",
"the",
"notBefore",
"date",
"from",
"the",
"validity",
"period",
"of",
"the",
"certificate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L978-L988 |
35,251 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.getNotAfter | 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;
}
} | java | 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;
}
} | [
"public",
"Date",
"getNotAfter",
"(",
")",
"{",
"if",
"(",
"info",
"==",
"null",
")",
"return",
"null",
";",
"try",
"{",
"Date",
"d",
"=",
"(",
"Date",
")",
"info",
".",
"get",
"(",
"CertificateValidity",
".",
"NAME",
"+",
"DOT",
"+",
"CertificateVal... | Gets the notAfter date from the validity period of the certificate.
@return the end date of the validity period. | [
"Gets",
"the",
"notAfter",
"date",
"from",
"the",
"validity",
"period",
"of",
"the",
"certificate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L995-L1005 |
35,252 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.getSigAlgOID | public String getSigAlgOID() {
if (algId == null)
return null;
ObjectIdentifier oid = algId.getOID();
return (oid.toString());
} | java | public String getSigAlgOID() {
if (algId == null)
return null;
ObjectIdentifier oid = algId.getOID();
return (oid.toString());
} | [
"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"
@return the signature algorithm oid string. | [
"Gets",
"the",
"signature",
"algorithm",
"OID",
"string",
"from",
"the",
"certificate",
".",
"For",
"example",
"the",
"string",
"1",
".",
"2",
".",
"840",
".",
"10040",
".",
"4",
".",
"3"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L1054-L1059 |
35,253 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.getIssuerUniqueID | 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;
}
} | java | 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;
}
} | [
"public",
"boolean",
"[",
"]",
"getIssuerUniqueID",
"(",
")",
"{",
"if",
"(",
"info",
"==",
"null",
")",
"return",
"null",
";",
"try",
"{",
"UniqueIdentity",
"id",
"=",
"(",
"UniqueIdentity",
")",
"info",
".",
"get",
"(",
"X509CertInfo",
".",
"ISSUER_ID"... | Gets the Issuer Unique Identity from the certificate.
@return the Issuer Unique Identity. | [
"Gets",
"the",
"Issuer",
"Unique",
"Identity",
"from",
"the",
"certificate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L1083-L1096 |
35,254 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.getSubjectUniqueID | 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;
}
} | java | 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;
}
} | [
"public",
"boolean",
"[",
"]",
"getSubjectUniqueID",
"(",
")",
"{",
"if",
"(",
"info",
"==",
"null",
")",
"return",
"null",
";",
"try",
"{",
"UniqueIdentity",
"id",
"=",
"(",
"UniqueIdentity",
")",
"info",
".",
"get",
"(",
"X509CertInfo",
".",
"SUBJECT_I... | Gets the Subject Unique Identity from the certificate.
@return the Subject Unique Identity. | [
"Gets",
"the",
"Subject",
"Unique",
"Identity",
"from",
"the",
"certificate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L1103-L1116 |
35,255 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.getSubjectKeyId | public KeyIdentifier getSubjectKeyId() {
SubjectKeyIdentifierExtension ski = getSubjectKeyIdentifierExtension();
if (ski != null) {
try {
return (KeyIdentifier)ski.get(
SubjectKeyIdentifierExtension.KEY_ID);
} catch (IOException ioe) {} // not possible
}
return null;
} | java | public KeyIdentifier getSubjectKeyId() {
SubjectKeyIdentifierExtension ski = getSubjectKeyIdentifierExtension();
if (ski != null) {
try {
return (KeyIdentifier)ski.get(
SubjectKeyIdentifierExtension.KEY_ID);
} catch (IOException ioe) {} // not possible
}
return null;
} | [
"public",
"KeyIdentifier",
"getSubjectKeyId",
"(",
")",
"{",
"SubjectKeyIdentifierExtension",
"ski",
"=",
"getSubjectKeyIdentifierExtension",
"(",
")",
";",
"if",
"(",
"ski",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"(",
"KeyIdentifier",
")",
"ski",
".",
... | Returns the subject's key identifier, or null | [
"Returns",
"the",
"subject",
"s",
"key",
"identifier",
"or",
"null"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L1133-L1142 |
35,256 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.hasUnsupportedCriticalExtension | 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;
}
} | java | 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;
}
} | [
"public",
"boolean",
"hasUnsupportedCriticalExtension",
"(",
")",
"{",
"if",
"(",
"info",
"==",
"null",
")",
"return",
"false",
";",
"try",
"{",
"CertificateExtensions",
"exts",
"=",
"(",
"CertificateExtensions",
")",
"info",
".",
"get",
"(",
"CertificateExtensi... | Return true if a critical extension is found that is
not supported, otherwise return false. | [
"Return",
"true",
"if",
"a",
"critical",
"extension",
"is",
"found",
"that",
"is",
"not",
"supported",
"otherwise",
"return",
"false",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L1268-L1280 |
35,257 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.getExtension | 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)) {
//XXXX May want to consider cloning this
return ex2;
}
}
/* no such extension in this certificate */
return null;
}
} catch (IOException ioe) {
return null;
}
} | java | 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)) {
//XXXX May want to consider cloning this
return ex2;
}
}
/* no such extension in this certificate */
return null;
}
} catch (IOException ioe) {
return null;
}
} | [
"public",
"Extension",
"getExtension",
"(",
"ObjectIdentifier",
"oid",
")",
"{",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"CertificateExtensions",
"extensions",
";",
"try",
"{",
"extensions",
"=",
"(",
"CertificateEx... | Gets the extension identified by the given ObjectIdentifier
@param oid the Object Identifier value for the extension.
@return Extension or null if certificate does not contain this
extension | [
"Gets",
"the",
"extension",
"identified",
"by",
"the",
"given",
"ObjectIdentifier"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L1350-L1380 |
35,258 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.getExtensionValue | 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) { // may be unknown
// get the extensions, search thru' for this oid
if (exts == null) {
return null;
}
for (Extension ex : exts.getAllExtensions()) {
ObjectIdentifier inCertOID = ex.getExtensionId();
if (inCertOID.equals((Object)findOID)) {
certExt = ex;
break;
}
}
} else { // there's sub-class that can handle this extension
try {
certExt = (Extension)this.get(extAlias);
} catch (CertificateException e) {
// get() throws an Exception instead of returning null, ignore
}
}
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;
}
} | java | 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) { // may be unknown
// get the extensions, search thru' for this oid
if (exts == null) {
return null;
}
for (Extension ex : exts.getAllExtensions()) {
ObjectIdentifier inCertOID = ex.getExtensionId();
if (inCertOID.equals((Object)findOID)) {
certExt = ex;
break;
}
}
} else { // there's sub-class that can handle this extension
try {
certExt = (Extension)this.get(extAlias);
} catch (CertificateException e) {
// get() throws an Exception instead of returning null, ignore
}
}
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;
}
} | [
"public",
"byte",
"[",
"]",
"getExtensionValue",
"(",
"String",
"oid",
")",
"{",
"try",
"{",
"ObjectIdentifier",
"findOID",
"=",
"new",
"ObjectIdentifier",
"(",
"oid",
")",
";",
"String",
"extAlias",
"=",
"OIDMap",
".",
"getName",
"(",
"findOID",
")",
";",... | Gets the DER encoded extension identified by the given
oid String.
@param oid the Object Identifier value for the extension. | [
"Gets",
"the",
"DER",
"encoded",
"extension",
"identified",
"by",
"the",
"given",
"oid",
"String",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L1409-L1455 |
35,259 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.getExtendedKeyUsage | 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;
}
} | java | 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;
}
} | [
"public",
"synchronized",
"List",
"<",
"String",
">",
"getExtendedKeyUsage",
"(",
")",
"throws",
"CertificateParsingException",
"{",
"if",
"(",
"readOnly",
"&&",
"extKeyUsage",
"!=",
"null",
")",
"{",
"return",
"extKeyUsage",
";",
"}",
"else",
"{",
"ExtendedKeyU... | 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. | [
"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",
"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L1490-L1503 |
35,260 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.getExtendedKeyUsage | 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);
}
} | java | 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);
}
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getExtendedKeyUsage",
"(",
"X509Certificate",
"cert",
")",
"throws",
"CertificateParsingException",
"{",
"try",
"{",
"byte",
"[",
"]",
"ext",
"=",
"cert",
".",
"getExtensionValue",
"(",
"EXTENDED_KEY_USAGE_OID",
")"... | 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. | [
"This",
"static",
"method",
"is",
"the",
"default",
"implementation",
"of",
"the",
"getExtendedKeyUsage",
"method",
"in",
"X509Certificate",
".",
"A",
"X509Certificate",
"provider",
"generally",
"should",
"overwrite",
"this",
"to",
"provide",
"among",
"other",
"thin... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L1511-L1526 |
35,261 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.cloneAltNames | private static Collection<List<?>> cloneAltNames(Collection<List<?>> altNames) {
boolean mustClone = false;
for (List<?> nameEntry : altNames) {
if (nameEntry.get(1) instanceof byte[]) {
// must clone names
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;
}
}
/**
* This method are the overridden implementation of
* getSubjectAlternativeNames method in X509Certificate in the Sun
* provider. It is better performance-wise since it returns cached
* values.
*/
public synchronized Collection<List<?>> getSubjectAlternativeNames()
throws CertificateParsingException {
// return cached value if we can
if (readOnly && subjectAlternativeNames != null) {
return cloneAltNames(subjectAlternativeNames);
}
SubjectAlternativeNameExtension subjectAltNameExt =
getSubjectAlternativeNameExtension();
if (subjectAltNameExt == null) {
return null;
}
GeneralNames names;
try {
names = subjectAltNameExt.get(
SubjectAlternativeNameExtension.SUBJECT_NAME);
} catch (IOException ioe) {
// should not occur
return Collections.<List<?>>emptySet();
}
subjectAlternativeNames = makeAltNames(names);
return subjectAlternativeNames;
}
/**
* This static method is the default implementation of the
* getSubjectAlternaitveNames method in X509Certificate. A
* X509Certificate provider generally should overwrite this to
* provide among other things caching for better performance.
*/
public static Collection<List<?>> getSubjectAlternativeNames(X509Certificate cert)
throws CertificateParsingException {
try {
byte[] ext = cert.getExtensionValue(SUBJECT_ALT_NAME_OID);
if (ext == null) {
return null;
}
DerValue val = new DerValue(ext);
byte[] data = val.getOctetString();
SubjectAlternativeNameExtension subjectAltNameExt =
new SubjectAlternativeNameExtension(Boolean.FALSE,
data);
GeneralNames names;
try {
names = subjectAltNameExt.get(
SubjectAlternativeNameExtension.SUBJECT_NAME);
} catch (IOException ioe) {
// should not occur
return Collections.<List<?>>emptySet();
}
return makeAltNames(names);
} catch (IOException ioe) {
throw new CertificateParsingException(ioe);
}
}
/**
* This method are the overridden implementation of
* getIssuerAlternativeNames method in X509Certificate in the Sun
* provider. It is better performance-wise since it returns cached
* values.
*/
public synchronized Collection<List<?>> getIssuerAlternativeNames()
throws CertificateParsingException {
// return cached value if we can
if (readOnly && issuerAlternativeNames != null) {
return cloneAltNames(issuerAlternativeNames);
}
IssuerAlternativeNameExtension issuerAltNameExt =
getIssuerAlternativeNameExtension();
if (issuerAltNameExt == null) {
return null;
}
GeneralNames names;
try {
names = issuerAltNameExt.get(
IssuerAlternativeNameExtension.ISSUER_NAME);
} catch (IOException ioe) {
// should not occur
return Collections.<List<?>>emptySet();
}
issuerAlternativeNames = makeAltNames(names);
return issuerAlternativeNames;
}
/**
* This static method is the default implementation of the
* getIssuerAlternaitveNames method in X509Certificate. A
* X509Certificate provider generally should overwrite this to
* provide among other things caching for better performance.
*/
public static Collection<List<?>> getIssuerAlternativeNames(X509Certificate cert)
throws CertificateParsingException {
try {
byte[] ext = cert.getExtensionValue(ISSUER_ALT_NAME_OID);
if (ext == null) {
return null;
}
DerValue val = new DerValue(ext);
byte[] data = val.getOctetString();
IssuerAlternativeNameExtension issuerAltNameExt =
new IssuerAlternativeNameExtension(Boolean.FALSE,
data);
GeneralNames names;
try {
names = issuerAltNameExt.get(
IssuerAlternativeNameExtension.ISSUER_NAME);
} catch (IOException ioe) {
// should not occur
return Collections.<List<?>>emptySet();
}
return makeAltNames(names);
} catch (IOException ioe) {
throw new CertificateParsingException(ioe);
}
}
public AuthorityInfoAccessExtension getAuthorityInfoAccessExtension() {
return (AuthorityInfoAccessExtension)
getExtension(PKIXExtensions.AuthInfoAccess_Id);
}
/************************************************************/
/*
* Cert is a SIGNED ASN.1 macro, a three elment sequence:
*
* - Data to be signed (ToBeSigned) -- the "raw" cert
* - Signature algorithm (SigAlgId)
* - The signature bits
*
* This routine unmarshals the certificate, saving the signature
* parts away for later verification.
*/
private void parse(DerValue val)
throws CertificateException, IOException {
parse(
val,
null // use re-encoded form of val as the encoded form
);
}
/*
* Cert is a SIGNED ASN.1 macro, a three elment sequence:
*
* - Data to be signed (ToBeSigned) -- the "raw" cert
* - Signature algorithm (SigAlgId)
* - The signature bits
*
* This routine unmarshals the certificate, saving the signature
* parts away for later verification.
*/
private void parse(DerValue val, byte[] originalEncodedForm)
throws CertificateException, IOException {
// check if can over write the certificate
if (readOnly)
throw new CertificateParsingException(
"cannot over-write existing certificate");
if (val.data == null || val.tag != DerValue.tag_Sequence)
throw new CertificateParsingException(
"invalid DER-encoded certificate data");
signedCert =
(originalEncodedForm != null)
? originalEncodedForm : val.toByteArray();
DerValue[] seq = new DerValue[3];
seq[0] = val.data.getDerValue();
seq[1] = val.data.getDerValue();
seq[2] = val.data.getDerValue();
if (val.data.available() != 0) {
throw new CertificateParsingException("signed overrun, bytes = "
+ val.data.available());
}
if (seq[0].tag != DerValue.tag_Sequence) {
throw new CertificateParsingException("signed fields invalid");
}
algId = AlgorithmId.parse(seq[1]);
signature = seq[2].getBitString();
if (seq[1].data.available() != 0) {
throw new CertificateParsingException("algid field overrun");
}
if (seq[2].data.available() != 0)
throw new CertificateParsingException("signed fields overrun");
// The CertificateInfo
info = new X509CertInfo(seq[0]);
// the "inner" and "outer" signature algorithms must match
AlgorithmId infoSigAlg = (AlgorithmId)info.get(
CertificateAlgorithmId.NAME
+ DOT +
CertificateAlgorithmId.ALGORITHM);
if (! algId.equals(infoSigAlg))
throw new CertificateException("Signature algorithm mismatch");
readOnly = true;
} | java | private static Collection<List<?>> cloneAltNames(Collection<List<?>> altNames) {
boolean mustClone = false;
for (List<?> nameEntry : altNames) {
if (nameEntry.get(1) instanceof byte[]) {
// must clone names
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;
}
}
/**
* This method are the overridden implementation of
* getSubjectAlternativeNames method in X509Certificate in the Sun
* provider. It is better performance-wise since it returns cached
* values.
*/
public synchronized Collection<List<?>> getSubjectAlternativeNames()
throws CertificateParsingException {
// return cached value if we can
if (readOnly && subjectAlternativeNames != null) {
return cloneAltNames(subjectAlternativeNames);
}
SubjectAlternativeNameExtension subjectAltNameExt =
getSubjectAlternativeNameExtension();
if (subjectAltNameExt == null) {
return null;
}
GeneralNames names;
try {
names = subjectAltNameExt.get(
SubjectAlternativeNameExtension.SUBJECT_NAME);
} catch (IOException ioe) {
// should not occur
return Collections.<List<?>>emptySet();
}
subjectAlternativeNames = makeAltNames(names);
return subjectAlternativeNames;
}
/**
* This static method is the default implementation of the
* getSubjectAlternaitveNames method in X509Certificate. A
* X509Certificate provider generally should overwrite this to
* provide among other things caching for better performance.
*/
public static Collection<List<?>> getSubjectAlternativeNames(X509Certificate cert)
throws CertificateParsingException {
try {
byte[] ext = cert.getExtensionValue(SUBJECT_ALT_NAME_OID);
if (ext == null) {
return null;
}
DerValue val = new DerValue(ext);
byte[] data = val.getOctetString();
SubjectAlternativeNameExtension subjectAltNameExt =
new SubjectAlternativeNameExtension(Boolean.FALSE,
data);
GeneralNames names;
try {
names = subjectAltNameExt.get(
SubjectAlternativeNameExtension.SUBJECT_NAME);
} catch (IOException ioe) {
// should not occur
return Collections.<List<?>>emptySet();
}
return makeAltNames(names);
} catch (IOException ioe) {
throw new CertificateParsingException(ioe);
}
}
/**
* This method are the overridden implementation of
* getIssuerAlternativeNames method in X509Certificate in the Sun
* provider. It is better performance-wise since it returns cached
* values.
*/
public synchronized Collection<List<?>> getIssuerAlternativeNames()
throws CertificateParsingException {
// return cached value if we can
if (readOnly && issuerAlternativeNames != null) {
return cloneAltNames(issuerAlternativeNames);
}
IssuerAlternativeNameExtension issuerAltNameExt =
getIssuerAlternativeNameExtension();
if (issuerAltNameExt == null) {
return null;
}
GeneralNames names;
try {
names = issuerAltNameExt.get(
IssuerAlternativeNameExtension.ISSUER_NAME);
} catch (IOException ioe) {
// should not occur
return Collections.<List<?>>emptySet();
}
issuerAlternativeNames = makeAltNames(names);
return issuerAlternativeNames;
}
/**
* This static method is the default implementation of the
* getIssuerAlternaitveNames method in X509Certificate. A
* X509Certificate provider generally should overwrite this to
* provide among other things caching for better performance.
*/
public static Collection<List<?>> getIssuerAlternativeNames(X509Certificate cert)
throws CertificateParsingException {
try {
byte[] ext = cert.getExtensionValue(ISSUER_ALT_NAME_OID);
if (ext == null) {
return null;
}
DerValue val = new DerValue(ext);
byte[] data = val.getOctetString();
IssuerAlternativeNameExtension issuerAltNameExt =
new IssuerAlternativeNameExtension(Boolean.FALSE,
data);
GeneralNames names;
try {
names = issuerAltNameExt.get(
IssuerAlternativeNameExtension.ISSUER_NAME);
} catch (IOException ioe) {
// should not occur
return Collections.<List<?>>emptySet();
}
return makeAltNames(names);
} catch (IOException ioe) {
throw new CertificateParsingException(ioe);
}
}
public AuthorityInfoAccessExtension getAuthorityInfoAccessExtension() {
return (AuthorityInfoAccessExtension)
getExtension(PKIXExtensions.AuthInfoAccess_Id);
}
/************************************************************/
/*
* Cert is a SIGNED ASN.1 macro, a three elment sequence:
*
* - Data to be signed (ToBeSigned) -- the "raw" cert
* - Signature algorithm (SigAlgId)
* - The signature bits
*
* This routine unmarshals the certificate, saving the signature
* parts away for later verification.
*/
private void parse(DerValue val)
throws CertificateException, IOException {
parse(
val,
null // use re-encoded form of val as the encoded form
);
}
/*
* Cert is a SIGNED ASN.1 macro, a three elment sequence:
*
* - Data to be signed (ToBeSigned) -- the "raw" cert
* - Signature algorithm (SigAlgId)
* - The signature bits
*
* This routine unmarshals the certificate, saving the signature
* parts away for later verification.
*/
private void parse(DerValue val, byte[] originalEncodedForm)
throws CertificateException, IOException {
// check if can over write the certificate
if (readOnly)
throw new CertificateParsingException(
"cannot over-write existing certificate");
if (val.data == null || val.tag != DerValue.tag_Sequence)
throw new CertificateParsingException(
"invalid DER-encoded certificate data");
signedCert =
(originalEncodedForm != null)
? originalEncodedForm : val.toByteArray();
DerValue[] seq = new DerValue[3];
seq[0] = val.data.getDerValue();
seq[1] = val.data.getDerValue();
seq[2] = val.data.getDerValue();
if (val.data.available() != 0) {
throw new CertificateParsingException("signed overrun, bytes = "
+ val.data.available());
}
if (seq[0].tag != DerValue.tag_Sequence) {
throw new CertificateParsingException("signed fields invalid");
}
algId = AlgorithmId.parse(seq[1]);
signature = seq[2].getBitString();
if (seq[1].data.available() != 0) {
throw new CertificateParsingException("algid field overrun");
}
if (seq[2].data.available() != 0)
throw new CertificateParsingException("signed fields overrun");
// The CertificateInfo
info = new X509CertInfo(seq[0]);
// the "inner" and "outer" signature algorithms must match
AlgorithmId infoSigAlg = (AlgorithmId)info.get(
CertificateAlgorithmId.NAME
+ DOT +
CertificateAlgorithmId.ALGORITHM);
if (! algId.equals(infoSigAlg))
throw new CertificateException("Signature algorithm mismatch");
readOnly = true;
} | [
"private",
"static",
"Collection",
"<",
"List",
"<",
"?",
">",
">",
"cloneAltNames",
"(",
"Collection",
"<",
"List",
"<",
"?",
">",
">",
"altNames",
")",
"{",
"boolean",
"mustClone",
"=",
"false",
";",
"for",
"(",
"List",
"<",
"?",
">",
"nameEntry",
... | only partially generified due to javac bug | [
"only",
"partially",
"generified",
"due",
"to",
"javac",
"bug"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L1619-L1855 |
35,262 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.getX500Principal | 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();
// skip version number if present
if (tmp.isContextSpecific((byte)0)) {
tmp = tbsIn.getDerValue();
}
// tmp always contains serial number now
tmp = tbsIn.getDerValue(); // skip signature
tmp = tbsIn.getDerValue(); // issuer
if (getIssuer == false) {
tmp = tbsIn.getDerValue(); // skip validity
tmp = tbsIn.getDerValue(); // subject
}
byte[] principalBytes = tmp.toByteArray();
return new X500Principal(principalBytes);
} | java | 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();
// skip version number if present
if (tmp.isContextSpecific((byte)0)) {
tmp = tbsIn.getDerValue();
}
// tmp always contains serial number now
tmp = tbsIn.getDerValue(); // skip signature
tmp = tbsIn.getDerValue(); // issuer
if (getIssuer == false) {
tmp = tbsIn.getDerValue(); // skip validity
tmp = tbsIn.getDerValue(); // subject
}
byte[] principalBytes = tmp.toByteArray();
return new X500Principal(principalBytes);
} | [
"private",
"static",
"X500Principal",
"getX500Principal",
"(",
"X509Certificate",
"cert",
",",
"boolean",
"getIssuer",
")",
"throws",
"Exception",
"{",
"byte",
"[",
"]",
"encoded",
"=",
"cert",
".",
"getEncoded",
"(",
")",
";",
"DerInputStream",
"derIn",
"=",
... | Extract the subject or issuer X500Principal from an X509Certificate.
Parses the encoded form of the cert to preserve the principal's
ASN.1 encoding. | [
"Extract",
"the",
"subject",
"or",
"issuer",
"X500Principal",
"from",
"an",
"X509Certificate",
".",
"Parses",
"the",
"encoded",
"form",
"of",
"the",
"cert",
"to",
"preserve",
"the",
"principal",
"s",
"ASN",
".",
"1",
"encoding",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L1862-L1883 |
35,263 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.toImpl | public static X509CertImpl toImpl(X509Certificate cert)
throws CertificateException {
if (cert instanceof X509CertImpl) {
return (X509CertImpl)cert;
} else {
return X509Factory.intern(cert);
}
} | java | public static X509CertImpl toImpl(X509Certificate cert)
throws CertificateException {
if (cert instanceof X509CertImpl) {
return (X509CertImpl)cert;
} else {
return X509Factory.intern(cert);
}
} | [
"public",
"static",
"X509CertImpl",
"toImpl",
"(",
"X509Certificate",
"cert",
")",
"throws",
"CertificateException",
"{",
"if",
"(",
"cert",
"instanceof",
"X509CertImpl",
")",
"{",
"return",
"(",
"X509CertImpl",
")",
"cert",
";",
"}",
"else",
"{",
"return",
"X... | Utility method to convert an arbitrary instance of X509Certificate
to a X509CertImpl. Does a cast if possible, otherwise reparses
the encoding. | [
"Utility",
"method",
"to",
"convert",
"an",
"arbitrary",
"instance",
"of",
"X509Certificate",
"to",
"a",
"X509CertImpl",
".",
"Does",
"a",
"cast",
"if",
"possible",
"otherwise",
"reparses",
"the",
"encoding",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L1929-L1936 |
35,264 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.isSelfIssued | public static boolean isSelfIssued(X509Certificate cert) {
X500Principal subject = cert.getSubjectX500Principal();
X500Principal issuer = cert.getIssuerX500Principal();
return subject.equals(issuer);
} | java | public static boolean isSelfIssued(X509Certificate cert) {
X500Principal subject = cert.getSubjectX500Principal();
X500Principal issuer = cert.getIssuerX500Principal();
return subject.equals(issuer);
} | [
"public",
"static",
"boolean",
"isSelfIssued",
"(",
"X509Certificate",
"cert",
")",
"{",
"X500Principal",
"subject",
"=",
"cert",
".",
"getSubjectX500Principal",
"(",
")",
";",
"X500Principal",
"issuer",
"=",
"cert",
".",
"getIssuerX500Principal",
"(",
")",
";",
... | Utility method to test if a certificate is self-issued. This is
the case iff the subject and issuer X500Principals are equal. | [
"Utility",
"method",
"to",
"test",
"if",
"a",
"certificate",
"is",
"self",
"-",
"issued",
".",
"This",
"is",
"the",
"case",
"iff",
"the",
"subject",
"and",
"issuer",
"X500Principals",
"are",
"equal",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L1942-L1946 |
35,265 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.isSelfSigned | 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) {
// In case of exception, return false
}
}
return false;
} | java | 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) {
// In case of exception, return false
}
}
return false;
} | [
"public",
"static",
"boolean",
"isSelfSigned",
"(",
"X509Certificate",
"cert",
",",
"String",
"sigProvider",
")",
"{",
"if",
"(",
"isSelfIssued",
"(",
"cert",
")",
")",
"{",
"try",
"{",
"if",
"(",
"sigProvider",
"==",
"null",
")",
"{",
"cert",
".",
"veri... | 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. | [
"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",
"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L1954-L1969 |
35,266 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.getCertificateFingerPrint | 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) {
// ignored
}
return fingerPrint;
} | java | 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) {
// ignored
}
return fingerPrint;
} | [
"private",
"String",
"getCertificateFingerPrint",
"(",
"String",
"mdAlg",
")",
"{",
"String",
"fingerPrint",
"=",
"\"\"",
";",
"try",
"{",
"byte",
"[",
"]",
"encCertInfo",
"=",
"getEncoded",
"(",
")",
";",
"MessageDigest",
"md",
"=",
"MessageDigest",
".",
"g... | Gets the requested finger print of the certificate. The result
only contains 0-9 and A-F. No small case, no colon. | [
"Gets",
"the",
"requested",
"finger",
"print",
"of",
"the",
"certificate",
".",
"The",
"result",
"only",
"contains",
"0",
"-",
"9",
"and",
"A",
"-",
"F",
".",
"No",
"small",
"case",
"no",
"colon",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L1985-L2000 |
35,267 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.byte2hex | 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]);
} | java | 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]);
} | [
"private",
"static",
"void",
"byte2hex",
"(",
"byte",
"b",
",",
"StringBuffer",
"buf",
")",
"{",
"char",
"[",
"]",
"hexChars",
"=",
"{",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
","... | Converts a byte to hex digit and writes to the supplied buffer | [
"Converts",
"a",
"byte",
"to",
"hex",
"digit",
"and",
"writes",
"to",
"the",
"supplied",
"buffer"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L2005-L2012 |
35,268 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipFile.java | ZipFile.getComment | public String getComment() {
synchronized (this) {
ensureOpen();
byte[] bcomm = getCommentBytes(jzfile);
if (bcomm == null)
return null;
return zc.toString(bcomm, bcomm.length);
}
} | java | public String getComment() {
synchronized (this) {
ensureOpen();
byte[] bcomm = getCommentBytes(jzfile);
if (bcomm == null)
return null;
return zc.toString(bcomm, bcomm.length);
}
} | [
"public",
"String",
"getComment",
"(",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"ensureOpen",
"(",
")",
";",
"byte",
"[",
"]",
"bcomm",
"=",
"getCommentBytes",
"(",
"jzfile",
")",
";",
"if",
"(",
"bcomm",
"==",
"null",
")",
"return",
"null",
... | Returns the zip file comment, or null if none.
@return the comment string for the zip file, or null if none
@throws IllegalStateException if the zip file has been closed
Since 1.7 | [
"Returns",
"the",
"zip",
"file",
"comment",
"or",
"null",
"if",
"none",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipFile.java#L291-L299 |
35,269 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipFile.java | ZipFile.getEntry | 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;
} | java | 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;
} | [
"public",
"ZipEntry",
"getEntry",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"name\"",
")",
";",
"}",
"long",
"jzentry",
"=",
"0",
";",
"synchronized",
"(",
"this",
")",
"{... | Returns the zip file entry for the specified name, or null
if not found.
@param name the name of the entry
@return the zip file entry, or null if not found
@throws IllegalStateException if the zip file has been closed | [
"Returns",
"the",
"zip",
"file",
"entry",
"for",
"the",
"specified",
"name",
"or",
"null",
"if",
"not",
"found",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipFile.java#L309-L324 |
35,270 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipFile.java | ZipFile.entries | 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;
}
}
};
} | java | 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;
}
}
};
} | [
"public",
"Enumeration",
"<",
"?",
"extends",
"ZipEntry",
">",
"entries",
"(",
")",
"{",
"ensureOpen",
"(",
")",
";",
"return",
"new",
"Enumeration",
"<",
"ZipEntry",
">",
"(",
")",
"{",
"private",
"int",
"i",
"=",
"0",
";",
"public",
"boolean",
"hasMo... | Returns an enumeration of the ZIP file entries.
@return an enumeration of the ZIP file entries
@throws IllegalStateException if the zip file has been closed | [
"Returns",
"an",
"enumeration",
"of",
"the",
"ZIP",
"file",
"entries",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipFile.java#L491-L529 |
35,271 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/PolicyInformation.java | PolicyInformation.encode | 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);
} | java | 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);
} | [
"public",
"void",
"encode",
"(",
"DerOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"DerOutputStream",
"tmp",
"=",
"new",
"DerOutputStream",
"(",
")",
";",
"policyIdentifier",
".",
"encode",
"(",
"tmp",
")",
";",
"if",
"(",
"!",
"policyQualifiers",
... | Write the PolicyInformation to the DerOutputStream.
@param out the DerOutputStream to write the extension to.
@exception IOException on encoding errors. | [
"Write",
"the",
"PolicyInformation",
"to",
"the",
"DerOutputStream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/PolicyInformation.java#L272-L283 |
35,272 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TimeUnit.java | TimeUnit.readResolve | private Object readResolve() throws ObjectStreamException {
// The old index field used to uniquely identify the time unit.
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);
}
} | java | private Object readResolve() throws ObjectStreamException {
// The old index field used to uniquely identify the time unit.
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);
}
} | [
"private",
"Object",
"readResolve",
"(",
")",
"throws",
"ObjectStreamException",
"{",
"// The old index field used to uniquely identify the time unit.",
"switch",
"(",
"index",
")",
"{",
"case",
"6",
":",
"return",
"SECOND",
";",
"case",
"5",
":",
"return",
"MINUTE",
... | For backward compatibility only | [
"For",
"backward",
"compatibility",
"only"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TimeUnit.java#L46-L66 |
35,273 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/LongPipeline.java | LongPipeline.asDoubleStream | @Override
public final DoubleStream asDoubleStream() {
return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
@Override
public Sink<Long> opWrapSink(int flags, Sink<Double> sink) {
return new Sink.ChainedLong<Double>(sink) {
@Override
public void accept(long t) {
downstream.accept((double) t);
}
};
}
};
} | java | @Override
public final DoubleStream asDoubleStream() {
return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
@Override
public Sink<Long> opWrapSink(int flags, Sink<Double> sink) {
return new Sink.ChainedLong<Double>(sink) {
@Override
public void accept(long t) {
downstream.accept((double) t);
}
};
}
};
} | [
"@",
"Override",
"public",
"final",
"DoubleStream",
"asDoubleStream",
"(",
")",
"{",
"return",
"new",
"DoublePipeline",
".",
"StatelessOp",
"<",
"Long",
">",
"(",
"this",
",",
"StreamShape",
".",
"LONG_VALUE",
",",
"StreamOpFlag",
".",
"NOT_SORTED",
"|",
"Stre... | Stateless intermediate ops from LongStream | [
"Stateless",
"intermediate",
"ops",
"from",
"LongStream"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/LongPipeline.java#L184-L198 |
35,274 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/LongPipeline.java | LongPipeline.limit | @Override
public final LongStream limit(long maxSize) {
if (maxSize < 0)
throw new IllegalArgumentException(Long.toString(maxSize));
return SliceOps.makeLong(this, 0, maxSize);
} | java | @Override
public final LongStream limit(long maxSize) {
if (maxSize < 0)
throw new IllegalArgumentException(Long.toString(maxSize));
return SliceOps.makeLong(this, 0, maxSize);
} | [
"@",
"Override",
"public",
"final",
"LongStream",
"limit",
"(",
"long",
"maxSize",
")",
"{",
"if",
"(",
"maxSize",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"Long",
".",
"toString",
"(",
"maxSize",
")",
")",
";",
"return",
"SliceOps",... | Stateful intermediate ops from LongStream | [
"Stateful",
"intermediate",
"ops",
"from",
"LongStream"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/LongPipeline.java#L353-L358 |
35,275 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliterationRule.java | TransliterationRule.getIndexValue | final int getIndexValue() {
if (anteContextLength == pattern.length()) {
// A pattern with just ante context {such as foo)>bar} can
// match any key.
return -1;
}
int c = UTF16.charAt(pattern, anteContextLength);
return data.lookupMatcher(c) == null ? (c & 0xFF) : -1;
} | java | final int getIndexValue() {
if (anteContextLength == pattern.length()) {
// A pattern with just ante context {such as foo)>bar} can
// match any key.
return -1;
}
int c = UTF16.charAt(pattern, anteContextLength);
return data.lookupMatcher(c) == null ? (c & 0xFF) : -1;
} | [
"final",
"int",
"getIndexValue",
"(",
")",
"{",
"if",
"(",
"anteContextLength",
"==",
"pattern",
".",
"length",
"(",
")",
")",
"{",
"// A pattern with just ante context {such as foo)>bar} can",
"// match any key.",
"return",
"-",
"1",
";",
"}",
"int",
"c",
"=",
... | 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. | [
"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",
"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliterationRule.java#L240-L248 |
35,276 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliterationRule.java | TransliterationRule.matchesIndexValue | final boolean matchesIndexValue(int v) {
// Delegate to the key, or if there is none, to the postContext.
// If there is neither then we match any key; return true.
UnicodeMatcher m = (key != null) ? key : postContext;
return (m != null) ? m.matchesIndexValue(v) : true;
} | java | final boolean matchesIndexValue(int v) {
// Delegate to the key, or if there is none, to the postContext.
// If there is neither then we match any key; return true.
UnicodeMatcher m = (key != null) ? key : postContext;
return (m != null) ? m.matchesIndexValue(v) : true;
} | [
"final",
"boolean",
"matchesIndexValue",
"(",
"int",
"v",
")",
"{",
"// Delegate to the key, or if there is none, to the postContext.",
"// If there is neither then we match any key; return true.",
"UnicodeMatcher",
"m",
"=",
"(",
"key",
"!=",
"null",
")",
"?",
"key",
":",
... | 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. | [
"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",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliterationRule.java#L260-L265 |
35,277 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliterationRule.java | TransliterationRule.matchAndReplace | public int matchAndReplace(Replaceable text,
Transliterator.Position pos,
boolean incremental) {
// Matching and replacing are done in one method because the
// replacement operation needs information obtained during the
// match. Another way to do this is to have the match method
// create a match result struct with relevant offsets, and to pass
// this into the replace method.
// ============================ MATCH ===========================
// Reset segment match data
if (segments != null) {
for (int i=0; i<segments.length; ++i) {
((StringMatcher) segments[i]).resetMatch();
}
}
int keyLimit;
int[] intRef = new int[1];
// ------------------------ Ante Context ------------------------
// A mismatch in the ante context, or with the start anchor,
// is an outright U_MISMATCH regardless of whether we are
// incremental or not.
int oText; // offset into 'text'
int minOText;
// Note (1): We process text in 16-bit code units, rather than
// 32-bit code points. This works because stand-ins are
// always in the BMP and because we are doing a literal match
// operation, which can be done 16-bits at a time.
int anteLimit = posBefore(text, pos.contextStart);
int match;
// Start reverse match at char before pos.start
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);
// ------------------------ Start Anchor ------------------------
if (((flags & ANCHOR_START) != 0) && oText != anteLimit) {
return UnicodeMatcher.U_MISMATCH;
}
// -------------------- Key and Post Context --------------------
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) {
// The key matches just before pos.limit, and there is
// a postContext. Since we are in incremental mode,
// we must assume more characters may be inserted at
// pos.limit -- this is a partial match.
return UnicodeMatcher.U_PARTIAL_MATCH;
}
match = postContext.matches(text, intRef, pos.contextLimit, incremental);
if (match != UnicodeMatcher.U_MATCH) {
return match;
}
}
oText = intRef[0];
// ------------------------- Stop Anchor ------------------------
if (((flags & ANCHOR_END)) != 0) {
if (oText != pos.contextLimit) {
return UnicodeMatcher.U_MISMATCH;
}
if (incremental) {
return UnicodeMatcher.U_PARTIAL_MATCH;
}
}
// =========================== REPLACE ==========================
// We have a full match. The key is between pos.start and
// keyLimit.
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;
// Restrict new value of start to [minOText, min(oText, pos.limit)].
pos.start = Math.max(minOText, Math.min(Math.min(oText, pos.limit), newStart));
return UnicodeMatcher.U_MATCH;
} | java | public int matchAndReplace(Replaceable text,
Transliterator.Position pos,
boolean incremental) {
// Matching and replacing are done in one method because the
// replacement operation needs information obtained during the
// match. Another way to do this is to have the match method
// create a match result struct with relevant offsets, and to pass
// this into the replace method.
// ============================ MATCH ===========================
// Reset segment match data
if (segments != null) {
for (int i=0; i<segments.length; ++i) {
((StringMatcher) segments[i]).resetMatch();
}
}
int keyLimit;
int[] intRef = new int[1];
// ------------------------ Ante Context ------------------------
// A mismatch in the ante context, or with the start anchor,
// is an outright U_MISMATCH regardless of whether we are
// incremental or not.
int oText; // offset into 'text'
int minOText;
// Note (1): We process text in 16-bit code units, rather than
// 32-bit code points. This works because stand-ins are
// always in the BMP and because we are doing a literal match
// operation, which can be done 16-bits at a time.
int anteLimit = posBefore(text, pos.contextStart);
int match;
// Start reverse match at char before pos.start
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);
// ------------------------ Start Anchor ------------------------
if (((flags & ANCHOR_START) != 0) && oText != anteLimit) {
return UnicodeMatcher.U_MISMATCH;
}
// -------------------- Key and Post Context --------------------
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) {
// The key matches just before pos.limit, and there is
// a postContext. Since we are in incremental mode,
// we must assume more characters may be inserted at
// pos.limit -- this is a partial match.
return UnicodeMatcher.U_PARTIAL_MATCH;
}
match = postContext.matches(text, intRef, pos.contextLimit, incremental);
if (match != UnicodeMatcher.U_MATCH) {
return match;
}
}
oText = intRef[0];
// ------------------------- Stop Anchor ------------------------
if (((flags & ANCHOR_END)) != 0) {
if (oText != pos.contextLimit) {
return UnicodeMatcher.U_MISMATCH;
}
if (incremental) {
return UnicodeMatcher.U_PARTIAL_MATCH;
}
}
// =========================== REPLACE ==========================
// We have a full match. The key is between pos.start and
// keyLimit.
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;
// Restrict new value of start to [minOText, min(oText, pos.limit)].
pos.start = Math.max(minOText, Math.min(Math.min(oText, pos.limit), newStart));
return UnicodeMatcher.U_MATCH;
} | [
"public",
"int",
"matchAndReplace",
"(",
"Replaceable",
"text",
",",
"Transliterator",
".",
"Position",
"pos",
",",
"boolean",
"incremental",
")",
"{",
"// Matching and replacing are done in one method because the",
"// replacement operation needs information obtained during the",
... | 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.
If a full match is obtained, perform a replacement, update pos,
and return U_MATCH. Otherwise both text and pos are unchanged.
@param text the text
@param pos the position indices
@param incremental if TRUE, test for partial matches that may
be completed by additional text inserted at pos.limit.
@return one of <code>U_MISMATCH</code>,
<code>U_PARTIAL_MATCH</code>, or <code>U_MATCH</code>. If
incremental is FALSE then U_PARTIAL_MATCH will not be returned. | [
"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",
"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliterationRule.java#L370-L484 |
35,278 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliterationRule.java | TransliterationRule.toRule | public String toRule(boolean escapeUnprintable) {
// int i;
StringBuffer rule = new StringBuffer();
// Accumulate special characters (and non-specials following them)
// into quoteBuf. Append quoteBuf, within single quotes, when
// a non-quoted element must be inserted.
StringBuffer quoteBuf = new StringBuffer();
// Do not emit the braces '{' '}' around the pattern if there
// is neither anteContext nor postContext.
boolean emitBraces =
(anteContext != null) || (postContext != null);
// Emit start anchor
if ((flags & ANCHOR_START) != 0) {
rule.append('^');
}
// Emit the input pattern
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);
// Emit end anchor
if ((flags & ANCHOR_END) != 0) {
rule.append('$');
}
Utility.appendToRule(rule, " > ", true, escapeUnprintable, quoteBuf);
// Emit the output pattern
Utility.appendToRule(rule, output.toReplacerPattern(escapeUnprintable),
true, escapeUnprintable, quoteBuf);
Utility.appendToRule(rule, ';', true, escapeUnprintable, quoteBuf);
return rule.toString();
} | java | public String toRule(boolean escapeUnprintable) {
// int i;
StringBuffer rule = new StringBuffer();
// Accumulate special characters (and non-specials following them)
// into quoteBuf. Append quoteBuf, within single quotes, when
// a non-quoted element must be inserted.
StringBuffer quoteBuf = new StringBuffer();
// Do not emit the braces '{' '}' around the pattern if there
// is neither anteContext nor postContext.
boolean emitBraces =
(anteContext != null) || (postContext != null);
// Emit start anchor
if ((flags & ANCHOR_START) != 0) {
rule.append('^');
}
// Emit the input pattern
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);
// Emit end anchor
if ((flags & ANCHOR_END) != 0) {
rule.append('$');
}
Utility.appendToRule(rule, " > ", true, escapeUnprintable, quoteBuf);
// Emit the output pattern
Utility.appendToRule(rule, output.toReplacerPattern(escapeUnprintable),
true, escapeUnprintable, quoteBuf);
Utility.appendToRule(rule, ';', true, escapeUnprintable, quoteBuf);
return rule.toString();
} | [
"public",
"String",
"toRule",
"(",
"boolean",
"escapeUnprintable",
")",
"{",
"// int i;",
"StringBuffer",
"rule",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"// Accumulate special characters (and non-specials following them)",
"// into quoteBuf. Append quoteBuf, within single qu... | Create a source string that represents this rule. Append it to the
given string. | [
"Create",
"a",
"source",
"string",
"that",
"represents",
"this",
"rule",
".",
"Append",
"it",
"to",
"the",
"given",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliterationRule.java#L490-L540 |
35,279 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliterationRule.java | TransliterationRule.addSourceTargetSet | void addSourceTargetSet(UnicodeSet filter, UnicodeSet sourceSet, UnicodeSet targetSet, UnicodeSet revisiting) {
int limit = anteContextLength + keyLength;
UnicodeSet tempSource = new UnicodeSet();
UnicodeSet temp = new UnicodeSet();
// We need to walk through the pattern.
// Iff some of the characters at ALL of the the positions are matched by the filter, then we add temp to toUnionTo
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) { // if the matcher is not a UnicodeSet
temp.clear();
matcher.addMatchSetTo(temp);
if (!filter.containsSome(temp)) {
return;
}
tempSource.addAll(temp);
}
}
}
// if we made our way through the gauntlet, add to source/target
sourceSet.addAll(tempSource);
output.addReplacementSetTo(targetSet);
} | java | void addSourceTargetSet(UnicodeSet filter, UnicodeSet sourceSet, UnicodeSet targetSet, UnicodeSet revisiting) {
int limit = anteContextLength + keyLength;
UnicodeSet tempSource = new UnicodeSet();
UnicodeSet temp = new UnicodeSet();
// We need to walk through the pattern.
// Iff some of the characters at ALL of the the positions are matched by the filter, then we add temp to toUnionTo
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) { // if the matcher is not a UnicodeSet
temp.clear();
matcher.addMatchSetTo(temp);
if (!filter.containsSome(temp)) {
return;
}
tempSource.addAll(temp);
}
}
}
// if we made our way through the gauntlet, add to source/target
sourceSet.addAll(tempSource);
output.addReplacementSetTo(targetSet);
} | [
"void",
"addSourceTargetSet",
"(",
"UnicodeSet",
"filter",
",",
"UnicodeSet",
"sourceSet",
",",
"UnicodeSet",
"targetSet",
",",
"UnicodeSet",
"revisiting",
")",
"{",
"int",
"limit",
"=",
"anteContextLength",
"+",
"keyLength",
";",
"UnicodeSet",
"tempSource",
"=",
... | However, following code applying the filter won't catch that case. | [
"However",
"following",
"code",
"applying",
"the",
"filter",
"won",
"t",
"catch",
"that",
"case",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliterationRule.java#L560-L595 |
35,280 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLClassLoader.java | URLClassLoader.findResources | @Override
public Enumeration<URL> findResources(final String name) throws IOException {
if (name == null) {
return null;
}
// On iOS, every resource is resolved by the SystemClassLoader, so
// any URL in this class loader will, too.
return Collections.enumeration(urls);
} | java | @Override
public Enumeration<URL> findResources(final String name) throws IOException {
if (name == null) {
return null;
}
// On iOS, every resource is resolved by the SystemClassLoader, so
// any URL in this class loader will, too.
return Collections.enumeration(urls);
} | [
"@",
"Override",
"public",
"Enumeration",
"<",
"URL",
">",
"findResources",
"(",
"final",
"String",
"name",
")",
"throws",
"IOException",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"// On iOS, every resource is resolved by the Sy... | Returns all known URLs which point to the specified resource.
@param name
the name of the requested resource.
@return the enumeration of URLs which point to the specified resource.
@throws IOException
if an I/O error occurs while attempting to connect. | [
"Returns",
"all",
"known",
"URLs",
"which",
"point",
"to",
"the",
"specified",
"resource",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLClassLoader.java#L89-L97 |
35,281 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/EnumSet.java | EnumSet.noneOf | 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);
} | java | 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);
} | [
"public",
"static",
"<",
"E",
"extends",
"Enum",
"<",
"E",
">",
">",
"EnumSet",
"<",
"E",
">",
"noneOf",
"(",
"Class",
"<",
"E",
">",
"elementType",
")",
"{",
"Enum",
"<",
"?",
">",
"[",
"]",
"universe",
"=",
"getUniverse",
"(",
"elementType",
")",... | Creates an empty enum set with the specified element type.
@param <E> The class of the elements in the set
@param elementType the class object of the element type for this enum
set
@return An empty enum set of the specified type.
@throws NullPointerException if <tt>elementType</tt> is null | [
"Creates",
"an",
"empty",
"enum",
"set",
"with",
"the",
"specified",
"element",
"type",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/EnumSet.java#L108-L117 |
35,282 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/EnumSet.java | EnumSet.allOf | public static <E extends Enum<E>> EnumSet<E> allOf(Class<E> elementType) {
EnumSet<E> result = noneOf(elementType);
result.addAll();
return result;
} | java | public static <E extends Enum<E>> EnumSet<E> allOf(Class<E> elementType) {
EnumSet<E> result = noneOf(elementType);
result.addAll();
return result;
} | [
"public",
"static",
"<",
"E",
"extends",
"Enum",
"<",
"E",
">",
">",
"EnumSet",
"<",
"E",
">",
"allOf",
"(",
"Class",
"<",
"E",
">",
"elementType",
")",
"{",
"EnumSet",
"<",
"E",
">",
"result",
"=",
"noneOf",
"(",
"elementType",
")",
";",
"result",... | Creates an enum set containing all of the elements in the specified
element type.
@param <E> The class of the elements in the set
@param elementType the class object of the element type for this enum
set
@return An enum set containing all the elements in the specified type.
@throws NullPointerException if <tt>elementType</tt> is null | [
"Creates",
"an",
"enum",
"set",
"containing",
"all",
"of",
"the",
"elements",
"in",
"the",
"specified",
"element",
"type",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/EnumSet.java#L129-L133 |
35,283 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/EnumSet.java | EnumSet.of | public static <E extends Enum<E>> EnumSet<E> of(E e) {
EnumSet<E> result = noneOf(e.getDeclaringClass());
result.add(e);
return result;
} | java | public static <E extends Enum<E>> EnumSet<E> of(E e) {
EnumSet<E> result = noneOf(e.getDeclaringClass());
result.add(e);
return result;
} | [
"public",
"static",
"<",
"E",
"extends",
"Enum",
"<",
"E",
">",
">",
"EnumSet",
"<",
"E",
">",
"of",
"(",
"E",
"e",
")",
"{",
"EnumSet",
"<",
"E",
">",
"result",
"=",
"noneOf",
"(",
"e",
".",
"getDeclaringClass",
"(",
")",
")",
";",
"result",
"... | Creates an enum set initially containing the specified element.
Overloadings of this method exist to initialize an enum set with
one through five elements. A sixth overloading is provided that
uses the varargs feature. This overloading may be used to create
an enum set initially containing an arbitrary number of elements, but
is likely to run slower than the overloadings that do not use varargs.
@param <E> The class of the specified element and of the set
@param e the element that this set is to contain initially
@throws NullPointerException if <tt>e</tt> is null
@return an enum set initially containing the specified element | [
"Creates",
"an",
"enum",
"set",
"initially",
"containing",
"the",
"specified",
"element",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/EnumSet.java#L218-L222 |
35,284 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/EnumSet.java | EnumSet.of | 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;
} | java | 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;
} | [
"public",
"static",
"<",
"E",
"extends",
"Enum",
"<",
"E",
">",
">",
"EnumSet",
"<",
"E",
">",
"of",
"(",
"E",
"e1",
",",
"E",
"e2",
")",
"{",
"EnumSet",
"<",
"E",
">",
"result",
"=",
"noneOf",
"(",
"e1",
".",
"getDeclaringClass",
"(",
")",
")"... | Creates an enum set initially containing the specified elements.
Overloadings of this method exist to initialize an enum set with
one through five elements. A sixth overloading is provided that
uses the varargs feature. This overloading may be used to create
an enum set initially containing an arbitrary number of elements, but
is likely to run slower than the overloadings that do not use varargs.
@param <E> The class of the parameter elements and of the set
@param e1 an element that this set is to contain initially
@param e2 another element that this set is to contain initially
@throws NullPointerException if any parameters are null
@return an enum set initially containing the specified elements | [
"Creates",
"an",
"enum",
"set",
"initially",
"containing",
"the",
"specified",
"elements",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/EnumSet.java#L239-L244 |
35,285 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/EnumSet.java | EnumSet.of | @SafeVarargs
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;
} | java | @SafeVarargs
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;
} | [
"@",
"SafeVarargs",
"public",
"static",
"<",
"E",
"extends",
"Enum",
"<",
"E",
">",
">",
"EnumSet",
"<",
"E",
">",
"of",
"(",
"E",
"first",
",",
"E",
"...",
"rest",
")",
"{",
"EnumSet",
"<",
"E",
">",
"result",
"=",
"noneOf",
"(",
"first",
".",
... | 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.
@param <E> The class of the parameter elements and of the set
@param first an element that the set is to contain initially
@param rest the remaining elements the set is to contain initially
@throws NullPointerException if any of the specified elements are null,
or if <tt>rest</tt> is null
@return an enum set initially containing the specified elements | [
"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",
"contai... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/EnumSet.java#L340-L347 |
35,286 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/EnumSet.java | EnumSet.range | 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;
} | java | 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;
} | [
"public",
"static",
"<",
"E",
"extends",
"Enum",
"<",
"E",
">",
">",
"EnumSet",
"<",
"E",
">",
"range",
"(",
"E",
"from",
",",
"E",
"to",
")",
"{",
"if",
"(",
"from",
".",
"compareTo",
"(",
"to",
")",
">",
"0",
")",
"throw",
"new",
"IllegalArgu... | 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.
@param <E> The class of the parameter elements and of the set
@param from the first element in the range
@param to the last element in the range
@throws NullPointerException if {@code from} or {@code to} are null
@throws IllegalArgumentException if {@code from.compareTo(to) > 0}
@return an enum set initially containing all of the elements in the
range defined by the two specified endpoints | [
"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... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/EnumSet.java#L363-L369 |
35,287 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/EnumSet.java | EnumSet.getUniverse | private static <E extends Enum<E>> E[] getUniverse(Class<E> elementType) {
// Android-changed: Use JavaLangAccess directly instead of going via
// SharedSecrets.
return java.lang.JavaLangAccess.getEnumConstantsShared(elementType);
} | java | private static <E extends Enum<E>> E[] getUniverse(Class<E> elementType) {
// Android-changed: Use JavaLangAccess directly instead of going via
// SharedSecrets.
return java.lang.JavaLangAccess.getEnumConstantsShared(elementType);
} | [
"private",
"static",
"<",
"E",
"extends",
"Enum",
"<",
"E",
">",
">",
"E",
"[",
"]",
"getUniverse",
"(",
"Class",
"<",
"E",
">",
"elementType",
")",
"{",
"// Android-changed: Use JavaLangAccess directly instead of going via",
"// SharedSecrets.",
"return",
"java",
... | Returns all of the values comprising E.
The result is uncloned, cached, and shared by all callers. | [
"Returns",
"all",
"of",
"the",
"values",
"comprising",
"E",
".",
"The",
"result",
"is",
"uncloned",
"cached",
"and",
"shared",
"by",
"all",
"callers",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/EnumSet.java#L409-L413 |
35,288 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/Vertex.java | Vertex.certToString | 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();
} | java | 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();
} | [
"public",
"String",
"certToString",
"(",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"X509CertImpl",
"x509Cert",
"=",
"null",
";",
"try",
"{",
"x509Cert",
"=",
"X509CertImpl",
".",
"toImpl",
"(",
"cert",
")",
";",
"}",
"c... | Return string representation of this vertex's
certificate information.
@returns String representation of certificate info | [
"Return",
"string",
"representation",
"of",
"this",
"vertex",
"s",
"certificate",
"information",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/Vertex.java#L134-L194 |
35,289 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/Vertex.java | Vertex.throwableToString | 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();
} | java | 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();
} | [
"public",
"String",
"throwableToString",
"(",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"\"Exception: \"",
")",
";",
"if",
"(",
"throwable",
"!=",
"null",
")",
"sb",
".",
"append",
"(",
"throwable",
".",
"toString",
"(",
")",
")",... | return Vertex throwable as String compatible with
the way toString returns other information
@returns String form of exception (or "none") | [
"return",
"Vertex",
"throwable",
"as",
"String",
"compatible",
"with",
"the",
"way",
"toString",
"returns",
"other",
"information"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/Vertex.java#L202-L210 |
35,290 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/ConstantBranchPruner.java | ConstantBranchPruner.removeUnreachable | 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;
} | java | 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;
} | [
"private",
"boolean",
"removeUnreachable",
"(",
"Block",
"block",
")",
"{",
"List",
"<",
"Statement",
">",
"stmts",
"=",
"block",
".",
"getStatements",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"stmts",
".",
"size",
"(",
")",
... | Removes all unreachable statements that occur after a return statement in
the given Block. Also recurses into child blocks. | [
"Removes",
"all",
"unreachable",
"statements",
"that",
"occur",
"after",
"a",
"return",
"statement",
"in",
"the",
"given",
"Block",
".",
"Also",
"recurses",
"into",
"child",
"blocks",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/ConstantBranchPruner.java#L56-L67 |
35,291 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/ConstantBranchPruner.java | ConstantBranchPruner.endVisit | @Override
public void endVisit(PrefixExpression node) {
Boolean value = getReplaceableValue(node.getOperand());
if (node.getOperator() == PrefixExpression.Operator.NOT && value != null) {
node.replaceWith(new BooleanLiteral(!value, typeUtil));
}
} | java | @Override
public void endVisit(PrefixExpression node) {
Boolean value = getReplaceableValue(node.getOperand());
if (node.getOperator() == PrefixExpression.Operator.NOT && value != null) {
node.replaceWith(new BooleanLiteral(!value, typeUtil));
}
} | [
"@",
"Override",
"public",
"void",
"endVisit",
"(",
"PrefixExpression",
"node",
")",
"{",
"Boolean",
"value",
"=",
"getReplaceableValue",
"(",
"node",
".",
"getOperand",
"(",
")",
")",
";",
"if",
"(",
"node",
".",
"getOperator",
"(",
")",
"==",
"PrefixExpr... | Invert ! boolean constant expressions. | [
"Invert",
"!",
"boolean",
"constant",
"expressions",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/ConstantBranchPruner.java#L150-L156 |
35,292 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/ConstantBranchPruner.java | ConstantBranchPruner.endVisit | @Override
public void endVisit(ParenthesizedExpression node) {
if (getReplaceableValue(node.getExpression()) != null) {
node.replaceWith(node.getExpression().copy());
}
} | java | @Override
public void endVisit(ParenthesizedExpression node) {
if (getReplaceableValue(node.getExpression()) != null) {
node.replaceWith(node.getExpression().copy());
}
} | [
"@",
"Override",
"public",
"void",
"endVisit",
"(",
"ParenthesizedExpression",
"node",
")",
"{",
"if",
"(",
"getReplaceableValue",
"(",
"node",
".",
"getExpression",
"(",
")",
")",
"!=",
"null",
")",
"{",
"node",
".",
"replaceWith",
"(",
"node",
".",
"getE... | Remove parentheses around constant booleans. | [
"Remove",
"parentheses",
"around",
"constant",
"booleans",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/ConstantBranchPruner.java#L161-L166 |
35,293 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/ConstantBranchPruner.java | ConstantBranchPruner.getKnownValue | 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) {
// We assume that this node has already been visited and pruned so
// if it has a known value, it will be equal to the last operand.
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;
}
} | java | 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) {
// We assume that this node has already been visited and pruned so
// if it has a known value, it will be equal to the last operand.
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;
}
} | [
"private",
"Boolean",
"getKnownValue",
"(",
"Expression",
"expr",
")",
"{",
"Object",
"value",
"=",
"expr",
".",
"getConstantValue",
"(",
")",
";",
"if",
"(",
"value",
"instanceof",
"Boolean",
")",
"{",
"return",
"(",
"Boolean",
")",
"value",
";",
"}",
"... | 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. | [
"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",
"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/ConstantBranchPruner.java#L194-L222 |
35,294 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/ConstantBranchPruner.java | ConstantBranchPruner.getSideEffects | private Statement getSideEffects(Expression expr) {
Expression sideEffectsExpr = extractSideEffects(expr);
return sideEffectsExpr == null ? null : new ExpressionStatement(sideEffectsExpr);
} | java | private Statement getSideEffects(Expression expr) {
Expression sideEffectsExpr = extractSideEffects(expr);
return sideEffectsExpr == null ? null : new ExpressionStatement(sideEffectsExpr);
} | [
"private",
"Statement",
"getSideEffects",
"(",
"Expression",
"expr",
")",
"{",
"Expression",
"sideEffectsExpr",
"=",
"extractSideEffects",
"(",
"expr",
")",
";",
"return",
"sideEffectsExpr",
"==",
"null",
"?",
"null",
":",
"new",
"ExpressionStatement",
"(",
"sideE... | Extracts side effects from the given expression and returns the statement
to insert. | [
"Extracts",
"side",
"effects",
"from",
"the",
"given",
"expression",
"and",
"returns",
"the",
"statement",
"to",
"insert",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/ConstantBranchPruner.java#L228-L231 |
35,295 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/ConstantBranchPruner.java | ConstantBranchPruner.extractSideEffects | 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;
}
} | java | 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;
}
} | [
"private",
"Expression",
"extractSideEffects",
"(",
"Expression",
"expr",
")",
"{",
"if",
"(",
"expr",
".",
"getConstantValue",
"(",
")",
"instanceof",
"Boolean",
")",
"{",
"return",
"null",
";",
"}",
"switch",
"(",
"expr",
".",
"getKind",
"(",
")",
")",
... | Returns an expression containing the side effects of the given expression.
The evaluated result of the expression may differ from the original. | [
"Returns",
"an",
"expression",
"containing",
"the",
"side",
"effects",
"of",
"the",
"given",
"expression",
".",
"The",
"evaluated",
"result",
"of",
"the",
"expression",
"may",
"differ",
"from",
"the",
"original",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/ConstantBranchPruner.java#L237-L267 |
35,296 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/OCSPResponse.java | OCSPResponse.initializeClockSkew | private static int initializeClockSkew() {
// Integer tmp = java.security.AccessController.doPrivileged(
// new GetIntegerAction("com.sun.security.ocsp.clockSkew"));
Integer tmp = Integer.getInteger("com.sun.security.ocsp.clockSkew");
if (tmp == null || tmp < 0) {
return DEFAULT_MAX_CLOCK_SKEW;
}
// Convert to milliseconds, as the system property will be
// specified in seconds
return tmp * 1000;
} | java | private static int initializeClockSkew() {
// Integer tmp = java.security.AccessController.doPrivileged(
// new GetIntegerAction("com.sun.security.ocsp.clockSkew"));
Integer tmp = Integer.getInteger("com.sun.security.ocsp.clockSkew");
if (tmp == null || tmp < 0) {
return DEFAULT_MAX_CLOCK_SKEW;
}
// Convert to milliseconds, as the system property will be
// specified in seconds
return tmp * 1000;
} | [
"private",
"static",
"int",
"initializeClockSkew",
"(",
")",
"{",
"// Integer tmp = java.security.AccessController.doPrivileged(",
"// new GetIntegerAction(\"com.sun.security.ocsp.clockSkew\"));",
"Integer",
"tmp",
"=",
"Integer",
".",
"getInteger",
"(",
"\"com.... | 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. | [
"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",
"ske... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/OCSPResponse.java#L163-L173 |
35,297 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/Collectors.java | Collectors.computeFinalSum | static double computeFinalSum(double[] summands) {
// Better error bounds to add both terms as the final sum
double tmp = summands[0] + summands[1];
double simpleSum = summands[summands.length - 1];
if (Double.isNaN(tmp) && Double.isInfinite(simpleSum))
return simpleSum;
else
return tmp;
} | java | static double computeFinalSum(double[] summands) {
// Better error bounds to add both terms as the final sum
double tmp = summands[0] + summands[1];
double simpleSum = summands[summands.length - 1];
if (Double.isNaN(tmp) && Double.isInfinite(simpleSum))
return simpleSum;
else
return tmp;
} | [
"static",
"double",
"computeFinalSum",
"(",
"double",
"[",
"]",
"summands",
")",
"{",
"// Better error bounds to add both terms as the final sum",
"double",
"tmp",
"=",
"summands",
"[",
"0",
"]",
"+",
"summands",
"[",
"1",
"]",
";",
"double",
"simpleSum",
"=",
"... | 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. | [
"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",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/Collectors.java#L552-L560 |
35,298 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/StringSearch.java | StringSearch.setPattern | 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();
} | java | 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();
} | [
"public",
"void",
"setPattern",
"(",
"String",
"pattern",
")",
"{",
"if",
"(",
"pattern",
"==",
"null",
"||",
"pattern",
".",
"length",
"(",
")",
"<=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Pattern to search for can not be null or of... | Set the pattern to search for.
The iterator's position will not be changed by this method.
@param pattern for searching
@see #getPattern
@exception IllegalArgumentException thrown if pattern is null or of
length 0 | [
"Set",
"the",
"pattern",
"to",
"search",
"for",
".",
"The",
"iterator",
"s",
"position",
"will",
"not",
"be",
"changed",
"by",
"this",
"method",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/StringSearch.java#L345-L352 |
35,299 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/StringSearch.java | StringSearch.getMask | private static int getMask(int strength) {
switch (strength) {
case Collator.PRIMARY:
return PRIMARYORDERMASK;
case Collator.SECONDARY:
return SECONDARYORDERMASK | PRIMARYORDERMASK;
default:
return TERTIARYORDERMASK | SECONDARYORDERMASK | PRIMARYORDERMASK;
}
} | java | private static int getMask(int strength) {
switch (strength) {
case Collator.PRIMARY:
return PRIMARYORDERMASK;
case Collator.SECONDARY:
return SECONDARYORDERMASK | PRIMARYORDERMASK;
default:
return TERTIARYORDERMASK | SECONDARYORDERMASK | PRIMARYORDERMASK;
}
} | [
"private",
"static",
"int",
"getMask",
"(",
"int",
"strength",
")",
"{",
"switch",
"(",
"strength",
")",
"{",
"case",
"Collator",
".",
"PRIMARY",
":",
"return",
"PRIMARYORDERMASK",
";",
"case",
"Collator",
".",
"SECONDARY",
":",
"return",
"SECONDARYORDERMASK",... | Getting the mask for collation strength
@param strength collation strength
@return collation element mask | [
"Getting",
"the",
"mask",
"for",
"collation",
"strength"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/StringSearch.java#L562-L571 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.