signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ConstantClassInfo { /** * Used to describe an array class . */
static ConstantClassInfo make ( ConstantPool cp , String className , int dim ) { } } | ConstantInfo ci = new ConstantClassInfo ( cp , className , dim ) ; return ( ConstantClassInfo ) cp . addConstant ( ci ) ; |
public class JSONObject { /** * Returns an array with the values corresponding to { @ code names } . The array contains
* null for names that aren ' t mapped . This method returns null if { @ code names } is
* either null or empty .
* @ param names the names of the properties
* @ return the array */
public JSONArray toJSONArray ( JSONArray names ) { } } | JSONArray result = new JSONArray ( ) ; if ( names == null ) { return null ; } int length = names . length ( ) ; if ( length == 0 ) { return null ; } for ( int i = 0 ; i < length ; i ++ ) { String name = JSON . toString ( names . opt ( i ) ) ; result . put ( opt ( name ) ) ; } return result ; |
public class X509CertSelector { /** * A private method that adds a name ( String or byte array ) to the
* pathToNames criterion . The { @ code X509Certificate } must contain
* the specified pathToName .
* @ param type the name type ( 0-8 , as specified in
* RFC 3280 , section 4.2.1.7)
* @ param name the name in string or byte array form
* @ throws IOException if an encoding error occurs ( incorrect form for DN ) */
private void addPathToNameInternal ( int type , Object name ) throws IOException { } } | // First , ensure that the name parses
GeneralNameInterface tempName = makeGeneralNameInterface ( type , name ) ; if ( pathToGeneralNames == null ) { pathToNames = new HashSet < List < ? > > ( ) ; pathToGeneralNames = new HashSet < GeneralNameInterface > ( ) ; } List < Object > list = new ArrayList < Object > ( 2 ) ; list . add ( Integer . valueOf ( type ) ) ; list . add ( name ) ; pathToNames . add ( list ) ; pathToGeneralNames . add ( tempName ) ; |
public class IdentityOpenHashSet { /** * implemented as per wiki suggested algo with minor adjustments . */
private void compactAndRemove ( final E [ ] buffer , final int mask , int removeHashIndex ) { } } | // remove ( 9a ) : [ 9a , 9b , 10a , 9c , 10b , 11a , null ] - > [ 9b , 9c , 10a , 10b , null , 11a , null ]
removeHashIndex = removeHashIndex & mask ; int j = removeHashIndex ; while ( true ) { int k ; // skip elements which belong where they are
do { // j : = ( j + 1 ) modulo num _ slots
j = ( j + 1 ) & mask ; // if slot [ j ] is unoccupied exit
if ( buffer [ j ] == null ) { // delete last duplicate slot
buffer [ removeHashIndex ] = null ; return ; } // k : = hash ( slot [ j ] . key ) modulo num _ slots
k = System . identityHashCode ( buffer [ j ] ) & mask ; // determine if k lies cyclically in [ i , j ]
// | i . k . j |
// | . . . . j i . k . | or | . k . . j i . . . |
} while ( ( removeHashIndex <= j ) ? ( ( removeHashIndex < k ) && ( k <= j ) ) : ( ( removeHashIndex < k ) || ( k <= j ) ) ) ; // slot [ removeHashIndex ] : = slot [ j ]
buffer [ removeHashIndex ] = buffer [ j ] ; // removeHashIndex : = j
removeHashIndex = j ; } |
public class UIViewRoot { /** * < p > < span class = " changed _ added _ 2_0 " > Override < / span > the default
* { @ link UIComponentBase # encodeBegin } behavior . If
* { @ link # getBeforePhaseListener } returns non - < code > null < / code > ,
* invoke it , passing a { @ link PhaseEvent } for the { @ link
* PhaseId # RENDER _ RESPONSE } phase . If the internal list populated
* by calls to { @ link # addPhaseListener } is non - empty , any listeners
* in that list must have their { @ link PhaseListener # beforePhase }
* method called , passing the < code > PhaseEvent < / code > . Any errors
* that occur during invocation of any of the the beforePhase
* listeners must be logged and swallowed . After listeners are invoked
* call superclass processing . < / p > */
@ Override public void encodeBegin ( FacesContext context ) throws IOException { } } | initState ( ) ; notifyBefore ( context , PhaseId . RENDER_RESPONSE ) ; if ( ! context . getResponseComplete ( ) ) { super . encodeBegin ( context ) ; } |
public class CredentialConfiguration { /** * Get the credential as configured .
* < p > The following is the order in which properties are applied to create the Credential :
* < ol >
* < li > If service accounts are not disabled and no service account key file or service account
* parameters are set , use the metadata service .
* < li > If service accounts are not disabled and a service - account email and keyfile , or service
* account parameters are provided , use service account authentication with the given
* parameters .
* < li > If service accounts are disabled and client id , client secret and OAuth credential file
* is provided , use the Installed App authentication flow .
* < li > If service accounts are disabled and null credentials are enabled for unit testing ,
* return null
* < / ol >
* @ throws IllegalStateException if none of the above conditions are met and a Credential cannot
* be created */
public Credential getCredential ( List < String > scopes ) throws IOException , GeneralSecurityException { } } | if ( isServiceAccountEnabled ( ) ) { logger . atFine ( ) . log ( "Using service account credentials" ) ; // By default , we want to use service accounts with the meta - data service ( assuming we ' re
// running in GCE ) .
if ( shouldUseMetadataService ( ) ) { logger . atFine ( ) . log ( "Getting service account credentials from meta data service." ) ; // TODO ( user ) : Validate the returned credential has access to the given scopes .
return credentialFactory . getCredentialFromMetadataServiceAccount ( ) ; } if ( ! isNullOrEmpty ( serviceAccountPrivateKeyId ) ) { logger . atFine ( ) . log ( "Attempting to get credentials from Configuration" ) ; Preconditions . checkState ( ! isNullOrEmpty ( serviceAccountPrivateKey ) , "privateKeyId must be set if using credentials configured directly in configuration" ) ; Preconditions . checkState ( ! isNullOrEmpty ( serviceAccountEmail ) , "clientEmail must be set if using credentials configured directly in configuration" ) ; Preconditions . checkArgument ( isNullOrEmpty ( serviceAccountKeyFile ) , "A P12 key file may not be specified at the same time as credentials" + " via configuration." ) ; Preconditions . checkArgument ( isNullOrEmpty ( serviceAccountJsonKeyFile ) , "A JSON key file may not be specified at the same time as credentials" + " via configuration." ) ; return credentialFactory . getCredentialsFromSAParameters ( serviceAccountPrivateKeyId , serviceAccountPrivateKey , serviceAccountEmail , scopes , getTransport ( ) ) ; } if ( ! isNullOrEmpty ( serviceAccountJsonKeyFile ) ) { logger . atFine ( ) . log ( "Using JSON keyfile %s" , serviceAccountJsonKeyFile ) ; Preconditions . checkArgument ( isNullOrEmpty ( serviceAccountKeyFile ) , "A P12 key file may not be specified at the same time as a JSON key file." ) ; Preconditions . checkArgument ( isNullOrEmpty ( serviceAccountEmail ) , "Service account email may not be specified at the same time as a JSON key file." ) ; return credentialFactory . getCredentialFromJsonKeyFile ( serviceAccountJsonKeyFile , scopes , getTransport ( ) ) ; } if ( ! isNullOrEmpty ( serviceAccountKeyFile ) ) { // A key file is specified , use email - address and p12 based authentication .
Preconditions . checkState ( ! isNullOrEmpty ( serviceAccountEmail ) , "Email must be set if using service account auth and a key file is specified." ) ; logger . atFine ( ) . log ( "Using service account email %s and private key file %s" , serviceAccountEmail , serviceAccountKeyFile ) ; return credentialFactory . getCredentialFromPrivateKeyServiceAccount ( serviceAccountEmail , serviceAccountKeyFile , scopes , getTransport ( ) ) ; } if ( shouldUseApplicationDefaultCredentials ( ) ) { logger . atFine ( ) . log ( "Getting Application Default Credentials" ) ; return credentialFactory . getApplicationDefaultCredentials ( scopes , getTransport ( ) ) ; } } else if ( oAuthCredentialFile != null && clientId != null && clientSecret != null ) { logger . atFine ( ) . log ( "Using installed app credentials in file %s" , oAuthCredentialFile ) ; return credentialFactory . getCredentialFromFileCredentialStoreForInstalledApp ( clientId , clientSecret , oAuthCredentialFile , scopes , getTransport ( ) ) ; } else if ( nullCredentialEnabled ) { logger . atWarning ( ) . log ( "Allowing null credentials for unit testing. This should not be used in production" ) ; return null ; } logger . atSevere ( ) . log ( "Credential configuration is not valid. Configuration: %s" , this ) ; throw new IllegalStateException ( "No valid credential configuration discovered." ) ; |
public class SpringContextUtils { /** * Loads a context from a XML and inject all objects in the Map
* @ param xmlPath Path for the xml applicationContext
* @ param extraBeans Extra beans for being injected
* @ return ApplicationContext generated */
public static ApplicationContext contextMergedBeans ( String xmlPath , Map < String , ? > extraBeans ) { } } | final DefaultListableBeanFactory parentBeanFactory = buildListableBeanFactory ( extraBeans ) ; // loads the xml and add definitions in the context
GenericApplicationContext parentContext = new GenericApplicationContext ( parentBeanFactory ) ; XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader ( parentContext ) ; xmlReader . loadBeanDefinitions ( xmlPath ) ; // refreshed the context to create class and make autowires
parentContext . refresh ( ) ; // return the created context
return parentContext ; |
public class Filters { /** * Equivalent to { @ link # replaceInBuffer ( java . util . regex . Pattern ,
* String ) } but takes the regular expression
* as string .
* @ param regexp the regular expression
* @ param replacement the string to be substituted for each match
* @ return the filter */
public static Filter replaceInBuffer ( final String regexp , final String replacement ) { } } | return replaceInBuffer ( Pattern . compile ( regexp ) , replacement ) ; |
public class Matrix3x2d { /** * Set this matrix to define a " view " transformation that maps the given < code > ( left , bottom ) < / code > and
* < code > ( right , top ) < / code > corners to < code > ( - 1 , - 1 ) < / code > and < code > ( 1 , 1 ) < / code > respectively .
* @ see # view ( double , double , double , double )
* @ param left
* the distance from the center to the left view edge
* @ param right
* the distance from the center to the right view edge
* @ param bottom
* the distance from the center to the bottom view edge
* @ param top
* the distance from the center to the top view edge
* @ return this */
public Matrix3x2d setView ( double left , double right , double bottom , double top ) { } } | m00 = 2.0 / ( right - left ) ; m01 = 0.0 ; m10 = 0.0 ; m11 = 2.0 / ( top - bottom ) ; m20 = ( left + right ) / ( left - right ) ; m21 = ( bottom + top ) / ( bottom - top ) ; return this ; |
public class ShasumSummaryFileTarget { /** * { @ inheritDoc } */
@ Override public void close ( final String subPath ) throws ExecutionTargetCloseException { } } | StringBuilder sb = new StringBuilder ( ) ; if ( algorithms . size ( ) != 1 ) throw new ExecutionTargetCloseException ( "Must use only one type of hash" ) ; // shasum entires are traditionally written in sorted order ( per globing argument )
@ SuppressWarnings ( "unchecked" ) Map . Entry < ChecksumFile , Map < String , String > > [ ] entries = filesHashcodes . entrySet ( ) . toArray ( ( Map . Entry < ChecksumFile , Map < String , String > > [ ] ) new Map . Entry [ 0 ] ) ; Arrays . sort ( entries , new Comparator < Map . Entry < ChecksumFile , Map < String , String > > > ( ) { @ Override public int compare ( Map . Entry < ChecksumFile , Map < String , String > > o1 , Map . Entry < ChecksumFile , Map < String , String > > o2 ) { ChecksumFile f1 = o1 . getKey ( ) ; ChecksumFile f2 = o2 . getKey ( ) ; return f1 . getRelativePath ( f1 , subPath ) . compareTo ( f2 . getRelativePath ( f2 , subPath ) ) ; } } ) ; // Write a line for each file .
for ( Map . Entry < ChecksumFile , Map < String , String > > entry : entries ) { ChecksumFile file = entry . getKey ( ) ; Map < String , String > fileHashcodes = entry . getValue ( ) ; for ( String algorithm : algorithms ) { if ( fileHashcodes . containsKey ( algorithm ) ) { sb . append ( fileHashcodes . get ( algorithm ) ) ; } } sb . append ( SHASUM_FIELD_SEPARATOR ) . append ( file . getRelativePath ( entry . getKey ( ) , subPath ) ) . append ( LINE_SEPARATOR ) ; } // Make sure the parent directory exists .
FileUtils . mkdir ( summaryFile . getParent ( ) ) ; // Write the result to the summary file .
try { FileUtils . fileWrite ( summaryFile . getPath ( ) , "US-ASCII" , sb . toString ( ) ) ; for ( ArtifactListener artifactListener : artifactListeners ) { artifactListener . artifactCreated ( summaryFile , "sum" , null , null ) ; } } catch ( IOException e ) { throw new ExecutionTargetCloseException ( e . getMessage ( ) ) ; } |
public class DummyTransaction { /** * Attempt to commit this transaction .
* @ throws RollbackException If the transaction was marked for rollback only , the transaction is rolled back
* and this exception is thrown .
* @ throws SystemException If the transaction service fails in an unexpected way .
* @ throws HeuristicMixedException If a heuristic decision was made and some some parts of the transaction have
* been committed while other parts have been rolled back .
* @ throws HeuristicRollbackException If a heuristic decision to roll back the transaction was made .
* @ throws SecurityException If the caller is not allowed to commit this transaction . */
@ Override public void commit ( ) throws RollbackException , HeuristicMixedException , HeuristicRollbackException , SecurityException , SystemException { } } | if ( trace ) { log . tracef ( "Transaction.commit() invoked in transaction with Xid=%s" , xid ) ; } if ( isDone ( ) ) { throw new IllegalStateException ( "Transaction is done. Cannot commit transaction." ) ; } runPrepare ( ) ; runCommit ( false ) ; |
public class VisitorAttributes { /** * Whether to recurse into the non - leaf file < p > . If there is a recurse filter then the result will by its
* accepts ( file ) value .
* Default : false
* @ param file the file
* @ return the recurse flag . */
public boolean isRecurse ( VirtualFile file ) { } } | boolean recurse = false ; if ( recurseFilter != null ) { recurse = recurseFilter . accepts ( file ) ; } return recurse ; |
public class RegExUtils { /** * < p > Replaces each substring of the text String that matches the given regular expression
* with the given replacement . < / p >
* This method is a { @ code null } safe equivalent to :
* < ul >
* < li > { @ code text . replaceAll ( regex , replacement ) } < / li >
* < li > { @ code Pattern . compile ( regex ) . matcher ( text ) . replaceAll ( replacement ) } < / li >
* < / ul >
* < p > A { @ code null } reference passed to this method is a no - op . < / p >
* < p > Unlike in the { @ link # replacePattern ( String , String , String ) } method , the { @ link Pattern # DOTALL } option
* is NOT automatically added .
* To use the DOTALL option prepend < code > " ( ? s ) " < / code > to the regex .
* DOTALL is also known as single - line mode in Perl . < / p >
* < pre >
* StringUtils . replaceAll ( null , * , * ) = null
* StringUtils . replaceAll ( " any " , ( String ) null , * ) = " any "
* StringUtils . replaceAll ( " any " , * , null ) = " any "
* StringUtils . replaceAll ( " " , " " , " zzz " ) = " zzz "
* StringUtils . replaceAll ( " " , " . * " , " zzz " ) = " zzz "
* StringUtils . replaceAll ( " " , " . + " , " zzz " ) = " "
* StringUtils . replaceAll ( " abc " , " " , " ZZ " ) = " ZZaZZbZZcZZ "
* StringUtils . replaceAll ( " & lt ; _ _ & gt ; \ n & lt ; _ _ & gt ; " , " & lt ; . * & gt ; " , " z " ) = " z \ nz "
* StringUtils . replaceAll ( " & lt ; _ _ & gt ; \ n & lt ; _ _ & gt ; " , " ( ? s ) & lt ; . * & gt ; " , " z " ) = " z "
* StringUtils . replaceAll ( " ABCabc123 " , " [ a - z ] " , " _ " ) = " ABC _ _ _ 123"
* StringUtils . replaceAll ( " ABCabc123 " , " [ ^ A - Z0-9 ] + " , " _ " ) = " ABC _ 123"
* StringUtils . replaceAll ( " ABCabc123 " , " [ ^ A - Z0-9 ] + " , " " ) = " ABC123"
* StringUtils . replaceAll ( " Lorem ipsum dolor sit " , " ( + ) ( [ a - z ] + ) " , " _ $ 2 " ) = " Lorem _ ipsum _ dolor _ sit "
* < / pre >
* @ param text text to search and replace in , may be null
* @ param regex the regular expression to which this string is to be matched
* @ param replacement the string to be substituted for each match
* @ return the text with any replacements processed ,
* { @ code null } if null String input
* @ throws java . util . regex . PatternSyntaxException
* if the regular expression ' s syntax is invalid
* @ see # replacePattern ( String , String , String )
* @ see String # replaceAll ( String , String )
* @ see java . util . regex . Pattern
* @ see java . util . regex . Pattern # DOTALL */
public static String replaceAll ( final String text , final String regex , final String replacement ) { } } | if ( text == null || regex == null || replacement == null ) { return text ; } return text . replaceAll ( regex , replacement ) ; |
public class ChangesKey { /** * { @ inheritDoc } */
@ Override public void readExternal ( ObjectInput in ) throws IOException , ClassNotFoundException { } } | super . readExternal ( in ) ; byte [ ] buf = new byte [ in . readInt ( ) ] ; in . readFully ( buf ) ; wsId = new String ( buf , Constants . DEFAULT_ENCODING ) ; |
public class ParserUtils { /** * Retrieves the conversion table for use with the getObject ( )
* method in IDataSet
* @ throws IOException
* @ return Properties
* Properties contained in the pzconvert . properties file */
public static Properties loadConvertProperties ( ) throws IOException { } } | final Properties pzConvertProps = new Properties ( ) ; final URL url = ParserUtils . class . getClassLoader ( ) . getResource ( "fpconvert.properties" ) ; pzConvertProps . load ( url . openStream ( ) ) ; return pzConvertProps ; |
public class FullEnumerationFormulaGenerator { /** * Generates a MolecularFormula object that contains the isotopes in the
* isotopes [ ] array with counts in the currentCounts [ ] array . In other
* words , generates a proper CDK representation of the currently examined
* formula . */
private IMolecularFormula generateFormulaObject ( ) { } } | IMolecularFormula formulaObject = builder . newInstance ( IMolecularFormula . class ) ; for ( int i = 0 ; i < isotopes . length ; i ++ ) { if ( currentCounts [ i ] == 0 ) continue ; formulaObject . addIsotope ( isotopes [ i ] , currentCounts [ i ] ) ; } return formulaObject ; |
public class DigitalOceanClient { @ Override public Tags getAvailableTags ( Integer pageNo , Integer perPage ) throws DigitalOceanException , RequestUnsuccessfulException { } } | validatePageNo ( pageNo ) ; return ( Tags ) perform ( new ApiRequest ( ApiAction . AVAILABLE_TAGS , pageNo , perPage ) ) . getData ( ) ; |
public class CommerceWishListUtil { /** * Returns the first commerce wish list in the ordered set where groupId = & # 63 ; and userId = & # 63 ; .
* @ param groupId the group ID
* @ param userId the user ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching commerce wish list , or < code > null < / code > if a matching commerce wish list could not be found */
public static CommerceWishList fetchByG_U_First ( long groupId , long userId , OrderByComparator < CommerceWishList > orderByComparator ) { } } | return getPersistence ( ) . fetchByG_U_First ( groupId , userId , orderByComparator ) ; |
public class ConverterManager { /** * Convert given string to specified collection with given element type .
* @ throws ConversionException If any occurs .
* @ see # find ( Class ) */
public < T > Object convert ( Class collectionType , Class < T > elementType , String origin ) throws ConversionException { } } | Converter < T > elementConverter = find ( elementType ) ; CollectionConverter < T > converter = new CollectionConverter < > ( elementConverter , stringSplitter ) ; try { Collection < T > converted = converter . convert ( origin ) ; return castCollectionToType ( collectionType , converted ) ; } catch ( Exception e ) { throw new ConversionException ( String . format ( "Could not convert string <%s> to collection <%s> " + "with element type <%s>" , origin , collectionType , elementType ) , e ) ; } |
public class MemberBuilder { /** * Sets a member property .
* @ param key the property key to set
* @ param value the property value to set
* @ return the member builder
* @ throws NullPointerException if the property is null */
public MemberBuilder withProperty ( String key , String value ) { } } | config . setProperty ( key , value ) ; return this ; |
public class Json { /** * Makes a tree of structure types reflecting the Bindings .
* A structure type contains a property member for each name / value pair in the Bindings . A property has the same name as the key and follows these rules :
* < ul >
* < li > If the type of the value is a " simple " type , such as a String or Integer , the type of the property matches the simple type exactly
* < li > Otherwise , if the value is a Bindings type , the property type is that of a child structure with the same name as the property and recursively follows these rules
* < li > Otherwise , if the value is a List , the property is a List parameterized with the component type , and the component type recursively follows these rules
* < / ul > */
public static String makeStructureTypes ( String nameForStructure , Bindings bindings , boolean mutable ) { } } | JsonStructureType type = ( JsonStructureType ) transformJsonObject ( nameForStructure , null , bindings ) ; StringBuilder sb = new StringBuilder ( ) ; type . render ( sb , 0 , mutable ) ; return sb . toString ( ) ; |
public class XsdAsmInterfaces { /** * Adds a method to the element which contains the sequence .
* @ param classWriter The { @ link ClassWriter } of the class which contains the sequence .
* @ param className The name of the class which contains the sequence .
* @ param nextTypeName The next sequence type name .
* @ param apiName The name of the generated fluent interface .
* @ param elements A { @ link List } of { @ link XsdElement } that are the first sequence value . */
private void createFirstSequenceInterface ( ClassWriter classWriter , String className , String nextTypeName , String apiName , List < XsdElement > elements ) { } } | elements . forEach ( element -> generateSequenceMethod ( classWriter , className , getJavaType ( element . getType ( ) ) , getCleanName ( element . getName ( ) ) , className , nextTypeName , apiName ) ) ; elements . forEach ( element -> createElement ( element , apiName ) ) ; |
public class ThreadBoundOutputStream { /** * Remove the custom stream for the current thread .
* @ return thread bound OutputStream or null if none exists */
public OutputStream removeThreadStream ( ) { } } | final OutputStream orig = inheritOutputStream . get ( ) ; inheritOutputStream . set ( null ) ; return orig ; |
public class DateParser { /** * Loads month aliases from the given resource file */
protected static Map < String , Integer > loadMonthAliases ( String file ) throws IOException { } } | InputStream in = DateParser . class . getClassLoader ( ) . getResourceAsStream ( file ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( in ) ) ; Map < String , Integer > map = new HashMap < > ( ) ; String line ; int month = 1 ; while ( ( line = reader . readLine ( ) ) != null ) { for ( String alias : line . split ( "," ) ) { map . put ( alias , month ) ; } month ++ ; } reader . close ( ) ; return map ; |
public class LoggingInterceptorSupport { /** * Log SOAP message with transformer instance .
* @ param logMessage the customized log message .
* @ param soapMessage the message content as SOAP envelope source .
* @ param incoming
* @ throws TransformerException */
protected void logSoapMessage ( String logMessage , SoapMessage soapMessage , boolean incoming ) throws TransformerException { } } | Transformer transformer = createIndentingTransformer ( ) ; StringWriter writer = new StringWriter ( ) ; transformer . transform ( soapMessage . getEnvelope ( ) . getSource ( ) , new StreamResult ( writer ) ) ; logMessage ( logMessage , XMLUtils . prettyPrint ( writer . toString ( ) ) , incoming ) ; |
public class TypeConverter { /** * checks if Class f is in classes * */
protected boolean oneOfClasses ( final Class f , final Class [ ] classes ) { } } | for ( final Class c : classes ) { if ( c . equals ( f ) ) { return true ; } } return false ; |
public class BundleUtils { /** * Returns a optional byte value . In other words , returns the value mapped by key if it exists and is a byte .
* The bundle argument is allowed to be { @ code null } . If the bundle is null , this method returns a fallback value .
* @ param bundle a bundle . If the bundle is null , this method will return a fallback value .
* @ param key a key for the value .
* @ param fallback fallback value .
* @ return a byte value if exists , fallback value otherwise .
* @ see android . os . Bundle # getByte ( String , byte ) */
public static byte optByte ( @ Nullable Bundle bundle , @ Nullable String key , byte fallback ) { } } | if ( bundle == null ) { return fallback ; } return bundle . getByte ( key , fallback ) ; |
public class RuleImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public NotificationChain basicSetBody ( RuleElement newBody , NotificationChain msgs ) { } } | RuleElement oldBody = body ; body = newBody ; if ( eNotificationRequired ( ) ) { ENotificationImpl notification = new ENotificationImpl ( this , Notification . SET , SimpleAntlrPackage . RULE__BODY , oldBody , newBody ) ; if ( msgs == null ) msgs = notification ; else msgs . add ( notification ) ; } return msgs ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcPropertyReferenceValue ( ) { } } | if ( ifcPropertyReferenceValueEClass == null ) { ifcPropertyReferenceValueEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 405 ) ; } return ifcPropertyReferenceValueEClass ; |
public class EFapsException { /** * If a caused exception is a { @ link SQLException } , also all next
* exceptions of the { @ link SQLException } ' s are printed into the stack
* trace .
* @ param _ writer < code > PrintWriter < / code > to use for output
* @ see # makeInfo ( ) to get all information about this EFapsException */
@ Override public void printStackTrace ( final PrintWriter _writer ) { } } | _writer . append ( makeInfo ( ) ) ; if ( this . className != null ) { _writer . append ( "Thrown within class " ) . append ( this . className . getName ( ) ) . append ( '\n' ) ; } super . printStackTrace ( _writer ) ; if ( getCause ( ) != null && getCause ( ) instanceof SQLException ) { SQLException ex = ( SQLException ) getCause ( ) ; ex = ex . getNextException ( ) ; while ( ex != null ) { _writer . append ( "Next SQL Exception is: " ) ; ex . printStackTrace ( _writer ) ; ex = ex . getNextException ( ) ; } } |
public class MappingServiceController { /** * Generate algorithms based on semantic matches between attribute tags and descriptions
* < p > package - private for testablity */
void autoGenerateAlgorithms ( EntityMapping mapping , EntityType sourceEntityType , EntityType targetEntityType , MappingProject project ) { } } | algorithmService . autoGenerateAlgorithm ( sourceEntityType , targetEntityType , mapping ) ; mappingService . updateMappingProject ( project ) ; |
public class BasePanel { /** * Free . */
public void free ( ) { } } | if ( m_recordOwnerCollection != null ) m_recordOwnerCollection . free ( ) ; m_recordOwnerCollection = null ; if ( m_registration != null ) ( ( UserProperties ) m_registration ) . free ( ) ; m_registration = null ; this . freeAllSFields ( true ) ; m_SFieldList = null ; super . free ( ) ; |
public class AllChemCompProvider { /** * Do the actual loading of the dictionary in a thread . */
@ Override public void run ( ) { } } | long timeS = System . currentTimeMillis ( ) ; initPath ( ) ; ensureFileExists ( ) ; try { loadAllChemComps ( ) ; long timeE = System . currentTimeMillis ( ) ; logger . debug ( "Time to init chem comp dictionary: " + ( timeE - timeS ) / 1000 + " sec." ) ; } catch ( IOException e ) { logger . error ( "Could not load chemical components definition file {}. Error: {}" , getLocalFileName ( ) , e . getMessage ( ) ) ; } finally { loading . set ( false ) ; isInitialized . set ( true ) ; } |
public class MongoDBAdaptor { /** * For histograms */
protected List < IntervalFeatureFrequency > getIntervalFeatureFrequencies ( Region region , int interval , List < Object [ ] > objectList , int numFeatures , double maxSnpsInterval ) { } } | int numIntervals = ( region . getEnd ( ) - region . getStart ( ) ) / interval + 1 ; List < IntervalFeatureFrequency > intervalFeatureFrequenciesList = new ArrayList < > ( numIntervals ) ; float maxNormValue = 1 ; if ( numFeatures != 0 ) { maxNormValue = ( float ) maxSnpsInterval / numFeatures ; } int start = region . getStart ( ) ; int end = start + interval ; for ( int i = 0 , j = 0 ; i < numIntervals ; i ++ ) { if ( j < objectList . size ( ) && ( ( BigInteger ) objectList . get ( j ) [ 0 ] ) . intValue ( ) == i ) { if ( numFeatures != 0 ) { intervalFeatureFrequenciesList . add ( new IntervalFeatureFrequency ( start , end , ( ( BigInteger ) objectList . get ( j ) [ 0 ] ) . intValue ( ) , ( ( BigInteger ) objectList . get ( j ) [ 1 ] ) . intValue ( ) , ( float ) Math . log ( ( ( BigInteger ) objectList . get ( j ) [ 1 ] ) . doubleValue ( ) ) / numFeatures / maxNormValue ) ) ; } else { // no features for this chromosome
intervalFeatureFrequenciesList . add ( new IntervalFeatureFrequency ( start , end , ( ( BigInteger ) objectList . get ( j ) [ 0 ] ) . intValue ( ) , ( ( BigInteger ) objectList . get ( j ) [ 1 ] ) . intValue ( ) , 0 ) ) ; } j ++ ; } else { intervalFeatureFrequenciesList . add ( new IntervalFeatureFrequency ( start , end , i , 0 , 0.0f ) ) ; } start += interval ; end += interval ; } return intervalFeatureFrequenciesList ; |
public class DescribeHapgResult { /** * @ param hsmsLastActionFailed */
public void setHsmsLastActionFailed ( java . util . Collection < String > hsmsLastActionFailed ) { } } | if ( hsmsLastActionFailed == null ) { this . hsmsLastActionFailed = null ; return ; } this . hsmsLastActionFailed = new com . amazonaws . internal . SdkInternalList < String > ( hsmsLastActionFailed ) ; |
public class HtmlLinkRendererBase { /** * Can be overwritten by derived classes to overrule the style to be used . */
protected String getStyle ( FacesContext facesContext , UIComponent link ) { } } | if ( link instanceof HtmlCommandLink ) { return ( ( HtmlCommandLink ) link ) . getStyle ( ) ; } return ( String ) link . getAttributes ( ) . get ( HTML . STYLE_ATTR ) ; |
public class S { /** * Return a { @ link org . rythmengine . utils . RawData } type wrapper of
* an object with XML escaping
* < p > Object is { @ link # toString ( Object ) converted to String } before escaping < / p >
* < p > After the object get escaped , the output string is safe to put inside a XML
* attribute
* @ param o
* @ return XML escaped data */
@ Transformer public static RawData escapeXML ( Object o ) { } } | if ( null == o ) return RawData . NULL ; if ( o instanceof RawData ) return ( RawData ) o ; return new RawData ( _escapeXML ( o . toString ( ) ) ) ; |
public class PdfSignatureAppearance { /** * Fits the text to some rectangle adjusting the font size as needed .
* @ param font the font to use
* @ param text the text
* @ param rect the rectangle where the text must fit
* @ param maxFontSize the maximum font size
* @ param runDirection the run direction
* @ return the calculated font size that makes the text fit */
public static float fitText ( Font font , String text , Rectangle rect , float maxFontSize , int runDirection ) { } } | try { ColumnText ct = null ; int status = 0 ; if ( maxFontSize <= 0 ) { int cr = 0 ; int lf = 0 ; char t [ ] = text . toCharArray ( ) ; for ( int k = 0 ; k < t . length ; ++ k ) { if ( t [ k ] == '\n' ) ++ lf ; else if ( t [ k ] == '\r' ) ++ cr ; } int minLines = Math . max ( cr , lf ) + 1 ; maxFontSize = Math . abs ( rect . getHeight ( ) ) / minLines - 0.001f ; } font . setSize ( maxFontSize ) ; Phrase ph = new Phrase ( text , font ) ; ct = new ColumnText ( null ) ; ct . setSimpleColumn ( ph , rect . getLeft ( ) , rect . getBottom ( ) , rect . getRight ( ) , rect . getTop ( ) , maxFontSize , Element . ALIGN_LEFT ) ; ct . setRunDirection ( runDirection ) ; status = ct . go ( true ) ; if ( ( status & ColumnText . NO_MORE_TEXT ) != 0 ) return maxFontSize ; float precision = 0.1f ; float min = 0 ; float max = maxFontSize ; float size = maxFontSize ; for ( int k = 0 ; k < 50 ; ++ k ) { // just in case it doesn ' t converge
size = ( min + max ) / 2 ; ct = new ColumnText ( null ) ; font . setSize ( size ) ; ct . setSimpleColumn ( new Phrase ( text , font ) , rect . getLeft ( ) , rect . getBottom ( ) , rect . getRight ( ) , rect . getTop ( ) , size , Element . ALIGN_LEFT ) ; ct . setRunDirection ( runDirection ) ; status = ct . go ( true ) ; if ( ( status & ColumnText . NO_MORE_TEXT ) != 0 ) { if ( max - min < size * precision ) return size ; min = size ; } else max = size ; } return size ; } catch ( Exception e ) { throw new ExceptionConverter ( e ) ; } |
public class OptionsApiPanel { /** * This method initializes panelMisc
* @ return javax . swing . JPanel */
private JPanel getPanelMisc ( ) { } } | if ( panelMisc == null ) { panelMisc = new JPanel ( ) ; panelMisc . setLayout ( new GridBagLayout ( ) ) ; int y = 0 ; panelMisc . add ( getChkEnabled ( ) , LayoutHelper . getGBC ( 0 , y ++ , 1 , 0.5 ) ) ; panelMisc . add ( getChkUiEnabled ( ) , LayoutHelper . getGBC ( 0 , y ++ , 1 , 0.5 ) ) ; panelMisc . add ( getChkSecureOnly ( ) , LayoutHelper . getGBC ( 0 , y ++ , 1 , 0.5 ) ) ; panelMisc . add ( new JLabel ( Constant . messages . getString ( "api.options.label.apiKey" ) ) , LayoutHelper . getGBC ( 0 , y , 1 , 0.5 ) ) ; panelMisc . add ( getKeyField ( ) , LayoutHelper . getGBC ( 1 , y ++ , 1 , 0.5 ) ) ; panelMisc . add ( getGenerateKeyButton ( ) , LayoutHelper . getGBC ( 1 , y ++ , 1 , 0.5 ) ) ; JPanel jPanel = new JPanel ( ) ; jPanel . setLayout ( new GridBagLayout ( ) ) ; jPanel . setBorder ( javax . swing . BorderFactory . createTitledBorder ( null , Constant . messages . getString ( "api.options.addr.title" ) , javax . swing . border . TitledBorder . DEFAULT_JUSTIFICATION , javax . swing . border . TitledBorder . DEFAULT_POSITION , FontUtils . getFont ( FontUtils . Size . standard ) , java . awt . Color . black ) ) ; jPanel . add ( getProxyPermittedAddressesPanel ( ) , LayoutHelper . getGBC ( 0 , 0 , 1 , 1.0 , 1.0 ) ) ; panelMisc . add ( jPanel , LayoutHelper . getGBC ( 0 , y ++ , 2 , 1.0 , 1.0 ) ) ; JLabel warning = new JLabel ( Constant . messages . getString ( "api.options.label.testingWarning" ) ) ; warning . setForeground ( Color . RED ) ; panelMisc . add ( warning , LayoutHelper . getGBC ( 0 , y ++ , 2 , 0.5D ) ) ; panelMisc . add ( getDisableKey ( ) , LayoutHelper . getGBC ( 0 , y ++ , 1 , 0.5 ) ) ; panelMisc . add ( getNoKeyForSafeOps ( ) , LayoutHelper . getGBC ( 0 , y ++ , 1 , 0.5 ) ) ; panelMisc . add ( getReportPermErrors ( ) , LayoutHelper . getGBC ( 0 , y ++ , 1 , 0.5 ) ) ; panelMisc . add ( getIncErrorDetails ( ) , LayoutHelper . getGBC ( 0 , y ++ , 1 , 0.5 ) ) ; panelMisc . add ( getAutofillKey ( ) , LayoutHelper . getGBC ( 0 , y ++ , 1 , 0.5 ) ) ; panelMisc . add ( getEnableJSONP ( ) , LayoutHelper . getGBC ( 0 , y ++ , 1 , 0.5 ) ) ; panelMisc . add ( new JLabel ( ) , LayoutHelper . getGBC ( 0 , y , 1 , 0.5D , 1.0D ) ) ; // Spacer
} return panelMisc ; |
public class FlowController { /** * Return the specified data source for the current Struts module .
* @ param request The servlet request we are processing
* @ param key The key specified in the
* < code > & lt ; message - resources & gt ; < / code > element for the
* requested bundle */
protected DataSource getDataSource ( HttpServletRequest request , String key ) { } } | // Return the requested data source instance
return ( DataSource ) getServletContext ( ) . getAttribute ( key + getModuleConfig ( ) . getPrefix ( ) ) ; |
public class GetKeyPairsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetKeyPairsRequest getKeyPairsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getKeyPairsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getKeyPairsRequest . getPageToken ( ) , PAGETOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class VodClient { /** * Update the title and description for the specific media resource managed by VOD service .
* The caller < i > must < / i > authenticate with a valid BCE Access Key / Private Key pair .
* @ param request The request wrapper object containing all options .
* @ return empty response will be returned */
public UpdateMediaResourceResponse updateMediaResource ( UpdateMediaResourceRequest request ) { } } | InternalRequest internalRequest = createRequest ( HttpMethodName . PUT , request , PATH_MEDIA , request . getMediaId ( ) ) ; internalRequest . addParameter ( PARA_ATTRIBUTES , null ) ; return invokeHttpClient ( internalRequest , UpdateMediaResourceResponse . class ) ; |
public class AbstractHdfsBolt { /** * Marked as final to prevent override . Subclasses should implement the doPrepare ( ) method .
* @ param conf
* @ param topologyContext
* @ param collector */
public final void prepare ( Map conf , TopologyContext topologyContext , OutputCollector collector ) { } } | this . writeLock = new Object ( ) ; if ( this . syncPolicy == null ) throw new IllegalStateException ( "SyncPolicy must be specified." ) ; if ( this . rotationPolicy == null ) throw new IllegalStateException ( "RotationPolicy must be specified." ) ; if ( this . fsUrl == null ) { throw new IllegalStateException ( "File system URL must be specified." ) ; } this . collector = collector ; this . fileNameFormat . prepare ( conf , topologyContext ) ; this . hdfsConfig = new Configuration ( ) ; Map < String , Object > map = ( Map < String , Object > ) conf . get ( this . configKey ) ; if ( map != null ) { for ( String key : map . keySet ( ) ) { this . hdfsConfig . set ( key , String . valueOf ( map . get ( key ) ) ) ; } } try { HdfsSecurityUtil . login ( conf , hdfsConfig ) ; doPrepare ( conf , topologyContext , collector ) ; this . currentFile = createOutputFile ( ) ; } catch ( Exception e ) { throw new RuntimeException ( "Error preparing HdfsBolt: " + e . getMessage ( ) , e ) ; } if ( this . rotationPolicy instanceof TimedRotationPolicy ) { long interval = ( ( TimedRotationPolicy ) this . rotationPolicy ) . getInterval ( ) ; this . rotationTimer = new Timer ( true ) ; TimerTask task = new TimerTask ( ) { @ Override public void run ( ) { try { rotateOutputFile ( ) ; } catch ( IOException e ) { LOG . warn ( "IOException during scheduled file rotation." , e ) ; } } } ; this . rotationTimer . scheduleAtFixedRate ( task , interval , interval ) ; } |
public class ConfigException { /** * support it ) */
private void writeObject ( java . io . ObjectOutputStream out ) throws IOException { } } | out . defaultWriteObject ( ) ; ConfigImplUtil . writeOrigin ( out , origin ) ; |
public class ValueMapper { /** * Maps a { @ link Value } message to the { @ link Object } it describes .
* @ param message
* the message to map
* @ return The observed value
* @ throws ObjectToIdMappingException
* When the value described it he message is unknown in the { @ link MetaModel } . */
public Object map ( final Value message ) throws ObjectToIdMappingException { } } | final UUID valueId = message . getObservableObjectId ( ) ; if ( valueId != null ) { return objectRegistry . getByIdOrFail ( valueId ) ; } else { return message . getSimpleObjectValue ( ) ; } |
public class FnString { /** * Converts a String into a Long , using the specified decimal point
* configuration ( { @ link DecimalPoint } ) . Rounding mode is used for removing the
* decimal part of the number . The target String should contain no
* thousand separators . The integer part of the input string must be between
* { @ link Long # MIN _ VALUE } and { @ link Long # MAX _ VALUE }
* @ param roundingMode the rounding mode to be used when setting the scale
* @ param decimalPoint the decimal point being used by the String
* @ return the resulting Long object */
public static final Function < String , Long > toLong ( final RoundingMode roundingMode , final DecimalPoint decimalPoint ) { } } | return new ToLong ( roundingMode , decimalPoint ) ; |
public class IconicsDrawable { /** * Set the size of the drawable .
* @ param sizeDp The size in density - independent pixels ( dp ) .
* @ return The current IconicsDrawable for chaining . */
@ NonNull public IconicsDrawable sizeDpX ( @ Dimension ( unit = DP ) int sizeDp ) { } } | return sizePxX ( Utils . convertDpToPx ( mContext , sizeDp ) ) ; |
public class EditShape { /** * Checks if there are degenerate segments in any of multipath geometries */
boolean hasDegenerateSegments ( double tolerance ) { } } | for ( int geometry = getFirstGeometry ( ) ; geometry != - 1 ; geometry = getNextGeometry ( geometry ) ) { if ( ! Geometry . isMultiPath ( getGeometryType ( geometry ) ) ) continue ; boolean b_polygon = getGeometryType ( geometry ) == Geometry . GeometryType . Polygon ; for ( int path = getFirstPath ( geometry ) ; path != - 1 ; ) { int path_size = getPathSize ( path ) ; if ( b_polygon ? path_size < 3 : path_size < 2 ) return true ; int vertex = getFirstVertex ( path ) ; for ( int index = 0 ; index < path_size ; index ++ ) { int next = getNextVertex ( vertex ) ; if ( next == - 1 ) break ; int vindex = getVertexIndex ( vertex ) ; Segment seg = getSegmentFromIndex_ ( vindex ) ; double length = 0 ; if ( seg != null ) { length = seg . calculateLength2D ( ) ; } else { int vindex_next = getVertexIndex ( next ) ; length = m_vertices . _getShortestDistance ( vindex , vindex_next ) ; } if ( length <= tolerance ) return true ; vertex = next ; } path = getNextPath ( path ) ; } } return false ; |
public class TopicImpl { /** * / / / / / Methods from JsMessagePoint */
private byte [ ] getData ( byte [ ] in , java . lang . Integer size ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getData" , new Object [ ] { in , size } ) ; byte tmp [ ] = null ; if ( in != null ) { int len = 1024 ; if ( size . intValue ( ) > 0 ) len = size . intValue ( ) ; if ( len > in . length ) len = in . length ; tmp = new byte [ len ] ; System . arraycopy ( in , 0 , tmp , 0 , len ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getData" , tmp ) ; return tmp ; |
public class WhitesourceService { /** * Updates the White Source organization account with the given OSS information .
* @ param orgToken Organization token uniquely identifying the account at white source .
* @ param requesterEmail Email of the WhiteSource user that requests to update WhiteSource .
* @ param updateType Request UpdateType
* @ param product The product name or token to update .
* @ param productVersion The product version .
* @ param projectInfos OSS usage information to send to white source .
* @ param userKey user key uniquely identifying the account at white source .
* @ param logData list of FSA ' s log data events
* @ param scanComment scan description
* @ return Result of updating white source .
* @ throws WssServiceException */
@ Deprecated public UpdateInventoryResult update ( String orgToken , String requesterEmail , UpdateType updateType , String product , String productVersion , Collection < AgentProjectInfo > projectInfos , String userKey , String logData , String scanComment ) throws WssServiceException { } } | return client . updateInventory ( requestFactory . newUpdateInventoryRequest ( orgToken , updateType , requesterEmail , product , productVersion , projectInfos , userKey , logData , scanComment ) ) ; |
public class ScriptRuntime { /** * Delegates to
* @ return true iff rhs appears in lhs ' proto chain */
public static boolean jsDelegatesTo ( Scriptable lhs , Scriptable rhs ) { } } | Scriptable proto = lhs . getPrototype ( ) ; while ( proto != null ) { if ( proto . equals ( rhs ) ) return true ; proto = proto . getPrototype ( ) ; } return false ; |
public class SQLiteConnection { /** * Called by SQLiteConnectionPool only . */
void reconfigure ( com . couchbase . lite . internal . database . sqlite . SQLiteDatabaseConfiguration configuration ) { } } | mOnlyAllowReadOnlyOperations = false ; // Remember what changed .
boolean foreignKeyModeChanged = configuration . foreignKeyConstraintsEnabled != mConfiguration . foreignKeyConstraintsEnabled ; boolean walModeChanged = ( ( configuration . openFlags ^ mConfiguration . openFlags ) & com . couchbase . lite . internal . database . sqlite . SQLiteDatabase . ENABLE_WRITE_AHEAD_LOGGING ) != 0 ; // Update configuration parameters .
mConfiguration . updateParametersFrom ( configuration ) ; // Update foreign key mode .
if ( foreignKeyModeChanged ) { setForeignKeyModeFromConfiguration ( ) ; } // Update WAL .
if ( walModeChanged ) { setWalModeFromConfiguration ( ) ; } |
public class AsynchronousRequest { /** * For more info on stories API go < a href = " https : / / wiki . guildwars2 . com / wiki / API : 2 / stories " > here < / a > < br / >
* Give user the access to { @ link Callback # onResponse ( Call , Response ) } and { @ link Callback # onFailure ( Call , Throwable ) } methods for custom interactions
* @ param ids list of story id
* @ param callback callback that is going to be used for { @ link Call # enqueue ( Callback ) }
* @ throws GuildWars2Exception empty ID list
* @ throws NullPointerException if given { @ link Callback } is empty
* @ see Story story info */
public void getStoryInfo ( int [ ] ids , Callback < List < Story > > callback ) throws GuildWars2Exception , NullPointerException { } } | isParamValid ( new ParamChecker ( ids ) ) ; gw2API . getStoryInfo ( processIds ( ids ) , GuildWars2 . lang . getValue ( ) ) . enqueue ( callback ) ; |
public class LRVerify { /** * Verfies that the provided message and signature using the public key
* @ param isSignature InputStream of the signature
* @ param isMessage InputStream of the message
* @ param isPublicKey InputStream of the public key
* @ throws LRException */
private static boolean Verify ( InputStream isSignature , InputStream isMessage , InputStream isPublicKey ) throws LRException { } } | // Get the public key ring collection from the public key input stream
PGPPublicKeyRingCollection pgpRings = null ; try { pgpRings = new PGPPublicKeyRingCollection ( PGPUtil . getDecoderStream ( isPublicKey ) ) ; } catch ( Exception e ) { throw new LRException ( LRException . INVALID_PUBLIC_KEY ) ; } // Add the Bouncy Castle security provider
Security . addProvider ( new BouncyCastleProvider ( ) ) ; // Build an output stream from the message for verification
boolean verify = false ; int ch ; ByteArrayOutputStream bOut = new ByteArrayOutputStream ( ) ; ArmoredInputStream aIn = null ; try { aIn = new ArmoredInputStream ( isMessage ) ; // We are making no effort to clean the input for this example
// If this turns into a fully - featured verification utility in a future version , this will need to be handled
while ( ( ch = aIn . read ( ) ) >= 0 && aIn . isClearText ( ) ) { bOut . write ( ( byte ) ch ) ; } bOut . close ( ) ; } catch ( Exception e ) { throw new LRException ( LRException . MESSAGE_INVALID ) ; } // Build an object factory from the signature input stream and try to get an object out of it
Object o = null ; try { PGPObjectFactory pgpFact = new PGPObjectFactory ( PGPUtil . getDecoderStream ( isSignature ) ) ; o = pgpFact . nextObject ( ) ; } catch ( Exception e ) { throw new LRException ( LRException . SIGNATURE_INVALID ) ; } // Check if the object we fetched is a signature list and if it is , get the signature and use it to verfiy
try { if ( o instanceof PGPSignatureList ) { PGPSignatureList list = ( PGPSignatureList ) o ; if ( list . size ( ) > 0 ) { PGPSignature sig = list . get ( 0 ) ; PGPPublicKey publicKey = pgpRings . getPublicKey ( sig . getKeyID ( ) ) ; sig . init ( new JcaPGPContentVerifierBuilderProvider ( ) . setProvider ( "BC" ) , publicKey ) ; sig . update ( bOut . toByteArray ( ) ) ; verify = sig . verify ( ) ; } } } catch ( Exception e ) { throw new LRException ( LRException . SIGNATURE_NOT_FOUND ) ; } return verify ; |
public class ProposalLineItem { /** * Gets the customFieldValues value for this ProposalLineItem .
* @ return customFieldValues * The values of the custom fields associated with the { @ code
* ProposalLineItem } .
* This attribute is optional .
* This attribute can be configured as editable after
* the proposal has been submitted .
* Please check with your network administrator for editable
* fields configuration . */
public com . google . api . ads . admanager . axis . v201805 . BaseCustomFieldValue [ ] getCustomFieldValues ( ) { } } | return customFieldValues ; |
public class DTMNodeProxy { /** * This is a bit of a problem in DTM , since a DTM may be a Document
* Fragment and hence not have a clear - cut Document Element . We can
* make it work in the well - formed cases but would that be confusing for others ?
* @ see org . w3c . dom . Document */
public final Element getDocumentElement ( ) { } } | int dochandle = dtm . getDocument ( ) ; int elementhandle = DTM . NULL ; for ( int kidhandle = dtm . getFirstChild ( dochandle ) ; kidhandle != DTM . NULL ; kidhandle = dtm . getNextSibling ( kidhandle ) ) { switch ( dtm . getNodeType ( kidhandle ) ) { case Node . ELEMENT_NODE : if ( elementhandle != DTM . NULL ) { elementhandle = DTM . NULL ; // More than one ; ill - formed .
kidhandle = dtm . getLastChild ( dochandle ) ; // End loop
} else elementhandle = kidhandle ; break ; // These are harmless ; document is still wellformed
case Node . COMMENT_NODE : case Node . PROCESSING_INSTRUCTION_NODE : case Node . DOCUMENT_TYPE_NODE : break ; default : elementhandle = DTM . NULL ; // ill - formed
kidhandle = dtm . getLastChild ( dochandle ) ; // End loop
break ; } } if ( elementhandle == DTM . NULL ) throw new DTMDOMException ( DOMException . NOT_SUPPORTED_ERR ) ; else return ( Element ) ( dtm . getNode ( elementhandle ) ) ; |
public class FullDTDReader { /** * Similar to { @ link # readDTDName } , except that the rules are bit looser ,
* ie . there are no additional restrictions for the first char */
private String readDTDNmtoken ( char c ) throws XMLStreamException { } } | char [ ] outBuf = getNameBuffer ( 64 ) ; int outLen = outBuf . length ; int outPtr = 0 ; while ( true ) { /* Note : colon not included in name char array , since it has
* special meaning WRT QNames , need to add into account here : */
if ( ! isNameChar ( c ) && c != ':' ) { // Need to get at least one char
if ( outPtr == 0 ) { throwDTDUnexpectedChar ( c , "; expected a NMTOKEN character to start a NMTOKEN" ) ; } -- mInputPtr ; break ; } if ( outPtr >= outLen ) { outBuf = expandBy50Pct ( outBuf ) ; outLen = outBuf . length ; } outBuf [ outPtr ++ ] = c ; if ( mInputPtr < mInputEnd ) { c = mInputBuffer [ mInputPtr ++ ] ; } else { c = dtdNextIfAvailable ( ) ; if ( c == CHAR_NULL ) { // end - of - block
break ; } } } /* Nmtokens need not be canonicalized ; they will be processed
* as necessary later on : */
return new String ( outBuf , 0 , outPtr ) ; |
public class Tuple3 { /** * Apply attribute 3 as argument to a function and return a new tuple with the substituted argument . */
public final < U3 > Tuple3 < T1 , T2 , U3 > map3 ( Function < ? super T3 , ? extends U3 > function ) { } } | return Tuple . tuple ( v1 , v2 , function . apply ( v3 ) ) ; |
public class AbstractMapBasedWALDAO { /** * Update an existing item including invoking the callback . Must only be
* invoked inside a write - lock .
* @ param aItem
* The item to be updated . May not be < code > null < / code > .
* @ param bInvokeCallbacks
* < code > true < / code > to invoke callbacks , < code > false < / code > to not do
* so .
* @ throws IllegalArgumentException
* If no item with the same ID is already contained
* @ since 9.2.1 */
@ MustBeLocked ( ELockType . WRITE ) protected final void internalUpdateItem ( @ Nonnull final IMPLTYPE aItem , final boolean bInvokeCallbacks ) { } } | // Add to map - ensure to overwrite any existing
_addItem ( aItem , EDAOActionType . UPDATE ) ; // Trigger save changes
super . markAsChanged ( aItem , EDAOActionType . UPDATE ) ; if ( bInvokeCallbacks ) { // Invoke callbacks
m_aCallbacks . forEach ( aCB -> aCB . onUpdateItem ( aItem ) ) ; } |
public class Annotations { /** * Checks if all roles are played .
* @ param role the role to check .
* @ param r the roles that all have to be played
* @ return true or false . */
public static boolean playsAll ( Role role , String ... r ) { } } | if ( role == null ) { return false ; } for ( String s : r ) { if ( ! role . value ( ) . contains ( s ) ) { return false ; } } return true ; |
public class TaskServiceImpl { @ On ( Orchid . Lifecycle . FilesChanged . class ) public void onFilesChanges ( Orchid . Lifecycle . FilesChanged event ) { } } | if ( server != null && server . getWebsocket ( ) != null ) { server . getWebsocket ( ) . sendMessage ( "Files Changed" , "" ) ; } context . build ( ) ; |
public class BatchAccumulator { /** * Append a record to this accumulator
* This method should never fail unless there is an exception . A future object should always be returned
* which can be queried to see if this record has been completed ( completion means the wrapped batch has been
* sent and received acknowledgement and callback has been invoked ) . Internally it tracks how many parallel appends
* are in progress by incrementing appendsInProgress counter . The real append logic is inside { @ link BatchAccumulator # enqueue ( Object , WriteCallback ) }
* @ param record : record needs to be added
* @ param callback : A callback which will be invoked when the whole batch gets sent and acknowledged
* @ return A future object which contains { @ link RecordMetadata } */
public final Future < RecordMetadata > append ( D record , WriteCallback callback ) throws InterruptedException { } } | appendsInProgress . incrementAndGet ( ) ; try { if ( this . closed ) { throw new RuntimeException ( "Cannot append after accumulator has been closed" ) ; } return this . enqueue ( record , callback ) ; } finally { appendsInProgress . decrementAndGet ( ) ; } |
public class BaseApplet { /** * Get the screen properties and set up the look and feel .
* @ param propertyOwner The screen properties ( if null , I will look them up ) . */
@ SuppressWarnings ( { } } | "unchecked" , "rawtypes" } ) public void setupLookAndFeel ( PropertyOwner propertyOwner ) { Map < String , Object > properties = null ; if ( propertyOwner == null ) propertyOwner = this . retrieveUserProperties ( Params . SCREEN ) ; if ( propertyOwner == null ) { // Thin only
RemoteTask task = ( RemoteTask ) this . getApplication ( ) . getRemoteTask ( null , null , false ) ; if ( task != null ) { try { properties = ( Map ) task . doRemoteAction ( Params . RETRIEVE_USER_PROPERTIES , properties ) ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; } } } String backgroundName = null ; if ( propertyOwner != null ) if ( propertyOwner . getProperty ( Params . BACKGROUNDCOLOR ) != null ) backgroundName = propertyOwner . getProperty ( Params . BACKGROUNDCOLOR ) ; if ( backgroundName == null ) if ( properties != null ) backgroundName = ( String ) properties . get ( Params . BACKGROUNDCOLOR ) ; if ( backgroundName != null ) this . setBackgroundColor ( BaseApplet . nameToColor ( backgroundName ) ) ; Container top = this ; while ( top . getParent ( ) != null ) { top = top . getParent ( ) ; } ScreenUtil . updateLookAndFeel ( top , propertyOwner , properties ) ; |
public class Beans { /** * Creates an instance of a given type by choosing the best constructor that matches the given list of arguments .
* @ param < T > the type of the object to create
* @ param type the type of the object to create
* @ param args the arguments to pass to the constructor
* @ param offset the offset into the args array from which to retrieve arguments
* @ param count the number of arguments from the args array to pass to the constructor
* @ return the object created
* @ throws NoSuchMethodException if an appropriate constructor cannot be found
* @ throws IllegalAccessException if an appropriate constructor cannot be accessed
* @ throws InvocationTargetException if errors occur while invoking the constructor
* @ throws InstantiationException if the constructor itself fails in any way */
public static < T > T create ( Class < T > type , Object [ ] args , int offset , int count ) throws NoSuchMethodException , IllegalAccessException , InvocationTargetException , InstantiationException { } } | if ( offset != 0 || count != args . length ) { return create ( type , Arrays . copyOfRange ( args , offset , offset + count ) ) ; } else { return create ( type , args ) ; } |
public class SimpleSolrPersistentProperty { /** * ( non - Javadoc )
* @ see org . springframework . data . solr . core . mapping . SolrPersistentProperty # getSolrTypeName ( ) */
@ Override public String getSolrTypeName ( ) { } } | Indexed indexedAnnotation = getIndexAnnotation ( ) ; if ( indexedAnnotation != null && StringUtils . hasText ( indexedAnnotation . type ( ) ) ) { return indexedAnnotation . type ( ) ; } return getActualType ( ) . getSimpleName ( ) . toLowerCase ( ) ; |
public class AttributeValue { /** * An attribute of type List . For example :
* < code > " L " : [ { " S " : " Cookies " } , { " S " : " Coffee " } , { " N " , " 3.14159 " } ] < / code >
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setL ( java . util . Collection ) } or { @ link # withL ( java . util . Collection ) } if you want to override the existing
* values .
* @ param l
* An attribute of type List . For example : < / p >
* < code > " L " : [ { " S " : " Cookies " } , { " S " : " Coffee " } , { " N " , " 3.14159 " } ] < / code >
* @ return Returns a reference to this object so that method calls can be chained together . */
public AttributeValue withL ( AttributeValue ... l ) { } } | if ( this . l == null ) { setL ( new java . util . ArrayList < AttributeValue > ( l . length ) ) ; } for ( AttributeValue ele : l ) { this . l . add ( ele ) ; } return this ; |
public class SwingGui { /** * Shows a { @ link FileWindow } for the given source , creating it
* if it doesn ' t exist yet . if < code > lineNumber < / code > is greater
* than - 1 , it indicates the line number to select and display .
* @ param sourceUrl the source URL
* @ param lineNumber the line number to select , or - 1 */
protected void showFileWindow ( String sourceUrl , int lineNumber ) { } } | FileWindow w ; if ( sourceUrl != null ) { w = getFileWindow ( sourceUrl ) ; } else { JInternalFrame f = getSelectedFrame ( ) ; if ( f != null && f instanceof FileWindow ) { w = ( FileWindow ) f ; } else { w = currentWindow ; } } if ( w == null && sourceUrl != null ) { Dim . SourceInfo si = dim . sourceInfo ( sourceUrl ) ; createFileWindow ( si , - 1 ) ; w = getFileWindow ( sourceUrl ) ; } if ( w == null ) { return ; } if ( lineNumber > - 1 ) { int start = w . getPosition ( lineNumber - 1 ) ; int end = w . getPosition ( lineNumber ) - 1 ; if ( start <= 0 ) { return ; } w . textArea . select ( start ) ; w . textArea . setCaretPosition ( start ) ; w . textArea . moveCaretPosition ( end ) ; } try { if ( w . isIcon ( ) ) { w . setIcon ( false ) ; } w . setVisible ( true ) ; w . moveToFront ( ) ; w . setSelected ( true ) ; requestFocus ( ) ; w . requestFocus ( ) ; w . textArea . requestFocus ( ) ; } catch ( Exception exc ) { } |
public class AlertPolicy { /** * Use { @ link # getUserLabelsMap ( ) } instead . */
@ java . lang . Deprecated public java . util . Map < java . lang . String , java . lang . String > getUserLabels ( ) { } } | return getUserLabelsMap ( ) ; |
public class InstantUtils { /** * Return a String suitable for use as an edn { @ code # inst } , given
* a { @ link Date } .
* @ param date must not be null .
* @ return an RFC3339 compatible string . */
public static String dateToString ( Date date ) { } } | GregorianCalendar c = new GregorianCalendar ( GMT ) ; c . setTime ( date ) ; String s = calendarToString ( c ) ; assert s . endsWith ( "+00:00" ) ; return s . substring ( 0 , s . length ( ) - 6 ) + "-00:00" ; |
public class AmazonEC2Client { /** * Disables detailed monitoring for a running instance . For more information , see < a
* href = " https : / / docs . aws . amazon . com / AWSEC2 / latest / UserGuide / using - cloudwatch . html " > Monitoring Your Instances and
* Volumes < / a > in the < i > Amazon Elastic Compute Cloud User Guide < / i > .
* @ param unmonitorInstancesRequest
* @ return Result of the UnmonitorInstances operation returned by the service .
* @ sample AmazonEC2 . UnmonitorInstances
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / UnmonitorInstances " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public UnmonitorInstancesResult unmonitorInstances ( UnmonitorInstancesRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeUnmonitorInstances ( request ) ; |
public class Json { /** * Converts netscaler resource to Json string .
* @ param resrc nitro resource .
* @ return returns a String */
public String resource_to_string ( base_resource resrc ) { } } | Gson gson = new Gson ( ) ; return gson . toJson ( resrc ) ; |
public class SelectorBuilderImpl { /** * Adds a predicate for the specified field , property values , and operator . */
private SelectorBuilderImpl multipleValuePredicate ( String field , String [ ] propertyValues , PredicateOperator operator ) { } } | if ( propertyValues == null ) { return this ; } Predicate predicate = new Predicate ( ) ; predicate . setOperator ( operator ) ; predicate . setField ( field ) ; String [ ] values = Arrays . copyOf ( propertyValues , propertyValues . length ) ; predicate . setValues ( values ) ; this . predicates . add ( predicate ) ; return this ; |
public class Rename { /** * Rename property of a node by creating a new one and deleting the old . */
@ Procedure ( mode = Mode . WRITE ) @ Description ( "apoc.refactor.rename.nodeProperty(oldName, newName, [nodes]) | rename all node's property from 'oldName' to 'newName'. If 'nodes' is provided renaming is applied to this set only" ) public Stream < BatchAndTotalResultWithInfo > nodeProperty ( @ Name ( "oldName" ) String oldName , @ Name ( "newName" ) String newName , @ Name ( value = "nodes" , defaultValue = "" ) List < Object > nodes ) { } } | String cypherIterate = nodes != null && ! nodes . isEmpty ( ) ? "UNWIND {nodes} AS n WITH n WHERE exists (n." + oldName + ") return n" : "match (n) where exists (n." + oldName + ") return n" ; String cypherAction = "set n." + newName + "= n." + oldName + " remove n." + oldName ; Map < String , Object > parameters = MapUtil . map ( "batchSize" , 100000 , "parallel" , true , "iterateList" , true , "params" , MapUtil . map ( "nodes" , nodes ) ) ; return getResultOfBatchAndTotalWithInfo ( newPeriodic ( ) . iterate ( cypherIterate , cypherAction , parameters ) , db , null , null , oldName ) ; |
public class AnalyticsQuery { /** * Creates an { @ link AnalyticsQuery } with positional parameters as part of the query .
* @ param statement the statement to send .
* @ param positionalParams the positional parameters which will be put in for the placeholders .
* @ param params the parameters to provide to the server in addition .
* @ return a { @ link AnalyticsQuery } . */
public static ParameterizedAnalyticsQuery parameterized ( final String statement , final JsonArray positionalParams , final AnalyticsParams params ) { } } | return new ParameterizedAnalyticsQuery ( statement , positionalParams , null , params ) ; |
public class MessageFormat { /** * Returns the ARG _ START index of the first occurrence of the plural number in a sub - message .
* Returns - 1 if it is a REPLACE _ NUMBER .
* Returns 0 if there is neither . */
private int findFirstPluralNumberArg ( int msgStart , String argName ) { } } | for ( int i = msgStart + 1 ; ; ++ i ) { Part part = msgPattern . getPart ( i ) ; Part . Type type = part . getType ( ) ; if ( type == Part . Type . MSG_LIMIT ) { return 0 ; } if ( type == Part . Type . REPLACE_NUMBER ) { return - 1 ; } if ( type == Part . Type . ARG_START ) { ArgType argType = part . getArgType ( ) ; if ( argName . length ( ) != 0 && ( argType == ArgType . NONE || argType == ArgType . SIMPLE ) ) { part = msgPattern . getPart ( i + 1 ) ; // ARG _ NUMBER or ARG _ NAME
if ( msgPattern . partSubstringMatches ( part , argName ) ) { return i ; } } i = msgPattern . getLimitPartIndex ( i ) ; } } |
public class XStreamTransformer { /** * pojo - > xml
* @ param clazz
* @ param object
* @ return */
public static < T > String toXml ( Class < T > clazz , T object ) { } } | return CLASS_2_XSTREAM_INSTANCE . get ( clazz ) . toXML ( object ) ; |
public class BuildsInner { /** * Gets a link to download the build logs .
* @ param resourceGroupName The name of the resource group to which the container registry belongs .
* @ param registryName The name of the container registry .
* @ param buildId The build ID .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the BuildGetLogResultInner object */
public Observable < BuildGetLogResultInner > getLogLinkAsync ( String resourceGroupName , String registryName , String buildId ) { } } | return getLogLinkWithServiceResponseAsync ( resourceGroupName , registryName , buildId ) . map ( new Func1 < ServiceResponse < BuildGetLogResultInner > , BuildGetLogResultInner > ( ) { @ Override public BuildGetLogResultInner call ( ServiceResponse < BuildGetLogResultInner > response ) { return response . body ( ) ; } } ) ; |
public class Classpath { /** * Search from URL . Fall back on prefix tokens if not able to read from original url param .
* @ param result
* the result urls
* @ param prefix
* the current prefix
* @ param suffix
* the suffix to match
* @ param url
* the current url to start search
* @ throws IOException
* for any error */
private static void _searchFromURL ( Set < URL > result , String prefix , String suffix , URL url ) throws IOException { } } | boolean done = false ; InputStream is = _getInputStream ( url ) ; if ( is != null ) { try { ZipInputStream zis ; if ( is instanceof ZipInputStream ) { zis = ( ZipInputStream ) is ; } else { zis = new ZipInputStream ( is ) ; } try { ZipEntry entry = zis . getNextEntry ( ) ; // initial entry should not be null
// if we assume this is some inner jar
done = entry != null ; while ( entry != null ) { String entryName = entry . getName ( ) ; if ( entryName . endsWith ( suffix ) ) { result . add ( new URL ( url . toExternalForm ( ) + entryName ) ) ; } entry = zis . getNextEntry ( ) ; } } finally { zis . close ( ) ; } } catch ( Exception ignore ) { } } if ( ! done && prefix . length ( ) > 0 ) { // we add ' / ' at the end since join adds it as well
String urlString = url . toExternalForm ( ) + "/" ; String [ ] split = prefix . split ( "/" ) ; prefix = _join ( split , true ) ; String end = _join ( split , false ) ; urlString = urlString . substring ( 0 , urlString . lastIndexOf ( end ) ) ; if ( isExcludedPrefix ( urlString ) ) { // excluded URL found , ignore it
return ; } url = new URL ( urlString ) ; _searchFromURL ( result , prefix , suffix , url ) ; } |
public class Vector3d { /** * Set the first two components from the given < code > v < / code >
* and the z component from the given < code > z < / code >
* @ param v
* the { @ link Vector2ic } to copy the values from
* @ param z
* the z component
* @ return this */
public Vector3d set ( Vector2ic v , double z ) { } } | return set ( v . x ( ) , v . y ( ) , z ) ; |
public class HCConditionalCommentNode { /** * Get the passed node wrapped in a conditional comment . This is a sanity
* method for < code > new HCConditionalCommentNode ( this , sCondition ) < / code > . If
* this node is already an { @ link HCConditionalCommentNode } the object is
* simply casted .
* @ param sCondition
* The condition to us . May neither be < code > null < / code > nor empty .
* @ param aNode
* The HC node to be wrapped . May not be < code > null < / code > .
* @ return Never < code > null < / code > . */
@ Nonnull public static HCConditionalCommentNode getAsConditionalCommentNode ( @ Nonnull @ Nonempty final String sCondition , @ Nonnull final IHCNode aNode ) { } } | if ( aNode instanceof HCConditionalCommentNode ) return ( HCConditionalCommentNode ) aNode ; return new HCConditionalCommentNode ( sCondition , aNode ) ; |
public class SSLContextBuilder { /** * The paths and passwords for both keystore and truststore are provided .
* And used to build an SSLContext .
* @ param keystoreFilePath Absolute path for the keystore .
* @ param keystorePassword Password for the keystore .
* @ param truststoreFilePath Absolute path for the truststore .
* @ param truststorePassword Password for the truststore . */
public SSLContext build ( String keystoreFilePath , String keystorePassword , String truststoreFilePath , String truststorePassword ) throws CommunicationsInitializationException { } } | // Passwords are needed as char arrays
char [ ] ckeystorePassword = keystorePassword . toCharArray ( ) ; char [ ] ctruststorePassword = truststorePassword . toCharArray ( ) ; // Load Keystore
FileInputStream fIn = null ; KeyStore keystore = null ; try { fIn = new FileInputStream ( keystoreFilePath ) ; keystore = KeyStore . getInstance ( this . keystoreType ) ; keystore . load ( fIn , ckeystorePassword ) ; } catch ( CertificateException e ) { throw new CommunicationsInitializationException ( "Cannot initialize keystore from: " + keystoreFilePath , e ) ; } catch ( NoSuchAlgorithmException e ) { throw new CommunicationsInitializationException ( "Cannot initialize keystore from: " + keystoreFilePath , e ) ; } catch ( KeyStoreException e ) { throw new CommunicationsInitializationException ( "Cannot initialize keystore from: " + keystoreFilePath , e ) ; } catch ( IOException e ) { throw new CommunicationsInitializationException ( "Cannot initialize keystore from: " + keystoreFilePath , e ) ; } // Load Truststore
KeyStore truststore = null ; try { fIn = new FileInputStream ( truststoreFilePath ) ; truststore = KeyStore . getInstance ( this . keystoreType ) ; truststore . load ( fIn , ctruststorePassword ) ; } catch ( IOException e ) { throw new CommunicationsInitializationException ( "Cannot initialize truststore from: " + truststoreFilePath , e ) ; } catch ( KeyStoreException e ) { throw new CommunicationsInitializationException ( "Cannot initialize truststore from: " + truststoreFilePath , e ) ; } catch ( NoSuchAlgorithmException e ) { throw new CommunicationsInitializationException ( "Cannot initialize truststore from: " + truststoreFilePath , e ) ; } catch ( CertificateException e ) { throw new CommunicationsInitializationException ( "Cannot initialize truststore from: " + truststoreFilePath , e ) ; } // Initialize Keystore and KeyManagerFactory
KeyManagerFactory kmf = null ; try { kmf = KeyManagerFactory . getInstance ( KeyManagerFactory . getDefaultAlgorithm ( ) ) ; kmf . init ( keystore , ckeystorePassword ) ; } catch ( NoSuchAlgorithmException e ) { throw new CommunicationsInitializationException ( "Cannot initialize KeyManagerFactory" , e ) ; } catch ( UnrecoverableKeyException e ) { throw new CommunicationsInitializationException ( "Cannot initialize KeyManagerFactory" , e ) ; } catch ( KeyStoreException e ) { throw new CommunicationsInitializationException ( "Cannot initialize KeyManagerFactory" , e ) ; } // Initialize Truststore and TrustManagerFactory
TrustManagerFactory trustManagerFactory = null ; try { trustManagerFactory = TrustManagerFactory . getInstance ( TrustManagerFactory . getDefaultAlgorithm ( ) ) ; trustManagerFactory . init ( truststore ) ; } catch ( NoSuchAlgorithmException e ) { throw new CommunicationsInitializationException ( "Cannot initialize TrustManagerFactory" , e ) ; } catch ( KeyStoreException e ) { throw new CommunicationsInitializationException ( "Cannot initialize TrustManagerFactory" , e ) ; } // Build SSLContext
SSLContext clientContext = null ; try { clientContext = SSLContext . getInstance ( this . securityProtocol ) ; clientContext . init ( kmf . getKeyManagers ( ) , trustManagerFactory . getTrustManagers ( ) , null ) ; } catch ( NoSuchAlgorithmException e ) { throw new CommunicationsInitializationException ( "Cannot initialize SSLContext" , e ) ; } catch ( KeyManagementException e ) { throw new CommunicationsInitializationException ( "Cannot initialize SSLContext" , e ) ; } return clientContext ; |
public class WPartialDateField { /** * { @ inheritDoc } */
@ Override protected boolean doHandleRequest ( final Request request ) { } } | // Valid date entered by the user
String dateValue = getRequestValue ( request ) ; // Text entered by the user ( An empty string is treated as null )
String value = request . getParameter ( getId ( ) ) ; String text = ( Util . empty ( value ) ) ? null : value ; // Current date value
String currentDate = getValue ( ) ; boolean changed = false ; // If a " valid " date value has not been entered , then check if the " user text " has changed
if ( dateValue == null ) { // User entered text
changed = ! Util . equals ( text , getText ( ) ) || currentDate != null ; } else { // Valid Date
changed = ! Util . equals ( dateValue , currentDate ) ; } if ( changed ) { boolean valid = dateValue != null || text == null ; handleRequestValue ( dateValue , valid , text ) ; } return changed ; |
public class HandshakeMessage { /** * Sets the protocol string for this handshake message .
* @ param protocolString
* the protocol string for this handshake message . */
public void setProtocolString ( String protocolString ) { } } | this . protocolString = protocolString ; if ( protocolString != null ) { try { this . stringLength = protocolString . getBytes ( "US-ASCII" ) . length ; } catch ( UnsupportedEncodingException uee ) { this . stringLength = 0 ; log . error ( "Couldn't encode to US-ASCII." , uee ) ; } } else { this . stringLength = 0 ; } |
public class HelpTask { /** * { @ inheritDoc } Prints the usage statement . The format is :
* < pre >
* Usage : { tasks | . . . } [ arguments ]
* < / pre > */
public String getScriptUsage ( ) { } } | StringBuffer scriptUsage = new StringBuffer ( NL ) ; scriptUsage . append ( getMessage ( "usage" , scriptName ) ) ; scriptUsage . append ( " {" ) ; for ( int i = 0 ; i < tasks . size ( ) ; i ++ ) { SecurityUtilityTask task = tasks . get ( i ) ; scriptUsage . append ( task . getTaskName ( ) ) ; if ( i != ( tasks . size ( ) - 1 ) ) { scriptUsage . append ( "|" ) ; } } scriptUsage . append ( "} [options]" ) ; scriptUsage . append ( NL ) ; return scriptUsage . toString ( ) ; |
public class CryptoKey { /** * < code > . google . privacy . dlp . v2 . UnwrappedCryptoKey unwrapped = 2 ; < / code > */
public com . google . privacy . dlp . v2 . UnwrappedCryptoKey getUnwrapped ( ) { } } | if ( sourceCase_ == 2 ) { return ( com . google . privacy . dlp . v2 . UnwrappedCryptoKey ) source_ ; } return com . google . privacy . dlp . v2 . UnwrappedCryptoKey . getDefaultInstance ( ) ; |
public class AddDynamicSearchAdsCampaign { /** * Creates the campaign . */
private static Campaign createCampaign ( AdWordsServicesInterface adWordsServices , AdWordsSession session , Budget budget ) throws RemoteException , ApiException { } } | // Get the CampaignService .
CampaignServiceInterface campaignService = adWordsServices . get ( session , CampaignServiceInterface . class ) ; // Create campaign .
Campaign campaign = new Campaign ( ) ; campaign . setName ( "Interplanetary Cruise #" + System . currentTimeMillis ( ) ) ; campaign . setAdvertisingChannelType ( AdvertisingChannelType . SEARCH ) ; // Recommendation : Set the campaign to PAUSED when creating it to prevent
// the ads from immediately serving . Set to ENABLED once you ' ve added
// targeting and the ads are ready to serve .
campaign . setStatus ( CampaignStatus . PAUSED ) ; BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration ( ) ; biddingStrategyConfiguration . setBiddingStrategyType ( BiddingStrategyType . MANUAL_CPC ) ; campaign . setBiddingStrategyConfiguration ( biddingStrategyConfiguration ) ; // Only the budgetId should be sent , all other fields will be ignored by CampaignService .
Budget campaignBudget = new Budget ( ) ; campaignBudget . setBudgetId ( budget . getBudgetId ( ) ) ; campaign . setBudget ( campaignBudget ) ; // Required : Set the campaign ' s Dynamic Search Ads settings .
DynamicSearchAdsSetting dynamicSearchAdsSetting = new DynamicSearchAdsSetting ( ) ; // Required : Set the domain name and language .
dynamicSearchAdsSetting . setDomainName ( "example.com" ) ; dynamicSearchAdsSetting . setLanguageCode ( "en" ) ; // Set the campaign settings .
campaign . setSettings ( new Setting [ ] { dynamicSearchAdsSetting } ) ; // Optional : Set the start date .
campaign . setStartDate ( new DateTime ( ) . plusDays ( 1 ) . toString ( "yyyyMMdd" ) ) ; // Optional : Set the end date .
campaign . setEndDate ( new DateTime ( ) . plusYears ( 1 ) . toString ( "yyyyMMdd" ) ) ; // Create the operation .
CampaignOperation operation = new CampaignOperation ( ) ; operation . setOperand ( campaign ) ; operation . setOperator ( Operator . ADD ) ; // Add the campaign .
Campaign newCampaign = campaignService . mutate ( new CampaignOperation [ ] { operation } ) . getValue ( 0 ) ; // Display the results .
System . out . printf ( "Campaign with name '%s' and ID %d was added.%n" , newCampaign . getName ( ) , newCampaign . getId ( ) ) ; return newCampaign ; |
public class AbstractFacade { /** * { @ inheritDoc } */
@ Override @ SuppressWarnings ( "unchecked" ) public < E extends R > void register ( final E readyObject , final Object ... keyPart ) { } } | register ( Key . create ( ( Class < R > ) readyObject . getClass ( ) , keyPart ) , readyObject ) ; |
public class CmsDefaultXmlContentHandler { /** * Initializes the resource bundle to use for localized messages in this content handler . < p >
* @ param root the " resourcebundle " element from the appinfo node of the XML content definition
* @ param contentDefinition the content definition the validation rules belong to
* @ param single if < code > true < / code > we process the classic sinle line entry , otherwise it ' s the multiple line setting
* @ throws CmsXmlException if something goes wrong */
protected void initResourceBundle ( Element root , CmsXmlContentDefinition contentDefinition , boolean single ) throws CmsXmlException { } } | if ( m_messageBundleNames == null ) { // it ' s uncommon to have more then one bundle so just initialize an array length of 2
m_messageBundleNames = new ArrayList < String > ( 2 ) ; } if ( single ) { // single " resourcebundle " node
String messageBundleName = root . attributeValue ( APPINFO_ATTR_NAME ) ; if ( messageBundleName == null ) { throw new CmsXmlException ( Messages . get ( ) . container ( Messages . ERR_XMLCONTENT_MISSING_RESOURCE_BUNDLE_NAME_2 , root . getName ( ) , contentDefinition . getSchemaLocation ( ) ) ) ; } if ( ! m_messageBundleNames . contains ( messageBundleName ) ) { // avoid duplicates
m_messageBundleNames . add ( messageBundleName ) ; } // clear the cached resource bundles for this bundle
CmsResourceBundleLoader . flushBundleCache ( messageBundleName , false ) ; } else { // multiple " resourcebundles " node
// get an iterator for all " propertybundle " subnodes
Iterator < Element > propertybundles = CmsXmlGenericWrapper . elementIterator ( root , APPINFO_PROPERTYBUNDLE ) ; while ( propertybundles . hasNext ( ) ) { // iterate all " propertybundle " elements in the " resourcebundle " node
Element propBundle = propertybundles . next ( ) ; String propertyBundleName = propBundle . attributeValue ( APPINFO_ATTR_NAME ) ; if ( ! m_messageBundleNames . contains ( propertyBundleName ) ) { // avoid duplicates
m_messageBundleNames . add ( propertyBundleName ) ; } // clear the cached resource bundles for this bundle
CmsResourceBundleLoader . flushBundleCache ( propertyBundleName , false ) ; } // get an iterator for all " xmlbundle " subnodes
Iterator < Element > xmlbundles = CmsXmlGenericWrapper . elementIterator ( root , APPINFO_XMLBUNDLE ) ; while ( xmlbundles . hasNext ( ) ) { Element xmlbundle = xmlbundles . next ( ) ; String xmlBundleName = xmlbundle . attributeValue ( APPINFO_ATTR_NAME ) ; // cache the bundle from the XML
if ( ! m_messageBundleNames . contains ( xmlBundleName ) ) { // avoid duplicates
m_messageBundleNames . add ( xmlBundleName ) ; } // clear the cached resource bundles for this bundle
CmsResourceBundleLoader . flushBundleCache ( xmlBundleName , true ) ; Iterator < Element > bundles = CmsXmlGenericWrapper . elementIterator ( xmlbundle , APPINFO_BUNDLE ) ; while ( bundles . hasNext ( ) ) { // iterate all " bundle " elements in the " xmlbundle " node
Element bundle = bundles . next ( ) ; String localeStr = bundle . attributeValue ( APPINFO_ATTR_LOCALE ) ; Locale locale ; if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( localeStr ) ) { // no locale set , so use no locale
locale = null ; } else { // use provided locale
locale = CmsLocaleManager . getLocale ( localeStr ) ; } boolean isDefaultLocaleAndNotNull = ( locale != null ) && locale . equals ( CmsLocaleManager . getDefaultLocale ( ) ) ; CmsListResourceBundle xmlBundle = null ; Iterator < Element > resources = CmsXmlGenericWrapper . elementIterator ( bundle , APPINFO_RESOURCE ) ; while ( resources . hasNext ( ) ) { // now collect all resource bundle keys
Element resource = resources . next ( ) ; String key = resource . attributeValue ( APPINFO_ATTR_KEY ) ; String value = resource . attributeValue ( APPINFO_ATTR_VALUE ) ; if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( value ) ) { // read from inside XML tag if value attribute is not set
value = resource . getTextTrim ( ) ; } if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( key ) && CmsStringUtil . isNotEmptyOrWhitespaceOnly ( value ) ) { if ( xmlBundle == null ) { // use lazy initilaizing of the bundle
xmlBundle = new CmsListResourceBundle ( ) ; } xmlBundle . addMessage ( key . trim ( ) , value . trim ( ) ) ; } } if ( xmlBundle != null ) { CmsResourceBundleLoader . addBundleToCache ( xmlBundleName , locale , xmlBundle ) ; if ( isDefaultLocaleAndNotNull ) { CmsResourceBundleLoader . addBundleToCache ( xmlBundleName , null , xmlBundle ) ; } } } } } |
public class Validator { /** * Validate email . */
protected void validateEmail ( String field , String errorKey , String errorMessage ) { } } | validateRegex ( field , emailAddressPattern , false , errorKey , errorMessage ) ; |
public class GoogleAccount { /** * Gets all the google calendars hold by this source .
* @ return The list of google calendars , always a new list . */
public List < GoogleCalendar > getGoogleCalendars ( ) { } } | List < GoogleCalendar > googleCalendars = new ArrayList < > ( ) ; for ( Calendar calendar : getCalendars ( ) ) { if ( ! ( calendar instanceof GoogleCalendar ) ) { continue ; } googleCalendars . add ( ( GoogleCalendar ) calendar ) ; } return googleCalendars ; |
public class MainModule { /** * Provisioning of a RendererBuilder implementation to work with places ListView . More
* information in this library : { @ link https : / / github . com / pedrovgs / Renderers } */
@ Provides protected PlacesCollectionRendererBuilder providePlaceCollectionRendererBuilder ( Context context ) { } } | List < Renderer < PlaceViewModel > > prototypes = new LinkedList < Renderer < PlaceViewModel > > ( ) ; prototypes . add ( new PlaceRenderer ( context ) ) ; return new PlacesCollectionRendererBuilder ( prototypes ) ; |
public class AbstractDirigent { /** * Executes all attached { @ link PostProcessor } s to process the specified { @ link Component } .
* @ param in The component to process .
* @ param context The compose context .
* @ param args The macro arguments .
* @ return The processed component . */
private Component applyPostProcessors ( Component in , Context context , Arguments args ) { } } | Component out = in ; for ( final PostProcessor postProcessor : postProcessors ) { out = postProcessor . process ( out , context , args ) ; } return out ; |
public class DdthCipherOutputStream { /** * { @ inheritDoc } */
@ Override public void close ( ) throws IOException { } } | if ( ! closed ) { closed = true ; try { byte [ ] buffer = cipher . doFinal ( ) ; if ( buffer != null ) { output . write ( buffer ) ; } } catch ( IllegalBlockSizeException | BadPaddingException e ) { throw new CipherException ( e ) ; } finally { if ( closeOutput ) { super . close ( ) ; } else { flush ( ) ; } } } |
public class InvokeLambdaAction { /** * Invokes an AWS Lambda Function in sync mode using AWS Java SDK
* @ param identity Access key associated with your Amazon AWS or IAM account .
* Example : " wJalrXUtnFEMI / K7MDENG / bPxRfiCYEXAMPLEKEY "
* @ param credential Secret access key ID associated with your Amazon AWS or IAM account .
* @ param proxyHost Optional - proxy server used to connect to Amazon API . If empty no proxy will be used .
* Default : " "
* @ param proxyPort Optional - proxy server port . You must either specify values for both proxyHost and
* proxyPort inputs or leave them both empty .
* Default : " "
* @ param proxyUsername Optional - proxy server user name .
* Default : " "
* @ param proxyPassword Optional - proxy server password associated with the proxyUsername input value .
* Default : " "
* @ param function Lambda function name to call
* Example : " helloWord "
* @ param qualifier Optional - Lambda function version or alias
* Example : " : 1"
* Default : " $ LATEST "
* @ param payload Optional - Lambda function payload in JSON format
* Example : " { " key1 " : " value1 " , " key1 " : " value2 " } "
* Default : null
* @ return A map with strings as keys and strings as values that contains : outcome of the action , returnCode of the
* operation , or failure message and the exception if there is one */
@ Action ( name = "Invoke AWS Lambda Function" , outputs = { } } | @ Output ( Outputs . RETURN_CODE ) , @ Output ( Outputs . RETURN_RESULT ) , @ Output ( Outputs . EXCEPTION ) } , responses = { @ Response ( text = Outputs . SUCCESS , field = Outputs . RETURN_CODE , value = Outputs . SUCCESS_RETURN_CODE , matchType = MatchType . COMPARE_EQUAL , responseType = ResponseType . RESOLVED ) , @ Response ( text = Outputs . FAILURE , field = Outputs . RETURN_CODE , value = Outputs . FAILURE_RETURN_CODE , matchType = MatchType . COMPARE_EQUAL , responseType = ResponseType . ERROR ) } ) public Map < String , String > execute ( @ Param ( value = IDENTITY , required = true ) String identity , @ Param ( value = CREDENTIAL , required = true , encrypted = true ) String credential , @ Param ( value = REGION , required = true ) String region , @ Param ( value = PROXY_HOST ) String proxyHost , @ Param ( value = PROXY_PORT ) String proxyPort , @ Param ( value = PROXY_USERNAME ) String proxyUsername , @ Param ( value = PROXY_PASSWORD ) String proxyPassword , @ Param ( value = FUNCTION_NAME , required = true ) String function , @ Param ( value = FUNCTION_QUALIFIER ) String qualifier , @ Param ( value = FUNCTION_PAYLOAD ) String payload , @ Param ( value = CONNECT_TIMEOUT ) String connectTimeoutMs , @ Param ( value = EXECUTION_TIMEOUT ) String execTimeoutMs ) { proxyPort = defaultIfEmpty ( proxyPort , DefaultValues . PROXY_PORT ) ; connectTimeoutMs = defaultIfEmpty ( connectTimeoutMs , DefaultValues . CONNECT_TIMEOUT ) ; execTimeoutMs = defaultIfBlank ( execTimeoutMs , DefaultValues . EXEC_TIMEOUT ) ; qualifier = defaultIfBlank ( qualifier , DefaultValues . DEFAULT_FUNCTION_QUALIFIER ) ; ClientConfiguration lambdaClientConf = AmazonWebServiceClientUtil . getClientConfiguration ( proxyHost , proxyPort , proxyUsername , proxyPassword , connectTimeoutMs , execTimeoutMs ) ; AWSLambdaAsyncClient client = ( AWSLambdaAsyncClient ) AWSLambdaAsyncClientBuilder . standard ( ) . withClientConfiguration ( lambdaClientConf ) . withCredentials ( new AWSStaticCredentialsProvider ( new BasicAWSCredentials ( identity , credential ) ) ) . withRegion ( region ) . build ( ) ; InvokeRequest invokeRequest = new InvokeRequest ( ) . withFunctionName ( function ) . withQualifier ( qualifier ) . withPayload ( payload ) . withSdkClientExecutionTimeout ( Integer . parseInt ( execTimeoutMs ) ) ; try { InvokeResult invokeResult = client . invoke ( invokeRequest ) ; return OutputUtilities . getSuccessResultsMap ( new String ( invokeResult . getPayload ( ) . array ( ) ) ) ; } catch ( Exception e ) { return OutputUtilities . getFailureResultsMap ( e ) ; } |
public class A_CmsEditSearchIndexDialog { /** * Commits the edited search index to the search manager . < p > */
@ Override public void actionCommit ( ) { } } | List < Throwable > errors = new ArrayList < Throwable > ( ) ; try { // if new create it first
if ( ! m_searchManager . getSearchIndexesAll ( ) . contains ( m_index ) ) { // check the index name for invalid characters
CmsStringUtil . checkName ( m_index . getName ( ) , INDEX_NAME_CONSTRAINTS , Messages . ERR_SEARCHINDEX_BAD_INDEXNAME_4 , Messages . get ( ) ) ; // empty or null name and uniqueness check in add method
m_searchManager . addSearchIndex ( m_index ) ; } // check if field configuration has been updated , if thus set field configuration to the now used
if ( ! m_index . getFieldConfigurationName ( ) . equals ( m_index . getFieldConfiguration ( ) . getName ( ) ) ) { m_index . setFieldConfiguration ( m_searchManager . getFieldConfiguration ( m_index . getFieldConfigurationName ( ) ) ) ; } writeConfiguration ( ) ; } catch ( Throwable t ) { errors . add ( t ) ; } // set the list of errors to display when saving failed
setCommitErrors ( errors ) ; |
public class AntPathMatcher { /** * Tokenize the given path String into parts , based on this matcher ' s settings .
* @ param path the path to tokenize
* @ return the tokenized path parts */
protected String [ ] tokenizePath ( String path ) { } } | return StringUtils . tokenizeToStringArray ( path , this . pathSeparator , this . trimTokens , true ) ; |
public class TimephasedUtility { /** * For a given date range , determine the duration of work , based on the
* timephased resource assignment data .
* This method deals with timescale units of less than a day .
* @ param projectCalendar calendar used for the resource assignment calendar
* @ param rangeUnits timescale units
* @ param range target date range
* @ param assignments timephased resource assignments
* @ param startIndex index at which to start searching through the timephased resource assignments
* @ return work duration */
private Duration getRangeDurationSubDay ( ProjectCalendar projectCalendar , TimescaleUnits rangeUnits , DateRange range , List < TimephasedWork > assignments , int startIndex ) { } } | throw new UnsupportedOperationException ( "Please request this functionality from the MPXJ maintainer" ) ; |
public class SQLTransformer { /** * Used to convert a generic parameter to where conditions .
* @ param methodBuilder
* the method builder
* @ param method
* the method
* @ param methodParamName
* name of the parameter in the method
* @ param paramName
* the param name
* @ param paramType
* the param type */
public static void javaMethodParam2WhereConditions ( MethodSpec . Builder methodBuilder , SQLiteModelMethod method , String methodParamName , String paramName , TypeName paramType ) { } } | if ( method . hasAdapterForParam ( methodParamName ) ) { checkTypeAdapterForParam ( method , methodParamName , BindSqlParam . class ) ; methodBuilder . addCode ( AbstractSQLTransform . PRE_TYPE_ADAPTER_TO_STRING + "$L" + AbstractSQLTransform . POST_TYPE_ADAPTER , SQLTypeAdapterUtils . class , method . getAdapterForParam ( methodParamName ) , paramName ) ; } else { SQLTransform transform = lookup ( paramType ) ; AssertKripton . assertTrueOrUnsupportedFieldTypeException ( transform != null , paramType ) ; transform . generateWriteParam2WhereCondition ( methodBuilder , method , paramName , paramType ) ; } |
public class UdpClient { /** * Set a { @ link ChannelOption } value for low level connection settings like { @ code SO _ TIMEOUT }
* or { @ code SO _ KEEPALIVE } . This will apply to each new channel from remote peer .
* @ param key the option key
* @ param value the option value
* @ param < T > the option type
* @ return new { @ link UdpClient }
* @ see Bootstrap # option ( ChannelOption , Object ) */
public final < T > UdpClient option ( ChannelOption < T > key , T value ) { } } | Objects . requireNonNull ( key , "key" ) ; Objects . requireNonNull ( value , "value" ) ; return bootstrap ( b -> b . option ( key , value ) ) ; |
public class AsmInvokeDistributeFactory { /** * 构建byte code
* @ param parentClass 父类
* @ param className 生成的class名
* @ return 生成的class的byte code数据 */
public byte [ ] buildByteCode ( Class < ? > parentClass , String className ) { } } | ClassWriter cw = new ClassWriter ( ClassWriter . COMPUTE_MAXS ) ; cw . visit ( version , // Java version
ACC_PUBLIC , // public class
convert ( className ) , // package and name
null , // signature ( null means not generic )
convert ( parentClass ) , // superclass
new String [ ] { convert ( InvokeDistribute . class ) } ) ; // 声明保存实际Target的字段
cw . visitField ( ACC_PRIVATE + ACC_FINAL , TARGET_FIELD_NAME , getByteCodeType ( parentClass ) , null , null ) . visitEnd ( ) ; /* 为类构建默认构造器 ( 编译器会自动生成 , 但是此处要手动生成bytecode就只能手动生成无参构造器了 ) */
generateDefaultConstructor ( cw , parentClass , className ) ; // 构建分发方法
buildMethod ( cw , className , parentClass ) ; // buildMethod ( cw ) ;
// finish the class definition
cw . visitEnd ( ) ; return cw . toByteArray ( ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.