signature
stringlengths 43
39.1k
| implementation
stringlengths 0
450k
|
|---|---|
public class HttpCookie { /** * Reports whether this http cookie has expired or not .
* @ return < tt > true < / tt > to indicate this http cookie has expired ;
* otherwise , < tt > false < / tt > */
public boolean hasExpired ( ) { } }
|
if ( maxAge == 0 ) return true ; // if not specify max - age , this cookie should be
// discarded when user agent is to be closed , but
// it is not expired .
if ( maxAge == MAX_AGE_UNSPECIFIED ) return false ; long deltaSecond = ( System . currentTimeMillis ( ) - whenCreated ) / 1000 ; if ( deltaSecond > maxAge ) return true ; else return false ;
|
public class Resolve { /** * where */
private Symbol findMethod ( Env < AttrContext > env , Type site , Name name , List < Type > argtypes , List < Type > typeargtypes , Type intype , Symbol bestSoFar , boolean allowBoxing , boolean useVarargs , boolean operator ) { } }
|
@ SuppressWarnings ( { "unchecked" , "rawtypes" } ) List < Type > [ ] itypes = ( List < Type > [ ] ) new List [ ] { List . < Type > nil ( ) , List . < Type > nil ( ) } ; InterfaceLookupPhase iphase = InterfaceLookupPhase . ABSTRACT_OK ; for ( TypeSymbol s : superclasses ( intype ) ) { bestSoFar = findMethodInScope ( env , site , name , argtypes , typeargtypes , s . members ( ) , bestSoFar , allowBoxing , useVarargs , operator , true ) ; if ( name == names . init ) return bestSoFar ; iphase = ( iphase == null ) ? null : iphase . update ( s , this ) ; if ( iphase != null ) { for ( Type itype : types . interfaces ( s . type ) ) { itypes [ iphase . ordinal ( ) ] = types . union ( types . closure ( itype ) , itypes [ iphase . ordinal ( ) ] ) ; } } } Symbol concrete = bestSoFar . kind < ERR && ( bestSoFar . flags ( ) & ABSTRACT ) == 0 ? bestSoFar : methodNotFound ; for ( InterfaceLookupPhase iphase2 : InterfaceLookupPhase . values ( ) ) { // keep searching for abstract methods
for ( Type itype : itypes [ iphase2 . ordinal ( ) ] ) { if ( ! itype . isInterface ( ) ) continue ; // skip j . l . Object ( included by Types . closure ( ) )
if ( iphase2 == InterfaceLookupPhase . DEFAULT_OK && ( itype . tsym . flags ( ) & DEFAULT ) == 0 ) continue ; bestSoFar = findMethodInScope ( env , site , name , argtypes , typeargtypes , itype . tsym . members ( ) , bestSoFar , allowBoxing , useVarargs , operator , true ) ; if ( concrete != bestSoFar && concrete . kind < ERR && bestSoFar . kind < ERR && types . isSubSignature ( concrete . type , bestSoFar . type ) ) { // this is an hack - as javac does not do full membership checks
// most specific ends up comparing abstract methods that might have
// been implemented by some concrete method in a subclass and ,
// because of raw override , it is possible for an abstract method
// to be more specific than the concrete method - so we need
// to explicitly call that out ( see CR 6178365)
bestSoFar = concrete ; } } } return bestSoFar ;
|
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcIndexedPolygonalFace ( ) { } }
|
if ( ifcIndexedPolygonalFaceEClass == null ) { ifcIndexedPolygonalFaceEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 320 ) ; } return ifcIndexedPolygonalFaceEClass ;
|
public class SimplePasswordAuthenticator { /** * { @ inheritDoc } */
public boolean authenticate ( String pUser , String pPassword , ServerSession pSession ) { } }
|
return pUser != null && pUser . equals ( user ) && password . equals ( pPassword ) ;
|
public class RegionInstanceGroupClient { /** * Retrieves the list of instance group resources contained within the specified region .
* < p > Sample code :
* < pre > < code >
* try ( RegionInstanceGroupClient regionInstanceGroupClient = RegionInstanceGroupClient . create ( ) ) {
* ProjectRegionName region = ProjectRegionName . of ( " [ PROJECT ] " , " [ REGION ] " ) ;
* for ( InstanceGroup element : regionInstanceGroupClient . listRegionInstanceGroups ( region ) . iterateAll ( ) ) {
* / / doThingsWith ( element ) ;
* < / code > < / pre >
* @ param region Name of the region scoping this request .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final ListRegionInstanceGroupsPagedResponse listRegionInstanceGroups ( ProjectRegionName region ) { } }
|
ListRegionInstanceGroupsHttpRequest request = ListRegionInstanceGroupsHttpRequest . newBuilder ( ) . setRegion ( region == null ? null : region . toString ( ) ) . build ( ) ; return listRegionInstanceGroups ( request ) ;
|
public class ST_ProjectPoint { /** * Project a point on a linestring or multilinestring
* @ param point
* @ param geometry
* @ return */
public static Point projectPoint ( Geometry point , Geometry geometry ) { } }
|
if ( point == null || geometry == null ) { return null ; } if ( point . getDimension ( ) == 0 && geometry . getDimension ( ) == 1 ) { LengthIndexedLine ll = new LengthIndexedLine ( geometry ) ; double index = ll . project ( point . getCoordinate ( ) ) ; return geometry . getFactory ( ) . createPoint ( ll . extractPoint ( index ) ) ; } else { return null ; }
|
public class WorkerDao { /** * Gets the status of each worker . The status contains the partitionId being consumed . This information
* helps the next worker bind to an unconsumed partition
* @ param plan
* @ param otherWorkers
* @ return
* @ throws WorkerDaoException */
public List < WorkerStatus > findAllWorkerStatusForPlan ( Plan plan , List < String > otherWorkers ) throws WorkerDaoException { } }
|
List < WorkerStatus > results = new ArrayList < WorkerStatus > ( ) ; try { Stat preCheck = framework . getCuratorFramework ( ) . checkExists ( ) . forPath ( PLAN_WORKERS_ZK + "/" + plan . getName ( ) ) ; if ( preCheck == null ) { return results ; } } catch ( Exception e1 ) { LOGGER . warn ( e1 ) ; throw new WorkerDaoException ( e1 ) ; } for ( String worker : otherWorkers ) { String lookAtPath = PLAN_WORKERS_ZK + "/" + plan . getName ( ) + "/" + worker ; try { Stat stat = framework . getCuratorFramework ( ) . checkExists ( ) . forPath ( lookAtPath ) ; byte [ ] data = framework . getCuratorFramework ( ) . getData ( ) . storingStatIn ( stat ) . forPath ( lookAtPath ) ; results . add ( MAPPER . readValue ( data , WorkerStatus . class ) ) ; } catch ( Exception e ) { LOGGER . warn ( e ) ; throw new WorkerDaoException ( e ) ; } } return results ;
|
public class ConfigurationTree { /** * Search value by unique type declaration .
* < pre > { @ code class Config extends Configuration {
* SubOne sub1 = . . .
* SubTwo sub2 = . . .
* SubTwoExt sub3 = . . . / / SubTwoExt extends SubTwo
* } } < / pre >
* { @ code valueByUniqueDeclaredType ( SubOne . class ) = = < sub1 > } ,
* { @ code valueByUniqueDeclaredType ( SubTwo . class ) = = < sub2 > }
* { @ code valueByUniqueDeclaredType ( SubTwoExt . class ) = = < sub3 > }
* Note that direct declaration comparison used ! For example , { @ code valuesByType ( SubTwo ) = = [ < sub2 > , < sub3 > ] }
* would consider sub2 and sub3 as the same type , but { @ code valueByUniqueDeclaredType } will not !
* Type declaration is not unique if somewhere ( maybe in some sub - sub configuration object ) declaration with
* the same type exists . If you need to treat uniqueness only by first path level , then write search
* function yourself using { @ link # findAllRootPaths ( ) } or { @ link # findAllRootPathsFrom ( Class ) } .
* @ param type required target declaration type
* @ param < T > value type
* @ param < K > actual expected sub type ( may be the same )
* @ return uniquely declared sub configuration object or null if declaration not found or value null */
@ SuppressWarnings ( "unchecked" ) public < T , K extends T > K valueByUniqueDeclaredType ( final Class < T > type ) { } }
|
return ( K ) uniqueTypePaths . stream ( ) . filter ( it -> type . equals ( it . getDeclaredType ( ) ) ) . findFirst ( ) . map ( ConfigPath :: getValue ) . orElse ( null ) ;
|
public class UniverseApi { /** * Get item category information ( asynchronously ) Get information of an item
* category - - - This route expires daily at 11:05
* @ param categoryId
* An Eve item category ID ( required )
* @ param acceptLanguage
* Language to use in the response ( optional , default to en - us )
* @ param datasource
* The server name you would like data from ( optional , default to
* tranquility )
* @ param ifNoneMatch
* ETag from a previous request . A 304 will be returned if this
* matches the current ETag ( optional )
* @ param language
* Language to use in the response , takes precedence over
* Accept - Language ( optional , default to en - us )
* @ param callback
* The callback to be executed when the API call finishes
* @ return The request call
* @ throws ApiException
* If fail to process the API call , e . g . serializing the request
* body object */
public com . squareup . okhttp . Call getUniverseCategoriesCategoryIdAsync ( Integer categoryId , String acceptLanguage , String datasource , String ifNoneMatch , String language , final ApiCallback < CategoryResponse > callback ) throws ApiException { } }
|
com . squareup . okhttp . Call call = getUniverseCategoriesCategoryIdValidateBeforeCall ( categoryId , acceptLanguage , datasource , ifNoneMatch , language , callback ) ; Type localVarReturnType = new TypeToken < CategoryResponse > ( ) { } . getType ( ) ; apiClient . executeAsync ( call , localVarReturnType , callback ) ; return call ;
|
public class Assistant { /** * Update workspace .
* Update an existing workspace with new or modified data . You must provide component objects defining the content of
* the updated workspace .
* This operation is limited to 30 request per 30 minutes . For more information , see * * Rate limiting * * .
* @ param updateWorkspaceOptions the { @ link UpdateWorkspaceOptions } containing the options for the call
* @ return a { @ link ServiceCall } with a response type of { @ link Workspace } */
public ServiceCall < Workspace > updateWorkspace ( UpdateWorkspaceOptions updateWorkspaceOptions ) { } }
|
Validator . notNull ( updateWorkspaceOptions , "updateWorkspaceOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" } ; String [ ] pathParameters = { updateWorkspaceOptions . workspaceId ( ) } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "updateWorkspace" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( updateWorkspaceOptions . append ( ) != null ) { builder . query ( "append" , String . valueOf ( updateWorkspaceOptions . append ( ) ) ) ; } final JsonObject contentJson = new JsonObject ( ) ; if ( updateWorkspaceOptions . name ( ) != null ) { contentJson . addProperty ( "name" , updateWorkspaceOptions . name ( ) ) ; } if ( updateWorkspaceOptions . description ( ) != null ) { contentJson . addProperty ( "description" , updateWorkspaceOptions . description ( ) ) ; } if ( updateWorkspaceOptions . language ( ) != null ) { contentJson . addProperty ( "language" , updateWorkspaceOptions . language ( ) ) ; } if ( updateWorkspaceOptions . metadata ( ) != null ) { contentJson . add ( "metadata" , GsonSingleton . getGson ( ) . toJsonTree ( updateWorkspaceOptions . metadata ( ) ) ) ; } if ( updateWorkspaceOptions . learningOptOut ( ) != null ) { contentJson . addProperty ( "learning_opt_out" , updateWorkspaceOptions . learningOptOut ( ) ) ; } if ( updateWorkspaceOptions . systemSettings ( ) != null ) { contentJson . add ( "system_settings" , GsonSingleton . getGson ( ) . toJsonTree ( updateWorkspaceOptions . systemSettings ( ) ) ) ; } if ( updateWorkspaceOptions . intents ( ) != null ) { contentJson . add ( "intents" , GsonSingleton . getGson ( ) . toJsonTree ( updateWorkspaceOptions . intents ( ) ) ) ; } if ( updateWorkspaceOptions . entities ( ) != null ) { contentJson . add ( "entities" , GsonSingleton . getGson ( ) . toJsonTree ( updateWorkspaceOptions . entities ( ) ) ) ; } if ( updateWorkspaceOptions . dialogNodes ( ) != null ) { contentJson . add ( "dialog_nodes" , GsonSingleton . getGson ( ) . toJsonTree ( updateWorkspaceOptions . dialogNodes ( ) ) ) ; } if ( updateWorkspaceOptions . counterexamples ( ) != null ) { contentJson . add ( "counterexamples" , GsonSingleton . getGson ( ) . toJsonTree ( updateWorkspaceOptions . counterexamples ( ) ) ) ; } builder . bodyJson ( contentJson ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( Workspace . class ) ) ;
|
public class RebindSafeMBeanServer { /** * Delegates to the wrapped mbean server , but if a mbean is already registered
* with the specified name , the existing instance is returned . */
@ Override public ObjectInstance registerMBean ( Object object , ObjectName name ) throws MBeanRegistrationException , NotCompliantMBeanException { } }
|
while ( true ) { try { // try to register the mbean
return mbeanServer . registerMBean ( object , name ) ; } catch ( InstanceAlreadyExistsException ignored ) { } try { // a mbean is already installed , try to return the already registered instance
ObjectInstance objectInstance = mbeanServer . getObjectInstance ( name ) ; log . debug ( "%s already bound to %s" , name , objectInstance ) ; return objectInstance ; } catch ( InstanceNotFoundException ignored ) { // the mbean was removed before we could get the reference
// start the whole process over again
} }
|
public class JSONArray { /** * Append an object value . This increases the array ' s length by one .
* @ param value
* An object value . The value should be a Boolean , Double ,
* Integer , JSONArray , JSONObject , Long , or String , or the
* JSONObject . NULL object .
* @ return this .
* @ throws JSONException
* If the value is non - finite number . */
public JSONArray put ( Object value ) { } }
|
JSONObject . testValidity ( value ) ; this . myArrayList . add ( value ) ; return this ;
|
public class Parser { /** * Jump over leading spaces
* Custom match methods normally call this before trying to match anything
* @ param textProvider */
public void clearLeadingSpaces ( TextProvider textProvider ) { } }
|
while ( true ) { mark ( textProvider ) ; char c ; try { c = getNextChar ( textProvider ) ; } catch ( ExceededBufferSizeException e ) { return ; } catch ( ParserException e ) { // ignore problems at this point
return ; } if ( c == 0 ) { if ( m_textProviderStack . size ( ) > 0 ) { textProvider . close ( ) ; textProvider = ( TextProvider ) m_textProviderStack . pop ( ) ; } break ; } if ( " \t\r\n" . indexOf ( c ) == - 1 ) { reset ( textProvider ) ; break ; } unmark ( textProvider ) ; }
|
public class ListenerCollection { /** * Removes the listener as a listener of the specified type .
* @ param < T > the type of the listener to be removed
* @ param type the type of the listener to be removed
* @ param listener the listener to be removed */
public synchronized < T extends EventListener > void remove ( Class < T > type , T listener ) { } }
|
assert listener != null ; // Is l on the list ?
int index = - 1 ; for ( int i = this . listeners . length - 2 ; i >= 0 ; i -= 2 ) { if ( ( this . listeners [ i ] == type ) && ( this . listeners [ i + 1 ] . equals ( listener ) ) ) { index = i ; break ; } } // If so , remove it
if ( index != - 1 ) { final Object [ ] tmp = new Object [ this . listeners . length - 2 ] ; // Copy the list up to index
System . arraycopy ( this . listeners , 0 , tmp , 0 , index ) ; // Copy from two past the index , up to
// the end of tmp ( which is two elements
// shorter than the old list )
if ( index < tmp . length ) { System . arraycopy ( this . listeners , index + 2 , tmp , index , tmp . length - index ) ; } // set the listener array to the new array or null
this . listeners = ( tmp . length == 0 ) ? NULL : tmp ; }
|
public class RESTReflect { /** * Finds path parameters based on { @ link javax . ws . rs . PathParam } annotation .
* @ param baseParam the base parameter URI
* @ param method the method to scan
* @ return the map of parameter URI by parameter name */
static Map < String , String > findPathParams ( String baseParam , Method method ) { } }
|
Map < String , String > hrefVars = new HashMap < > ( ) ; for ( Annotation [ ] paramAnnotations : method . getParameterAnnotations ( ) ) { for ( Annotation paramAnnotation : paramAnnotations ) { if ( paramAnnotation . annotationType ( ) . equals ( PathParam . class ) ) { String varName = ( ( PathParam ) paramAnnotation ) . value ( ) ; addHrefVar ( baseParam , hrefVars , varName ) ; } } } return hrefVars ;
|
public class AbstractCacheConfig { /** * Remove a configuration for a { @ link javax . cache . event . CacheEntryListener } .
* @ param cacheEntryListenerConfiguration the { @ link CacheEntryListenerConfiguration } to remove
* @ return the { @ link CacheConfig } */
@ Override public CacheConfiguration < K , V > removeCacheEntryListenerConfiguration ( CacheEntryListenerConfiguration < K , V > cacheEntryListenerConfiguration ) { } }
|
checkNotNull ( cacheEntryListenerConfiguration , "CacheEntryListenerConfiguration can't be null" ) ; DeferredValue < CacheEntryListenerConfiguration < K , V > > lazyConfig = DeferredValue . withValue ( cacheEntryListenerConfiguration ) ; listenerConfigurations . remove ( lazyConfig ) ; return this ;
|
public class Disposables { /** * Performs null checks and disposes of assets . Ignores exceptions .
* @ param disposables its values will be disposed of ( if they exist ) . Can be null . */
public static void gracefullyDisposeOf ( final Map < ? , ? extends Disposable > disposables ) { } }
|
if ( disposables != null ) { for ( final Disposable disposable : disposables . values ( ) ) { gracefullyDisposeOf ( disposable ) ; } }
|
public class AlertApi { /** * Delete Alert Attachment
* Delete alert attachment for the given identifier
* @ param params . identifier Identifier of alert which could be alert id , tiny id or alert alias ( required )
* @ param params . attachmentId Identifier of alert attachment ( required )
* @ param params . alertIdentifierType Type of the identifier that is provided as an in - line parameter . Possible values are & # 39 ; id & # 39 ; , & # 39 ; alias & # 39 ; or & # 39 ; tiny & # 39 ; ( optional , default to id )
* @ param params . user Display name of the request owner ( optional )
* @ return SuccessResponse
* @ throws ApiException if fails to make API call */
public SuccessResponse deleteAttachment ( DeleteAlertAttachmentRequest params ) throws ApiException { } }
|
String identifier = params . getIdentifier ( ) ; Long attachmentId = params . getAttachmentId ( ) ; String alertIdentifierType = params . getAlertIdentifierType ( ) . getValue ( ) ; String user = params . getUser ( ) ; Object localVarPostBody = null ; // verify the required parameter ' identifier ' is set
if ( identifier == null ) { throw new ApiException ( 400 , "Missing the required parameter 'identifier' when calling deleteAttachment" ) ; } // verify the required parameter ' attachmentId ' is set
if ( attachmentId == null ) { throw new ApiException ( 400 , "Missing the required parameter 'attachmentId' when calling deleteAttachment" ) ; } // create path and map variables
String localVarPath = "/v2/alerts/{identifier}/attachments/{attachmentId}" . replaceAll ( "\\{" + "identifier" + "\\}" , apiClient . escapeString ( identifier . toString ( ) ) ) . replaceAll ( "\\{" + "attachmentId" + "\\}" , apiClient . escapeString ( attachmentId . toString ( ) ) ) ; // query params
List < Pair > localVarQueryParams = new ArrayList < Pair > ( ) ; Map < String , String > localVarHeaderParams = new HashMap < String , String > ( ) ; Map < String , Object > localVarFormParams = new HashMap < String , Object > ( ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "alertIdentifierType" , alertIdentifierType ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "user" , user ) ) ; final String [ ] localVarAccepts = { "application/json" } ; final String localVarAccept = apiClient . selectHeaderAccept ( localVarAccepts ) ; final String [ ] localVarContentTypes = { } ; final String localVarContentType = apiClient . selectHeaderContentType ( localVarContentTypes ) ; String [ ] localVarAuthNames = new String [ ] { "GenieKey" } ; GenericType < SuccessResponse > localVarReturnType = new GenericType < SuccessResponse > ( ) { } ; return apiClient . invokeAPI ( localVarPath , "DELETE" , localVarQueryParams , localVarPostBody , localVarHeaderParams , localVarFormParams , localVarAccept , localVarContentType , localVarAuthNames , localVarReturnType ) ;
|
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link ValuePropertyType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link ValuePropertyType } { @ code > } */
@ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "valueComponent" ) public JAXBElement < ValuePropertyType > createValueComponent ( ValuePropertyType value ) { } }
|
return new JAXBElement < ValuePropertyType > ( _ValueComponent_QNAME , ValuePropertyType . class , null , value ) ;
|
public class SecretsManager { /** * Obtain a secret ' s metadata . This requires the permission < code > secretsmanager : DescribeSecret < / code >
* @ param secretId the ARN of the secret
* @ return the secret ' s metadata */
public DescribeSecretResult describeSecret ( final String secretId ) { } }
|
final DescribeSecretRequest describeSecretRequest = new DescribeSecretRequest ( ) ; describeSecretRequest . setSecretId ( secretId ) ; return getDelegate ( ) . describeSecret ( describeSecretRequest ) ;
|
public class ConnectorServiceImpl { /** * Declarative Services method for unsetting the executor service reference .
* @ param ref reference to the service */
protected void unsetExecutor ( ServiceReference < ExecutorService > ref ) { } }
|
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "unsetExecutor" , ref ) ; execSvcRef . unsetReference ( ref ) ;
|
public class ManagementLocksInner { /** * Creates or updates a management lock at the subscription level .
* When you apply a lock at a parent scope , all child resources inherit the same lock . To create management locks , you must have access to Microsoft . Authorization / * or Microsoft . Authorization / locks / * actions . Of the built - in roles , only Owner and User Access Administrator are granted those actions .
* @ param lockName The name of lock . The lock name can be a maximum of 260 characters . It cannot contain & lt ; , & gt ; % , & amp ; , : , \ , ? , / , or any control characters .
* @ param parameters The management lock parameters .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < ManagementLockObjectInner > createOrUpdateAtSubscriptionLevelAsync ( String lockName , ManagementLockObjectInner parameters , final ServiceCallback < ManagementLockObjectInner > serviceCallback ) { } }
|
return ServiceFuture . fromResponse ( createOrUpdateAtSubscriptionLevelWithServiceResponseAsync ( lockName , parameters ) , serviceCallback ) ;
|
public class EJSLocalWrapper { /** * Get the primary key associated with this wrapper . < p >
* This method is part of the EJBLocalObject interface .
* @ return an < code > Object < / code > containing primary key of
* this wrapper . */
public Object getPrimaryKey ( ) throws javax . ejb . EJBException { } }
|
HomeInternal hi = beanId . getHome ( ) ; if ( hi . isStatelessSessionHome ( ) || hi . isStatefulSessionHome ( ) ) { throw new IllegalSessionMethodLocalException ( ) ; } // PK26539 : copy the primary key ( see WASInternal _ copyPrimaryKey for explanation )
return ( ( EJSHome ) hi ) . WASInternal_copyPrimaryKey ( beanId . getPrimaryKey ( ) ) ;
|
public class Selection { /** * Move the selection edge to offset < code > index < / code > . */
public static final void extendSelection ( Spannable text , int index ) { } }
|
if ( text . getSpanStart ( SELECTION_END ) != index ) text . setSpan ( SELECTION_END , index , index , Spanned . SPAN_POINT_POINT ) ;
|
public class SimulatorTaskTracker { /** * Called once at the start of the simulation .
* @ param when Time when the task tracker starts .
* @ return the initial HeartbeatEvent for ourselves . */
public List < SimulatorEvent > init ( long when ) { } }
|
LOG . debug ( "TaskTracker starting up, current simulation time=" + when ) ; return Collections . < SimulatorEvent > singletonList ( new HeartbeatEvent ( this , when ) ) ;
|
public class LongFunctionBuilder { /** * One of ways of creating builder . This might be the only way ( considering all _ functional _ builders ) that might be utilize to specify generic params only once . */
@ Nonnull public static < R > LongFunctionBuilder < R > longFunction ( Consumer < LongFunction < R > > consumer ) { } }
|
return new LongFunctionBuilder ( consumer ) ;
|
public class CorsRuleMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CorsRule corsRule , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( corsRule == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( corsRule . getAllowedOrigins ( ) , ALLOWEDORIGINS_BINDING ) ; protocolMarshaller . marshall ( corsRule . getAllowedMethods ( ) , ALLOWEDMETHODS_BINDING ) ; protocolMarshaller . marshall ( corsRule . getAllowedHeaders ( ) , ALLOWEDHEADERS_BINDING ) ; protocolMarshaller . marshall ( corsRule . getMaxAgeSeconds ( ) , MAXAGESECONDS_BINDING ) ; protocolMarshaller . marshall ( corsRule . getExposeHeaders ( ) , EXPOSEHEADERS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class Mockito { /** * Same as { @ link # doReturn ( Object ) } but sets consecutive values to be returned . Remember to use
* < code > doReturn ( ) < / code > in those rare occasions when you cannot use { @ link Mockito # when ( Object ) } .
* < b > Beware that { @ link Mockito # when ( Object ) } is always recommended for stubbing because it is argument type - safe
* and more readable < / b > ( especially when stubbing consecutive calls ) .
* Here are those rare occasions when doReturn ( ) comes handy :
* < ol >
* < li > When spying real objects and calling real methods on a spy brings side effects
* < pre class = " code " > < code class = " java " >
* List list = new LinkedList ( ) ;
* List spy = spy ( list ) ;
* / / Impossible : real method is called so spy . get ( 0 ) throws IndexOutOfBoundsException ( the list is yet empty )
* when ( spy . get ( 0 ) ) . thenReturn ( " foo " , " bar " , " qix " ) ;
* / / You have to use doReturn ( ) for stubbing :
* doReturn ( " foo " , " bar " , " qix " ) . when ( spy ) . get ( 0 ) ;
* < / code > < / pre >
* < / li >
* < li > Overriding a previous exception - stubbing :
* < pre class = " code " > < code class = " java " >
* when ( mock . foo ( ) ) . thenThrow ( new RuntimeException ( ) ) ;
* / / Impossible : the exception - stubbed foo ( ) method is called so RuntimeException is thrown .
* when ( mock . foo ( ) ) . thenReturn ( " bar " , " foo " , " qix " ) ;
* / / You have to use doReturn ( ) for stubbing :
* doReturn ( " bar " , " foo " , " qix " ) . when ( mock ) . foo ( ) ;
* < / code > < / pre >
* < / li >
* < / ol >
* Above scenarios shows a trade - off of Mockito ' s elegant syntax . Note that the scenarios are very rare , though .
* Spying should be sporadic and overriding exception - stubbing is very rare . Not to mention that in general
* overridding stubbing is a potential code smell that points out too much stubbing .
* See examples in javadoc for { @ link Mockito } class
* @ param toBeReturned to be returned when the stubbed method is called
* @ param toBeReturnedNext to be returned in consecutive calls when the stubbed method is called
* @ return stubber - to select a method for stubbing
* @ since 2.1.0 */
@ SuppressWarnings ( { } }
|
"unchecked" , "varargs" } ) @ CheckReturnValue public static Stubber doReturn ( Object toBeReturned , Object ... toBeReturnedNext ) { return MOCKITO_CORE . stubber ( ) . doReturn ( toBeReturned , toBeReturnedNext ) ;
|
public class ImageRetinaApiImpl { /** * { @ inheritDoc } */
@ Override public ByteArrayInputStream getImage ( String jsonModels ) throws JsonProcessingException , ApiException { } }
|
return getImage ( null , null , jsonModels ) ;
|
public class Util { /** * Checks that two bytes are the same , while generating
* a formatted error message if they are not . The error
* message will indicate the hex value of the bytes if
* they do not match .
* @ param expected the expected value
* @ param actual the actual value
* @ throws IOException if the two values do not match */
public static void check ( byte expected , byte actual ) throws IOException { } }
|
if ( expected != actual ) throw new IOException ( "check expected " + Integer . toHexString ( 0xff & expected ) + ", found " + Integer . toHexString ( 0xff & actual ) ) ;
|
public class SubnetUtils { /** * Convert a packed integer address into a 4 - element array */
private int [ ] toArray ( int val ) { } }
|
int [ ] ret = new int [ 4 ] ; for ( int j = 3 ; j >= 0 ; -- j ) { ret [ j ] |= ( ( val >>> 8 * ( 3 - j ) ) & ( 0xff ) ) ; } return ret ;
|
import java . util . ArrayList ; import java . util . Collections ; class CheckAscending { /** * This function checks if a list of numbers is sorted in ascending order or not .
* > > > is _ ascending ( [ 1 , 2 , 3 , 4 ] )
* True
* > > > is _ ascending ( [ 4 , 3 , 2 , 1 ] )
* False
* > > > is _ ascending ( [ 0 , 1 , 4 , 9 ] )
* True */
public static boolean isAscending ( ArrayList < Integer > sequence ) { } }
|
ArrayList < Integer > sortedSequence = new ArrayList < > ( sequence ) ; Collections . sort ( sortedSequence ) ; return sequence . equals ( sortedSequence ) ;
|
public class BioPAXIOHandlerAdapter { /** * Similar to { @ link BioPAXIOHandler # convertToOWL ( org . biopax . paxtools . model . Model ,
* java . io . OutputStream ) } ( org . biopax . paxtools . model . Model , Object ) } , but
* extracts a sub - model , converts it into BioPAX ( OWL ) format ,
* and writes it into the outputStream .
* Saved data can be then read via { @ link BioPAXIOHandler }
* interface ( e . g . , { @ link SimpleIOHandler } ) .
* @ param model model to be converted into OWL format
* @ param outputStream output stream into which the output will be written
* @ param ids optional list of " root " element absolute URIs ;
* direct / indirect child objects are auto - exported as well . */
public void convertToOWL ( Model model , OutputStream outputStream , String ... ids ) { } }
|
if ( ids . length == 0 ) { convertToOWL ( model , outputStream ) ; } else { Model m = model . getLevel ( ) . getDefaultFactory ( ) . createModel ( ) ; m . setXmlBase ( model . getXmlBase ( ) ) ; Fetcher fetcher = new Fetcher ( SimpleEditorMap . get ( model . getLevel ( ) ) ) ; // no Filters anymore
for ( String uri : ids ) { BioPAXElement bpe = model . getByID ( uri ) ; if ( bpe != null ) { fetcher . fetch ( bpe , m ) ; } } convertToOWL ( m , outputStream ) ; }
|
public class Parser { /** * full parser to deal with . */
private static boolean hasUnsafeChars ( String s ) { } }
|
for ( int i = 0 ; i < s . length ( ) ; ++ i ) { char c = s . charAt ( i ) ; if ( Character . isLetter ( c ) || c == '.' ) continue ; else return true ; } return false ;
|
public class SyncMapItem { /** * Create a SyncMapItemCreator to execute create .
* @ param pathServiceSid The service _ sid
* @ param pathMapSid The map _ sid
* @ param key The unique user - defined key of this Map Item .
* @ param data Contains arbitrary user - defined , schema - less data that this Map
* Item stores , represented by a JSON object , up to 16KB .
* @ return SyncMapItemCreator capable of executing the create */
public static SyncMapItemCreator creator ( final String pathServiceSid , final String pathMapSid , final String key , final Map < String , Object > data ) { } }
|
return new SyncMapItemCreator ( pathServiceSid , pathMapSid , key , data ) ;
|
public class CassandraSchemaManager { /** * On set key validation .
* @ param cfDef
* the cf def
* @ param cfProperties
* the cf properties
* @ param builder
* the builder */
private void onSetKeyValidation ( CfDef cfDef , Properties cfProperties , StringBuilder builder ) { } }
|
String keyValidationClass = cfProperties . getProperty ( CassandraConstants . KEY_VALIDATION_CLASS ) ; if ( keyValidationClass != null ) { if ( builder != null ) { // nothing available .
} else { cfDef . setKey_validation_class ( keyValidationClass ) ; } }
|
public class LollipopDrawablesCompat { /** * Create a drawable from an inputstream , using the given resources and value to determine
* density information . */
public static Drawable createFromResourceStream ( Resources res , TypedValue value , InputStream is , String srcName , BitmapFactory . Options opts ) { } }
|
return Drawable . createFromResourceStream ( res , value , is , srcName , opts ) ;
|
public class MapTilePathModel { /** * MapTilePath */
@ Override public void loadPathfinding ( Media pathfindingConfig ) { } }
|
final Collection < PathCategory > config = PathfindingConfig . imports ( pathfindingConfig ) ; categories . clear ( ) ; for ( final PathCategory category : config ) { categories . put ( category . getName ( ) , category ) ; } for ( int ty = 0 ; ty < map . getInTileHeight ( ) ; ty ++ ) { for ( int tx = 0 ; tx < map . getInTileWidth ( ) ; tx ++ ) { final Tile tile = map . getTile ( tx , ty ) ; if ( tile != null ) { final String group = mapGroup . getGroup ( tile ) ; final String category = getCategory ( group ) ; final TilePath tilePath = new TilePathModel ( category ) ; tile . addFeature ( tilePath ) ; } } }
|
public class UsersWriter { /** * Append roles to the builder .
* @ param builder the builder
* @ param user the user whose roles are appended */
private void appendRoles ( final StringBuilder builder , final User user ) { } }
|
for ( final UserRoleName role : user . getRoles ( ) ) { append ( builder , "," , role . name ( ) ) ; }
|
public class ImplementationImpl { /** * Create a new < code > DList < / code > object .
* @ return The new < code > DList < / code > object .
* @ see DList */
public DList newDList ( ) { } }
|
if ( ( getCurrentDatabase ( ) == null ) ) { throw new DatabaseClosedException ( "Database is NULL, cannot create a DList with a null database." ) ; } return ( DList ) DListFactory . singleton . createCollectionOrMap ( getCurrentPBKey ( ) ) ;
|
public class Row { /** * move to be the last item of parent */
public void moveLastChild ( Row newParent ) { } }
|
if ( this == newParent ) return ; // remove from its current position
Row parentItem = m_parent ; if ( parentItem == null ) parentItem = this . treeTable . m_rootItem ; parentItem . getChilds ( ) . remove ( this ) ; // DOM . removeChild ( m _ body , m _ tr ) ;
if ( newParent == null ) newParent = this . treeTable . m_rootItem ; // insert at the end of the current parent
// DOM add
Row lastLeaf = newParent . getLastLeaf ( ) ; Element trToInsertAfter = lastLeaf . m_tr ; if ( trToInsertAfter != null ) { int after = DOM . getChildIndex ( this . treeTable . m_body , trToInsertAfter ) ; int before = after + 1 ; DOM . insertChild ( this . treeTable . m_body , m_tr , before ) ; } else { DOM . appendChild ( this . treeTable . m_body , m_tr ) ; } parentItem . getChilds ( ) . add ( this ) ; // take care of the left padding
Element firstTd = DOM . getChild ( m_tr , 0 ) ; firstTd . getStyle ( ) . setPaddingLeft ( getLevel ( ) * this . treeTable . treePadding , Unit . PX ) ;
|
public class NamedArgumentDefinition { /** * populated with the actual value and tags and attributes provided by the user for that argument . */
private Object getValuePopulatedWithTags ( final String originalTag , final String stringValue ) { } }
|
// See if the value is a surrogate key in the tag parser ' s map that was placed there during preprocessing ,
// and if so , unpack the values retrieved via the key and use those to populate the field
final Object value = constructFromString ( stringValue , getLongName ( ) ) ; if ( TaggedArgument . class . isAssignableFrom ( getUnderlyingFieldClass ( ) ) ) { // NOTE : this propagates the tag name / attributes to the field BEFORE the value is set
TaggedArgument taggedArgument = ( TaggedArgument ) value ; TaggedArgumentParser . populateArgumentTags ( taggedArgument , getLongName ( ) , originalTag ) ; } else if ( originalTag != null ) { // a tag was found for a non - taggable argument
throw new CommandLineException ( String . format ( "The argument: \"%s/%s\" does not accept tags: \"%s\"" , getShortName ( ) , getFullName ( ) , originalTag ) ) ; } return value ;
|
public class InternalRoles { /** * Remove a role from a user .
* @ param username
* The username of the user .
* @ param oldrole
* The role to remove from the user .
* @ throws RolesException
* if there was an error during removal . */
@ Override public void removeRole ( String username , String oldrole ) throws RolesException { } }
|
List < String > users_with_role = new ArrayList < String > ( ) ; if ( user_list . containsKey ( username ) ) { List < String > roles_of_user = user_list . get ( username ) ; if ( roles_of_user . contains ( oldrole ) ) { // Update our user list
roles_of_user . remove ( oldrole ) ; user_list . put ( username , roles_of_user ) ; // Update our roles list
if ( role_list . containsKey ( oldrole ) ) users_with_role = role_list . get ( oldrole ) ; users_with_role . remove ( username ) ; if ( users_with_role . size ( ) < 1 ) { role_list . remove ( oldrole ) ; } else { role_list . put ( oldrole , users_with_role ) ; } // Don ' t forget to update our file _ store
String roles = StringUtils . join ( roles_of_user . toArray ( new String [ 0 ] ) , "," ) ; file_store . setProperty ( username , roles ) ; // And commit the file _ store to disk
try { saveRoles ( ) ; } catch ( IOException e ) { throw new RolesException ( e ) ; } } else { throw new RolesException ( "User '" + username + "' does not have the role '" + oldrole + "'!" ) ; } } else { throw new RolesException ( "User '" + username + "' does not exist!" ) ; }
|
public class JHtmlEditor { /** * Create the hyperlink listener .
* @ return The hyperlink listener . */
public HyperlinkListener createHyperLinkListener ( ) { } }
|
return new HyperlinkListener ( ) { public void hyperlinkUpdate ( HyperlinkEvent e ) { if ( e . getEventType ( ) == HyperlinkEvent . EventType . ACTIVATED ) { if ( e instanceof HTMLFrameHyperlinkEvent ) { ( ( HTMLDocument ) getDocument ( ) ) . processHTMLFrameHyperlinkEvent ( ( HTMLFrameHyperlinkEvent ) e ) ; } else { URL url = e . getURL ( ) ; if ( getCallingApplet ( ) != null ) if ( getHelpPane ( ) != null ) { String strQuery = url . getQuery ( ) ; if ( ( strQuery != null ) && ( strQuery . length ( ) > 0 ) && ( strQuery . indexOf ( Params . HELP + "=" ) == - 1 ) ) { // This is a command , not a new help screen
if ( BaseApplet . handleAction ( "?" + strQuery , getCallingApplet ( ) , null , 0 ) ) // Try to have my calling screen handle it
url = null ; // Handled
} } if ( url != null ) linkActivated ( url , m_applet , 0 ) ; } } } } ;
|
public class AppConfig { /** * Merge application configurator settings . Note application configurator
* settings has lower priority as it ' s hardcoded thus only when configuration file
* does not provided the settings , the app configurator will take effect
* @ param conf
* the application configurator */
public void _merge ( AppConfigurator conf ) { } }
|
app . emit ( SysEventId . CONFIG_PREMERGE ) ; if ( mergeTracker . contains ( conf ) ) { return ; } mergeTracker . add ( conf ) ; for ( Method method : AppConfig . class . getDeclaredMethods ( ) ) { boolean isPrivate = Modifier . isPrivate ( method . getModifiers ( ) ) ; if ( isPrivate && method . getName ( ) . startsWith ( "_merge" ) ) { method . setAccessible ( true ) ; $ . invokeVirtual ( this , method , conf ) ; } } Set < String > keys = conf . propKeys ( ) ; if ( ! keys . isEmpty ( ) ) { for ( String k : keys ) { if ( ! raw . containsKey ( k ) ) { raw . put ( k , conf . propVal ( k ) ) ; } } }
|
public class SparseUndirectedEdgeSet { /** * { @ inheritDoc } */
public boolean contains ( Object o ) { } }
|
if ( o instanceof Edge ) { Edge e = ( Edge ) o ; int toFind = 0 ; if ( e . to ( ) == rootVertex ) toFind = e . from ( ) ; else if ( e . from ( ) == rootVertex ) toFind = e . to ( ) ; else return false ; boolean b = edges . contains ( toFind ) ; return b ; } return false ;
|
public class AxesChartSeriesNumericalNoErrorBars { /** * Finds the min and max of a dataset accounting for error bars
* @ param data
* @ param errorBars
* @ return */
private double [ ] findMinMaxWithErrorBars ( double [ ] data , double [ ] errorBars ) { } }
|
double min = Double . MAX_VALUE ; double max = - Double . MAX_VALUE ; for ( int i = 0 ; i < data . length ; i ++ ) { double d = data [ i ] ; double eb = errorBars [ i ] ; if ( d - eb < min ) { min = d - eb ; } if ( d + eb > max ) { max = d + eb ; } } return new double [ ] { min , max } ;
|
public class CfgParser { /** * Compute the marginal distribution over all grammar entries conditioned on
* the given sequence of terminals . */
public CfgParseChart parseMarginal ( List < ? > terminals , Object root , boolean useSumProduct ) { } }
|
CfgParseChart chart = createParseChart ( terminals , useSumProduct ) ; Factor rootFactor = TableFactor . pointDistribution ( parentVar , parentVar . outcomeArrayToAssignment ( root ) ) ; return marginal ( chart , terminals , rootFactor ) ;
|
public class MLNumericArray { /** * / * ( non - Javadoc )
* @ see ca . mjdsystems . jmatio . types . MLArray # contentToString ( ) */
public String contentToString ( ) { } }
|
StringBuffer sb = new StringBuffer ( ) ; sb . append ( name + " = \n" ) ; if ( getSize ( ) > 1000 ) { sb . append ( "Cannot display variables with more than 1000 elements." ) ; return sb . toString ( ) ; } for ( int m = 0 ; m < getM ( ) ; m ++ ) { sb . append ( "\t" ) ; for ( int n = 0 ; n < getN ( ) ; n ++ ) { sb . append ( getReal ( m , n ) ) ; if ( isComplex ( ) ) { sb . append ( "+" + getImaginary ( m , n ) ) ; } sb . append ( "\t" ) ; } sb . append ( "\n" ) ; } return sb . toString ( ) ;
|
public class InventoryActionMessage { /** * Sends GUI action to the server { @ link MalisisInventoryContainer } .
* @ param action the action
* @ param inventoryId the inventory id
* @ param slotNumber the slot number
* @ param code the code */
@ SideOnly ( Side . CLIENT ) public static void sendAction ( ActionType action , int inventoryId , int slotNumber , int code ) { } }
|
int windowId = Utils . getClientPlayer ( ) . openContainer . windowId ; Packet packet = new Packet ( action , inventoryId , slotNumber , code , windowId ) ; MalisisCore . network . sendToServer ( packet ) ;
|
public class BigtableTableAdminClient { /** * Constructs an instance of BigtableTableAdminClient with the given instanceName .
* @ deprecated Please { @ link # create ( String , String ) } . */
@ Deprecated public static BigtableTableAdminClient create ( @ Nonnull com . google . bigtable . admin . v2 . InstanceName instanceName ) throws IOException { } }
|
return create ( instanceName . getProject ( ) , instanceName . getInstance ( ) ) ;
|
public class ConfigImpl { /** * sets the Schedule Directory
* @ param scheduleDirectory sets the schedule Directory
* @ param logger
* @ throws PageException */
protected void setScheduler ( CFMLEngine engine , Resource scheduleDirectory ) throws PageException { } }
|
if ( scheduleDirectory == null ) { if ( this . scheduler == null ) this . scheduler = new SchedulerImpl ( engine , "<?xml version=\"1.0\"?>\n<schedule></schedule>" , this ) ; return ; } if ( ! isDirectory ( scheduleDirectory ) ) throw new ExpressionException ( "schedule task directory " + scheduleDirectory + " doesn't exist or is not a directory" ) ; try { if ( this . scheduler == null ) this . scheduler = new SchedulerImpl ( engine , this , scheduleDirectory , SystemUtil . getCharset ( ) . name ( ) ) ; } catch ( Exception e ) { throw Caster . toPageException ( e ) ; }
|
public class Policy { /** * Specifies the AWS account IDs to include in the policy . If < code > IncludeMap < / code > is null , all accounts in the
* organization in AWS Organizations are included in the policy . If < code > IncludeMap < / code > is not null , only values
* listed in < code > IncludeMap < / code > are included in the policy .
* The key to the map is < code > ACCOUNT < / code > . For example , a valid < code > IncludeMap < / code > would be
* < code > { “ ACCOUNT ” : [ “ accountID1 ” , “ accountID2 ” ] } < / code > .
* @ param includeMap
* Specifies the AWS account IDs to include in the policy . If < code > IncludeMap < / code > is null , all accounts
* in the organization in AWS Organizations are included in the policy . If < code > IncludeMap < / code > is not
* null , only values listed in < code > IncludeMap < / code > are included in the policy . < / p >
* The key to the map is < code > ACCOUNT < / code > . For example , a valid < code > IncludeMap < / code > would be
* < code > { “ ACCOUNT ” : [ “ accountID1 ” , “ accountID2 ” ] } < / code > .
* @ return Returns a reference to this object so that method calls can be chained together . */
public Policy withIncludeMap ( java . util . Map < String , java . util . List < String > > includeMap ) { } }
|
setIncludeMap ( includeMap ) ; return this ;
|
public class AbstractMaterialDialogBuilder { /** * Sets the margin of the dialog , which is created by the builder .
* @ param left
* The left margin , which should be set , in pixels as an { @ link Integer } value . The left
* margin must be at least 0
* @ param top
* The top margin , which should be set , in pixels as an { @ link Integer } value . The top
* margin must be at least 0
* @ param right
* The right margin , which should be set , in pixels as an { @ link Integer } value . The
* right margin must be at least 0
* @ param bottom
* The bottom margin , which should be set , in pixels as an { @ link Integer } value . The
* bottom margin must be at least 0
* @ return The builder , the method has been called upon , as an instance of the generic type
* BuilderType */
public final BuilderType setMargin ( final int left , final int top , final int right , final int bottom ) { } }
|
getProduct ( ) . setMargin ( left , top , right , bottom ) ; return self ( ) ;
|
public class RemoteFacadeCircuitBreaker { /** * 这里会判断当前调用服务的状态 , 分析判断是否需要进入降级状态
* 如果服务在指定的时间区间内累积的错误 , 达到了配置的次数 , 则进入服务降级
* 如果满足上面条件 , 并且满足重试机制 , 则也不会进入降级流程 , 而是触发远程服务调用
* @ param invoker
* @ param invocation
* @ return */
private boolean checkNeedCircuitBreak ( Invoker < ? > invoker , Invocation invocation ) { } }
|
String interfaceName = invoker . getUrl ( ) . getParameter ( Constants . INTERFACE_KEY ) ; String method = invocation . getMethodName ( ) ; String methodKey = Config . getMethodPropertyName ( invoker , invocation ) . toString ( ) ; int limit = Config . getBreakLimit ( invoker , invocation ) ; BreakCounter breakCounter = breakCounterMap . get ( methodKey ) ; if ( breakCounter != null && breakCounter . isEnable ( ) ) { long currentExceptionCount = breakCounter . getCurrentExceptionCount ( ) ; long currentBreakCount = breakCounter . getCurrentBreakCount ( ) ; logger . info ( "[{}] check invoke [{}.{}] circuit break,current exception count [{}] limit [{}]" , localHost , interfaceName , method , currentExceptionCount , limit ) ; if ( limit <= currentExceptionCount ) { if ( currentBreakCount > 0 && needRetry ( invoker , invocation , currentBreakCount ) ) { logger . info ( "[{}] retry invoke [{}.{}] current break count [{}]" , localHost , interfaceName , method , currentBreakCount ) ; breakCounter . incrementRetryTimes ( ) ; return false ; } return true ; } } return false ;
|
public class UpdateBuilder { /** * Deletes the document referred to by this DocumentReference .
* @ param documentReference The DocumentReference to delete .
* @ return The instance for chaining . */
@ Nonnull public T delete ( @ Nonnull DocumentReference documentReference ) { } }
|
return performDelete ( documentReference , Precondition . NONE ) ;
|
public class MaxiCode { /** * Guesses the best set to use at the specified index by looking at the surrounding sets . In general , characters in
* lower - numbered sets are more common , so we choose them if we can . If no good surrounding sets can be found , the default
* value returned is the first value from the valid set .
* @ param index the current index
* @ param length the maximum length to look at
* @ param valid the valid sets for this index
* @ return the best set to use at the specified index */
private int bestSurroundingSet ( int index , int length , int ... valid ) { } }
|
int option1 = set [ index - 1 ] ; if ( index + 1 < length ) { // we have two options to check
int option2 = set [ index + 1 ] ; if ( contains ( valid , option1 ) && contains ( valid , option2 ) ) { return Math . min ( option1 , option2 ) ; } else if ( contains ( valid , option1 ) ) { return option1 ; } else if ( contains ( valid , option2 ) ) { return option2 ; } else { return valid [ 0 ] ; } } else { // we only have one option to check
if ( contains ( valid , option1 ) ) { return option1 ; } else { return valid [ 0 ] ; } }
|
public class HttpHeaders { /** * Write all Headers and a trailing CRLF , CRLF
* @ param out
* @ throws IOException */
public void write ( OutputStream out ) throws IOException { } }
|
for ( HttpHeader header : this ) { header . write ( out ) ; } out . write ( CR ) ; out . write ( LF ) ;
|
public class CmsSearchManager { /** * Updates the indexes from as a scheduled job . < p >
* @ param cms the OpenCms user context to use when reading resources from the VFS
* @ param parameters the parameters for the scheduled job
* @ throws Exception if something goes wrong
* @ return the String to write in the scheduler log
* @ see org . opencms . scheduler . I _ CmsScheduledJob # launch ( CmsObject , Map ) */
public String launch ( CmsObject cms , Map < String , String > parameters ) throws Exception { } }
|
CmsSearchManager manager = OpenCms . getSearchManager ( ) ; I_CmsReport report = null ; boolean writeLog = Boolean . valueOf ( parameters . get ( JOB_PARAM_WRITELOG ) ) . booleanValue ( ) ; if ( writeLog ) { report = new CmsLogReport ( cms . getRequestContext ( ) . getLocale ( ) , CmsSearchManager . class ) ; } List < String > updateList = null ; String indexList = parameters . get ( JOB_PARAM_INDEXLIST ) ; if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( indexList ) ) { // index list has been provided as job parameter
updateList = new ArrayList < String > ( ) ; String [ ] indexNames = CmsStringUtil . splitAsArray ( indexList , '|' ) ; for ( int i = 0 ; i < indexNames . length ; i ++ ) { // check if the index actually exists
if ( manager . getIndex ( indexNames [ i ] ) != null ) { updateList . add ( indexNames [ i ] ) ; } else { if ( LOG . isWarnEnabled ( ) ) { LOG . warn ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_NO_INDEX_WITH_NAME_1 , indexNames [ i ] ) ) ; } } } } long startTime = System . currentTimeMillis ( ) ; if ( updateList == null ) { // all indexes need to be updated
manager . rebuildAllIndexes ( report ) ; } else { // rebuild only the selected indexes
manager . rebuildIndexes ( updateList , report ) ; } long runTime = System . currentTimeMillis ( ) - startTime ; String finishMessage = Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_REBUILD_INDEXES_FINISHED_1 , CmsStringUtil . formatRuntime ( runTime ) ) ; if ( LOG . isInfoEnabled ( ) ) { LOG . info ( finishMessage ) ; } return finishMessage ;
|
public class AbcGrammar { /** * comment : : = " % " ( [ non - comment - char * ( VCHAR / WSP ) ] ) eol */
Rule Comment ( ) { } }
|
return Sequence ( String ( "%" ) , Optional ( Sequence ( NonCommentChar ( ) , ZeroOrMore ( FirstOf ( VCHAR ( ) , WSP ( ) ) ) ) ) . label ( CommentText ) . suppressSubnodes ( ) , FirstOfS ( Eol ( ) , EOI ) ) . label ( Comment ) ;
|
public class I18nPopulator { /** * Populate data store with default languages */
public void populateLanguages ( ) { } }
|
dataService . add ( LANGUAGE , languageFactory . create ( LanguageService . DEFAULT_LANGUAGE_CODE , LanguageService . DEFAULT_LANGUAGE_NAME , true ) ) ; dataService . add ( LANGUAGE , languageFactory . create ( "nl" , new Locale ( "nl" ) . getDisplayName ( new Locale ( "nl" ) ) , false ) ) ; dataService . add ( LANGUAGE , languageFactory . create ( "pt" , new Locale ( "pt" ) . getDisplayName ( new Locale ( "pt" ) ) , false ) ) ; dataService . add ( LANGUAGE , languageFactory . create ( "es" , new Locale ( "es" ) . getDisplayName ( new Locale ( "es" ) ) , false ) ) ; dataService . add ( LANGUAGE , languageFactory . create ( "de" , new Locale ( "de" ) . getDisplayName ( new Locale ( "de" ) ) , false ) ) ; dataService . add ( LANGUAGE , languageFactory . create ( "it" , new Locale ( "it" ) . getDisplayName ( new Locale ( "it" ) ) , false ) ) ; dataService . add ( LANGUAGE , languageFactory . create ( "fr" , new Locale ( "fr" ) . getDisplayName ( new Locale ( "fr" ) ) , false ) ) ; dataService . add ( LANGUAGE , languageFactory . create ( "xx" , "My language" , false ) ) ;
|
public class TerminalRuleImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setFragment ( boolean newFragment ) { } }
|
boolean oldFragment = fragment ; fragment = newFragment ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , XtextPackage . TERMINAL_RULE__FRAGMENT , oldFragment , fragment ) ) ;
|
public class TNiftyClientTransport { /** * yeah , mimicking sync with async is just horrible */
private int read ( byte [ ] bytes , int offset , int length , Duration receiveTimeout ) throws InterruptedException , TTransportException { } }
|
long timeRemaining = receiveTimeout . roundTo ( TimeUnit . NANOSECONDS ) ; lock . lock ( ) ; try { while ( ! closed ) { int bytesAvailable = readBuffer . readableBytes ( ) ; if ( bytesAvailable > 0 ) { int begin = readBuffer . readerIndex ( ) ; readBuffer . readBytes ( bytes , offset , Math . min ( bytesAvailable , length ) ) ; int end = readBuffer . readerIndex ( ) ; return end - begin ; } if ( timeRemaining <= 0 ) { break ; } timeRemaining = condition . awaitNanos ( timeRemaining ) ; if ( exception != null ) { try { throw new TTransportException ( exception ) ; } finally { exception = null ; closed = true ; close ( ) ; } } } if ( closed ) { throw new TTransportException ( "channel closed !" ) ; } } finally { lock . unlock ( ) ; } throw new TTransportException ( String . format ( "receive timeout, %d ms has elapsed" , receiveTimeout . toMillis ( ) ) ) ;
|
public class DescribeMatchmakingRuleSetsResult { /** * Collection of requested matchmaking rule set objects .
* @ param ruleSets
* Collection of requested matchmaking rule set objects . */
public void setRuleSets ( java . util . Collection < MatchmakingRuleSet > ruleSets ) { } }
|
if ( ruleSets == null ) { this . ruleSets = null ; return ; } this . ruleSets = new java . util . ArrayList < MatchmakingRuleSet > ( ruleSets ) ;
|
public class ElmBaseVisitor { /** * Visit a FunctionDef . This method will be called for
* every node in the tree that is a FunctionDef .
* @ param elm the ELM tree
* @ param context the context passed to the visitor
* @ return the visitor result */
public T visitFunctionDef ( FunctionDef elm , C context ) { } }
|
for ( OperandDef element : elm . getOperand ( ) ) { visitElement ( element , context ) ; } visitElement ( elm . getExpression ( ) , context ) ; return null ;
|
public class WASCDIAnnotationInjectionProvider { /** * { @ inheritDoc } */
@ Override public Object inject ( Object instance , boolean doPostConstruct ) throws InjectionProviderException { } }
|
return inject ( instance , doPostConstruct , null ) ;
|
public class RoundRobinSelectionStrategy { /** * Selects an { @ link Endpoint } for the given { @ link CouchbaseRequest } .
* < p > < / p >
* If null is returned , it means that no endpoint could be selected and it is up to the calling party
* to decide what to do next .
* @ param request the input request .
* @ param endpoints all the available endpoints .
* @ return the selected endpoint . */
@ Override public Endpoint select ( CouchbaseRequest request , List < Endpoint > endpoints ) { } }
|
int endpointSize = endpoints . size ( ) ; // increments skip and prevents it to overflow to a negative value
skip = Math . max ( 0 , skip + 1 ) ; int offset = skip % endpointSize ; // attempt to find a CONNECTED endpoint at the offset , or try following ones
for ( int i = offset ; i < endpointSize ; i ++ ) { Endpoint endpoint = endpoints . get ( i ) ; if ( endpoint . isState ( LifecycleState . CONNECTED ) && endpoint . isFree ( ) ) { return endpoint ; } } // arriving here means the offset endpoint wasn ' t CONNECTED and none of the endpoints after it were .
// wrap around and try from the beginning of the array
for ( int i = 0 ; i < offset ; i ++ ) { Endpoint endpoint = endpoints . get ( i ) ; if ( endpoint . isState ( LifecycleState . CONNECTED ) && endpoint . isFree ( ) ) { return endpoint ; } } // lastly , really no eligible endpoint was found , return null
return null ;
|
public class VersionHistoryImpl { /** * { @ inheritDoc } */
public Version getVersionByLabel ( String label ) throws RepositoryException { } }
|
checkValid ( ) ; NodeData versionData = getVersionDataByLabel ( label ) ; if ( versionData == null ) { throw new RepositoryException ( "There are no label '" + label + "' in the version history " + getPath ( ) ) ; } VersionImpl version = ( VersionImpl ) dataManager . getItemByIdentifier ( versionData . getIdentifier ( ) , true , false ) ; if ( version == null ) { throw new VersionException ( "There are no version with label '" + label + "' in the version history " + getPath ( ) ) ; } return version ;
|
public class Yaml { /** * Dumps { @ code data } into a { @ code OutputStream } using a { @ code UTF - 8}
* encoding .
* @ param data the data
* @ param output the output stream */
public void dumpAll ( Iterator < ? extends YamlNode > data , OutputStream output ) { } }
|
getDelegate ( ) . dumpAll ( data , new OutputStreamWriter ( output , Charset . forName ( "UTF-8" ) ) ) ;
|
public class WARClassLoader { /** * { @ inheritDoc } */
@ Override public Class < ? > loadClass ( String name ) throws ClassNotFoundException { } }
|
for ( Deployment deployment : kernel . getDeployments ( ) ) { if ( ! ( deployment instanceof WARDeployment ) ) { try { return deployment . getClassLoader ( ) . loadClass ( name ) ; } catch ( Throwable t ) { // Next
} } } return super . loadClass ( name ) ;
|
public class CoronaReleaseManager { /** * Get the release directory ' s latest timestamp */
private long getLastTimeStamp ( Path pathToCheck ) { } }
|
long lastTimeStamp = - 1 ; long tmpTimeStamp = - 1 ; try { for ( FileStatus fileStat : fs . listStatus ( pathToCheck ) ) { Path srcPath = fileStat . getPath ( ) ; if ( ! fileStat . isDir ( ) ) { boolean checkFlag = true ; if ( release_pattern != null ) { // just need to check the files that match the pattern
Matcher m = release_pattern . matcher ( srcPath . toString ( ) ) ; if ( ! m . find ( ) ) { checkFlag = false ; } } if ( checkFlag ) { tmpTimeStamp = fileStat . getModificationTime ( ) ; } else { continue ; } } else { tmpTimeStamp = getLastTimeStamp ( srcPath ) ; } if ( tmpTimeStamp > lastTimeStamp ) { lastTimeStamp = tmpTimeStamp ; } } } catch ( IOException ioe ) { LOG . error ( "IOException when checking timestamp " , ioe ) ; } return lastTimeStamp ;
|
public class FirewallSupport { /** * The Dasein abstraction assumes that a firewall rule has only one source target , one destination target , one protocol and one distinct port range
* However , the GCE abstraction defines groups of these against one single firewall rule .
* Therefore , Dasein splits these groups into distinct parts . The result is that , when Dasein creates rules on GCE they will matchup but when
* Dasein is reading rules created on the GCE side there is the potential for each one to map to multiple Dasein rules .
* @ param rules the GCE API rule response
* @ return A Dasein collection of FirewallRules */
private @ Nonnull Collection < FirewallRule > toFirewallRules ( @ Nonnull List < com . google . api . services . compute . model . Firewall > rules ) { } }
|
ArrayList < FirewallRule > firewallRules = new ArrayList < FirewallRule > ( ) ; for ( com . google . api . services . compute . model . Firewall googleRule : rules ) { List < RuleTarget > sources = new ArrayList < RuleTarget > ( ) ; if ( googleRule . getSourceRanges ( ) != null ) for ( String source : googleRule . getSourceRanges ( ) ) { // Right now GCE only supports IPv4
if ( InetAddressUtils . isIPv4Address ( source ) ) { source = source + "/32" ; } sources . add ( RuleTarget . getCIDR ( source ) ) ; } else if ( googleRule . getSourceTags ( ) != null ) for ( String source : googleRule . getSourceTags ( ) ) { sources . add ( RuleTarget . getVirtualMachine ( source ) ) ; } else return firewallRules ; // got nothing . . .
for ( RuleTarget sourceTarget : sources ) { String tail = "" ; if ( sources . size ( ) > 1 ) tail = "--" + sourceTarget . getCidr ( ) ; String vLanId = googleRule . getNetwork ( ) . substring ( googleRule . getNetwork ( ) . lastIndexOf ( "/" ) + 1 ) ; for ( Allowed allowed : googleRule . getAllowed ( ) ) { Protocol protocol = Protocol . ANY ; try { protocol = Protocol . valueOf ( allowed . getIPProtocol ( ) . toUpperCase ( ) ) ; } catch ( IllegalArgumentException ex ) { // ignore , defaults to ANY if protocol is not supported explicitly
} RuleTarget destinationTarget ; int portStart = 0 ; int portEnd = 0 ; if ( protocol != Protocol . ICMP ) { if ( ( null != allowed ) && ( null != allowed . getPorts ( ) ) ) { for ( String portString : allowed . getPorts ( ) ) { if ( portString . indexOf ( "-" ) > 0 ) { String [ ] parts = portString . split ( "-" ) ; portStart = Integer . valueOf ( parts [ 0 ] ) ; portEnd = Integer . valueOf ( parts [ 1 ] ) ; } else portStart = portEnd = Integer . valueOf ( portString ) ; if ( googleRule . getTargetTags ( ) != null ) { for ( String targetTag : googleRule . getTargetTags ( ) ) { destinationTarget = RuleTarget . getVirtualMachine ( targetTag ) ; FirewallRule rule = FirewallRule . getInstance ( googleRule . getName ( ) + tail , "fw-" + vLanId , sourceTarget , Direction . INGRESS , protocol , Permission . ALLOW , destinationTarget , portStart , portEnd ) ; firewallRules . add ( rule ) ; } } else { destinationTarget = RuleTarget . getVlan ( vLanId ) ; FirewallRule rule = FirewallRule . getInstance ( googleRule . getName ( ) + tail , "fw-" + vLanId , sourceTarget , Direction . INGRESS , protocol , Permission . ALLOW , destinationTarget , portStart , portEnd ) ; firewallRules . add ( rule ) ; } } } } else { if ( googleRule . getTargetTags ( ) != null ) { for ( String targetTag : googleRule . getTargetTags ( ) ) { destinationTarget = RuleTarget . getVirtualMachine ( targetTag ) ; FirewallRule rule = FirewallRule . getInstance ( googleRule . getName ( ) + tail , "fw-" + vLanId , sourceTarget , Direction . INGRESS , protocol , Permission . ALLOW , destinationTarget , portStart , portEnd ) ; firewallRules . add ( rule ) ; } } else { destinationTarget = RuleTarget . getVlan ( vLanId ) ; FirewallRule rule = FirewallRule . getInstance ( googleRule . getName ( ) + tail , "fw-" + vLanId , sourceTarget , Direction . INGRESS , protocol , Permission . ALLOW , destinationTarget , portStart , portEnd ) ; firewallRules . add ( rule ) ; } } } } } return firewallRules ;
|
public class ImagingKitUtils { /** * Throws an { @ link IllegalArgumentException } when the specified area
* is not within the bounds of the specified image , or if the area
* is not positive .
* This is used for parameter evaluation .
* @ param xStart left boundary of the area
* @ param yStart top boundary of the area
* @ param width of the area
* @ param height of the area
* @ param img the area has to fit in .
* @ throws IllegalArgumentException when area not in image bounds or not area not positive */
public static void requireAreaInImageBounds ( final int xStart , final int yStart , final int width , final int height , ImgBase < ? > img ) { } }
|
if ( width <= 0 || height <= 0 || xStart < 0 || yStart < 0 || xStart + width > img . getWidth ( ) || yStart + height > img . getHeight ( ) ) { throw new IllegalArgumentException ( String . format ( "provided area [%d,%d][%d,%d] is not within bounds of the image [%d,%d]" , xStart , yStart , width , height , img . getWidth ( ) , img . getHeight ( ) ) ) ; }
|
public class UserInterfaceApi { /** * Open Contract Window Open the contract window inside the client - - - SSO
* Scope : esi - ui . open _ window . v1
* @ param contractId
* The contract to open ( required )
* @ param datasource
* The server name you would like data from ( optional , default to
* tranquility )
* @ param token
* Access token to use if unable to set a header ( optional )
* @ return ApiResponse & lt ; Void & gt ;
* @ throws ApiException
* If fail to call the API , e . g . server error or cannot
* deserialize the response body */
public ApiResponse < Void > postUiOpenwindowContractWithHttpInfo ( Integer contractId , String datasource , String token ) throws ApiException { } }
|
com . squareup . okhttp . Call call = postUiOpenwindowContractValidateBeforeCall ( contractId , datasource , token , null ) ; return apiClient . execute ( call ) ;
|
public class SubscriptionMessageType { /** * Returns the corresponding SubscriptionMessageType for a given integer .
* This method should NOT be called by any code outside the MFP component .
* It is only public so that it can be accessed by sub - packages .
* @ param aValue The integer for which an SubscriptionMessageType is required .
* @ return The corresponding SubscriptionMessageType */
public final static SubscriptionMessageType getSubscriptionMessageType ( int aValue ) { } }
|
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Value = " + aValue ) ; return set [ aValue ] ;
|
public class SchemaBuilder { /** * Shortcut for { @ link # createAggregate ( CqlIdentifier )
* CreateAggregateStart ( CqlIdentifier . fromCql ( keyspaceName ) , CqlIdentifier . fromCql ( aggregateName ) } */
@ NonNull public static CreateAggregateStart createAggregate ( @ NonNull String aggregateName ) { } }
|
return new DefaultCreateAggregate ( CqlIdentifier . fromCql ( aggregateName ) ) ;
|
public class JGeometryConverter { /** * FIXME */
private static GeometryCollection convertCollection ( JGeometry geometry ) { } }
|
JGeometry [ ] elements = geometry . getElements ( ) ; if ( elements == null || elements . length == 0 ) { return GeometryCollection . createEmpty ( ) ; } Geometry [ ] geometries = new Geometry [ elements . length ] ; for ( int i = 0 ; i < elements . length ; i ++ ) { geometries [ i ] = convert ( elements [ i ] ) ; } return new GeometryCollection ( geometries ) ;
|
public class BaseDateTimeType { /** * Returns a human readable version of this date / time using the system local format .
* < b > Note on time zones : < / b > This method renders the value using the time zone that is contained within the value .
* For example , if this date object contains the value " 2012-01-05T12:00:00-08:00 " ,
* the human display will be rendered as " 12:00:00 " even if the application is being executed on a system in a
* different time zone . If this behaviour is not what you want , use
* { @ link # toHumanDisplayLocalTimezone ( ) } instead . */
public String toHumanDisplay ( ) { } }
|
TimeZone tz = getTimeZone ( ) ; Calendar value = tz != null ? Calendar . getInstance ( tz ) : Calendar . getInstance ( ) ; value . setTime ( getValue ( ) ) ; switch ( getPrecision ( ) ) { case YEAR : case MONTH : case DAY : return ourHumanDateFormat . format ( value ) ; case MILLI : case SECOND : default : return ourHumanDateTimeFormat . format ( value ) ; }
|
public class JCollapsiblePane { /** * Sets the content pane of this JCollapsiblePane . Components must be added
* to this content pane , not to the JCollapsiblePane .
* @ param contentPanel
* @ throws IllegalArgumentException if contentPanel is null */
public void setContentPane ( Container contentPanel ) { } }
|
if ( contentPanel == null ) { throw new IllegalArgumentException ( "Content pane can't be null" ) ; } if ( wrapper != null ) { super . remove ( wrapper ) ; } wrapper = new WrapperContainer ( contentPanel ) ; super . addImpl ( wrapper , BorderLayout . CENTER , - 1 ) ;
|
public class BreadCrumbView { /** * { @ inheritDoc } */
@ Override public void layoutParts ( ) { } }
|
HBox . setHgrow ( breadCrumbBar , Priority . ALWAYS ) ; // align undo / redo buttons on the right if there are no breadcrumbs
if ( model . isOneCategoryLayout ( ) ) { setAlignment ( Pos . CENTER_RIGHT ) ; }
|
public class JFeatureSpec { /** * Java wrapper for { @ link FeatureSpec # extractWithSettings ( String , FeatureBuilder , ClassTag ) . */
public JRecordExtractor < T , Example > extractWithSettingsExample ( String settings ) { } }
|
return new JRecordExtractor < > ( JavaOps . extractWithSettingsExample ( self , settings ) ) ;
|
public class DefaultXWikiGeneratorListener { /** * { @ inheritDoc }
* Called when WikiModel finds an reference ( link or image ) such as a URI located directly in the text
* ( free - standing URI ) , as opposed to a link / image inside wiki link / image syntax delimiters .
* @ see org . xwiki . rendering . wikimodel . IWemListener # onLineBreak ( ) */
@ Override public void onReference ( String reference ) { } }
|
onReference ( reference , null , true , Listener . EMPTY_PARAMETERS ) ;
|
public class ApproximateHistogram { /** * Constructs an ApproximateHistogram object from the given dense byte - buffer representation
* @ param buf ByteBuffer to construct an ApproximateHistogram from
* @ return ApproximateHistogram constructed from the given ByteBuffer */
public static ApproximateHistogram fromBytesDense ( ByteBuffer buf ) { } }
|
int size = buf . getInt ( ) ; int binCount = buf . getInt ( ) ; float [ ] positions = new float [ size ] ; long [ ] bins = new long [ size ] ; buf . asFloatBuffer ( ) . get ( positions ) ; buf . position ( buf . position ( ) + Float . BYTES * positions . length ) ; buf . asLongBuffer ( ) . get ( bins ) ; buf . position ( buf . position ( ) + Long . BYTES * bins . length ) ; float min = buf . getFloat ( ) ; float max = buf . getFloat ( ) ; return new ApproximateHistogram ( binCount , positions , bins , min , max ) ;
|
public class GUIUtil { /** * Setup logging of uncaught exceptions .
* @ param logger logger */
public static void logUncaughtExceptions ( Logging logger ) { } }
|
try { Thread . setDefaultUncaughtExceptionHandler ( ( t , e ) -> logger . exception ( e ) ) ; } catch ( SecurityException e ) { logger . warning ( "Could not set the Default Uncaught Exception Handler" , e ) ; }
|
public class FXMLUtils { /** * Load a FXML component .
* The fxml path could be :
* < ul >
* < li > Relative : fxml file will be loaded with the classloader of the given model class < / li >
* < li > Absolute : fxml file will be loaded with default thread class loader , packages must be separated by / character < / li >
* < / ul >
* @ param model the model that will manage the fxml node
* @ param fxmlPath the fxml string path
* @ param bundlePath the bundle string path
* @ return a FXMLComponent object that wrap a fxml node with its controller
* @ param < M > the model type that will manage this fxml node */
@ SuppressWarnings ( "unchecked" ) public static < M extends Model > FXMLComponentBase loadFXML ( final M model , final String fxmlPath , final String bundlePath ) { } }
|
final FXMLLoader fxmlLoader = new FXMLLoader ( ) ; final Callback < Class < ? > , Object > fxmlControllerFactory = ( Callback < Class < ? > , Object > ) ParameterUtility . buildCustomizableClass ( ExtensionParameters . FXML_CONTROLLER_FACTORY , DefaultFXMLControllerFactory . class , FXMLControllerFactory . class ) ; if ( fxmlControllerFactory instanceof FXMLControllerFactory ) { ( ( FXMLControllerFactory ) fxmlControllerFactory ) . relatedModel ( model ) ; } // Use Custom controller factory to attach the root model to the controller
fxmlLoader . setControllerFactory ( fxmlControllerFactory ) ; fxmlLoader . setLocation ( convertFxmlUrl ( model , fxmlPath ) ) ; try { if ( bundlePath != null ) { fxmlLoader . setResources ( ResourceBundle . getBundle ( bundlePath ) ) ; } } catch ( final MissingResourceException e ) { LOGGER . log ( MISSING_RESOURCE_BUNDLE , e , bundlePath ) ; } Node node = null ; boolean error = false ; try { error = fxmlLoader . getLocation ( ) == null ; if ( error ) { node = TextBuilder . create ( ) . text ( FXML_ERROR_NODE_LABEL . getText ( fxmlPath ) ) . build ( ) ; } else { node = ( Node ) fxmlLoader . load ( fxmlLoader . getLocation ( ) . openStream ( ) ) ; } } catch ( final IOException e ) { throw new CoreRuntimeException ( FXML_NODE_DOESNT_EXIST . getText ( fxmlPath ) , e ) ; } final FXMLController < M , ? > fxmlController = ( FXMLController < M , ? > ) fxmlLoader . getController ( ) ; // It ' s tolerated to have a null controller for an fxml node
if ( fxmlController != null ) { // The fxml controller must extends AbstractFXMLController
if ( ! error && ! ( fxmlLoader . getController ( ) instanceof AbstractFXMLController ) ) { throw new CoreRuntimeException ( BAD_FXML_CONTROLLER_ANCESTOR . getText ( fxmlLoader . getController ( ) . getClass ( ) . getCanonicalName ( ) ) ) ; } // Link the View component with the fxml controller
fxmlController . model ( model ) ; } return new FXMLComponentBase ( node , fxmlController ) ;
|
public class BeanManager { /** * Start discovering nearby Beans . If a discovery is in progress , it will be canceled . A
* discovery will run for a limited time after which
* { @ link BeanDiscoveryListener # onDiscoveryComplete ( ) } will be called .
* @ param listener the listener for reporting progress
* @ return false if the Bluetooth stack was unable to start the scan . */
public boolean startDiscovery ( BeanDiscoveryListener listener ) { } }
|
if ( mScanning ) { Log . e ( TAG , "Already discovering" ) ; return true ; } mListener = listener ; return scan ( ) ;
|
public class FragmentManager { /** * This method sets the builder for this thread of execution .
* @ param builder The fragment builder */
public void setFragmentBuilder ( FragmentBuilder builder ) { } }
|
FragmentBuilder currentBuilder = builders . get ( ) ; if ( currentBuilder == null && builder != null ) { int currentCount = threadCounter . incrementAndGet ( ) ; int builderCount = builder . incrementThreadCount ( ) ; if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "Associate Thread with FragmentBuilder(2): Total Thread Count = " + currentCount + " : Fragment Thread Count = " + builderCount ) ; synchronized ( threadNames ) { threadNames . add ( Thread . currentThread ( ) . getName ( ) ) ; } } } else if ( currentBuilder != null && builder == null ) { int currentCount = threadCounter . decrementAndGet ( ) ; if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "Disassociate Thread from FragmentBuilder(2): Total Thread Count = " + currentCount ) ; synchronized ( threadNames ) { threadNames . remove ( Thread . currentThread ( ) . getName ( ) ) ; } } } else if ( currentBuilder != builder ) { int oldCount = currentBuilder . decrementThreadCount ( ) ; int newCount = builder . incrementThreadCount ( ) ; if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "WARNING: Overwriting thread's fragment builder: old=[" + currentBuilder + " count=" + oldCount + "] now=[" + builder + " count=" + newCount + "]" ) ; } } builders . set ( builder ) ;
|
public class BasicSupport { /** * exist or variable is not in server . env */
private String getWlpOutputDir ( ) throws IOException { } }
|
Properties envvars = new Properties ( ) ; File serverEnvFile = new File ( installDirectory , "etc/server.env" ) ; if ( serverEnvFile . exists ( ) ) { envvars . load ( new FileInputStream ( serverEnvFile ) ) ; } serverEnvFile = new File ( configDirectory , "server.env" ) ; if ( configDirectory != null && serverEnvFile . exists ( ) ) { envvars . load ( new FileInputStream ( serverEnvFile ) ) ; } else if ( serverEnv . exists ( ) ) { envvars . load ( new FileInputStream ( serverEnv ) ) ; } return ( String ) envvars . get ( "WLP_OUTPUT_DIR" ) ;
|
public class HtmlEscape { /** * Perform an HTML5 level 1 ( XML - style ) < strong > escape < / strong > operation on a < tt > String < / tt > input .
* < em > Level 1 < / em > means this method will only escape the five markup - significant characters :
* < tt > & lt ; < / tt > , < tt > & gt ; < / tt > , < tt > & amp ; < / tt > , < tt > & quot ; < / tt > and < tt > & # 39 ; < / tt > . It is called
* < em > XML - style < / em > in order to link it with JSP ' s < tt > escapeXml < / tt > attribute in JSTL ' s
* < tt > & lt ; c : out . . . / & gt ; < / tt > tags .
* Note this method may < strong > not < / strong > produce the same results as { @ link # escapeHtml4Xml ( String ) } because
* it will escape the apostrophe as < tt > & amp ; apos ; < / tt > , whereas in HTML 4 such NCR does not exist
* ( the decimal numeric reference < tt > & amp ; # 39 ; < / tt > is used instead ) .
* This method calls { @ link # escapeHtml ( String , HtmlEscapeType , HtmlEscapeLevel ) } with the following
* preconfigured values :
* < ul >
* < li > < tt > type < / tt > :
* { @ link org . unbescape . html . HtmlEscapeType # HTML5 _ NAMED _ REFERENCES _ DEFAULT _ TO _ DECIMAL } < / li >
* < li > < tt > level < / tt > :
* { @ link org . unbescape . html . HtmlEscapeLevel # LEVEL _ 1 _ ONLY _ MARKUP _ SIGNIFICANT } < / li >
* < / ul >
* This method is < strong > thread - safe < / strong > .
* @ param text the < tt > String < / tt > to be escaped .
* @ return The escaped result < tt > String < / tt > . As a memory - performance improvement , will return the exact
* same object as the < tt > text < / tt > input argument if no escaping modifications were required ( and
* no additional < tt > String < / tt > objects will be created during processing ) . Will
* return < tt > null < / tt > if input is < tt > null < / tt > . */
public static String escapeHtml5Xml ( final String text ) { } }
|
return escapeHtml ( text , HtmlEscapeType . HTML5_NAMED_REFERENCES_DEFAULT_TO_DECIMAL , HtmlEscapeLevel . LEVEL_1_ONLY_MARKUP_SIGNIFICANT ) ;
|
public class EpisodicUtil { /** * Unmarshalls the input stream into an object from org . yestech . episodic . objectmodel .
* @ param response the response
* @ return The unmarshalled object .
* @ throws javax . xml . bind . JAXBException Thrown if there are issues with the xml stream passed in . */
public static Object unmarshall ( HttpResponse response ) throws JAXBException , IOException { } }
|
String xml = EntityUtils . toString ( response . getEntity ( ) ) ; Unmarshaller unmarshaller = ctx . createUnmarshaller ( ) ; return unmarshaller . unmarshal ( new StringReader ( xml ) ) ;
|
public class CmsJlanDiskInterface { /** * Helper method to get a network file object given a path . < p >
* @ param cms the CMS context wrapper
* @ param session the current session
* @ param connection the current connection
* @ param path the file path
* @ return the network file object for the given path
* @ throws CmsException if something goes wrong */
protected CmsJlanNetworkFile getFileForPath ( CmsObjectWrapper cms , SrvSession session , TreeConnection connection , String path ) throws CmsException { } }
|
try { String cmsPath = getCmsPath ( path ) ; CmsResource resource = cms . readResource ( cmsPath , STANDARD_FILTER ) ; CmsJlanNetworkFile result = new CmsJlanNetworkFile ( cms , resource , path ) ; return result ; } catch ( CmsVfsResourceNotFoundException e ) { return null ; }
|
public class AsyncCaseInstanceAuditEventReceiver { /** * Helper methods */
protected void updateCaseFileItems ( AuditCaseInstanceData auditCaseInstanceData , EntityManager em ) { } }
|
if ( auditCaseInstanceData . getCaseFileData ( ) == null || auditCaseInstanceData . getCaseFileData ( ) . isEmpty ( ) ) { return ; } List < String > currentCaseData = currentCaseData ( auditCaseInstanceData . getCaseId ( ) , em ) ; auditCaseInstanceData . getCaseFileData ( ) . forEach ( ( item ) -> { CaseFileDataLog caseFileDataLog = null ; if ( currentCaseData . contains ( item . getItemName ( ) ) ) { logger . debug ( "Case instance {} has already stored log value for {} thus it's going to be updated" , auditCaseInstanceData . getCaseId ( ) , item . getItemName ( ) ) ; caseFileDataLog = caseFileDataByName ( auditCaseInstanceData . getCaseId ( ) , item . getItemName ( ) , em ) ; caseFileDataLog . setItemType ( item . getItemType ( ) ) ; caseFileDataLog . setItemValue ( item . getItemValue ( ) ) ; caseFileDataLog . setLastModified ( item . getLastModified ( ) ) ; caseFileDataLog . setLastModifiedBy ( item . getLastModifiedBy ( ) ) ; em . merge ( caseFileDataLog ) ; } else { logger . debug ( "Case instance {} has no log value for {} thus it's going to be inserted" , auditCaseInstanceData . getCaseId ( ) , item . getItemName ( ) ) ; em . persist ( item ) ; }
|
public class Document { /** * Sets c4doc and updates my root dictionary */
private void setC4Document ( C4Document c4doc ) { } }
|
synchronized ( lock ) { replaceC4Document ( c4doc ) ; data = null ; if ( c4doc != null && ! c4doc . deleted ( ) ) { data = c4doc . getSelectedBody2 ( ) ; } updateDictionary ( ) ; }
|
public class DiscordApiImpl { /** * Purges all cached entities .
* This method is only meant to be called after receiving a READY packet . */
public void purgeCache ( ) { } }
|
synchronized ( users ) { users . values ( ) . stream ( ) . map ( Reference :: get ) . filter ( Objects :: nonNull ) . map ( Cleanupable . class :: cast ) . forEach ( Cleanupable :: cleanup ) ; users . clear ( ) ; } userIdByRef . clear ( ) ; servers . values ( ) . stream ( ) . map ( Cleanupable . class :: cast ) . forEach ( Cleanupable :: cleanup ) ; servers . clear ( ) ; channels . values ( ) . stream ( ) . filter ( Cleanupable . class :: isInstance ) . map ( Cleanupable . class :: cast ) . forEach ( Cleanupable :: cleanup ) ; channels . clear ( ) ; unavailableServers . clear ( ) ; customEmojis . clear ( ) ; messages . clear ( ) ; messageIdByRef . clear ( ) ; timeOffset = null ;
|
public class SourceStreamManager { /** * Put a message back into the appropriate source stream . This will create a stream
* if one does not exist but will not change any fields in the message
* @ param msgItem The message to be restored
* @ param commit Boolean indicating whether message to be restored is in commit state */
public void restoreMessage ( SIMPMessage msgItem , boolean commit ) throws SIResourceException { } }
|
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "restoreMessage" , new Object [ ] { msgItem } ) ; int priority = msgItem . getPriority ( ) ; Reliability reliability = msgItem . getReliability ( ) ; SIBUuid12 streamID = msgItem . getGuaranteedStreamUuid ( ) ; StreamSet streamSet = getStreamSet ( streamID ) ; SourceStream sourceStream = null ; synchronized ( streamSet ) { sourceStream = ( SourceStream ) streamSet . getStream ( priority , reliability ) ; if ( sourceStream == null && reliability . compareTo ( Reliability . BEST_EFFORT_NONPERSISTENT ) > 0 ) { sourceStream = createStream ( streamSet , priority , reliability , streamSet . getPersistentData ( priority , reliability ) , true ) ; } } // NOTE : sourceStream should only be null for express qos
if ( sourceStream != null ) { if ( ! commit ) sourceStream . restoreUncommitted ( msgItem ) ; else sourceStream . restoreValue ( msgItem ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "restoreMessage" ) ;
|
public class FactoryImageBorder { /** * Given an image type return the appropriate { @ link ImageBorder } class type .
* @ param imageType Type of image which is being processed .
* @ return The ImageBorder for processing the image type . */
public static Class < ImageBorder > lookupBorderClassType ( Class < ImageGray > imageType ) { } }
|
if ( ( Class ) imageType == GrayF32 . class ) return ( Class ) ImageBorder1D_F32 . class ; if ( ( Class ) imageType == GrayF64 . class ) return ( Class ) ImageBorder1D_F64 . class ; else if ( GrayI . class . isAssignableFrom ( imageType ) ) return ( Class ) ImageBorder1D_S32 . class ; else if ( ( Class ) imageType == GrayS64 . class ) return ( Class ) ImageBorder1D_S64 . class ; else throw new IllegalArgumentException ( "Unknown image type" ) ;
|
public class CrossPlatformCommand { /** * Main method that should be executed . This will return the proper result depending on your platform .
* @ return the result */
public T execute ( ) { } }
|
if ( isWindows ( ) ) { return onWindows ( ) ; } else if ( isMac ( ) ) { return onMac ( ) ; } else if ( isUnix ( ) ) { return onUnix ( ) ; } else if ( isSolaris ( ) ) { return onSolaris ( ) ; } else { throw new IllegalStateException ( "Invalid operating system " + os ) ; }
|
public class GetProductsResult { /** * The list of products that match your filters . The list contains both the product metadata and the price
* information .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setPriceList ( java . util . Collection ) } or { @ link # withPriceList ( java . util . Collection ) } if you want to
* override the existing values .
* @ param priceList
* The list of products that match your filters . The list contains both the product metadata and the price
* information .
* @ return Returns a reference to this object so that method calls can be chained together . */
public GetProductsResult withPriceList ( String ... priceList ) { } }
|
if ( this . priceList == null ) { setPriceList ( new java . util . ArrayList < String > ( priceList . length ) ) ; } for ( String ele : priceList ) { this . priceList . add ( ele ) ; } return this ;
|
public class DBConn { /** * Attempt to connect to the given Cassandra host name or IP address . If a connection
* cannot be made , a { @ link DBNotAvailableException } is thrown that wraps the
* Cassandra exception . If a connection is made and a keyspace was configured , the
* session is set to the configured keyspace . However , if the keyspace cannot be used ,
* a RuntimeException is thrown .
* @ param dbhost Name or address of Cassandra host to connect to .
* @ throws DBNotAvailableException If the given host is not reachable .
* @ throws RuntimeException If a keyspace was configured but cannot be used . */
public void connect ( String dbhost ) throws DBNotAvailableException , RuntimeException { } }
|
assert ! m_bDBOpen ; int bufferSize = m_thrift_buffer_size_mb * 1024 * 1024 ; // Attempt to open the requested dbhost .
try { TSocket socket = null ; if ( m_dbtls ) { m_logger . debug ( "Connecting to Cassandra node {}:{} using TLS" , dbhost , m_dbport ) ; socket = createTLSSocket ( dbhost ) ; } else { m_logger . debug ( "Connecting to Cassandra node {}:{}" , dbhost , m_dbport ) ; socket = new TSocket ( dbhost , m_dbport , m_db_timeout_millis ) ; socket . open ( ) ; } TTransport transport = new TFramedTransport ( socket , bufferSize ) ; TProtocol protocol = new TBinaryProtocol ( transport ) ; m_client = new Cassandra . Client ( protocol ) ; } catch ( Exception e ) { throw new DBNotAvailableException ( e ) ; } // Set keyspace if requested .
if ( m_keyspace != null ) { try { m_client . set_keyspace ( m_keyspace ) ; } catch ( Exception e ) { // This can ' t be retried , so we throw a RuntimeException
m_logger . error ( "Cannot use Keyspace '" + m_keyspace + "'" , e ) ; throw new RuntimeException ( e ) ; } } // Set credentials if requested .
if ( ! Utils . isEmpty ( m_dbuser ) ) { try { Map < String , String > credentials = new HashMap < > ( ) ; credentials . put ( "username" , m_dbuser ) ; credentials . put ( "password" , m_dbpassword ) ; AuthenticationRequest auth_request = new AuthenticationRequest ( credentials ) ; m_client . login ( auth_request ) ; } catch ( Exception e ) { // This can ' t be retried , so we throw a RuntimeException
m_logger . error ( "Could not authenticate with dbuser '" + m_dbuser + "'" , e ) ; throw new RuntimeException ( e ) ; } } m_bDBOpen = true ; m_bFailed = false ;
|
public class PortletDefinitionRegistryImpl { /** * Get the portletApplicationId and portletName for the specified channel definition id . The
* portletApplicationId will be { @ link Tuple # first } and the portletName will be { @ link
* Tuple # second } */
@ Override public Tuple < String , String > getPortletDescriptorKeys ( IPortletDefinition portletDefinition ) { } }
|
final String portletApplicationId ; if ( portletDefinition . getPortletDescriptorKey ( ) . isFrameworkPortlet ( ) ) { portletApplicationId = this . servletContext . getContextPath ( ) ; } else { portletApplicationId = portletDefinition . getPortletDescriptorKey ( ) . getWebAppName ( ) ; } final String portletName = portletDefinition . getPortletDescriptorKey ( ) . getPortletName ( ) ; return new Tuple < String , String > ( portletApplicationId , portletName ) ;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.