signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class SmartCache { /** * Add a new value to the cache . The value will expire in accordance with the cache ' s expiration * timeout value which was set when the cache was created . * @ param key the key , typically a String * @ param value the value * @ return the previous value of the specified key in this hashtable , or null if it did not have * one . */ @ Override public synchronized Object put ( Object key , Object value ) { } }
ValueWrapper valueWrapper = new ValueWrapper ( value ) ; return super . put ( key , valueWrapper ) ;
public class Heritrix3Wrapper { /** * Creates a new job and initialises it with the default cxml file which must be modified before launch . * @ param jobname name of the new job * @ return engine state and a list of registered jobs */ public EngineResult createNewJob ( String jobname ) { } }
HttpPost postRequest = new HttpPost ( baseUrl ) ; List < NameValuePair > nvp = new LinkedList < NameValuePair > ( ) ; nvp . add ( new BasicNameValuePair ( "action" , "create" ) ) ; nvp . add ( new BasicNameValuePair ( "createpath" , jobname ) ) ; StringEntity postEntity = null ; try { postEntity = new UrlEncodedFormEntity ( nvp ) ; } catch ( UnsupportedEncodingException e ) { e . printStackTrace ( ) ; } postEntity . setContentType ( "application/x-www-form-urlencoded" ) ; postRequest . addHeader ( "Accept" , "application/xml" ) ; postRequest . setEntity ( postEntity ) ; return engineResult ( postRequest ) ;
public class EntryStream { /** * Return a new { @ link EntryStream } containing all the nodes of tree - like * data structure in entry values along with the corresponding tree depths * in entry keys , in depth - first order . * The keys of the returned stream are non - negative integer numbers . 0 is * used for the root node only , 1 is for root immediate children , 2 is for * their children and so on . * The streams created by mapper may be automatically * { @ link java . util . stream . BaseStream # close ( ) closed } after its contents * already consumed and unnecessary anymore . It ' s not guaranteed that all * created streams will be closed during the stream terminal operation . If * it ' s necessary to close all the created streams , call the { @ code close ( ) } * method of the resulting stream returned by { @ code ofTree ( ) } . * @ param < T > the type of tree nodes * @ param root root node of the tree * @ param mapper a non - interfering , stateless function to apply to each tree * node and its depth which returns null for leaf nodes or stream of * direct children for non - leaf nodes . * @ return the new sequential ordered { @ code EntryStream } * @ since 0.5.2 * @ see StreamEx # ofTree ( Object , Function ) * @ see # ofTree ( Object , Class , BiFunction ) */ public static < T > EntryStream < Integer , T > ofTree ( T root , BiFunction < Integer , T , Stream < T > > mapper ) { } }
TreeSpliterator < T , Entry < Integer , T > > spliterator = new TreeSpliterator . Depth < > ( root , mapper ) ; return new EntryStream < > ( spliterator , StreamContext . SEQUENTIAL . onClose ( spliterator :: close ) ) ;
public class SofaRegistry { /** * 添加额外的属性 * @ param subscriberRegistration 注册或者订阅对象 * @ param group 分组 */ private void addAttributes ( SubscriberRegistration subscriberRegistration , String group ) { } }
// if group = = null ; group = " DEFAULT _ GROUP " if ( StringUtils . isNotEmpty ( group ) ) { subscriberRegistration . setGroup ( group ) ; } subscriberRegistration . setScopeEnum ( ScopeEnum . global ) ;
public class LocalDateTime { /** * Compares this date - time to another date - time . * The comparison is primarily based on the date - time , from earliest to latest . * It is " consistent with equals " , as defined by { @ link Comparable } . * If all the date - times being compared are instances of { @ code LocalDateTime } , * then the comparison will be entirely based on the date - time . * If some dates being compared are in different chronologies , then the * chronology is also considered , see { @ link ChronoLocalDateTime # compareTo } . * @ param other the other date - time to compare to , not null * @ return the comparator value , negative if less , positive if greater */ @ Override // override for Javadoc and performance public int compareTo ( ChronoLocalDateTime < ? > other ) { } }
if ( other instanceof LocalDateTime ) { return compareTo0 ( ( LocalDateTime ) other ) ; } return super . compareTo ( other ) ;
public class BMOImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public boolean eIsSet ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . BMO__OVLY_NAME : return OVLY_NAME_EDEFAULT == null ? ovlyName != null : ! OVLY_NAME_EDEFAULT . equals ( ovlyName ) ; case AfplibPackage . BMO__TRIPLETS : return triplets != null && ! triplets . isEmpty ( ) ; } return super . eIsSet ( featureID ) ;
public class ChainingXmlWriter { /** * Registers the data type of a non - standard parameter . Non - standard * parameters use the " unknown " data type by default . * @ param parameterName the parameter name ( e . g . " x - foo " ) * @ param dataType the data type * @ return this */ public ChainingXmlWriter register ( String parameterName , ICalDataType dataType ) { } }
parameterDataTypes . put ( parameterName , dataType ) ; return this ;
public class HarFileSystem { /** * this method returns the path * inside the har filesystem . * this is relative path inside * the har filesystem . * @ param path the fully qualified path in the har filesystem . * @ return relative path in the filesystem . */ public Path getPathInHar ( Path path ) { } }
Path harPath = new Path ( path . toUri ( ) . getPath ( ) ) ; if ( archivePath . compareTo ( harPath ) == 0 ) return new Path ( Path . SEPARATOR ) ; Path tmp = new Path ( harPath . getName ( ) ) ; Path parent = harPath . getParent ( ) ; while ( ! ( parent . compareTo ( archivePath ) == 0 ) ) { if ( parent . toString ( ) . equals ( Path . SEPARATOR ) ) { tmp = null ; break ; } tmp = new Path ( parent . getName ( ) , tmp ) ; parent = parent . getParent ( ) ; } if ( tmp != null ) tmp = new Path ( Path . SEPARATOR , tmp ) ; return tmp ;
public class SetUtils { /** * Generates a new Powerset out of the given set . * @ param < T > * Type of set elements * @ param hashSet * Underlying set of elements * @ return Powerset of < code > set < / code > */ public static < T > PowerSet < T > getPowerSet ( Set < T > hashSet ) { } }
Validate . notNull ( hashSet ) ; if ( hashSet . isEmpty ( ) ) throw new IllegalArgumentException ( "set size 0" ) ; HashList < T > hashList = new HashList < > ( hashSet ) ; PowerSet < T > result = new PowerSet < > ( hashList . size ( ) ) ; for ( int i = 0 ; i < Math . pow ( 2 , hashList . size ( ) ) ; i ++ ) { int setSize = Integer . bitCount ( i ) ; HashSet < T > newList = new HashSet < > ( setSize ) ; result . get ( setSize ) . add ( newList ) ; for ( int j = 0 ; j < hashList . size ( ) ; j ++ ) { if ( ( i & ( 1 << j ) ) != 0 ) { newList . add ( hashList . get ( j ) ) ; } } } return result ;
public class CPRulePersistenceImpl { /** * Caches the cp rule in the entity cache if it is enabled . * @ param cpRule the cp rule */ @ Override public void cacheResult ( CPRule cpRule ) { } }
entityCache . putResult ( CPRuleModelImpl . ENTITY_CACHE_ENABLED , CPRuleImpl . class , cpRule . getPrimaryKey ( ) , cpRule ) ; cpRule . resetOriginalValues ( ) ;
public class CodeGenBase { /** * Unregistration of the { @ link # irObserver } . */ @ Override public void unregisterIrObs ( IREventObserver obs ) { } }
if ( obs != null && irObserver == obs ) { irObserver = null ; }
public class DefaultGroovyMethods { /** * Sorts the given iterator items using the comparator . The * original iterator will become exhausted of elements after completing this method call . * A new iterator is produced that traverses the items in sorted order . * @ param self the Iterator to be sorted * @ param comparator a Comparator used for comparing items * @ return the sorted items as an Iterator * @ since 2.4.0 */ public static < T > Iterator < T > toSorted ( Iterator < T > self , Comparator < T > comparator ) { } }
return toSorted ( toList ( self ) , comparator ) . listIterator ( ) ;
public class ResourceHandler { /** * < p class = " changed _ added _ 2_2 " > Return { @ code true } if the argument { @ code url } * contains the string given by the value of the constant * { @ link ResourceHandler # RESOURCE _ IDENTIFIER } , false otherwise . < / p > * @ param url the url to inspect for the presence of { @ link ResourceHandler # RESOURCE _ IDENTIFIER } . * @ throws NullPointerException if the argument url is { @ code null } . */ public boolean isResourceURL ( String url ) { } }
boolean result = false ; if ( null == url ) { throw new NullPointerException ( "null url" ) ; } result = url . contains ( ResourceHandler . RESOURCE_IDENTIFIER ) ; return result ;
public class FTPClient { /** * Renames remote directory . */ public void rename ( String oldName , String newName ) throws IOException , ServerException { } }
if ( oldName == null || newName == null ) { throw new IllegalArgumentException ( "Required argument missing" ) ; } Command cmd = new Command ( "RNFR" , oldName ) ; try { Reply reply = controlChannel . exchange ( cmd ) ; if ( ! Reply . isPositiveIntermediate ( reply ) ) { throw new UnexpectedReplyCodeException ( reply ) ; } controlChannel . execute ( new Command ( "RNTO" , newName ) ) ; } catch ( FTPReplyParseException rpe ) { throw ServerException . embedFTPReplyParseException ( rpe ) ; } catch ( UnexpectedReplyCodeException urce ) { throw ServerException . embedUnexpectedReplyCodeException ( urce , "Server refused renaming file" ) ; }
public class SpatialViewQuery { /** * Proactively load the full document for the row returned . * This only works if reduce is false , since with reduce the original document ID is not included anymore . * @ param includeDocs if it should be enabled or not . * @ param target the custom document type target . * @ return the { @ link SpatialViewQuery } DSL . */ public SpatialViewQuery includeDocs ( boolean includeDocs , Class < ? extends Document < ? > > target ) { } }
this . includeDocs = includeDocs ; this . includeDocsTarget = target ; return this ;
public class Job { /** * Trigger a parameterized build with file parameters * @ param params the job parameters * @ param fileParams the job file parameters * @ return { @ link QueueReference } for further analysis of the queued build . * @ throws IOException in case of an error . */ public QueueReference build ( Map < String , String > params , Map < String , File > fileParams ) throws IOException { } }
return build ( params , fileParams , false ) ;
public class AWS3Signer { /** * Signs the specified request with the AWS3 signing protocol by using the * AWS account credentials specified when this object was constructed and * adding the required AWS3 headers to the request . * @ param request * The request to sign . */ @ Override public void sign ( SignableRequest < ? > request , AWSCredentials credentials ) throws SdkClientException { } }
// annonymous credentials , don ' t sign if ( credentials instanceof AnonymousAWSCredentials ) { return ; } AWSCredentials sanitizedCredentials = sanitizeCredentials ( credentials ) ; SigningAlgorithm algorithm = SigningAlgorithm . HmacSHA256 ; String nonce = UUID . randomUUID ( ) . toString ( ) ; int timeOffset = request . getTimeOffset ( ) ; Date dateValue = getSignatureDate ( timeOffset ) ; String date = DateUtils . formatRFC822Date ( dateValue ) ; boolean isHttps = false ; if ( overriddenDate != null ) date = overriddenDate ; request . addHeader ( "Date" , date ) ; request . addHeader ( "X-Amz-Date" , date ) ; // AWS3 HTTP requires that we sign the Host header // so we have to have it in the request by the time we sign . String hostHeader = request . getEndpoint ( ) . getHost ( ) ; if ( SdkHttpUtils . isUsingNonDefaultPort ( request . getEndpoint ( ) ) ) { hostHeader += ":" + request . getEndpoint ( ) . getPort ( ) ; } request . addHeader ( "Host" , hostHeader ) ; if ( sanitizedCredentials instanceof AWSSessionCredentials ) { addSessionCredentials ( request , ( AWSSessionCredentials ) sanitizedCredentials ) ; } byte [ ] bytesToSign ; String stringToSign ; if ( isHttps ) { request . addHeader ( NONCE_HEADER , nonce ) ; stringToSign = date + nonce ; bytesToSign = stringToSign . getBytes ( UTF8 ) ; } else { String path = SdkHttpUtils . appendUri ( request . getEndpoint ( ) . getPath ( ) , request . getResourcePath ( ) ) ; /* * AWS3 requires all query params to be listed on the third line of * the string to sign , even if those query params will be sent in * the request body and not as a query string . POST formatted query * params should * NOT * be included in the request payload . */ stringToSign = request . getHttpMethod ( ) . toString ( ) + "\n" + getCanonicalizedResourcePath ( path ) + "\n" + getCanonicalizedQueryString ( request . getParameters ( ) ) + "\n" + getCanonicalizedHeadersForStringToSign ( request ) + "\n" + getRequestPayloadWithoutQueryParams ( request ) ; bytesToSign = hash ( stringToSign ) ; } if ( log . isDebugEnabled ( ) ) log . debug ( "Calculated StringToSign: " + stringToSign ) ; String signature = signAndBase64Encode ( bytesToSign , sanitizedCredentials . getAWSSecretKey ( ) , algorithm ) ; StringBuilder builder = new StringBuilder ( ) ; builder . append ( isHttps ? HTTPS_SCHEME : HTTP_SCHEME ) . append ( " " ) ; builder . append ( "AWSAccessKeyId=" + sanitizedCredentials . getAWSAccessKeyId ( ) + "," ) ; builder . append ( "Algorithm=" + algorithm . toString ( ) + "," ) ; if ( ! isHttps ) { builder . append ( getSignedHeadersComponent ( request ) + "," ) ; } builder . append ( "Signature=" + signature ) ; request . addHeader ( AUTHORIZATION_HEADER , builder . toString ( ) ) ;
public class AsyncSocketChannelHelper { /** * Create the delayed timeout work item for this request . * @ param future * @ param delay * @ param isRead */ private void createTimeout ( IAbstractAsyncFuture future , long delay , boolean isRead ) { } }
if ( AsyncProperties . disableTimeouts ) { return ; } // create the timeout time , while not holding the lock long timeoutTime = ( System . currentTimeMillis ( ) + delay + Timer . timeoutRoundup ) & Timer . timeoutResolution ; synchronized ( future . getCompletedSemaphore ( ) ) { // make sure it didn ' t complete while we were getting here if ( ! future . isCompleted ( ) ) { timer . createTimeoutRequest ( timeoutTime , this . callback , future ) ; } }
public class NodeSet { /** * Add the node into a vector of nodes where it should occur in * document order . * @ param node The node to be added . * @ param support The XPath runtime context . * @ return The index where it was inserted . * @ throws RuntimeException thrown if this NodeSet is not of * a mutable type . */ public int addNodeInDocOrder ( Node node , XPathContext support ) { } }
if ( ! m_mutable ) throw new RuntimeException ( XSLMessages . createXPATHMessage ( XPATHErrorResources . ER_NODESET_NOT_MUTABLE , null ) ) ; // " This NodeSet is not mutable ! " ) ; return addNodeInDocOrder ( node , true , support ) ;
public class AnnotationConstraintValidator { /** * This method ensures that any control property value assignment satisfies * all property constraints . This method should be called by control * property setters to ensure values assigned to properties at runtime are * validated . * @ param key * The property that the specified key is assigned to * @ param value * The value assigned to the specified property key * @ throws IllegalArgumentException * when the value assigned to the specified property key does * not satisfy a property constraint . */ public static void validate ( PropertyKey key , Object value ) throws IllegalArgumentException { } }
validate ( key . getAnnotations ( ) , value ) ;
public class SharedByteArray { /** * Responds to memory pressure by simply ' discarding ' the local byte array if it is not used * at the moment . * @ param trimType kind of trimming to perform ( ignored ) */ @ Override public void trim ( MemoryTrimType trimType ) { } }
if ( ! mSemaphore . tryAcquire ( ) ) { return ; } try { mByteArraySoftRef . clear ( ) ; } finally { mSemaphore . release ( ) ; }
public class FctBnAccEntitiesProcessors { /** * < p > Get purchase return good line utility . < / p > * @ param pAddParam additional param * @ return purchase return good line utility * @ throws Exception - an exception */ protected final UtlInvLine < RS , PurchaseReturn , PurchaseReturnLine , PurchaseReturnTaxLine , PurchaseReturnGoodsTaxLine > lazyGetUtlPurRetGdLn ( final Map < String , Object > pAddParam ) throws Exception { } }
UtlInvLine < RS , PurchaseReturn , PurchaseReturnLine , PurchaseReturnTaxLine , PurchaseReturnGoodsTaxLine > utlInvLn = this . utlPurRetGdLn ; if ( utlInvLn == null ) { utlInvLn = new UtlInvLine < RS , PurchaseReturn , PurchaseReturnLine , PurchaseReturnTaxLine , PurchaseReturnGoodsTaxLine > ( ) ; utlInvLn . setUtlInvBase ( lazyGetUtlInvBase ( pAddParam ) ) ; utlInvLn . setInvTxMeth ( lazyGetPurRetTxMeth ( pAddParam ) ) ; utlInvLn . setIsMutable ( false ) ; utlInvLn . setNeedMkTxCat ( false ) ; utlInvLn . setLtlCl ( PurchaseReturnGoodsTaxLine . class ) ; utlInvLn . setDstTxItLnCl ( DestTaxGoodsLn . class ) ; FactoryPersistableBase < PurchaseReturnGoodsTaxLine > fctLtl = new FactoryPersistableBase < PurchaseReturnGoodsTaxLine > ( ) ; fctLtl . setObjectClass ( PurchaseReturnGoodsTaxLine . class ) ; fctLtl . setDatabaseId ( getSrvDatabase ( ) . getIdDatabase ( ) ) ; utlInvLn . setFctLineTxLn ( fctLtl ) ; // assigning fully initialized object : this . utlPurRetGdLn = utlInvLn ; } return utlInvLn ;
public class TunnelingFeature { /** * Creates a new tunneling feature - response service . * @ param channelId tunneling connection channel identifier * @ param seq tunneling connection send sequence number * @ param featureId interface feature to respond to * @ param result result of processing the corresponding tunneling feature - get / set service * @ param featureValue feature value sent with a response ( optional , depdending on { @ code result } ) * @ return new tunneling feature - response service */ public static TunnelingFeature newResponse ( final int channelId , final int seq , final InterfaceFeature featureId , final ReturnCode result , final byte ... featureValue ) { } }
return new TunnelingFeature ( KNXnetIPHeader . TunnelingFeatureResponse , channelId , seq , featureId , result , featureValue ) ;
public class TasksImpl { /** * Adds a task to the specified job . * The maximum lifetime of a task from addition to completion is 180 days . If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time . * @ param jobId The ID of the job to which the task is to be added . * @ param task The task to be added . * @ param taskAddOptions Additional parameters for the operation * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceResponseWithHeaders } object if successful . */ public Observable < ServiceResponseWithHeaders < Void , TaskAddHeaders > > addWithServiceResponseAsync ( String jobId , TaskAddParameter task , TaskAddOptions taskAddOptions ) { } }
if ( this . client . batchUrl ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.batchUrl() is required and cannot be null." ) ; } if ( jobId == null ) { throw new IllegalArgumentException ( "Parameter jobId is required and cannot be null." ) ; } if ( task == null ) { throw new IllegalArgumentException ( "Parameter task is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } Validator . validate ( task ) ; Validator . validate ( taskAddOptions ) ; Integer timeout = null ; if ( taskAddOptions != null ) { timeout = taskAddOptions . timeout ( ) ; } UUID clientRequestId = null ; if ( taskAddOptions != null ) { clientRequestId = taskAddOptions . clientRequestId ( ) ; } Boolean returnClientRequestId = null ; if ( taskAddOptions != null ) { returnClientRequestId = taskAddOptions . returnClientRequestId ( ) ; } DateTime ocpDate = null ; if ( taskAddOptions != null ) { ocpDate = taskAddOptions . ocpDate ( ) ; } String parameterizedHost = Joiner . on ( ", " ) . join ( "{batchUrl}" , this . client . batchUrl ( ) ) ; DateTimeRfc1123 ocpDateConverted = null ; if ( ocpDate != null ) { ocpDateConverted = new DateTimeRfc1123 ( ocpDate ) ; } return service . add ( jobId , task , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , timeout , clientRequestId , returnClientRequestId , ocpDateConverted , parameterizedHost , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponseWithHeaders < Void , TaskAddHeaders > > > ( ) { @ Override public Observable < ServiceResponseWithHeaders < Void , TaskAddHeaders > > call ( Response < ResponseBody > response ) { try { ServiceResponseWithHeaders < Void , TaskAddHeaders > clientResponse = addDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
public class CreateAliasRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( CreateAliasRequest createAliasRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( createAliasRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createAliasRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( createAliasRequest . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( createAliasRequest . getRoutingStrategy ( ) , ROUTINGSTRATEGY_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class VdmUILabelProvider { /** * ( non - Javadoc ) * @ see ILabelProvider # getText */ public String getText ( Object element ) { } }
String result = VdmElementLabels . getTextLabel ( element , evaluateTextFlags ( element ) ) ; // if ( result . length ( ) = = 0 & & ( element instanceof IStorage ) ) { // result = fStorageLabelProvider . getText ( element ) ; return decorateText ( result , element ) ;
public class GroovyScript2RestLoader { /** * Remove node that contains groovy script . * @ param repository repository name * @ param workspace workspace name * @ param path JCR path to node that contains script * @ LevelAPI Provisional */ @ POST @ Path ( "delete/{repository}/{workspace}/{path:.*}" ) public Response deleteScript ( @ PathParam ( "repository" ) String repository , @ PathParam ( "workspace" ) String workspace , @ PathParam ( "path" ) String path ) { } }
Session ses = null ; try { ses = sessionProviderService . getSessionProvider ( null ) . getSession ( workspace , repositoryService . getRepository ( repository ) ) ; ses . getItem ( "/" + path ) . remove ( ) ; ses . save ( ) ; return Response . status ( Response . Status . NO_CONTENT ) . build ( ) ; } catch ( PathNotFoundException e ) { String msg = "Path " + path + " does not exists" ; LOG . error ( msg ) ; return Response . status ( Response . Status . NOT_FOUND ) . entity ( msg ) . entity ( MediaType . TEXT_PLAIN ) . build ( ) ; } catch ( Exception e ) { LOG . error ( e . getMessage ( ) , e ) ; return Response . status ( Response . Status . INTERNAL_SERVER_ERROR ) . entity ( e . getMessage ( ) ) . type ( MediaType . TEXT_PLAIN ) . build ( ) ; } finally { if ( ses != null ) { ses . logout ( ) ; } }
public class CustomDictionary { /** * 热更新 ( 重新加载 ) < br > * 集群环境 ( 或其他IOAdapter ) 需要自行删除缓存文件 ( 路径 = HanLP . Config . CustomDictionaryPath [ 0 ] + Predefine . BIN _ EXT ) * @ return 是否加载成功 */ public static boolean reload ( ) { } }
String path [ ] = HanLP . Config . CustomDictionaryPath ; if ( path == null || path . length == 0 ) return false ; IOUtil . deleteFile ( path [ 0 ] + Predefine . BIN_EXT ) ; // 删掉缓存 return loadMainDictionary ( path [ 0 ] ) ;
public class CertificateValidatorBuilder { /** * Builds an Openssl - style certificate validator configured as specified in * the parameters * @ param trustAnchorsDir * the directory where trust anchors are loaded from * @ param validationErrorListener * the listener that will receive notification about validation * errors * @ param storeUpdateListener * the listener that will receive notifications about trust store * update events * @ param updateInterval * the trust anchor store update interval * @ param namespaceChecks * the namespace checking policy * @ param crlChecks * the crl checking policy * @ param ocspChecks * the ocsp checking policy * @ param lazy * whether the validator should be lazy in loading crls and * certificates * @ return an Openssl - style certificate validator configured as specified in * the parameters * @ deprecated Create a { @ link CertificateValidatorBuilder } object instead . */ public static X509CertChainValidatorExt buildCertificateValidator ( String trustAnchorsDir , ValidationErrorListener validationErrorListener , StoreUpdateListener storeUpdateListener , long updateInterval , NamespaceCheckingMode namespaceChecks , CrlCheckingMode crlChecks , OCSPCheckingMode ocspChecks , boolean lazy ) { } }
CertificateValidatorBuilder builder = new CertificateValidatorBuilder ( ) ; return builder . trustAnchorsDir ( trustAnchorsDir ) . validationErrorListener ( validationErrorListener ) . storeUpdateListener ( storeUpdateListener ) . trustAnchorsUpdateInterval ( updateInterval ) . namespaceChecks ( namespaceChecks ) . crlChecks ( crlChecks ) . ocspChecks ( ocspChecks ) . lazyAnchorsLoading ( lazy ) . build ( ) ;
public class PhoenixReader { /** * For a given activity , retrieve a map of the activity code values which have been assigned to it . * @ param activity target activity * @ return map of activity code value UUIDs */ Map < UUID , UUID > getActivityCodes ( Activity activity ) { } }
Map < UUID , UUID > map = m_activityCodeCache . get ( activity ) ; if ( map == null ) { map = new HashMap < UUID , UUID > ( ) ; m_activityCodeCache . put ( activity , map ) ; for ( CodeAssignment ca : activity . getCodeAssignment ( ) ) { UUID code = getUUID ( ca . getCodeUuid ( ) , ca . getCode ( ) ) ; UUID value = getUUID ( ca . getValueUuid ( ) , ca . getValue ( ) ) ; map . put ( code , value ) ; } } return map ;
public class XFunctionTypeRefImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public JvmType getType ( ) { } }
if ( type != null && type . eIsProxy ( ) ) { InternalEObject oldType = ( InternalEObject ) type ; type = ( JvmType ) eResolveProxy ( oldType ) ; if ( type != oldType ) { if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . RESOLVE , XtypePackage . XFUNCTION_TYPE_REF__TYPE , oldType , type ) ) ; } } return type ;
public class BasePanel { /** * Process the " Add " toolbar command . * @ return true If command was handled */ public boolean onAdd ( ) { } }
Record record = this . getMainRecord ( ) ; if ( record == null ) return false ; try { if ( record . isModified ( false ) ) { if ( record . getEditMode ( ) == Constants . EDIT_IN_PROGRESS ) record . set ( ) ; else if ( record . getEditMode ( ) == Constants . EDIT_ADD ) record . add ( ) ; } record . addNew ( ) ; this . clearStatusText ( ) ; } catch ( DBException ex ) { this . displayError ( ex ) ; return false ; } return true ;
public class ScanningQueryEngine { /** * Create a node sequence for the given source . * @ param originalQuery the original query command ; may not be null * @ param context the context in which the query is to be executed ; may not be null * @ param sourceNode the { @ link Type # SOURCE } plan node for one part of a query ; may not be null * @ param columns the result column definition ; may not be null * @ param sources the query sources for the repository ; may not be null * @ return the sequence of results ; null only if the type of plan is not understood */ protected NodeSequence createNodeSequenceForSource ( QueryCommand originalQuery , QueryContext context , PlanNode sourceNode , Columns columns , QuerySources sources ) { } }
// The indexes should already be in the correct order , from lowest cost to highest cost . . . for ( PlanNode indexNode : sourceNode . getChildren ( ) ) { if ( indexNode . getType ( ) != Type . INDEX ) continue ; IndexPlan index = indexNode . getProperty ( Property . INDEX_SPECIFICATION , IndexPlan . class ) ; NodeSequence sequence = createNodeSequenceForSource ( originalQuery , context , sourceNode , index , columns , sources ) ; if ( sequence != null ) { // Mark the index as being used . . . indexNode . setProperty ( Property . INDEX_USED , Boolean . TRUE ) ; return sequence ; } // Otherwise , keep looking for an index . . . LOGGER . debug ( "Skipping disabled index '{0}' from provider '{1}' in workspace(s) {2} for query: {3}" , index . getName ( ) , index . getProviderName ( ) , context . getWorkspaceNames ( ) , originalQuery ) ; } // Grab all of the nodes . . . return sources . allNodes ( 1.0f , - 1 ) ;
public class ArraysUtil { /** * Concatenate the arrays . * @ param array First array . * @ param array2 Second array . * @ return Concatenate between first and second array . */ public static int [ ] Concatenate ( int [ ] array , int [ ] array2 ) { } }
int [ ] all = new int [ array . length + array2 . length ] ; int idx = 0 ; // First array for ( int i = 0 ; i < array . length ; i ++ ) all [ idx ++ ] = array [ i ] ; // Second array for ( int i = 0 ; i < array2 . length ; i ++ ) all [ idx ++ ] = array2 [ i ] ; return all ;
public class TombstoneImpl { /** * Check if the node has a fedora : tombstone mixin * @ param node the node * @ return true if the node has the fedora object mixin */ public static boolean hasMixin ( final Node node ) { } }
try { return node . isNodeType ( FEDORA_TOMBSTONE ) ; } catch ( final RepositoryException e ) { throw new RepositoryRuntimeException ( e ) ; }
public class WebAppMonitorListener { /** * 19@539186A */ public void checkAppCounters ( ) { } }
if ( appPmiState != APP_PMI_WEB ) { synchronized ( this ) { if ( appPmiState != APP_PMI_WEB ) { appPmi = new WebAppModule ( getAppName ( ) , true ) ; appPmiState = APP_PMI_WEB ; } } }
public class Matrix4f { /** * / * ( non - Javadoc ) * @ see org . joml . Matrix4fc # normalize3x3 ( org . joml . Matrix4f ) */ public Matrix4f normalize3x3 ( Matrix4f dest ) { } }
float invXlen = ( float ) ( 1.0 / Math . sqrt ( m00 * m00 + m01 * m01 + m02 * m02 ) ) ; float invYlen = ( float ) ( 1.0 / Math . sqrt ( m10 * m10 + m11 * m11 + m12 * m12 ) ) ; float invZlen = ( float ) ( 1.0 / Math . sqrt ( m20 * m20 + m21 * m21 + m22 * m22 ) ) ; dest . _m00 ( m00 * invXlen ) ; dest . _m01 ( m01 * invXlen ) ; dest . _m02 ( m02 * invXlen ) ; dest . _m10 ( m10 * invYlen ) ; dest . _m11 ( m11 * invYlen ) ; dest . _m12 ( m12 * invYlen ) ; dest . _m20 ( m20 * invZlen ) ; dest . _m21 ( m21 * invZlen ) ; dest . _m22 ( m22 * invZlen ) ; dest . _properties ( properties ) ; return dest ;
public class StorageSnippets { /** * Example of how to generate a GET V4 Signed URL */ public URL generateV4GetObjectSignedUrl ( String bucketName , String objectName ) throws StorageException { } }
// [ START storage _ generate _ signed _ url _ v4] // Instantiate a Google Cloud Storage client Storage storage = StorageOptions . getDefaultInstance ( ) . getService ( ) ; // The name of a bucket , e . g . " my - bucket " // String bucketName = " my - bucket " ; // The name of an object , e . g . " my - object " // String objectName = " my - object " ; // Define resource BlobInfo blobinfo = BlobInfo . newBuilder ( BlobId . of ( bucketName , objectName ) ) . build ( ) ; // Generate Signed URL URL url = storage . signUrl ( blobinfo , 15 , TimeUnit . MINUTES , Storage . SignUrlOption . withV4Signature ( ) ) ; System . out . println ( "Generated GET signed URL:" ) ; System . out . println ( url ) ; System . out . println ( "You can use this URL with any user agent, for example:" ) ; System . out . println ( "curl '" + url + "'" ) ; // [ END storage _ generate _ signed _ url _ v4] return url ;
public class BaseCheckBox { /** * < b > Affected Elements : < / b > * < ul > * < li > - label = label next to checkbox . < / li > * < / ul > * @ see UIObject # onEnsureDebugId ( String ) */ @ Override protected void onEnsureDebugId ( String baseID ) { } }
super . onEnsureDebugId ( baseID ) ; ensureDebugId ( labelElem , baseID , "label" ) ; ensureDebugId ( inputElem , baseID , "input" ) ; labelElem . setHtmlFor ( inputElem . getId ( ) ) ;
public class FileLogHolder { /** * This method will get an instance of TraceComponent * @ return */ private static TraceComponent getTc ( ) { } }
if ( tc == null ) { tc = Tr . register ( FileLogHolder . class , null , "com.ibm.ws.logging.internal.resources.LoggingMessages" ) ; } return tc ;
public class MtasSpanNotSpans { /** * Go to next doc . * @ return true , if successful * @ throws IOException Signals that an I / O exception has occurred . */ private boolean goToNextDoc ( ) throws IOException { } }
if ( docId == NO_MORE_DOCS ) { return true ; } else { docId = spans1 . spans . nextDoc ( ) ; if ( docId == NO_MORE_DOCS ) { return true ; } else { int spans2DocId = spans2 . spans . docID ( ) ; if ( spans2DocId < docId ) { spans2DocId = spans2 . spans . advance ( docId ) ; } if ( docId != spans2DocId ) { return spans1 . spans . nextStartPosition ( ) != NO_MORE_POSITIONS ; } else if ( goToNextStartPosition ( ) ) { return true ; } else { reset ( ) ; return false ; } } }
public class TextureAtlas { /** * Sets the image data of the provided { @ link Texture } with the image data found in this { @ link TextureAtlas } . This should be called after all textures have been added to the { @ link * TextureAtlas } . * @ param texture Texture to set image data */ public void attachTo ( Texture texture ) { } }
final int width = image . getWidth ( ) ; final int height = image . getHeight ( ) ; texture . setImageData ( CausticUtil . getImageData ( image , Format . RGBA ) , width , height ) ;
public class MessageToast { /** * Adds new link label below toast message . * @ param text link label text * @ param labelListener will be called upon label click . Note that toast won ' t be closed automatically so { @ link Toast # fadeOut ( ) } * must be called */ public void addLinkLabel ( String text , LinkLabel . LinkLabelListener labelListener ) { } }
LinkLabel label = new LinkLabel ( text ) ; label . setListener ( labelListener ) ; linkLabelTable . add ( label ) . spaceRight ( 12 ) ;
public class TextUtil { /** * Format the given double value . * @ param amount the value to convert . * @ param decimalCount is the maximal count of decimal to put in the string . * @ return a string representation of the given value . */ @ Pure public static String formatDouble ( double amount , int decimalCount ) { } }
final int dc = ( decimalCount < 0 ) ? 0 : decimalCount ; final StringBuilder str = new StringBuilder ( "#0" ) ; // $ NON - NLS - 1 $ if ( dc > 0 ) { str . append ( '.' ) ; for ( int i = 0 ; i < dc ; ++ i ) { str . append ( '0' ) ; } } final DecimalFormat fmt = new DecimalFormat ( str . toString ( ) ) ; return fmt . format ( amount ) ;
public class SSLWriteServiceContext { /** * Handle common activity of write and writeAsynch involving the encryption of the * current buffers . The caller will have the responsibility of writing them to the * device side channel . * @ return SSLEngineResult * @ throws IOException */ private SSLEngineResult encryptMessage ( ) throws IOException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "encryptMessage" ) ; } // Get the application buffer used as input to the encryption algorithm . // Extract the app buffers containing data to be written . final WsByteBuffer [ ] appBuffers = getBuffers ( ) ; SSLEngineResult result ; while ( true ) { // Protect JSSE from potential SSL packet sizes that are too big . int [ ] appLimitInfo = SSLUtils . adjustBuffersForJSSE ( appBuffers , getConnLink ( ) . getAppBufferSize ( ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "before wrap: appBuffers: " + SSLUtils . getBufferTraceInfo ( appBuffers ) + "\r\n\tencAppBuf: " + SSLUtils . getBufferTraceInfo ( encryptedAppBuffer ) ) ; } // Call the SSL engine to encrypt the request . result = getConnLink ( ) . getSSLEngine ( ) . wrap ( SSLUtils . getWrappedByteBuffers ( appBuffers ) , encryptedAppBuffer . getWrappedByteBuffer ( ) ) ; // Check the result of the call to wrap . Status status = result . getStatus ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "after wrap: appBuffers: " + SSLUtils . getBufferTraceInfo ( appBuffers ) + "\r\n\tencAppBuf: " + SSLUtils . getBufferTraceInfo ( encryptedAppBuffer ) + "\r\n\tstatus=" + status + " consumed=" + result . bytesConsumed ( ) + " produced=" + result . bytesProduced ( ) ) ; } // If a limit modification was saved , restore it . if ( appLimitInfo != null ) { SSLUtils . resetBuffersAfterJSSE ( appBuffers , appLimitInfo ) ; } if ( status == Status . OK ) { break ; } else if ( status == Status . BUFFER_OVERFLOW ) { // The output buffers provided to the SSL engine were not big enough . A bigger buffer // must be supplied . If we can build a bigger buffer and call again , build it . increaseEncryptedBuffer ( ) ; continue ; } else { throw new IOException ( "Unable to encrypt data, status=" + status ) ; } } // end of while if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "encryptMessage: " + result . getStatus ( ) ) ; } return result ;
public class Watch { /** * Applies a document add to the document tree . Returns the corresponding DocumentChange event . */ private DocumentChange addDoc ( QueryDocumentSnapshot newDocument ) { } }
ResourcePath resourcePath = newDocument . getReference ( ) . getResourcePath ( ) ; documentSet = documentSet . add ( newDocument ) ; int newIndex = documentSet . indexOf ( resourcePath ) ; return new DocumentChange ( newDocument , Type . ADDED , - 1 , newIndex ) ;
public class ConvertBufferedImage { /** * Converts the buffered image into an { @ link Planar } image of the specified ype . * @ param src Input image . Not modified . * @ param dst Output . The converted image is written to . If null a new unsigned image is created . * @ param orderRgb If applicable , should it adjust the ordering of each color band to maintain color consistency . * Most of the time you want this to be true . * @ param type Which type of data structure is each band . ( GrayU8 or GrayF32) * @ return Converted image . */ public static < T extends ImageGray < T > > Planar < T > convertFromPlanar ( BufferedImage src , Planar < T > dst , boolean orderRgb , Class < T > type ) { } }
if ( src == null ) throw new IllegalArgumentException ( "src is null!" ) ; if ( dst != null ) { dst . reshape ( src . getWidth ( ) , src . getHeight ( ) ) ; } try { WritableRaster raster = src . getRaster ( ) ; int numBands ; if ( ! isKnownByteFormat ( src ) ) numBands = 3 ; else numBands = raster . getNumBands ( ) ; if ( dst == null ) dst = new Planar < > ( type , src . getWidth ( ) , src . getHeight ( ) , numBands ) ; else if ( dst . getNumBands ( ) != numBands ) dst . setNumberOfBands ( numBands ) ; DataBuffer srcBuff = src . getRaster ( ) . getDataBuffer ( ) ; if ( type == GrayU8 . class ) { if ( srcBuff . getDataType ( ) == DataBuffer . TYPE_BYTE && isKnownByteFormat ( src ) ) { if ( src . getType ( ) == BufferedImage . TYPE_BYTE_GRAY ) { for ( int i = 0 ; i < dst . getNumBands ( ) ; i ++ ) { ConvertRaster . bufferedToGray ( ( DataBufferByte ) srcBuff , raster , ( ( Planar < GrayU8 > ) dst ) . getBand ( i ) ) ; } } else { ConvertRaster . bufferedToPlanar_U8 ( ( DataBufferByte ) srcBuff , src . getRaster ( ) , ( Planar < GrayU8 > ) dst ) ; } } else if ( srcBuff . getDataType ( ) == DataBuffer . TYPE_INT ) { ConvertRaster . bufferedToPlanar_U8 ( ( DataBufferInt ) srcBuff , src . getRaster ( ) , ( Planar < GrayU8 > ) dst ) ; } else { ConvertRaster . bufferedToPlanar_U8 ( src , ( Planar < GrayU8 > ) dst ) ; } } else if ( type == GrayF32 . class ) { if ( srcBuff . getDataType ( ) == DataBuffer . TYPE_BYTE && isKnownByteFormat ( src ) ) { if ( src . getType ( ) == BufferedImage . TYPE_BYTE_GRAY ) { for ( int i = 0 ; i < dst . getNumBands ( ) ; i ++ ) ConvertRaster . bufferedToGray ( ( DataBufferByte ) srcBuff , raster , ( ( Planar < GrayF32 > ) dst ) . getBand ( i ) ) ; } else { ConvertRaster . bufferedToPlanar_F32 ( ( DataBufferByte ) srcBuff , src . getRaster ( ) , ( Planar < GrayF32 > ) dst ) ; } } else if ( srcBuff . getDataType ( ) == DataBuffer . TYPE_INT ) { ConvertRaster . bufferedToPlanar_F32 ( ( DataBufferInt ) srcBuff , src . getRaster ( ) , ( Planar < GrayF32 > ) dst ) ; } else { ConvertRaster . bufferedToPlanar_F32 ( src , ( Planar < GrayF32 > ) dst ) ; } } else { throw new IllegalArgumentException ( "Band type not supported yet" ) ; } } catch ( java . security . AccessControlException e ) { // Applets don ' t allow access to the raster ( ) if ( dst == null ) dst = new Planar < > ( type , src . getWidth ( ) , src . getHeight ( ) , 3 ) ; else { dst . setNumberOfBands ( 3 ) ; } if ( type == GrayU8 . class ) { ConvertRaster . bufferedToPlanar_U8 ( src , ( Planar < GrayU8 > ) dst ) ; } else if ( type == GrayF32 . class ) { ConvertRaster . bufferedToPlanar_F32 ( src , ( Planar < GrayF32 > ) dst ) ; } } // if requested , ensure the ordering of the bands if ( orderRgb ) { orderBandsIntoRGB ( dst , src ) ; } return dst ;
public class TableFunctions { /** * Given 2 fields , if the first is null then return the second field * In the config file use : * fieldName = " func ( IFNULL ( field1 , field2 ) ) " */ private String ifNull ( int rowIndex ) { } }
if ( params . length != 2 ) { throw new IllegalArgumentException ( "Wrong number of Parameters for if null expression" ) ; } final RecordList . Record currentRecord = recordList . getRecords ( ) . get ( rowIndex ) ; final String field1 = currentRecord . getValueByFieldName ( params [ 0 ] ) ; if ( ! field1 . isEmpty ( ) ) { return field1 ; } final String field2 = currentRecord . getValueByFieldName ( params [ 1 ] ) ; return field2 ;
public class ClaimsUtils { /** * Converts the value for the specified claim into a String list . */ @ FFDCIgnore ( { } }
MalformedClaimException . class } ) private void convertToList ( String claimName , JwtClaims claimsSet ) { List < String > list = null ; try { list = claimsSet . getStringListClaimValue ( claimName ) ; } catch ( MalformedClaimException e ) { try { String value = claimsSet . getStringClaimValue ( claimName ) ; if ( value != null ) { list = new ArrayList < String > ( ) ; list . add ( value ) ; claimsSet . setClaim ( claimName , list ) ; } } catch ( MalformedClaimException e1 ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "The value for the claim [" + claimName + "] could not be convered to a string list: " + e1 . getLocalizedMessage ( ) ) ; } } }
public class TcpSocketServer { /** * Starts the I / O of a socket server . After creation , a socket server does * not accept connections until started . This allows listeners to be * registered between creation and start call . * @ throws IllegalStateException if closed or already started */ public void start ( final Callback < ? super TcpSocketServer > onStart , final Callback < ? super Exception > onError ) throws IllegalStateException { } }
if ( isClosed ( ) ) throw new IllegalStateException ( "TcpSocketServer is closed" ) ; synchronized ( lock ) { if ( serverSocket != null ) throw new IllegalStateException ( ) ; executors . getUnbounded ( ) . submit ( new Runnable ( ) { @ Override public void run ( ) { try { if ( isClosed ( ) ) throw new SocketException ( "TcpSocketServer is closed" ) ; final ServerSocket newServerSocket = new ServerSocket ( port , backlog , bindAddr ) ; synchronized ( lock ) { TcpSocketServer . this . serverSocket = newServerSocket ; } // Handle incoming messages in a Thread , can try nio later executors . getUnbounded ( ) . submit ( new Runnable ( ) { @ Override public void run ( ) { try { while ( true ) { synchronized ( lock ) { // Check if closed if ( newServerSocket != TcpSocketServer . this . serverSocket ) break ; } Socket socket = newServerSocket . accept ( ) ; long connectTime = System . currentTimeMillis ( ) ; socket . setKeepAlive ( KEEPALIVE ) ; socket . setSoLinger ( SOCKET_SO_LINGER_ENABLED , SOCKET_SO_LINGER_SECONDS ) ; socket . setTcpNoDelay ( TCP_NO_DELAY ) ; CompressedDataInputStream in = new CompressedDataInputStream ( socket . getInputStream ( ) ) ; CompressedDataOutputStream out = new CompressedDataOutputStream ( socket . getOutputStream ( ) ) ; Identifier id = newIdentifier ( ) ; out . writeLong ( id . getHi ( ) ) ; out . writeLong ( id . getLo ( ) ) ; out . flush ( ) ; TcpSocket tcpSocket = new TcpSocket ( TcpSocketServer . this , id , connectTime , socket , in , out ) ; addSocket ( tcpSocket ) ; } } catch ( Exception exc ) { if ( ! isClosed ( ) ) callOnError ( exc ) ; } finally { close ( ) ; } } } ) ; if ( onStart != null ) onStart . call ( TcpSocketServer . this ) ; } catch ( Exception exc ) { if ( onError != null ) onError . call ( exc ) ; } } } ) ; }
public class AssetServicesImpl { /** * Returns all the assets for the specified package . * Does not use the AssetCache . */ public PackageAssets getAssets ( String packageName , boolean withVcsInfo ) throws ServiceException { } }
try { PackageDir pkgDir = getPackageDir ( packageName ) ; if ( pkgDir == null ) { pkgDir = getGhostPackage ( packageName ) ; if ( pkgDir == null ) throw new DataAccessException ( "Missing package metadata directory: " + packageName ) ; } List < AssetInfo > assets = new ArrayList < > ( ) ; if ( ! DiffType . MISSING . equals ( pkgDir . getVcsDiffType ( ) ) ) { for ( File file : pkgDir . listFiles ( ) ) { if ( file . isFile ( ) ) { AssetFile assetFile = pkgDir . getAssetFile ( file ) ; if ( ! MdwIgnore . isIgnore ( assetFile ) ) assets . add ( new AssetInfo ( assetFile ) ) ; } } } PackageAssets pkgAssets = new PackageAssets ( pkgDir ) ; pkgAssets . setAssets ( assets ) ; if ( withVcsInfo ) { CodeTimer timer = new CodeTimer ( "AssetServices" , true ) ; addVersionControlInfo ( pkgAssets ) ; pkgAssets . sort ( ) ; timer . stopAndLogTiming ( "addVersionControlInfo(PackageAssets)" ) ; } return pkgAssets ; } catch ( Exception ex ) { throw new ServiceException ( ex . getMessage ( ) , ex ) ; }
public class MvpDialogFragment { /** * * Get the mvp delegate . This is internally used for creating presenter , attaching and * detaching view from presenter . * < b > Please note that only one instance of mvp delegate should be used per fragment * instance < / b > . * Only override this method if you really know what you are doing . * @ return { @ link FragmentMvpDelegateImpl } */ @ NonNull protected FragmentMvpDelegate < V , P > getMvpDelegate ( ) { } }
if ( mvpDelegate == null ) { mvpDelegate = new FragmentMvpDelegateImpl < > ( this , this , true , true ) ; } return mvpDelegate ;
public class SQSMessageProducer { /** * Sends a message to a queue . * @ param queue * the queue destination to send this message to * @ param message * the message to send * @ throws InvalidDestinationException * If a client uses this method with a destination other than * SQS queue destination . * @ throws MessageFormatException * If an invalid message is specified . * @ throws UnsupportedOperationException * If a client uses this method with a MessageProducer that * specified a destination at creation time . * @ throws JMSException * If session is closed or internal error . */ @ Override public void send ( Queue queue , Message message ) throws JMSException { } }
if ( ! ( queue instanceof SQSQueueDestination ) ) { throw new InvalidDestinationException ( "Incompatible implementation of Queue. Please use SQSQueueDestination implementation." ) ; } checkIfDestinationAlreadySet ( ) ; sendInternal ( ( SQSQueueDestination ) queue , message ) ;
public class ModuleFactory { /** * parse module load config * @ param moduleLoadList alias of all config modules * @ param moduleName the module name * @ return need load */ static boolean needLoad ( String moduleLoadList , String moduleName ) { } }
String [ ] activatedModules = StringUtils . splitWithCommaOrSemicolon ( moduleLoadList ) ; boolean match = false ; for ( String activatedModule : activatedModules ) { if ( StringUtils . ALL . equals ( activatedModule ) ) { match = true ; } else if ( activatedModule . equals ( moduleName ) ) { match = true ; } else if ( match && ( activatedModule . equals ( "!" + moduleName ) || activatedModule . equals ( "-" + moduleName ) ) ) { match = false ; break ; } } return match ;
public class NodeIdRepresentation { /** * This method serializes requested resource with an access type . * @ param resource * The requested resource * @ param nodeId * The node id of the requested resource . * @ param revision * The revision of the requested resource . * @ param doNodeId * Specifies whether the node id ' s have to be shown in the * result . * @ param output * The output stream to be written . * @ param wrapResult * Specifies whether the result has to be wrapped with a result * element . * @ param accessType * The { @ link EIdAccessType } which indicates the access to a * special node . */ private void serializeAT ( final String resource , final long nodeId , final Long revision , final boolean doNodeId , final OutputStream output , final boolean wrapResult , final EIdAccessType accessType ) { } }
if ( mDatabase . existsResource ( resource ) ) { ISession session = null ; INodeReadTrx rtx = null ; try { session = mDatabase . getSession ( new SessionConfiguration ( resource , StandardSettings . KEY ) ) ; if ( revision == null ) { rtx = new NodeReadTrx ( session . beginBucketRtx ( session . getMostRecentVersion ( ) ) ) ; } else { rtx = new NodeReadTrx ( session . beginBucketRtx ( revision ) ) ; } if ( rtx . moveTo ( nodeId ) ) { switch ( accessType ) { case FIRSTCHILD : if ( ! rtx . moveTo ( ( ( ITreeStructData ) rtx . getNode ( ) ) . getFirstChildKey ( ) ) ) throw new JaxRxException ( 404 , NOTFOUND ) ; break ; case LASTCHILD : if ( rtx . moveTo ( ( ( ITreeStructData ) rtx . getNode ( ) ) . getFirstChildKey ( ) ) ) { long last = rtx . getNode ( ) . getDataKey ( ) ; while ( rtx . moveTo ( ( ( ITreeStructData ) rtx . getNode ( ) ) . getRightSiblingKey ( ) ) ) { last = rtx . getNode ( ) . getDataKey ( ) ; } rtx . moveTo ( last ) ; } else { throw new JaxRxException ( 404 , NOTFOUND ) ; } break ; case RIGHTSIBLING : if ( ! rtx . moveTo ( ( ( ITreeStructData ) rtx . getNode ( ) ) . getRightSiblingKey ( ) ) ) throw new JaxRxException ( 404 , NOTFOUND ) ; break ; case LEFTSIBLING : if ( ! rtx . moveTo ( ( ( ITreeStructData ) rtx . getNode ( ) ) . getLeftSiblingKey ( ) ) ) throw new JaxRxException ( 404 , NOTFOUND ) ; break ; default : // nothing to do ; } if ( wrapResult ) { output . write ( BEGINRESULT ) ; final XMLSerializerProperties props = new XMLSerializerProperties ( ) ; final XMLSerializerBuilder builder = new XMLSerializerBuilder ( session , rtx . getNode ( ) . getDataKey ( ) , output , props ) ; builder . setREST ( doNodeId ) ; builder . setID ( doNodeId ) ; builder . setDeclaration ( false ) ; builder . setIndend ( false ) ; final XMLSerializer serializer = builder . build ( ) ; serializer . call ( ) ; output . write ( ENDRESULT ) ; } else { final XMLSerializerProperties props = new XMLSerializerProperties ( ) ; final XMLSerializerBuilder builder = new XMLSerializerBuilder ( session , rtx . getNode ( ) . getDataKey ( ) , output , props ) ; builder . setREST ( doNodeId ) ; builder . setID ( doNodeId ) ; builder . setDeclaration ( false ) ; builder . setIndend ( false ) ; final XMLSerializer serializer = builder . build ( ) ; serializer . call ( ) ; } } else { throw new JaxRxException ( 404 , NOTFOUND ) ; } } catch ( final TTException ttExcep ) { throw new JaxRxException ( ttExcep ) ; } catch ( final IOException ioExcep ) { throw new JaxRxException ( ioExcep ) ; } catch ( final Exception globExcep ) { if ( globExcep instanceof JaxRxException ) { // NOPMD due // to // different // exception // types throw ( JaxRxException ) globExcep ; } else { throw new JaxRxException ( globExcep ) ; } } finally { try { WorkerHelper . closeRTX ( rtx , session ) ; } catch ( final TTException exce ) { throw new JaxRxException ( exce ) ; } } } else { throw new JaxRxException ( 404 , "Resource does not exist" ) ; }
public class JMThread { /** * New max queue thread pool executor service . * @ param numWorkerThreads the num worker threads * @ param waitingMillis the waiting millis * @ param maxQueue the max queue * @ return the executor service */ public static ExecutorService newMaxQueueThreadPool ( int numWorkerThreads , long waitingMillis , int maxQueue ) { } }
return new ThreadPoolExecutor ( numWorkerThreads , numWorkerThreads , 0L , TimeUnit . MILLISECONDS , waitingMillis > 0 ? getWaitingLimitedBlockingQueue ( waitingMillis , maxQueue ) : getLimitedBlockingQueue ( maxQueue ) ) ;
public class Parser { /** * A { @ link Parser } that runs { @ code op } for 0 or more times greedily , then runs { @ code this } . * The { @ link Function } objects returned from { @ code op } are applied from right to left to the * return value of { @ code p } . * < p > { @ code p . prefix ( op ) } is equivalent to { @ code op * p } in EBNF . */ public final Parser < T > prefix ( Parser < ? extends Function < ? super T , ? extends T > > op ) { } }
return Parsers . sequence ( op . many ( ) , this , Parser :: applyPrefixOperators ) ;
public class ARGBColorUtil { /** * Gets a color composed of the specified channels . All values must be between 0 and 255 , both inclusive * @ param alpha The alpha channel [ 0-255] * @ param red The red channel [ 0-255] * @ param green The green channel [ 0-255] * @ param blue The blue channel [ 0-255] * @ return The color composed of the specified channels */ public static int getColor ( final int alpha , final int red , final int green , final int blue ) { } }
return ( alpha << ALPHA_SHIFT ) | ( red << RED_SHIFT ) | ( green << GREEN_SHIFT ) | blue ;
public class CreateWSDL11 { /** * AddTypeType Method . */ public void addTypeType ( String version , TTypes TTypes , MessageProcessInfo recMessageProcessInfo ) { } }
// Create the types ( import the OTA specs ) MessageInfo recMessageInfo = this . getMessageIn ( recMessageProcessInfo ) ; if ( recMessageInfo != null ) { String name = this . fixName ( recMessageInfo . getField ( MessageInfo . DESCRIPTION ) . toString ( ) ) ; if ( this . isNewType ( name ) ) { this . addSchema ( version , TTypes , recMessageInfo ) ; } } recMessageInfo = this . getMessageOut ( recMessageProcessInfo ) ; if ( recMessageInfo != null ) { String name = this . fixName ( recMessageInfo . getField ( MessageInfo . DESCRIPTION ) . toString ( ) ) ; if ( this . isNewType ( name ) ) { this . addSchema ( version , TTypes , recMessageInfo ) ; } }
public class MessageFieldUtil { /** * Returns a field converter class name for proto repeated enum field . */ public static String getRepeatedEnumConverterName ( Field field ) { } }
if ( field . isRepeated ( ) ) { return "__" + Formatter . toCamelCase ( field . getName ( ) ) + "Converter" ; } throw new IllegalArgumentException ( field . toString ( ) ) ;
public class RemoteMongoCollectionImpl { /** * Finds a document in the collection and delete it . * @ param filter the query filter * @ param options A RemoteFindOneAndModifyOptions struct * @ return the resulting document */ public DocumentT findOneAndDelete ( final Bson filter , final RemoteFindOneAndModifyOptions options ) { } }
return proxy . findOneAndDelete ( filter , options ) ;
public class Input { /** * Fills the buffer with at least the number of bytes specified , if possible . * @ param optional Must be > 0. * @ return the number of bytes remaining , but not more than optional , or - 1 if { @ link # fill ( byte [ ] , int , int ) } is unable to * provide more bytes . */ protected int optional ( int optional ) throws KryoException { } }
int remaining = limit - position ; if ( remaining >= optional ) return optional ; optional = Math . min ( optional , capacity ) ; int count ; // Try to fill the buffer . count = fill ( buffer , limit , capacity - limit ) ; if ( count == - 1 ) return remaining == 0 ? - 1 : Math . min ( remaining , optional ) ; remaining += count ; if ( remaining >= optional ) { limit += count ; return optional ; } // Was not enough , compact and try again . System . arraycopy ( buffer , position , buffer , 0 , remaining ) ; total += position ; position = 0 ; while ( true ) { count = fill ( buffer , remaining , capacity - remaining ) ; if ( count == - 1 ) break ; remaining += count ; if ( remaining >= optional ) break ; // Enough has been read . } limit = remaining ; return remaining == 0 ? - 1 : Math . min ( remaining , optional ) ;
public class AmazonTextractClient { /** * Starts asynchronous analysis of an input document for relationships between detected items such as key and value * pairs , tables , and selection elements . * < code > StartDocumentAnalysis < / code > can analyze text in documents that are in JPG , PNG , and PDF format . The * documents are stored in an Amazon S3 bucket . Use < a > DocumentLocation < / a > to specify the bucket name and file name * of the document . * < code > StartDocumentAnalysis < / code > returns a job identifier ( < code > JobId < / code > ) that you use to get the results * of the operation . When text analysis is finished , Amazon Textract publishes a completion status to the Amazon * Simple Notification Service ( Amazon SNS ) topic that you specify in < code > NotificationChannel < / code > . To get the * results of the text analysis operation , first check that the status value published to the Amazon SNS topic is * < code > SUCCEEDED < / code > . If so , call < a > GetDocumentAnalysis < / a > , and pass the job identifier ( < code > JobId < / code > ) * from the initial call to < code > StartDocumentAnalysis < / code > . * For more information , see < a * href = " https : / / docs . aws . amazon . com / textract / latest / dg / how - it - works - analyzing . html " > Document Text Analysis < / a > . * @ param startDocumentAnalysisRequest * @ return Result of the StartDocumentAnalysis operation returned by the service . * @ throws InvalidParameterException * An input parameter violated a constraint . For example , in synchronous operations , an * < code > InvalidParameterException < / code > exception occurs when neither of the < code > S3Object < / code > or * < code > Bytes < / code > values are supplied in the < code > Document < / code > request parameter . Validate your * parameter before calling the API operation again . * @ throws InvalidS3ObjectException * Amazon Textract is unable to access the S3 object that ' s specified in the request . * @ throws UnsupportedDocumentException * The format of the input document isn ' t supported . Amazon Textract supports documents that are . png or * . jpg format . * @ throws DocumentTooLargeException * The document can ' t be processed because it ' s too large . The maximum document size for synchronous * operations 5 MB . The maximum document size for asynchronous operations is 500 MB for PDF format files . * @ throws BadDocumentException * Amazon Textract isn ' t able to read the document . * @ throws AccessDeniedException * You aren ' t authorized to perform the action . * @ throws ProvisionedThroughputExceededException * The number of requests exceeded your throughput limit . If you want to increase this limit , contact Amazon * Textract . * @ throws InternalServerErrorException * Amazon Textract experienced a service issue . Try your call again . * @ throws IdempotentParameterMismatchException * A < code > ClientRequestToken < / code > input parameter was reused with an operation , but at least one of the * other input parameters is different from the previous call to the operation . * @ throws ThrottlingException * Amazon Textract is temporarily unable to process the request . Try your call again . * @ throws LimitExceededException * An Amazon Textract service limit was exceeded . For example , if you start too many asynchronous jobs * concurrently , calls to start operations ( < code > StartDocumentTextDetection < / code > , for example ) raise a * LimitExceededException exception ( HTTP status code : 400 ) until the number of concurrently running jobs is * below the Amazon Textract service limit . * @ sample AmazonTextract . StartDocumentAnalysis * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / textract - 2018-06-27 / StartDocumentAnalysis " target = " _ top " > AWS * API Documentation < / a > */ @ Override public StartDocumentAnalysisResult startDocumentAnalysis ( StartDocumentAnalysisRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeStartDocumentAnalysis ( request ) ;
public class BasicStreamReader { /** * Support for SAX XMLReader implementation */ public void fireSaxStartElement ( ContentHandler h , Attributes attrs ) throws SAXException { } }
if ( h != null ) { // First ; any ns declarations ? int nsCount = mElementStack . getCurrentNsCount ( ) ; for ( int i = 0 ; i < nsCount ; ++ i ) { String prefix = mElementStack . getLocalNsPrefix ( i ) ; String uri = mElementStack . getLocalNsURI ( i ) ; h . startPrefixMapping ( ( prefix == null ) ? "" : prefix , uri ) ; } // Then start - elem event itself : String uri = mElementStack . getNsURI ( ) ; // Sax requires " " ( not null ) for ns uris . . . h . startElement ( ( uri == null ) ? "" : uri , mElementStack . getLocalName ( ) , getPrefixedName ( ) , attrs ) ; }
public class ExcelReader { /** * 增加标题别名 * @ param header 标题 * @ param alias 别名 * @ return this */ public ExcelReader addHeaderAlias ( String header , String alias ) { } }
this . headerAlias . put ( header , alias ) ; return this ;
public class AsyncChannelFuture { /** * Throws the receiver ' s exception in its correct class . * This assumes that the exception is not null . * @ throws InterruptedException * @ throws IOException */ protected void throwException ( ) throws InterruptedException , IOException { } }
if ( this . exception instanceof IOException ) { throw ( IOException ) this . exception ; } if ( this . exception instanceof InterruptedException ) { throw ( InterruptedException ) this . exception ; } if ( this . exception instanceof RuntimeException ) { throw ( RuntimeException ) this . exception ; } throw new RuntimeException ( this . exception ) ;
public class DatastoreHelper { /** * Gets the project ID from the Compute Engine metadata server . Returns { @ code null } if the * project ID cannot be determined ( because , for instance , the code is not running on Compute * Engine ) . */ @ Nullable public static String getProjectIdFromComputeEngine ( ) { } }
String cachedProjectId = projectIdFromComputeEngine . get ( ) ; return cachedProjectId != null ? cachedProjectId : queryProjectIdFromComputeEngine ( ) ;
public class CmsContentService { /** * Returns the value that has to be set for the dynamic attribute . * @ param file the file where the current content is stored * @ param value the content value that is represented by the attribute * @ param attributeName the attribute ' s name * @ param editedLocalEntity the entities that where edited last * @ return the value that has to be set for the dynamic attribute . */ private String getDynamicAttributeValue ( CmsFile file , I_CmsXmlContentValue value , String attributeName , CmsEntity editedLocalEntity ) { } }
if ( ( null != editedLocalEntity ) && ( editedLocalEntity . getAttribute ( attributeName ) != null ) ) { getSessionCache ( ) . setDynamicValue ( attributeName , editedLocalEntity . getAttribute ( attributeName ) . getSimpleValue ( ) ) ; } String currentValue = getSessionCache ( ) . getDynamicValue ( attributeName ) ; if ( null != currentValue ) { return currentValue ; } if ( null != file ) { if ( value . getTypeName ( ) . equals ( CmsXmlDynamicCategoryValue . TYPE_NAME ) ) { List < CmsCategory > categories = new ArrayList < CmsCategory > ( 0 ) ; try { categories = CmsCategoryService . getInstance ( ) . readResourceCategories ( getCmsObject ( ) , file ) ; } catch ( CmsException e ) { LOG . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . ERROR_FAILED_READING_CATEGORIES_1 ) , e ) ; } I_CmsWidget widget = null ; widget = CmsWidgetUtil . collectWidgetInfo ( value ) . getWidget ( ) ; if ( ( null != widget ) && ( widget instanceof CmsCategoryWidget ) ) { String mainCategoryPath = ( ( CmsCategoryWidget ) widget ) . getStartingCategory ( getCmsObject ( ) , getCmsObject ( ) . getSitePath ( file ) ) ; StringBuffer pathes = new StringBuffer ( ) ; for ( CmsCategory category : categories ) { if ( category . getPath ( ) . startsWith ( mainCategoryPath ) ) { String path = category . getBasePath ( ) + category . getPath ( ) ; path = getCmsObject ( ) . getRequestContext ( ) . removeSiteRoot ( path ) ; pathes . append ( path ) . append ( ',' ) ; } } String dynamicConfigString = pathes . length ( ) > 0 ? pathes . substring ( 0 , pathes . length ( ) - 1 ) : "" ; getSessionCache ( ) . setDynamicValue ( attributeName , dynamicConfigString ) ; return dynamicConfigString ; } } } return "" ;
public class AdapterMap { /** * Convert java object to its corresponding PyObject representation . * @ param o Java object * @ return PyObject */ public static PyObject adapt ( Object o ) { } }
if ( o instanceof PyObject ) { return ( PyObject ) o ; } return Py . java2py ( o ) ;
public class ClassFields { /** * Set up the key areas . */ public void setupKeys ( ) { } }
KeyAreaInfo keyArea = null ; keyArea = new KeyAreaInfo ( this , Constants . UNIQUE , ID_KEY ) ; keyArea . addKeyField ( ID , Constants . ASCENDING ) ; keyArea = new KeyAreaInfo ( this , Constants . NOT_UNIQUE , CLASS_INFO_CLASS_NAME_KEY ) ; keyArea . addKeyField ( CLASS_INFO_CLASS_NAME , Constants . ASCENDING ) ; keyArea . addKeyField ( CLASS_FIELD_SEQUENCE , Constants . ASCENDING ) ; keyArea . addKeyField ( CLASS_FIELD_NAME , Constants . ASCENDING ) ;
public class ConventionPackageProvider { /** * generator default results by method name * @ param clazz * @ return */ protected List < ResultConfig > buildResultConfigs ( Class < ? > clazz , PackageConfig . Builder pcb ) { } }
List < ResultConfig > configs = CollectUtils . newArrayList ( ) ; // load annotation results Result [ ] results = new Result [ 0 ] ; Results rs = clazz . getAnnotation ( Results . class ) ; if ( null == rs ) { org . beangle . struts2 . annotation . Action an = clazz . getAnnotation ( org . beangle . struts2 . annotation . Action . class ) ; if ( null != an ) results = an . results ( ) ; } else { results = rs . value ( ) ; } Set < String > annotationResults = CollectUtils . newHashSet ( ) ; if ( null != results ) { for ( Result result : results ) { String resultType = result . type ( ) ; if ( Strings . isEmpty ( resultType ) ) resultType = "dispatcher" ; ResultTypeConfig rtc = pcb . getResultType ( resultType ) ; ResultConfig . Builder rcb = new ResultConfig . Builder ( result . name ( ) , rtc . getClassName ( ) ) ; if ( null != rtc . getDefaultResultParam ( ) ) rcb . addParam ( rtc . getDefaultResultParam ( ) , result . location ( ) ) ; configs . add ( rcb . build ( ) ) ; annotationResults . add ( result . name ( ) ) ; } } // load ftl convension results if ( ! preloadftl || null == profileService ) return configs ; String extention = profileService . getProfile ( clazz . getName ( ) ) . getViewExtension ( ) ; if ( ! extention . equals ( "ftl" ) ) return configs ; ResultTypeConfig rtc = pcb . getResultType ( "freemarker" ) ; for ( Method m : clazz . getMethods ( ) ) { String methodName = m . getName ( ) ; if ( ! annotationResults . contains ( methodName ) && shouldGenerateResult ( m ) ) { String path = templateFinder . find ( clazz , methodName , methodName , extention ) ; if ( null != path ) { configs . add ( new ResultConfig . Builder ( m . getName ( ) , rtc . getClassName ( ) ) . addParam ( rtc . getDefaultResultParam ( ) , path ) . build ( ) ) ; } } } return configs ;
public class UBTree { /** * Returns all supersets of a given set in this UBTree . * @ param set the set to search for * @ return all supersets of the given set */ public Set < SortedSet < T > > allSupersets ( final SortedSet < T > set ) { } }
final Set < SortedSet < T > > supersets = new LinkedHashSet < > ( ) ; allSupersets ( set , this . rootNodes , supersets ) ; return supersets ;
public class InetAddressPredicates { /** * Returns a { @ link Predicate } which returns { @ code true } if the given { @ link InetAddress } equals to * the specified { @ code address } . * @ param address the expected IP address string , e . g . { @ code 10.0.0.1} */ public static Predicate < InetAddress > ofExact ( String address ) { } }
requireNonNull ( address , "address" ) ; try { final InetAddress inetAddress = InetAddress . getByName ( address ) ; return ofExact ( inetAddress ) ; } catch ( UnknownHostException e ) { throw new IllegalArgumentException ( "Invalid address: " + address , e ) ; }
public class AWSGreengrassClient { /** * Returns a list of bulk deployments . * @ param listBulkDeploymentsRequest * @ return Result of the ListBulkDeployments operation returned by the service . * @ throws BadRequestException * invalid request * @ sample AWSGreengrass . ListBulkDeployments * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / greengrass - 2017-06-07 / ListBulkDeployments " target = " _ top " > AWS * API Documentation < / a > */ @ Override public ListBulkDeploymentsResult listBulkDeployments ( ListBulkDeploymentsRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeListBulkDeployments ( request ) ;
public class IterableELResolver { /** * Like { @ link ListELResolver } , returns { @ code null } for an illegal index . */ @ Override public Object getValue ( ELContext context , Object base , Object property ) throws NullPointerException , PropertyNotFoundException , ELException { } }
Iterator < ? > pos ; try { pos = seek ( context , base , property ) ; } catch ( PropertyNotFoundException e ) { pos = null ; } return pos == null ? null : pos . next ( ) ;
public class BSHPrimarySuffix { /** * Array index or bracket expression implementation . * @ param obj array or list instance * @ param toLHS whether to return an LHS instance * @ param callstack the evaluation call stack * @ param interpreter the evaluation interpreter * @ return data as per index expression or LHS for assignment * @ throws EvalError with evaluation exceptions */ @ SuppressWarnings ( { } }
"rawtypes" , "unchecked" } ) private Object doIndex ( Object obj , boolean toLHS , CallStack callstack , Interpreter interpreter ) throws EvalError { // Map or Entry index access not applicable to strict java if ( ! interpreter . getStrictJava ( ) ) { // allow index access for maps if ( Types . isPropertyTypeMap ( obj ) ) { Object key = ( ( SimpleNode ) jjtGetChild ( 0 ) ) . eval ( callstack , interpreter ) ; return toLHS ? new LHS ( obj , key ) : Reflect . getObjectProperty ( obj , key ) ; } // allow index access for map entries if ( Types . isPropertyTypeEntry ( obj ) ) { Object key = ( ( SimpleNode ) jjtGetChild ( 0 ) ) . eval ( callstack , interpreter ) ; if ( toLHS ) { if ( key . equals ( ( ( Entry ) obj ) . getKey ( ) ) ) return new LHS ( obj ) ; throw new EvalError ( "No such property: " + key , this , callstack ) ; } return Reflect . getObjectProperty ( obj , key ) ; } } Class < ? > cls = obj . getClass ( ) ; if ( ( interpreter . getStrictJava ( ) || ! ( obj instanceof List ) ) && ! cls . isArray ( ) ) throw new EvalError ( "Not an array or List type" , this , callstack ) ; int length = obj instanceof List ? ( ( List ) obj ) . size ( ) : Array . getLength ( obj ) ; int index = length + 1 ; // allow index access for a Map . Entry array . if ( ! interpreter . getStrictJava ( ) && Types . isPropertyTypeEntryList ( cls ) ) { Object key = ( ( SimpleNode ) jjtGetChild ( 0 ) ) . eval ( callstack , interpreter ) ; int idx = 0 ; if ( key instanceof Primitive && ( ( Primitive ) key ) . isNumber ( ) && length > ( idx = ( ( Primitive ) key ) . numberValue ( ) . intValue ( ) ) && - length < idx ) index = idx ; else if ( toLHS ) return new LHS ( Reflect . getEntryForKey ( key , ( Entry [ ] ) obj ) ) ; else return Reflect . getObjectProperty ( obj , key ) ; } else if ( index > length ) index = getIndexAux ( obj , 0 , callstack , interpreter , this ) ; // Negative index or slice expressions not applicable to strict java if ( ! interpreter . getStrictJava ( ) ) { if ( 0 > index ) index = length + index ; if ( this . slice ) { if ( toLHS ) throw new EvalError ( "cannot assign to array slice" , this , callstack ) ; int rindex = 0 , stepby = 0 ; if ( this . step ) { Integer step = null ; if ( hasLeftIndex && hasRightIndex && jjtGetNumChildren ( ) == 3 ) step = getIndexAux ( obj , 2 , callstack , interpreter , this ) ; else if ( ( ! hasLeftIndex || ! hasRightIndex ) && jjtGetNumChildren ( ) == 2 ) step = getIndexAux ( obj , 1 , callstack , interpreter , this ) ; else if ( ! hasLeftIndex && ! hasRightIndex ) { step = getIndexAux ( obj , 0 , callstack , interpreter , this ) ; index = 0 ; } if ( null != step ) { if ( step == 0 ) throw new EvalError ( "array slice step cannot be zero" , this , callstack ) ; stepby = step ; } } if ( hasLeftIndex && hasRightIndex ) rindex = getIndexAux ( obj , 1 , callstack , interpreter , this ) ; else if ( ! hasRightIndex ) rindex = length ; else { rindex = index ; index = 0 ; } if ( 0 > rindex ) rindex = length + rindex ; if ( obj . getClass ( ) . isArray ( ) ) return BshArray . slice ( obj , index , rindex , stepby ) ; return BshArray . slice ( ( List < Object > ) obj , index , rindex , stepby ) ; } } else if ( this . slice ) throw new EvalError ( "expected ']' but found ':'" , this , callstack ) ; if ( toLHS ) return new LHS ( obj , index ) ; else try { return BshArray . getIndex ( obj , index ) ; } catch ( UtilEvalError e ) { throw e . toEvalError ( "Error array get index" , this , callstack ) ; }
public class BsfUtils { /** * Resolve the search expression * @ param refItem * @ return */ public static String resolveSearchExpressions ( String refItem ) { } }
if ( refItem != null ) { if ( refItem . contains ( "@" ) || refItem . contains ( "*" ) ) { refItem = ExpressionResolver . getComponentIDs ( FacesContext . getCurrentInstance ( ) , FacesContext . getCurrentInstance ( ) . getViewRoot ( ) , refItem ) ; } } return refItem ;
public class VMCommandLine { /** * Run a new VM with the class path of the current VM . * @ param classToLaunch is the class to launch . * @ param additionalParams is the list of additional parameters * @ return the process that is running the new virtual machine , neither < code > null < / code > * @ throws IOException when a IO error occurs . * @ since 6.2 */ @ Inline ( value = "VMCommandLine.launchVMWithClassPath(($1), System.getProperty(\"java.class.path\"), ($2))" , imported = { } }
VMCommandLine . class } , statementExpression = true ) public static Process launchVM ( String classToLaunch , String ... additionalParams ) throws IOException { return launchVMWithClassPath ( classToLaunch , System . getProperty ( "java.class.path" ) , // $ NON - NLS - 1 $ additionalParams ) ;
public class ScriptableObject { /** * Seal this object . * It is an error to add properties to or delete properties from * a sealed object . It is possible to change the value of an * existing property . Once an object is sealed it may not be unsealed . * @ since 1.4R3 */ public void sealObject ( ) { } }
if ( ! isSealed ) { final long stamp = slotMap . readLock ( ) ; try { for ( Slot slot : slotMap ) { Object value = slot . value ; if ( value instanceof LazilyLoadedCtor ) { LazilyLoadedCtor initializer = ( LazilyLoadedCtor ) value ; try { initializer . init ( ) ; } finally { slot . value = initializer . getValue ( ) ; } } } isSealed = true ; } finally { slotMap . unlockRead ( stamp ) ; } }
public class CmsStringUtil { /** * Checks if a given name is composed only of the characters < code > a . . . z , A . . . Z , 0 . . . 9 < / code > * and the provided < code > constraints < / code > . < p > * If the check fails , an Exception is generated . The provided bundle and key is * used to generate the Exception . 4 parameters are passed to the Exception : < ol > * < li > The < code > name < / code > * < li > The first illegal character found * < li > The position where the illegal character was found * < li > The < code > constraints < / code > < / ol > * @ param name the name to check * @ param constraints the additional character constraints * @ param key the key to use for generating the Exception ( if required ) * @ param bundle the bundle to use for generating the Exception ( if required ) * @ throws CmsIllegalArgumentException if the check fails ( generated from the given key and bundle ) */ public static void checkName ( String name , String constraints , String key , I_CmsMessageBundle bundle ) throws CmsIllegalArgumentException { } }
int l = name . length ( ) ; for ( int i = 0 ; i < l ; i ++ ) { char c = name . charAt ( i ) ; if ( ( ( c < 'a' ) || ( c > 'z' ) ) && ( ( c < '0' ) || ( c > '9' ) ) && ( ( c < 'A' ) || ( c > 'Z' ) ) && ( constraints . indexOf ( c ) < 0 ) ) { throw new CmsIllegalArgumentException ( bundle . container ( key , new Object [ ] { name , new Character ( c ) , new Integer ( i ) , constraints } ) ) ; } }
public class Graph { /** * Creates a graph from a DataSet of edges . * Vertices are created automatically and their values are set to * NullValue . * @ param edges a DataSet of edges . * @ param context the flink execution environment . * @ return the newly created graph . */ public static < K , EV > Graph < K , NullValue , EV > fromDataSet ( DataSet < Edge < K , EV > > edges , ExecutionEnvironment context ) { } }
DataSet < Vertex < K , NullValue > > vertices = edges . flatMap ( new EmitSrcAndTarget < > ( ) ) . name ( "Source and target IDs" ) . distinct ( ) . name ( "IDs" ) ; return new Graph < > ( vertices , edges , context ) ;
public class SiteMapIndexServlet { /** * Gets all the books that contain at least one accessible view / page combo . * Also provides the last modified time , if known , for the book . */ private static List < Tuple2 < Book , ReadableInstant > > getSitemapBooks ( final ServletContext servletContext , HttpServletRequest req , HttpServletResponse resp ) throws ServletException , IOException { } }
SemanticCMS semanticCMS = SemanticCMS . getInstance ( servletContext ) ; HtmlRenderer htmlRenderer = HtmlRenderer . getInstance ( servletContext ) ; final SortedSet < View > views = htmlRenderer . getViews ( ) ; List < Book > books ; { // Filter published and accessible only Collection < Book > values = semanticCMS . getPublishedBooks ( ) . values ( ) ; books = new ArrayList < > ( values . size ( ) ) ; for ( Book book : values ) if ( book . isAccessible ( ) ) books . add ( book ) ; } int numBooks = books . size ( ) ; if ( numBooks > 1 && CountConcurrencyFilter . useConcurrentSubrequests ( req ) ) { // Concurrent implementation final HttpServletRequest threadSafeReq = new UnmodifiableCopyHttpServletRequest ( req ) ; final HttpServletResponse threadSafeResp = new UnmodifiableCopyHttpServletResponse ( resp ) ; final TempFileContext tempFileContext = ServletTempFileContext . getTempFileContext ( req ) ; List < Book > booksWithSiteMapUrl ; { List < Callable < Boolean > > tasks = new ArrayList < > ( numBooks ) ; { for ( final Book book : books ) { tasks . add ( new Callable < Boolean > ( ) { @ Override public Boolean call ( ) throws ServletException , IOException { HttpServletRequest subrequest = new HttpServletSubRequest ( threadSafeReq ) ; HttpServletResponse subresponse = new HttpServletSubResponse ( threadSafeResp , tempFileContext ) ; if ( logger . isLoggable ( Level . FINE ) ) logger . log ( Level . FINE , "called, subrequest={0}, book={1}" , new Object [ ] { subrequest , book } ) ; return hasSiteMapUrl ( servletContext , subrequest , subresponse , views , book , book . getContentRoot ( ) // new HashSet < PageRef > ( ) ) ; } } ) ; } } List < Boolean > results ; try { results = semanticCMS . getExecutors ( ) . getPerProcessor ( ) . callAll ( tasks ) ; } catch ( InterruptedException e ) { throw new ServletException ( e ) ; } catch ( ExecutionException e ) { Throwable cause = e . getCause ( ) ; if ( cause instanceof RuntimeException ) throw ( RuntimeException ) cause ; if ( cause instanceof ServletException ) throw ( ServletException ) cause ; if ( cause instanceof IOException ) throw ( IOException ) cause ; throw new ServletException ( cause ) ; } // Now find the last modified with concurrency booksWithSiteMapUrl = new ArrayList < > ( numBooks ) ; { int i = 0 ; for ( Book book : books ) { if ( results . get ( i ++ ) ) booksWithSiteMapUrl . add ( book ) ; } assert i == numBooks ; } } int booksWithSiteMapUrlSize = booksWithSiteMapUrl . size ( ) ; if ( booksWithSiteMapUrlSize > 0 ) { if ( booksWithSiteMapUrlSize > 1 ) { // Concurrent implementation List < Callable < ReadableInstant > > lastModifiedTasks = new ArrayList < > ( booksWithSiteMapUrlSize ) ; { for ( final Book book : booksWithSiteMapUrl ) { lastModifiedTasks . add ( new Callable < ReadableInstant > ( ) { @ Override public ReadableInstant call ( ) throws ServletException , IOException { HttpServletRequest subrequest = new HttpServletSubRequest ( threadSafeReq ) ; HttpServletResponse subresponse = new HttpServletSubResponse ( threadSafeResp , tempFileContext ) ; if ( logger . isLoggable ( Level . FINE ) ) logger . log ( Level . FINE , "called, subrequest={0}, book={1}" , new Object [ ] { subrequest , book } ) ; return SiteMapServlet . getLastModified ( servletContext , subrequest , subresponse , views , book ) ; } } ) ; } } List < ReadableInstant > lastModifieds ; try { lastModifieds = semanticCMS . getExecutors ( ) . getPerProcessor ( ) . callAll ( lastModifiedTasks ) ; } catch ( InterruptedException e ) { throw new ServletException ( e ) ; } catch ( ExecutionException e ) { Throwable cause = e . getCause ( ) ; if ( cause instanceof RuntimeException ) throw ( RuntimeException ) cause ; if ( cause instanceof ServletException ) throw ( ServletException ) cause ; if ( cause instanceof IOException ) throw ( IOException ) cause ; throw new ServletException ( cause ) ; } List < Tuple2 < Book , ReadableInstant > > sitemapBooks = new ArrayList < > ( booksWithSiteMapUrlSize ) ; for ( int i = 0 ; i < booksWithSiteMapUrlSize ; i ++ ) { sitemapBooks . add ( new Tuple2 < > ( booksWithSiteMapUrl . get ( i ) , lastModifieds . get ( i ) ) ) ; } return sitemapBooks ; } else { // Single implementation Book book = booksWithSiteMapUrl . get ( 0 ) ; return Collections . singletonList ( new Tuple2 < > ( book , SiteMapServlet . getLastModified ( servletContext , req , resp , views , book ) ) ) ; } } else { return Collections . emptyList ( ) ; } } else { // Sequential implementation List < Tuple2 < Book , ReadableInstant > > sitemapBooks = new ArrayList < > ( numBooks ) ; for ( Book book : books ) { if ( hasSiteMapUrl ( servletContext , req , resp , views , book , book . getContentRoot ( ) ) ) { sitemapBooks . add ( new Tuple2 < > ( book , SiteMapServlet . getLastModified ( servletContext , req , resp , views , book ) ) ) ; } } return sitemapBooks ; }
public class RpcLookout { /** * Record the number of calls and time consuming . * @ param mixinMetric MixinMetric * @ param model information model */ private void recordCounterAndTimer ( MixinMetric mixinMetric , RpcAbstractLookoutModel model ) { } }
Counter totalCounter = mixinMetric . counter ( "total_count" ) ; Timer totalTimer = mixinMetric . timer ( "total_time" ) ; Long elapsedTime = model . getElapsedTime ( ) ; totalCounter . inc ( ) ; if ( elapsedTime != null ) { totalTimer . record ( elapsedTime , TimeUnit . MILLISECONDS ) ; } if ( ! model . getSuccess ( ) ) { Counter failCounter = mixinMetric . counter ( "fail_count" ) ; Timer failTimer = mixinMetric . timer ( "fail_time" ) ; failCounter . inc ( ) ; if ( elapsedTime != null ) { failTimer . record ( elapsedTime , TimeUnit . MILLISECONDS ) ; } }
public class SqlTableAlert { /** * / * ( non - Javadoc ) * @ see org . parosproxy . paros . db . paros . TableAlert # read ( int ) */ @ Override public synchronized RecordAlert read ( int alertId ) throws DatabaseException { } }
SqlPreparedStatementWrapper psRead = null ; try { psRead = DbSQL . getSingleton ( ) . getPreparedStatement ( "alert.ps.read" ) ; psRead . getPs ( ) . setInt ( 1 , alertId ) ; try ( ResultSet rs = psRead . getPs ( ) . executeQuery ( ) ) { return build ( rs ) ; } } catch ( Exception e ) { throw new DatabaseException ( e ) ; } finally { DbSQL . getSingleton ( ) . releasePreparedStatement ( psRead ) ; }
public class ReviewsImpl { /** * Get the Job Details for a Job Id . * @ param teamName Your Team Name . * @ param jobId Id of the job . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws APIErrorException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the Job object if successful . */ public Job getJobDetails ( String teamName , String jobId ) { } }
return getJobDetailsWithServiceResponseAsync ( teamName , jobId ) . toBlocking ( ) . single ( ) . body ( ) ;
public class FluentWebElements { /** * These are as they would be in the WebElement API */ public FluentWebElements sendKeys ( final CharSequence ... keysToSend ) { } }
Context ctx = Context . singular ( context , "sendKeys" , charSeqArrayAsHumanString ( keysToSend ) ) ; executeAndWrapReThrowIfNeeded ( new SendKeys ( keysToSend ) , ctx ) ; return makeFluentWebElements ( this , ctx , monitor ) ;
public class BasicHttpTaf { /** * Note : BasicHttp works for either Carbon Based ( Humans ) or Silicon Based ( machine ) Lifeforms . * @ see Taf */ public TafResp validate ( Taf . LifeForm reading , HttpServletRequest req , HttpServletResponse resp ) { } }
// See if Request implements BasicCred ( aka CadiWrap or other ) , and if User / Pass has already been set separately if ( req instanceof BasicCred ) { BasicCred bc = ( BasicCred ) req ; if ( bc . getUser ( ) != null ) { // CadiWrap , if set , makes sure User & Password are both valid , or both null if ( DenialOfServiceTaf . isDeniedID ( bc . getUser ( ) ) != null ) { return DenialOfServiceTaf . respDenyID ( access , bc . getUser ( ) ) ; } CachedBasicPrincipal bp = new CachedBasicPrincipal ( this , bc , realm , timeToLive ) ; // ONLY FOR Last Ditch DEBUGGING . . . // access . log ( Level . WARN , bp . getName ( ) + " : " + new String ( bp . getCred ( ) ) ) ; if ( rbac . validate ( bp . getName ( ) , Type . PASSWORD , bp . getCred ( ) ) ) { return new BasicHttpTafResp ( access , bp , bp . getName ( ) + " authenticated by password" , RESP . IS_AUTHENTICATED , resp , realm , false ) ; } else { // TODO may need timed retries in a given time period return new BasicHttpTafResp ( access , null , buildMsg ( bp , req , "User/Pass combo invalid for " , bc . getUser ( ) ) , RESP . TRY_AUTHENTICATING , resp , realm , true ) ; } } } // Get User / Password from Authorization Header value String authz = req . getHeader ( "Authorization" ) ; if ( authz != null && authz . startsWith ( "Basic " ) ) { if ( warn && ! req . isSecure ( ) ) { access . log ( Level . WARN , "WARNING! BasicAuth has been used over an insecure channel" ) ; } try { CachedBasicPrincipal ba = new CachedBasicPrincipal ( this , authz , realm , timeToLive ) ; if ( DenialOfServiceTaf . isDeniedID ( ba . getName ( ) ) != null ) { return DenialOfServiceTaf . respDenyID ( access , ba . getName ( ) ) ; } // ONLY FOR Last Ditch DEBUGGING . . . // access . log ( Level . WARN , ba . getName ( ) + " : " + new String ( ba . getCred ( ) ) ) ; if ( rbac . validate ( ba . getName ( ) , Type . PASSWORD , ba . getCred ( ) ) ) { return new BasicHttpTafResp ( access , ba , ba . getName ( ) + " authenticated by BasicAuth password" , RESP . IS_AUTHENTICATED , resp , realm , false ) ; } else { // TODO may need timed retries in a given time period return new BasicHttpTafResp ( access , null , buildMsg ( ba , req , "User/Pass combo invalid" ) , RESP . TRY_AUTHENTICATING , resp , realm , true ) ; } } catch ( IOException e ) { String msg = buildMsg ( null , req , "Failed HTTP Basic Authorization (" , e . getMessage ( ) , ')' ) ; access . log ( Level . INFO , msg ) ; return new BasicHttpTafResp ( access , null , msg , RESP . TRY_AUTHENTICATING , resp , realm , true ) ; } } return new BasicHttpTafResp ( access , null , "Requesting HTTP Basic Authorization" , RESP . TRY_AUTHENTICATING , resp , realm , false ) ;
public class StopWatchFactory { /** * Returns an uninitialized stopwatch instance . * @ return An uninitialized stopwatch instance . Will be null if the factory has not been * initialized . */ public static IStopWatch create ( ) { } }
if ( factory == null ) { throw new IllegalStateException ( "No stopwatch factory registered." ) ; } try { return factory . clazz . newInstance ( ) ; } catch ( Exception e ) { throw new RuntimeException ( "Could not create stopwatch instance." , e ) ; }
public class CommercePriceListAccountRelUtil { /** * Returns the commerce price list account rel where commerceAccountId = & # 63 ; and commercePriceListId = & # 63 ; or returns < code > null < / code > if it could not be found , optionally using the finder cache . * @ param commerceAccountId the commerce account ID * @ param commercePriceListId the commerce price list ID * @ param retrieveFromCache whether to retrieve from the finder cache * @ return the matching commerce price list account rel , or < code > null < / code > if a matching commerce price list account rel could not be found */ public static CommercePriceListAccountRel fetchByC_C ( long commerceAccountId , long commercePriceListId , boolean retrieveFromCache ) { } }
return getPersistence ( ) . fetchByC_C ( commerceAccountId , commercePriceListId , retrieveFromCache ) ;
public class EmbeddedChannel { /** * Read data from the outbound . This may return { @ code null } if nothing is readable . */ @ SuppressWarnings ( "unchecked" ) public < T > T readOutbound ( ) { } }
T message = ( T ) poll ( outboundMessages ) ; if ( message != null ) { ReferenceCountUtil . touch ( message , "Caller of readOutbound() will handle the message from this point." ) ; } return message ;
public class Property { /** * Sets property value , even if private . * < br / > * Swallows JaversException . MISSING _ PROPERTY * @ param target invocation target * @ param value value to be set */ public void set ( Object target , Object value ) { } }
try { member . setEvenIfPrivate ( target , value ) ; } catch ( JaversException e ) { if ( e . getCode ( ) == JaversExceptionCode . MISSING_PROPERTY ) { return ; // swallowed } throw e ; }
public class Cache { /** * 这个命令和 EXPIRE 命令的作用类似 , 但是它以毫秒为单位设置 key 的生存时间 , 而不像 EXPIRE 命令那样 , 以秒为单位 。 */ public Long pexpire ( Object key , long milliseconds ) { } }
Jedis jedis = getJedis ( ) ; try { return jedis . pexpire ( keyToBytes ( key ) , milliseconds ) ; } finally { close ( jedis ) ; }
public class CreateGrantRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( CreateGrantRequest createGrantRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( createGrantRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createGrantRequest . getKeyId ( ) , KEYID_BINDING ) ; protocolMarshaller . marshall ( createGrantRequest . getGranteePrincipal ( ) , GRANTEEPRINCIPAL_BINDING ) ; protocolMarshaller . marshall ( createGrantRequest . getRetiringPrincipal ( ) , RETIRINGPRINCIPAL_BINDING ) ; protocolMarshaller . marshall ( createGrantRequest . getOperations ( ) , OPERATIONS_BINDING ) ; protocolMarshaller . marshall ( createGrantRequest . getConstraints ( ) , CONSTRAINTS_BINDING ) ; protocolMarshaller . marshall ( createGrantRequest . getGrantTokens ( ) , GRANTTOKENS_BINDING ) ; protocolMarshaller . marshall ( createGrantRequest . getName ( ) , NAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class DPTXlator64BitSigned { /** * / * ( non - Javadoc ) * @ see tuwien . auto . calimero . dptxlator . DPTXlator # toDPT ( java . lang . String , short [ ] , int ) */ @ Override protected void toDPT ( final String value , final short [ ] dst , final int index ) throws KNXFormatException { } }
try { toDPT ( Long . decode ( removeUnit ( value ) ) . longValue ( ) , dst , index ) ; } catch ( final NumberFormatException e ) { throw newException ( "wrong value format" , value ) ; }
public class Proxy { /** * Apply any applicable header overrides to request * @ param httpMethodProxyRequest * @ throws Exception */ private void processRequestHeaderOverrides ( HttpMethod httpMethodProxyRequest ) throws Exception { } }
RequestInformation requestInfo = requestInformation . get ( ) ; for ( EndpointOverride selectedPath : requestInfo . selectedRequestPaths ) { List < EnabledEndpoint > points = selectedPath . getEnabledEndpoints ( ) ; for ( EnabledEndpoint endpoint : points ) { if ( endpoint . getOverrideId ( ) == Constants . PLUGIN_REQUEST_HEADER_OVERRIDE_ADD ) { httpMethodProxyRequest . addRequestHeader ( endpoint . getArguments ( ) [ 0 ] . toString ( ) , endpoint . getArguments ( ) [ 1 ] . toString ( ) ) ; requestInfo . modified = true ; } else if ( endpoint . getOverrideId ( ) == Constants . PLUGIN_REQUEST_HEADER_OVERRIDE_REMOVE ) { httpMethodProxyRequest . removeRequestHeader ( endpoint . getArguments ( ) [ 0 ] . toString ( ) ) ; requestInfo . modified = true ; } } }
public class GeometryCoordinateDimension { /** * Force the dimension of the MultiLineString and update correctly the coordinate * dimension * @ param multiLineString * @ param dimension * @ return */ public static MultiLineString convert ( MultiLineString multiLineString , int dimension ) { } }
int nb = multiLineString . getNumGeometries ( ) ; final LineString [ ] ls = new LineString [ nb ] ; for ( int i = 0 ; i < nb ; i ++ ) { ls [ i ] = GeometryCoordinateDimension . convert ( ( LineString ) multiLineString . getGeometryN ( i ) , dimension ) ; } return gf . createMultiLineString ( ls ) ;
public class HadoopConfigurationInjector { /** * Writes out the XML configuration file that will be injected by the client * as a configuration resource . * This file will include a series of links injected by Azkaban as well as * any job properties that begin with the designated injection prefix . * @ param props The Azkaban properties * @ param workingDir The Azkaban job working directory */ public static void prepareResourcesToInject ( Props props , String workingDir ) { } }
try { Configuration conf = new Configuration ( false ) ; // First , inject a series of Azkaban links . These are equivalent to // CommonJobProperties . [ EXECUTION , WORKFLOW , JOB , JOBEXEC , ATTEMPT ] _ LINK addHadoopProperties ( props ) ; // Next , automatically inject any properties that begin with the // designated injection prefix . Map < String , String > confProperties = props . getMapByPrefix ( INJECT_PREFIX ) ; for ( Map . Entry < String , String > entry : confProperties . entrySet ( ) ) { String confKey = entry . getKey ( ) . replace ( INJECT_PREFIX , "" ) ; String confVal = entry . getValue ( ) ; if ( confVal != null ) { conf . set ( confKey , confVal ) ; } } // Now write out the configuration file to inject . File file = getConfFile ( props , workingDir , INJECT_FILE ) ; OutputStream xmlOut = new FileOutputStream ( file ) ; conf . writeXml ( xmlOut ) ; xmlOut . close ( ) ; } catch ( Throwable e ) { _logger . error ( "Encountered error while preparing the Hadoop configuration resource file" , e ) ; }
public class CRLDistributionPointRevocationChecker { /** * Adds the url to the list . * Build URI by components to facilitate proper encoding of querystring . * e . g . http : / / example . com : 8085 / ca ? action = crl & issuer = CN = CAS Test User CA * < p > If { @ code uriString } is encoded , it will be decoded with { @ code UTF - 8} * first before it ' s added to the list . < / p > * @ param list the list * @ param uriString the uri string */ private static void addURL ( final List < URI > list , final String uriString ) { } }
try { try { val url = new URL ( URLDecoder . decode ( uriString , StandardCharsets . UTF_8 . name ( ) ) ) ; list . add ( new URI ( url . getProtocol ( ) , url . getAuthority ( ) , url . getPath ( ) , url . getQuery ( ) , null ) ) ; } catch ( final MalformedURLException e ) { list . add ( new URI ( uriString ) ) ; } } catch ( final Exception e ) { LOGGER . warn ( "[{}] is not a valid distribution point URI." , uriString ) ; }
public class Utils { /** * Returns an instance of ThreadPoolExecutor using an bounded queue and blocking when the worker queue is full . * @ param nThreads thread pool size * @ param queueSize workers queue size * @ return thread pool executor */ public static ExecutorService newBlockingFixedThreadPoolExecutor ( int nThreads , int queueSize ) { } }
BlockingQueue < Runnable > blockingQueue = new ArrayBlockingQueue < > ( queueSize ) ; RejectedExecutionHandler blockingRejectedExecutionHandler = new RejectedExecutionHandler ( ) { @ Override public void rejectedExecution ( Runnable task , ThreadPoolExecutor executor ) { try { executor . getQueue ( ) . put ( task ) ; } catch ( InterruptedException e ) { } } } ; return new ThreadPoolExecutor ( nThreads , nThreads , 0L , TimeUnit . MILLISECONDS , blockingQueue , blockingRejectedExecutionHandler ) ;
public class TranscoderService { /** * Deserialize session data that was serialized using { @ link # serialize ( MemcachedBackupSession ) } * ( or a combination of { @ link # serializeAttributes ( MemcachedBackupSession , ConcurrentMap ) } and * { @ link # serialize ( MemcachedBackupSession , byte [ ] ) } ) . * Note : the returned session already has the manager set and * { @ link MemcachedBackupSession # doAfterDeserialization ( ) } is invoked . Additionally * the attributes hash is set ( via { @ link MemcachedBackupSession # setDataHashCode ( int ) } ) . * @ param data the byte array of the serialized session and its session attributes . Can be < code > null < / code > . * @ param manager the manager to set on the deserialized session . * @ return the deserialized { @ link MemcachedBackupSession } * or < code > null < / code > if the provided < code > byte [ ] data < / code > was < code > null < / code > . */ public MemcachedBackupSession deserialize ( final byte [ ] data , final SessionManager manager ) { } }
if ( data == null ) { return null ; } try { final DeserializationResult deserializationResult = deserializeSessionFields ( data , manager ) ; final byte [ ] attributesData = deserializationResult . getAttributesData ( ) ; final ConcurrentMap < String , Object > attributes = deserializeAttributes ( attributesData ) ; final MemcachedBackupSession session = deserializationResult . getSession ( ) ; session . setAttributesInternal ( attributes ) ; session . setDataHashCode ( Arrays . hashCode ( attributesData ) ) ; session . setManager ( manager ) ; session . doAfterDeserialization ( ) ; return session ; } catch ( final InvalidVersionException e ) { LOG . info ( "Got session data from memcached with an unsupported version: " + e . getVersion ( ) ) ; // for versioning probably there will be changes in the design , // with the first change and version 2 we ' ll see what we need return null ; }