signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class SundialJobScheduler { /** * Triggers a Job interrupt on all Jobs matching the given Job Name . The Job termination mechanism
* works by setting a flag that the Job should be terminated , but it is up to the logic in the Job
* to decide at what point termination should occur . Therefore , in any long - running job that you
* anticipate the need to terminate , put the method call checkTerminated ( ) at an appropriate
* location .
* @ param jobName The job name */
public static void stopJob ( String jobName ) throws SundialSchedulerException { } } | try { List < JobExecutionContext > currentlyExecutingJobs = getScheduler ( ) . getCurrentlyExecutingJobs ( ) ; for ( JobExecutionContext jobExecutionContext : currentlyExecutingJobs ) { String currentlyExecutingJobName = jobExecutionContext . getJobDetail ( ) . getName ( ) ; if ( currentlyExecutingJobName . equals ( jobName ) ) { logger . debug ( "Matching Job found. Now Stopping!" ) ; if ( jobExecutionContext . getJobInstance ( ) instanceof Job ) { ( ( Job ) jobExecutionContext . getJobInstance ( ) ) . interrupt ( ) ; } else { logger . warn ( "CANNOT STOP NON-INTERRUPTABLE JOB!!!" ) ; } } else { logger . debug ( "Non-matching Job found. Not Stopping!" ) ; } } } catch ( SchedulerException e ) { throw new SundialSchedulerException ( "ERROR STOPPING JOB!!!" , e ) ; } |
public class PublicIPAddressesInner { /** * Gets information about all public IP addresses in a virtual machine IP configuration in a virtual machine scale set .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the PagedList & lt ; PublicIPAddressInner & gt ; object if successful . */
public PagedList < PublicIPAddressInner > listVirtualMachineScaleSetVMPublicIPAddressesNext ( final String nextPageLink ) { } } | ServiceResponse < Page < PublicIPAddressInner > > response = listVirtualMachineScaleSetVMPublicIPAddressesNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) ; return new PagedList < PublicIPAddressInner > ( response . body ( ) ) { @ Override public Page < PublicIPAddressInner > nextPage ( String nextPageLink ) { return listVirtualMachineScaleSetVMPublicIPAddressesNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) . body ( ) ; } } ; |
public class SocketChannelWrapperBar { /** * Closes the write half of the stream . */
@ Override public void closeWrite ( ) throws IOException { } } | if ( _isWriteClosed ) { return ; } _isWriteClosed = true ; StreamImpl stream = _streamImpl ; if ( stream != null ) { stream . closeWrite ( ) ; } else if ( _sslSocket != null ) { _sslSocket . getOutputStream ( ) . close ( ) ; } else if ( _channel != null ) { try { _channel . shutdownOutput ( ) ; } catch ( UnsupportedOperationException e ) { log . log ( Level . FINEST , e . toString ( ) , e ) ; } catch ( Exception e ) { log . finer ( e . toString ( ) ) ; log . log ( Level . FINEST , e . toString ( ) , e ) ; } } |
public class RolloutSpecification { /** * { @ link Specification } for retrieving { @ link Rollout } s by its DELETED
* attribute . Includes fetch for stuff that is required for { @ link Rollout }
* queries .
* @ param isDeleted
* TRUE / FALSE are compared to the attribute DELETED . If NULL the
* attribute is ignored
* @ return the { @ link Rollout } { @ link Specification } */
public static Specification < JpaRollout > isDeletedWithDistributionSet ( final Boolean isDeleted ) { } } | return ( root , query , cb ) -> { final Predicate predicate = cb . equal ( root . < Boolean > get ( JpaRollout_ . deleted ) , isDeleted ) ; root . fetch ( JpaRollout_ . distributionSet ) ; return predicate ; } ; |
public class AdaptedAction { /** * ( non - Javadoc )
* @ see com . sporniket . libre . ui . action . UserInterfaceAction # setLabelDescription ( java . lang . String ) */
@ Override public void setLabelDescription ( String labelDescription ) { } } | myUserInterfaceAction . setLabelDescription ( labelDescription ) ; putValue ( Action . SHORT_DESCRIPTION , myMessageProvider . getMessage ( getLabelDescription ( ) , getLocale ( ) ) ) ; |
public class ReconciliationLineItemReport { /** * Sets the grossRate value for this ReconciliationLineItemReport .
* @ param grossRate * If this reconciliation data is for a { @ link ProposalLineItem }
* and the { @ link # pricingModel }
* is { @ link PricingModel # GROSS } , then this contains
* the { @ link Money gross rate } of
* the proposal line item . Otherwise , the value of this
* field will be the same as
* the { @ link # netRate } .
* This value is read - only . */
public void setGrossRate ( com . google . api . ads . admanager . axis . v201811 . Money grossRate ) { } } | this . grossRate = grossRate ; |
public class LayerImpl { /** * Generates a cache key for the layer .
* @ param request
* the request object
* @ param cacheKeyGenerators
* map of cache key generator class names to instance objects
* @ return the cache key
* @ throws IOException */
protected String generateCacheKey ( HttpServletRequest request , Map < String , ICacheKeyGenerator > cacheKeyGenerators ) throws IOException { } } | String cacheKey = null ; if ( cacheKeyGenerators != null ) { // First , decompose any composite cache key generators into their
// constituent cache key generators so that we can combine them
// more effectively . Use TreeMap to get predictable ordering of
// keys .
Map < String , ICacheKeyGenerator > gens = new TreeMap < String , ICacheKeyGenerator > ( ) ; for ( ICacheKeyGenerator gen : cacheKeyGenerators . values ( ) ) { List < ICacheKeyGenerator > constituentGens = gen . getCacheKeyGenerators ( request ) ; addCacheKeyGenerators ( gens , constituentGens == null ? Arrays . asList ( new ICacheKeyGenerator [ ] { gen } ) : constituentGens ) ; } cacheKey = KeyGenUtil . generateKey ( request , gens . values ( ) ) ; } return cacheKey ; |
public class InterpretedEntryImpl { /** * { @ inheritDoc } */
@ Override public String getPath ( ) { } } | if ( structureHelperLocalRootDelegate != null ) { String originalNodePath = super . getPath ( ) ; return originalNodePath . substring ( structureHelperLocalRootDelegate . getPath ( ) . length ( ) ) ; } else { return super . getPath ( ) ; } |
public class MavenUtils { /** * Utility method for creating an artifact version resolver that will get the version out of
* maven project .
* @ return version resolver */
public static MavenArtifactUrlReference . VersionResolver asInProject ( ) { } } | return new MavenArtifactUrlReference . VersionResolver ( ) { @ Override public String getVersion ( final String groupId , final String artifactId ) { return getArtifactVersion ( groupId , artifactId ) ; } } ; |
public class CodeableConcept { /** * syntactic sugar */
public Coding addCoding ( ) { } } | Coding t = new Coding ( ) ; if ( this . coding == null ) this . coding = new ArrayList < Coding > ( ) ; this . coding . add ( t ) ; return t ; |
public class AbstractCSLToolCommand { /** * Outputs an error message
* @ param msg the message */
protected void error ( String msg ) { } } | System . err . println ( CSLToolContext . current ( ) . getToolName ( ) + ": " + msg ) ; |
public class BusinessProcess { /** * Returns the { @ link ProcessInstance } currently associated or ' null '
* @ throws ProcessEngineCdiException
* if no { @ link Execution } is associated . Use
* { @ link # isAssociated ( ) } to check whether an association exists . */
public ProcessInstance getProcessInstance ( ) { } } | Execution execution = getExecution ( ) ; if ( execution != null && ! ( execution . getProcessInstanceId ( ) . equals ( execution . getId ( ) ) ) ) { return processEngine . getRuntimeService ( ) . createProcessInstanceQuery ( ) . processInstanceId ( execution . getProcessInstanceId ( ) ) . singleResult ( ) ; } return ( ProcessInstance ) execution ; |
public class EvaluationResultMarshaller { /** * Marshall the given parameter object . */
public void marshall ( EvaluationResult evaluationResult , ProtocolMarshaller protocolMarshaller ) { } } | if ( evaluationResult == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( evaluationResult . getComplianceStatus ( ) , COMPLIANCESTATUS_BINDING ) ; protocolMarshaller . marshall ( evaluationResult . getViolatorCount ( ) , VIOLATORCOUNT_BINDING ) ; protocolMarshaller . marshall ( evaluationResult . getEvaluationLimitExceeded ( ) , EVALUATIONLIMITEXCEEDED_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class PojoDescriptorBuilderImpl { /** * Makes all { @ link AccessibleObject } s in the given { @ link List } { @ link AccessibleObject # setAccessible ( boolean )
* accessible } .
* @ param nonPublicAccessibleObjects is the { @ link List } where the non - public { @ link AccessibleObject } s have been
* collected . */
private void makeAccessible ( List < AccessibleObject > nonPublicAccessibleObjects ) { } } | if ( nonPublicAccessibleObjects . size ( ) > 0 ) { final AccessibleObject [ ] nonPublicAccessibles = new AccessibleObject [ nonPublicAccessibleObjects . size ( ) ] ; nonPublicAccessibleObjects . toArray ( nonPublicAccessibles ) ; // enable reflective access that violates visibility - this will
// fail if disallowed by security - manager .
AccessController . doPrivileged ( new PrivilegedAction < Object > ( ) { @ Override public Object run ( ) { AccessibleObject . setAccessible ( nonPublicAccessibles , true ) ; return null ; } } ) ; } |
public class InputStreamConfigurationProducer { /** * Returns an input stream , the first one found , for a given { @ link Configuration }
* @ param injectionPoint
* @ return */
@ Produces @ Configuration public InputStream getInputStream ( InjectionPoint injectionPoint ) { } } | // get configuration instance
ConfigurationWrapper wrapper = this . getConfigurationWrapper ( injectionPoint ) ; // get input streams
List < ISource > sources = this . locate ( wrapper ) ; // return first available source
for ( ISource source : sources ) { if ( source . available ( ) ) { return source . stream ( ) ; } } // otherwise just return the first stream
return sources . get ( 0 ) . stream ( ) ; |
public class ForeignHost { /** * Deliver a deserialized message from the network to a local mailbox */
private void deliverMessage ( long destinationHSId , VoltMessage message ) { } } | if ( ! m_hostMessenger . validateForeignHostId ( m_hostId ) ) { hostLog . warn ( String . format ( "Message (%s) sent to site id: %s @ (%s) at %d from %s " + "which is a known failed host. The message will be dropped\n" , message . getClass ( ) . getSimpleName ( ) , CoreUtils . hsIdToString ( destinationHSId ) , m_socket . getRemoteSocketAddress ( ) . toString ( ) , m_hostMessenger . getHostId ( ) , CoreUtils . hsIdToString ( message . m_sourceHSId ) ) ) ; return ; } Mailbox mailbox = m_hostMessenger . getMailbox ( destinationHSId ) ; /* * At this point we are OK with messages going to sites that don ' t exist
* because we are saying that things can come and go */
if ( mailbox == null ) { hostLog . info ( String . format ( "Message (%s) sent to unknown site id: %s @ (%s) at %d from %s \n" , message . getClass ( ) . getSimpleName ( ) , CoreUtils . hsIdToString ( destinationHSId ) , m_socket . getRemoteSocketAddress ( ) . toString ( ) , m_hostMessenger . getHostId ( ) , CoreUtils . hsIdToString ( message . m_sourceHSId ) ) ) ; /* * If it is for the wrong host , that definitely isn ' t cool */
if ( m_hostMessenger . getHostId ( ) != ( int ) destinationHSId ) { VoltDB . crashLocalVoltDB ( "Received a message at wrong host" , false , null ) ; } return ; } // deliver the message to the mailbox
mailbox . deliver ( message ) ; |
public class ExternalContextUtils { /** * Returns the request input stream if one is available
* @ param ec the current external context
* @ return the request ' s input stream
* @ throws IOException if there was a problem getting the input stream */
public static InputStream getRequestInputStream ( ExternalContext ec ) throws IOException { } } | RequestType type = getRequestType ( ec ) ; if ( type . isRequestFromClient ( ) ) { Object req = ec . getRequest ( ) ; if ( type . isPortlet ( ) ) { return ( InputStream ) _runMethod ( req , "getPortletInputStream" ) ; } else { return ( ( ServletRequest ) ec . getRequest ( ) ) . getInputStream ( ) ; } } return null ; |
public class UnixResolverDnsServerAddressStreamProvider { /** * Parse a file of the format < a href = " https : / / linux . die . net / man / 5 / resolver " > / etc / resolv . conf < / a > and return the
* list of search domains found in it or an empty list if not found .
* @ param etcResolvConf a file of the format < a href = " https : / / linux . die . net / man / 5 / resolver " > / etc / resolv . conf < / a > .
* @ return List of search domains .
* @ throws IOException If a failure occurs parsing the file . */
static List < String > parseEtcResolverSearchDomains ( File etcResolvConf ) throws IOException { } } | String localDomain = null ; List < String > searchDomains = new ArrayList < String > ( ) ; FileReader fr = new FileReader ( etcResolvConf ) ; BufferedReader br = null ; try { br = new BufferedReader ( fr ) ; String line ; while ( ( line = br . readLine ( ) ) != null ) { if ( localDomain == null && line . startsWith ( DOMAIN_ROW_LABEL ) ) { int i = indexOfNonWhiteSpace ( line , DOMAIN_ROW_LABEL . length ( ) ) ; if ( i >= 0 ) { localDomain = line . substring ( i ) ; } } else if ( line . startsWith ( SEARCH_ROW_LABEL ) ) { int i = indexOfNonWhiteSpace ( line , SEARCH_ROW_LABEL . length ( ) ) ; if ( i >= 0 ) { // May contain more then one entry , either seperated by whitespace or tab .
// See https : / / linux . die . net / man / 5 / resolver
String [ ] domains = SEARCH_DOMAIN_PATTERN . split ( line . substring ( i ) ) ; Collections . addAll ( searchDomains , domains ) ; } } } } finally { if ( br == null ) { fr . close ( ) ; } else { br . close ( ) ; } } // return what was on the ' domain ' line only if there were no ' search ' lines
return localDomain != null && searchDomains . isEmpty ( ) ? Collections . singletonList ( localDomain ) : searchDomains ; |
public class LogAnalyticsInner { /** * Export logs that show Api requests made by this subscription in the given time window to show throttling activities .
* @ param location The location upon which virtual - machine - sizes is queried .
* @ param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api .
* @ 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 < LogAnalyticsOperationResultInner > beginExportRequestRateByIntervalAsync ( String location , RequestRateByIntervalInput parameters , final ServiceCallback < LogAnalyticsOperationResultInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( beginExportRequestRateByIntervalWithServiceResponseAsync ( location , parameters ) , serviceCallback ) ; |
public class ReflectingConverter { /** * / * ( non - Javadoc )
* @ see com . google . code . siren4j . converter . ResourceConverter # toEntity ( java . lang . Object ) */
public Entity toEntity ( Object obj ) { } } | try { return toEntity ( obj , null , null , null ) ; } catch ( Siren4JException e ) { throw new Siren4JConversionException ( e ) ; } |
public class Criteria { /** * Creates new { @ link Predicate } for { @ code ! circle } for a specified distance . The difference between this and
* { @ link # within ( Circle ) } is this is approximate while { @ code within } is exact .
* @ param circle
* @ return
* @ since 1.2 */
public Criteria near ( Circle circle ) { } } | Assert . notNull ( circle , "Circle for 'near' must not be 'null'." ) ; return near ( circle . getCenter ( ) , circle . getRadius ( ) ) ; |
public class SARLJvmModelInferrer { /** * Create an annotation with classes as values .
* @ param type the type of the annotation .
* @ param values the values .
* @ return the reference to the JVM annotation . */
private JvmAnnotationReference annotationClassRef ( Class < ? extends Annotation > type , List < ? extends JvmTypeReference > values ) { } } | try { final JvmAnnotationReference annot = this . _annotationTypesBuilder . annotationRef ( type ) ; final JvmTypeAnnotationValue annotationValue = this . services . getTypesFactory ( ) . createJvmTypeAnnotationValue ( ) ; for ( final JvmTypeReference value : values ) { annotationValue . getValues ( ) . add ( this . typeBuilder . cloneWithProxies ( value ) ) ; } annot . getExplicitValues ( ) . add ( annotationValue ) ; return annot ; } catch ( IllegalArgumentException exception ) { // ignore
} return null ; |
public class AbstractJcrNode { /** * Sets a multi valued property , skipping over protected ones .
* @ param name the name of the property ; may not be null
* @ param values the values of the property ; may not be null
* @ param jcrPropertyType the expected property type ; may be { @ link PropertyType # UNDEFINED } if the values should not be
* converted
* @ param skipReferenceValidation indicates whether constraints on REFERENCE properties should be enforced
* @ return the new JCR property object
* @ throws VersionException if the node is checked out
* @ throws LockException if the node is locked
* @ throws ConstraintViolationException if the new value would violate the constraints on the property definition
* @ throws RepositoryException if the named property does not exist , or if some other error occurred */
final AbstractJcrProperty setProperty ( Name name , Value [ ] values , int jcrPropertyType , boolean skipReferenceValidation ) throws VersionException , LockException , ConstraintViolationException , RepositoryException { } } | return setProperty ( name , values , jcrPropertyType , false , skipReferenceValidation , false , false ) ; |
public class W1Master { /** * Get a list of devices that implement a certain interface .
* @ param type
* @ param < T >
* @ return */
@ SuppressWarnings ( "unchecked" ) public < T > List < T > getDevices ( final Class < T > type ) { } } | final List < W1Device > allDevices = getDevices ( ) ; final List < T > filteredDevices = new ArrayList < > ( ) ; for ( final W1Device device : allDevices ) { if ( type . isAssignableFrom ( device . getClass ( ) ) ) { filteredDevices . add ( ( T ) device ) ; } } return filteredDevices ; |
public class ApptentiveNotificationCenter { /** * Adds an entry to the receiver ’ s dispatch table with an observer .
* @ param useWeakReference - weak reference is used if < code > true < / code > */
public synchronized void addObserver ( String notification , ApptentiveNotificationObserver observer , boolean useWeakReference ) { } } | final ApptentiveNotificationObserverList list = resolveObserverList ( notification ) ; list . addObserver ( observer , useWeakReference ) ; |
public class DirectoryRestore { /** * { @ inheritDoc } */
public void restore ( ) throws BackupException { } } | try { SecurityHelper . doPrivilegedIOExceptionAction ( new PrivilegedExceptionAction < Void > ( ) { public Void run ( ) throws IOException { for ( int i = 0 ; i < zipFiles . size ( ) ; i ++ ) { File zipFile = zipFiles . get ( i ) ; File dataDir = dataDirs . get ( i ) ; if ( zipFile . isDirectory ( ) ) { DirectoryHelper . uncompressEveryFileFromDirectory ( zipFile , dataDir ) ; } else { DirectoryHelper . uncompressDirectory ( zipFile , dataDir ) ; } } return null ; } } ) ; } catch ( IOException e ) { throw new BackupException ( e ) ; } |
public class MessageMapTable { /** * Get an element from the table */
public MessageMap getMap ( BigInteger index ) { } } | if ( array != null ) return array [ index . intValue ( ) ] ; else return ( MessageMap ) hashtable . get ( index ) ; |
public class DeleteVaultRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteVaultRequest deleteVaultRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteVaultRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteVaultRequest . getAccountId ( ) , ACCOUNTID_BINDING ) ; protocolMarshaller . marshall ( deleteVaultRequest . getVaultName ( ) , VAULTNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class SafeTreeMarshallingStrategy { /** * If anything goes wrong with an element , don ' t serialize it */
@ Override protected TreeMarshaller createMarshallingContext ( HierarchicalStreamWriter writer , ConverterLookup converterLookup , Mapper mapper ) { } } | return new SafeTreeMarshaller ( writer , converterLookup , mapper , RELATIVE ) ; |
public class StringListFlattener { /** * Joins the given list into a single string . */
public String join ( List < String > list ) { } } | if ( list == null ) { return null ; } StringBuilder sb = new StringBuilder ( ) ; boolean first = true ; for ( String s : list ) { if ( s == null ) { if ( convertEmptyToNull ) { s = "" ; } else { throw new IllegalArgumentException ( "StringListFlattener does not support null strings in the list. Consider calling setConvertEmptyToNull(true)." ) ; } } if ( ! first ) { sb . append ( separator ) ; } for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char c = s . charAt ( i ) ; if ( c == escapeChar || c == separator ) { sb . append ( escapeChar ) ; } sb . append ( c ) ; } first = false ; } return sb . toString ( ) ; |
public class CommerceAccountUtil { /** * Returns the commerce account where companyId = & # 63 ; and externalReferenceCode = & # 63 ; or returns < code > null < / code > if it could not be found , optionally using the finder cache .
* @ param companyId the company ID
* @ param externalReferenceCode the external reference code
* @ param retrieveFromCache whether to retrieve from the finder cache
* @ return the matching commerce account , or < code > null < / code > if a matching commerce account could not be found */
public static CommerceAccount fetchByC_ERC ( long companyId , String externalReferenceCode , boolean retrieveFromCache ) { } } | return getPersistence ( ) . fetchByC_ERC ( companyId , externalReferenceCode , retrieveFromCache ) ; |
public class InvocationHandlerAdapter { /** * Applies an implementation that delegates to a invocation handler .
* @ param methodVisitor The method visitor for writing the byte code to .
* @ param implementationContext The implementation context for the current implementation .
* @ param instrumentedMethod The method that is instrumented .
* @ param preparingManipulation A stack manipulation that applies any preparation to the operand stack .
* @ param fieldDescription The field that contains the value for the invocation handler .
* @ return The size of the applied assignment . */
protected ByteCodeAppender . Size apply ( MethodVisitor methodVisitor , Context implementationContext , MethodDescription instrumentedMethod , StackManipulation preparingManipulation , FieldDescription fieldDescription ) { } } | if ( instrumentedMethod . isStatic ( ) ) { throw new IllegalStateException ( "It is not possible to apply an invocation handler onto the static method " + instrumentedMethod ) ; } MethodConstant . CanCache methodConstant = privileged ? MethodConstant . ofPrivileged ( instrumentedMethod . asDefined ( ) ) : MethodConstant . of ( instrumentedMethod . asDefined ( ) ) ; StackManipulation . Size stackSize = new StackManipulation . Compound ( preparingManipulation , FieldAccess . forField ( fieldDescription ) . read ( ) , MethodVariableAccess . loadThis ( ) , cached ? methodConstant . cached ( ) : methodConstant , ArrayFactory . forType ( TypeDescription . Generic . OBJECT ) . withValues ( argumentValuesOf ( instrumentedMethod ) ) , MethodInvocation . invoke ( INVOCATION_HANDLER_TYPE . getDeclaredMethods ( ) . getOnly ( ) ) , assigner . assign ( TypeDescription . Generic . OBJECT , instrumentedMethod . getReturnType ( ) , Assigner . Typing . DYNAMIC ) , MethodReturn . of ( instrumentedMethod . getReturnType ( ) ) ) . apply ( methodVisitor , implementationContext ) ; return new ByteCodeAppender . Size ( stackSize . getMaximalSize ( ) , instrumentedMethod . getStackSize ( ) ) ; |
public class ConverterUtils { /** * Gets an instance of a Workbook ( { @ link ConverterUtils # newWorkbook ( InputStream ) } , creates copy of original file ,
* clears all the cell values , but preserves formatting . */
static Workbook clearContent ( final Workbook book ) { } } | ByteArrayOutputStream originalOut = new ByteArrayOutputStream ( ) ; try { book . write ( originalOut ) ; } catch ( IOException e ) { throw new CalculationEngineException ( e ) ; } InputStream originalIn = new ByteArrayInputStream ( copyOf ( originalOut . toByteArray ( ) , originalOut . size ( ) ) ) ; Workbook w = ConverterUtils . newWorkbook ( originalIn ) ; Sheet s = w . getSheetAt ( 0 ) ; // TODO : only one sheet is supported
for ( int i = s . getFirstRowNum ( ) ; i <= s . getLastRowNum ( ) ; i ++ ) { Row r = s . getRow ( i ) ; if ( r == null ) { continue ; } for ( int j = r . getFirstCellNum ( ) ; j <= r . getLastCellNum ( ) ; j ++ ) { Cell c = r . getCell ( j ) ; if ( c == null ) { continue ; } c . setCellType ( CELL_TYPE_BLANK ) ; } } return w ; |
public class GlobusGSSCredentialImpl { /** * Retrieves arbitrary data about this credential .
* Currently supported oid : < UL >
* < LI >
* { @ link GSSConstants # X509 _ CERT _ CHAIN GSSConstants . X509 _ CERT _ CHAIN }
* returns certificate chain of this credential
* ( < code > X509Certificate [ ] < / code > ) .
* < / LI >
* < / UL >
* @ param oid the oid of the information desired .
* @ return the information desired . Might be null .
* @ exception GSSException containing the following major error codes :
* < code > GSSException . FAILURE < / code > */
public Object inquireByOid ( Oid oid ) throws GSSException { } } | if ( oid == null ) { throw new GlobusGSSException ( GSSException . FAILURE , GlobusGSSException . BAD_ARGUMENT , "nullOption" ) ; } if ( oid . equals ( GSSConstants . X509_CERT_CHAIN ) ) { return ( this . cred == null ) ? null : this . cred . getCertificateChain ( ) ; } return null ; |
public class DateTimeParseContext { /** * Stores the parsed field .
* This stores a field - value pair that has been parsed .
* The value stored may be out of range for the field - no checks are performed .
* @ param field the field to set in the field - value map , not null
* @ param value the value to set in the field - value map
* @ param errorPos the position of the field being parsed
* @ param successPos the position after the field being parsed
* @ return the new position */
int setParsedField ( TemporalField field , long value , int errorPos , int successPos ) { } } | Objects . requireNonNull ( field , "field" ) ; Long old = currentParsed ( ) . fieldValues . put ( field , value ) ; return ( old != null && old . longValue ( ) != value ) ? ~ errorPos : successPos ; |
public class ContextLifeCycle { /** * Fires ContextStart to all registered event handlers . */
void start ( ) { } } | final ContextStart contextStart = new ContextStartImpl ( this . identifier ) ; for ( final EventHandler < ContextStart > startHandler : this . contextStartHandlers ) { startHandler . onNext ( contextStart ) ; } |
public class Sequences { /** * This will materialize the entire sequence in memory . Use at your own risk . */
public static < T > Sequence < T > sort ( final Sequence < T > sequence , final Comparator < T > comparator ) { } } | List < T > seqList = sequence . toList ( ) ; Collections . sort ( seqList , comparator ) ; return simple ( seqList ) ; |
public class LocationsInner { /** * Check Name Availability .
* Checks whether the Media Service resource name is available .
* @ param locationName the String value
* @ param parameters The request 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 < EntityNameAvailabilityCheckOutputInner > checkNameAvailabilityAsync ( String locationName , CheckNameAvailabilityInput parameters , final ServiceCallback < EntityNameAvailabilityCheckOutputInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( checkNameAvailabilityWithServiceResponseAsync ( locationName , parameters ) , serviceCallback ) ; |
public class MetaDataResult { /** * Get a LocalDate field ( converted from a String internally ) . Throws a QuandlRuntimeException if it cannot find the field
* @ param fieldName the name of the field
* @ return the field value , or null if the field is null */
public LocalDate getLocalDate ( final String fieldName ) { } } | try { if ( _jsonObject . isNull ( fieldName ) ) { return null ; } else { return LocalDate . parse ( _jsonObject . getString ( fieldName ) , DATE_FORMATTER ) ; } } catch ( JSONException ex ) { throw new QuandlRuntimeException ( "Cannot find field" , ex ) ; } |
public class RtfRow { /** * Imports a Row and copies all settings
* @ param row The Row to import */
private void importRow ( Row row ) { } } | this . cells = new ArrayList ( ) ; this . width = this . document . getDocumentHeader ( ) . getPageSetting ( ) . getPageWidth ( ) - this . document . getDocumentHeader ( ) . getPageSetting ( ) . getMarginLeft ( ) - this . document . getDocumentHeader ( ) . getPageSetting ( ) . getMarginRight ( ) ; this . width = ( int ) ( this . width * this . parentTable . getTableWidthPercent ( ) / 100 ) ; int cellRight = 0 ; int cellWidth = 0 ; for ( int i = 0 ; i < row . getColumns ( ) ; i ++ ) { cellWidth = ( int ) ( this . width * this . parentTable . getProportionalWidths ( ) [ i ] / 100 ) ; cellRight = cellRight + cellWidth ; Cell cell = ( Cell ) row . getCell ( i ) ; RtfCell rtfCell = new RtfCell ( this . document , this , cell ) ; rtfCell . setCellRight ( cellRight ) ; rtfCell . setCellWidth ( cellWidth ) ; this . cells . add ( rtfCell ) ; } |
public class AbstractItem { /** * Check new name for job
* @ param newName - New name for job . */
private void checkIfNameIsUsed ( @ Nonnull String newName ) throws Failure { } } | try { Item item = getParent ( ) . getItem ( newName ) ; if ( item != null ) { throw new Failure ( Messages . AbstractItem_NewNameInUse ( newName ) ) ; } try ( ACLContext ctx = ACL . as ( ACL . SYSTEM ) ) { item = getParent ( ) . getItem ( newName ) ; if ( item != null ) { if ( LOGGER . isLoggable ( Level . FINE ) ) { LOGGER . log ( Level . FINE , "Unable to rename the job {0}: name {1} is already in use. " + "User {2} has no {3} permission for existing job with the same name" , new Object [ ] { this . getFullName ( ) , newName , ctx . getPreviousContext ( ) . getAuthentication ( ) . getName ( ) , Item . DISCOVER . name } ) ; } // Don ' t explicitly mention that there is another item with the same name .
throw new Failure ( Messages . Jenkins_NotAllowedName ( newName ) ) ; } } } catch ( AccessDeniedException ex ) { if ( LOGGER . isLoggable ( Level . FINE ) ) { LOGGER . log ( Level . FINE , "Unable to rename the job {0}: name {1} is already in use. " + "User {2} has {3} permission, but no {4} for existing job with the same name" , new Object [ ] { this . getFullName ( ) , newName , User . current ( ) , Item . DISCOVER . name , Item . READ . name } ) ; } throw new Failure ( Messages . AbstractItem_NewNameInUse ( newName ) ) ; } |
public class Compiler { /** * Submits a task to one of the compiler ' s task queues for processing . Although public , this method should only be
* called by tasks started by the compiler itself .
* @ param task task to run on one of the compiler ' s task queues */
public void submit ( Task < ? extends TaskResult > task ) { } } | // Increment the counter which indicates the number of results to
// expect . This must be done BEFORE actually submitting the task for
// execution .
remainingTasks . incrementAndGet ( ) ; // Increment the statistics and put the task on the correct queue .
stats . incrementStartedTasks ( task . resultType ) ; executors . get ( task . resultType ) . submit ( task ) ; // Make sure that the task gets added to the results queue .
resultsQueue . add ( task ) ; stats . updateMemoryInfo ( ) ; |
public class JmsMessageImpl { /** * @ see javax . jms . Message # setJMSMessageID ( String )
* Note that this method is used to change the MessageID once the
* message has been received - it cannot be used to affect the assignment
* of the message ID , which is supplied by the provider on send .
* d255144 Method changed to set a local variable instead of calling
* down into the js message . Validation of the parameter removed . */
@ Override public void setJMSMessageID ( String newMsgId ) throws JMSException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setJMSMessageID" , newMsgId ) ; localJMSMessageID = newMsgId ; // Invalidate the toString cache
cachedToString = null ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "setJMSMessageID" ) ; |
public class CmsShellCommands { /** * Sleeps for a duration given in milliseconds . < p >
* @ param sleepMillis a string containing the number of milliseconds to wait
* @ throws NumberFormatException if the sleepMillis parameter is not a valid number */
public void sleep ( String sleepMillis ) throws NumberFormatException { } } | try { Thread . sleep ( Long . parseLong ( sleepMillis ) ) ; } catch ( InterruptedException e ) { // ignore
} |
public class DatabaseHashMap { /** * updateNukerTimeStamp
* When running in a clustered environment , there could be multiple machines processing invalidation .
* This method updates the last time the invalidation was run . A server should not try to process invalidation if
* it was already done within the specified time interval for that app . */
private void updateNukerTimeStamp ( Connection nukerCon , String appName ) throws SQLException { } } | if ( com . ibm . websphere . ras . TraceComponent . isAnyTracingEnabled ( ) && LoggingUtil . SESSION_LOGGER_WAS . isLoggable ( Level . FINE ) ) { LoggingUtil . SESSION_LOGGER_WAS . entering ( methodClassName , methodNames [ UPDATE_NUKER_TIME_STAMP ] , "appName=" + appName ) ; } PreparedStatement ps = null ; long now = System . currentTimeMillis ( ) ; try { ps = nukerCon . prepareStatement ( asyncUpdate ) ; setPSLong ( ps , 1 , now ) ; ps . setString ( 2 , appName ) ; ps . setString ( 3 , appName ) ; ps . setString ( 4 , appName ) ; ps . executeUpdate ( ) ; } finally { if ( ps != null ) closeStatement ( ps ) ; } if ( com . ibm . websphere . ras . TraceComponent . isAnyTracingEnabled ( ) && LoggingUtil . SESSION_LOGGER_WAS . isLoggable ( Level . FINER ) ) { LoggingUtil . SESSION_LOGGER_WAS . exiting ( methodClassName , methodNames [ UPDATE_NUKER_TIME_STAMP ] , "appName=" + appName ) ; } |
public class ExpressRouteCrossConnectionPeeringsInner { /** * Creates or updates a peering in the specified ExpressRouteCrossConnection .
* @ param resourceGroupName The name of the resource group .
* @ param crossConnectionName The name of the ExpressRouteCrossConnection .
* @ param peeringName The name of the peering .
* @ param peeringParameters Parameters supplied to the create or update ExpressRouteCrossConnection peering operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the ExpressRouteCrossConnectionPeeringInner object if successful . */
public ExpressRouteCrossConnectionPeeringInner createOrUpdate ( String resourceGroupName , String crossConnectionName , String peeringName , ExpressRouteCrossConnectionPeeringInner peeringParameters ) { } } | return createOrUpdateWithServiceResponseAsync ( resourceGroupName , crossConnectionName , peeringName , peeringParameters ) . toBlocking ( ) . last ( ) . body ( ) ; |
public class SiRNANotation { /** * this method converts nucleotide sequences into HELM2Notation
* @ param senseSeq
* 5-3 nucleotide sequence for default notation
* @ param antiSenseSeq
* 3-5 nucleotide sequence for default notation
* @ return HELM2Notation for siRNA
* @ throws NotationException
* if notation is not valid
* @ throws FastaFormatException if the fasta input is not valid
* @ throws HELM2HandledException if it contains HELM2 specific features , so that it can not be casted to HELM1 Format
* @ throws RNAUtilsException if the polymer is not a RNA / DNA
* @ throws org . helm . notation2 . exception . NotationException if notation is not valid
* @ throws ChemistryException
* if the Chemistry Engine can not be initialized
* @ throws CTKException general ChemToolKit exception passed to HELMToolKit
* @ throws NucleotideLoadingException if nucleotides can not be loaded */
public static HELM2Notation getSiRNANotation ( String senseSeq , String antiSenseSeq ) throws NotationException , FastaFormatException , HELM2HandledException , RNAUtilsException , org . helm . notation2 . exception . NotationException , ChemistryException , CTKException , NucleotideLoadingException { } } | return getSirnaNotation ( senseSeq , antiSenseSeq , NucleotideParser . RNA_DESIGN_NONE ) ; |
public class CmsFileExplorer { /** * Expands the currently viewed folder in the tree . < p > */
void expandCurrentFolder ( ) { } } | if ( m_currentFolder != null ) { m_treeContainer . setChildrenAllowed ( m_currentFolder , true ) ; m_fileTree . expandItem ( m_currentFolder ) ; } |
public class Dictionary { /** * Gets a property ' s value as a Date .
* JSON does not directly support dates , so the actual property value must be a string , which is
* then parsed according to the ISO - 8601 date format ( the default used in JSON . )
* Returns null if the value doesn ' t exist , is not a string , or is not parseable as a date .
* NOTE : This is not a generic date parser ! It only recognizes the ISO - 8601 format , with or
* without milliseconds .
* @ param key the key
* @ return the Date value or null . */
@ Override public Date getDate ( @ NonNull String key ) { } } | if ( key == null ) { throw new IllegalArgumentException ( "key cannot be null." ) ; } return DateUtils . fromJson ( getString ( key ) ) ; |
public class ComputationGraph { /** * Return an array of network outputs ( predictions ) , given the specified network inputs
* Network outputs are for output layers only . < br >
* If no memory workspace is provided , the output will be detached ( not in any workspace ) . < br >
* If a memory workspace is provided , the output activation array ( i . e . , the INDArray returned by this method )
* will be placed in the specified workspace . This workspace must be opened by the user before calling this method -
* and the user is responsible for ( a ) closing this workspace , and ( b ) ensuring the output array is not used out
* of scope ( i . e . , not used after closing the workspace to which it belongs - as this is likely to cause either
* an exception when used , or a crash ) .
* @ param train If true : do forward pass at training time ; false : do forward pass at test time
* @ param outputWorkspace May be null . If not null : the workspace MUST be opened before calling this method .
* @ param input Inputs to the network
* @ return Output activations ( order : same as defined in network configuration ) */
public INDArray [ ] output ( boolean train , MemoryWorkspace outputWorkspace , INDArray ... input ) { } } | return output ( train , input , inputMaskArrays , labelMaskArrays , outputWorkspace ) ; |
public class HttpFileService { /** * Creates a new { @ link HttpService } that tries this { @ link HttpFileService } first and then the specified
* { @ link HttpService } when this { @ link HttpFileService } does not have a requested resource .
* @ param nextService the { @ link HttpService } to try secondly */
public HttpService orElse ( Service < HttpRequest , HttpResponse > nextService ) { } } | requireNonNull ( nextService , "nextService" ) ; return new OrElseHttpService ( this , nextService ) ; |
public class SwaggerAnnotationsReader { /** * Scans a set of classes for Swagger annotations .
* @ param swagger is the Swagger instance
* @ param classes are a set of classes to scan */
public static void read ( Swagger swagger , Set < Class < ? > > classes ) { } } | final SwaggerAnnotationsReader reader = new SwaggerAnnotationsReader ( swagger ) ; for ( Class < ? > cls : classes ) { final ReaderContext context = new ReaderContext ( swagger , cls , "" , null , false , new ArrayList < > ( ) , new ArrayList < > ( ) , new ArrayList < > ( ) , new ArrayList < > ( ) ) ; reader . read ( context ) ; } |
public class InternalXtextParser { /** * InternalXtext . g : 2698:1 : entryRuleCrossReferenceableTerminal returns [ EObject current = null ] : iv _ ruleCrossReferenceableTerminal = ruleCrossReferenceableTerminal EOF ; */
public final EObject entryRuleCrossReferenceableTerminal ( ) throws RecognitionException { } } | EObject current = null ; EObject iv_ruleCrossReferenceableTerminal = null ; try { // InternalXtext . g : 2698:67 : ( iv _ ruleCrossReferenceableTerminal = ruleCrossReferenceableTerminal EOF )
// InternalXtext . g : 2699:2 : iv _ ruleCrossReferenceableTerminal = ruleCrossReferenceableTerminal EOF
{ newCompositeNode ( grammarAccess . getCrossReferenceableTerminalRule ( ) ) ; pushFollow ( FollowSets000 . FOLLOW_1 ) ; iv_ruleCrossReferenceableTerminal = ruleCrossReferenceableTerminal ( ) ; state . _fsp -- ; current = iv_ruleCrossReferenceableTerminal ; match ( input , EOF , FollowSets000 . FOLLOW_2 ) ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ; |
public class IO { /** * Reads an object from the given file .
* @ param < T > the type of the read object
* @ param path the path to read from .
* @ param type the type of the read object .
* @ return the de - serialized object .
* @ throws NullPointerException if the input stream { @ code in } is { @ code null } .
* @ throws IOException if the object could not be read . */
public < T > T read ( final Class < T > type , final String path ) throws IOException { } } | try ( final FileInputStream in = new FileInputStream ( new File ( path ) ) ) { return read ( type , in ) ; } |
public class ContainerClassLoader { /** * Method to allow adding shared libraries to this classloader , currently using File .
* @ param f the File to add as a shared lib . . can be a dir or a jar ( or a loose xml ; p ) */
@ FFDCIgnore ( NullPointerException . class ) protected void addLibraryFile ( File f ) { } } | if ( ! ! ! f . exists ( ) ) { if ( tc . isWarningEnabled ( ) ) { Tr . warning ( tc , "cls.library.archive" , f , new FileNotFoundException ( f . getName ( ) ) ) ; } return ; } // Skip files that are not archives of some sort .
if ( ! f . isDirectory ( ) && ! isArchive ( f ) ) return ; // this area subject to refactor following shared lib rework . .
// ideally the shared lib code will start passing us ArtifactContainers , and it
// will own the management of the ACF via DS .
// NASTY . . need to use DS to get the ACF , not OSGi backdoor ; p
BundleContext bc = FrameworkUtil . getBundle ( ContainerClassLoader . class ) . getBundleContext ( ) ; ServiceReference < ArtifactContainerFactory > acfsr = bc . getServiceReference ( ArtifactContainerFactory . class ) ; if ( acfsr != null ) { ArtifactContainerFactory acf = bc . getService ( acfsr ) ; if ( acf != null ) { // NASTY . . using this bundle as the cache dir location for the data file . .
try { ArtifactContainer ac = acf . getContainer ( bc . getBundle ( ) . getDataFile ( "" ) , f ) ; smartClassPath . addArtifactContainer ( ac ) ; } catch ( NullPointerException e ) { // TODO completed under task 74097
if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Exception while adding files to classpath" , e ) ; } if ( tc . isInfoEnabled ( ) ) { Tr . info ( tc , "cls.library.file.forbidden" , f ) ; } } } } |
public class JavaParser { @ SuppressSubnodes @ MemoMismatches Rule Identifier ( ) { } } | return Sequence ( TestNot ( Keyword ( ) ) , Letter ( ) , ZeroOrMore ( LetterOrDigit ( ) ) , Spacing ( ) ) ; |
public class UserBuilder { /** * Adds to the extra data for the user .
* @ param name Name of the data
* @ param value Value of the data
* @ return current instance of UserBuilder */
public UserBuilder withData ( String name , Object value ) { } } | if ( this . data == null ) { this . data = new HashMap < > ( ) ; } this . data . put ( name , value ) ; return this ; |
public class ByteArrayMessage { /** * base - 64 encodes the message . */
@ Override public String encodeAsString ( ) { } } | if ( message . size == 0 ) return "" ; return new String ( Base64Coder . encode ( message . array , message . size ) ) ; |
public class AbstractJSPExtensionProcessor { /** * PK81387 - added checkWEBINF param */
private boolean handleCaseSensitivityCheck ( String path , boolean checkWEBINF ) throws IOException { } } | if ( System . getSecurityManager ( ) != null ) { final String tmpPath = path ; final boolean tmpCheckWEBINF = checkWEBINF ; // PK81387
try { return ( ( Boolean ) AccessController . doPrivileged ( new PrivilegedExceptionAction ( ) { public Object run ( ) throws IOException { return _handleCaseSensitivityCheck ( tmpPath , tmpCheckWEBINF ) ; // PK81387 added tmpCheckWEBINF param
} } ) ) . booleanValue ( ) ; } catch ( PrivilegedActionException pae ) { throw ( IOException ) pae . getException ( ) ; } } else { return ( _handleCaseSensitivityCheck ( path , checkWEBINF ) ) . booleanValue ( ) ; // PK81387 added checkWEBINF param
} |
public class IamCredentialsClient { /** * Generates an OpenID Connect ID token for a service account .
* < p > Sample code :
* < pre > < code >
* try ( IamCredentialsClient iamCredentialsClient = IamCredentialsClient . create ( ) ) {
* ServiceAccountName name = ServiceAccountName . of ( " [ PROJECT ] " , " [ SERVICE _ ACCOUNT ] " ) ;
* List & lt ; String & gt ; delegates = new ArrayList & lt ; & gt ; ( ) ;
* String audience = " " ;
* boolean includeEmail = false ;
* GenerateIdTokenResponse response = iamCredentialsClient . generateIdToken ( name , delegates , audience , includeEmail ) ;
* < / code > < / pre >
* @ param name The resource name of the service account for which the credentials are requested ,
* in the following format : ` projects / - / serviceAccounts / { ACCOUNT _ EMAIL _ OR _ UNIQUEID } ` .
* @ param delegates The sequence of service accounts in a delegation chain . Each service account
* must be granted the ` roles / iam . serviceAccountTokenCreator ` role on its next service account
* in the chain . The last service account in the chain must be granted the
* ` roles / iam . serviceAccountTokenCreator ` role on the service account that is specified in the
* ` name ` field of the request .
* < p > The delegates must have the following format :
* ` projects / - / serviceAccounts / { ACCOUNT _ EMAIL _ OR _ UNIQUEID } `
* @ param audience The audience for the token , such as the API or account that this token grants
* access to .
* @ param includeEmail Include the service account email in the token . If set to ` true ` , the token
* will contain ` email ` and ` email _ verified ` claims .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
public final GenerateIdTokenResponse generateIdToken ( ServiceAccountName name , List < String > delegates , String audience , boolean includeEmail ) { } } | GenerateIdTokenRequest request = GenerateIdTokenRequest . newBuilder ( ) . setName ( name == null ? null : name . toString ( ) ) . addAllDelegates ( delegates ) . setAudience ( audience ) . setIncludeEmail ( includeEmail ) . build ( ) ; return generateIdToken ( request ) ; |
public class RingBuffer { /** * Add the supplied consumer , and have it start processing entries in a separate thread .
* The consumer is automatically removed from the ring buffer when it returns { @ code false } from its
* { @ link Consumer # consume ( Object , long , long ) } method .
* @ param consumer the component that will process the entries ; may not be null
* @ param timesToRetryUponTimeout the number of times that the thread should retry after timing out while waiting for the next
* entry ; retries will not be attempted if the value is less than 1
* @ return true if the consumer was added , or false if the consumer was already registered with this buffer
* @ throws IllegalStateException if the ring buffer has already been { @ link # shutdown ( ) } */
public boolean addConsumer ( final C consumer , final int timesToRetryUponTimeout ) { } } | if ( ! addEntries . get ( ) ) { throw new IllegalStateException ( ) ; } ConsumerRunner runner = new ConsumerRunner ( consumer , timesToRetryUponTimeout ) ; if ( gcConsumer != null ) gcConsumer . stayBehind ( runner . getPointer ( ) ) ; // Try to add the runner instance , with equality based upon consumer instance equality . . .
if ( ! consumers . add ( runner ) ) return false ; // It was added , so start it . . .
executor . execute ( runner ) ; return true ; |
public class TTException { /** * Util method to provide StringBuilder functionality .
* @ param message
* to be concatenated
* @ return the StringBuilder for the combined string */
public static StringBuilder concat ( final String ... message ) { } } | final StringBuilder builder = new StringBuilder ( ) ; for ( final String mess : message ) { builder . append ( mess ) ; builder . append ( " " ) ; } return builder ; |
public class HawkContext { /** * Create a new RequestBuilder _ A , initialized with request data .
* @ param method
* @ param path
* @ param host
* @ param port
* @ return */
public static HawkContextBuilder_B request ( String method , String path , String host , int port ) { } } | return new HawkContextBuilder ( ) . method ( method ) . path ( path ) . host ( host ) . port ( port ) ; |
public class Node { /** * Sets reference to the graph owning this node .
* @ param ownerGraph the owning graph */
public void setOwner ( Graph < DataT , NodeT > ownerGraph ) { } } | if ( this . ownerGraph != null ) { throw new RuntimeException ( "Changing owner graph is not allowed" ) ; } this . ownerGraph = ownerGraph ; |
public class SoLoader { /** * This function ensure that every SoSources Abi is supported for at least one abi in
* SysUtil . getSupportedAbis
* @ return true if all SoSources have their Abis supported */
public static boolean areSoSourcesAbisSupported ( ) { } } | sSoSourcesLock . readLock ( ) . lock ( ) ; try { if ( sSoSources == null ) { return false ; } String supportedAbis [ ] = SysUtil . getSupportedAbis ( ) ; for ( int i = 0 ; i < sSoSources . length ; ++ i ) { String [ ] soSourceAbis = sSoSources [ i ] . getSoSourceAbis ( ) ; for ( int j = 0 ; j < soSourceAbis . length ; ++ j ) { boolean soSourceSupported = false ; for ( int k = 0 ; k < supportedAbis . length && ! soSourceSupported ; ++ k ) { soSourceSupported = soSourceAbis [ j ] . equals ( supportedAbis [ k ] ) ; } if ( ! soSourceSupported ) { Log . e ( TAG , "abi not supported: " + soSourceAbis [ j ] ) ; return false ; } } } return true ; } finally { sSoSourcesLock . readLock ( ) . unlock ( ) ; } |
public class EnglishGrammaticalStructure { /** * This method will collapse a referent relation such as follows . e . g . :
* " The man that I love . . . " ref ( man , that ) dobj ( love , that ) - > dobj ( love ,
* man ) */
private static void collapseReferent ( Collection < TypedDependency > list ) { } } | // find typed deps of form ref ( gov , dep )
// put them in a List for processing ; remove them from the set of deps
List < TypedDependency > refs = new ArrayList < TypedDependency > ( ) ; for ( Iterator < TypedDependency > iter = list . iterator ( ) ; iter . hasNext ( ) ; ) { TypedDependency td = iter . next ( ) ; if ( td . reln ( ) == REFERENT ) { refs . add ( td ) ; iter . remove ( ) ; } } // now substitute target of referent where possible
for ( TypedDependency ref : refs ) { TreeGraphNode dep = ref . dep ( ) ; // take the relative word
TreeGraphNode ant = ref . gov ( ) ; // take the antecedent
for ( TypedDependency td : list ) { // the last condition below maybe shouldn ' t be necessary , but it has
// helped stop things going haywire a couple of times ( it stops the
// creation of a unit cycle that probably leaves something else
// disconnected ) [ cdm Jan 2010]
if ( td . dep ( ) == dep && td . reln ( ) != RELATIVE && td . reln ( ) != REFERENT && td . gov ( ) != ant ) { if ( DEBUG ) System . err . print ( "referent: changing " + td ) ; td . setDep ( ant ) ; if ( DEBUG ) System . err . println ( " to " + td ) ; } } } |
public class SecurityModuleAppFixturesService { /** * region > runFixtureScript */
@ Override public List < FixtureResult > runFixtureScript ( final FixtureScript fixtureScript , @ Parameter ( optionality = Optionality . OPTIONAL ) @ ParameterLayout ( named = "Parameters" , describedAs = "Script-specific parameters (if any). The format depends on the script implementation (eg key=value, CSV, JSON, XML etc)" , multiLine = 10 ) final String parameters ) { } } | return super . runFixtureScript ( fixtureScript , parameters ) ; |
public class VelocityRendererImpl { /** * { @ inheritDoc } */
@ Override public void renderTemplate ( final String templateName , final Map < String , Object > context , final Map < String , WComponent > taggedComponents , final Writer writer , final Map < String , Object > options ) { } } | LOG . debug ( "Rendering velocity template [" + templateName + "]." ) ; // Velocity uses a ClassLoader so dont use an absolute path .
String name = templateName . startsWith ( "/" ) ? templateName . substring ( 1 ) : templateName ; try { // Load template
Template template = getVelocityEngine ( ) . getTemplate ( name ) ; // Map the tagged components to be used in the replace writer
Map < String , WComponent > componentsByKey = TemplateUtil . mapTaggedComponents ( context , taggedComponents ) ; // Setup context
VelocityContext velocityContext = new VelocityContext ( ) ; for ( Map . Entry < String , Object > entry : context . entrySet ( ) ) { velocityContext . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } // Write template
UIContext uic = UIContextHolder . getCurrent ( ) ; try ( TemplateWriter velocityWriter = new TemplateWriter ( writer , componentsByKey , uic ) ) { template . merge ( velocityContext , velocityWriter ) ; } } catch ( ResourceNotFoundException e ) { throw new SystemException ( "Could not find velocity template [" + templateName + "]. " + e . getMessage ( ) , e ) ; } catch ( Exception e ) { throw new SystemException ( "Problems with velocity template [" + templateName + "]. " + e . getMessage ( ) , e ) ; } |
public class ElemTemplateElement { /** * NodeList method : Return the Nth immediate child of this node , or
* null if the index is out of bounds .
* @ param index Index of child to find
* @ return org . w3c . dom . Node : the child node at given index */
public Node item ( int index ) { } } | // It is assumed that the getChildNodes call synchronized
// the children . Therefore , we can access the first child
// reference directly .
ElemTemplateElement node = m_firstChild ; for ( int i = 0 ; i < index && node != null ; i ++ ) { node = node . m_nextSibling ; } return node ; |
public class Logger { /** * Issue a log message with a level of DEBUG using { @ link java . text . MessageFormat } - style formatting .
* @ param format the message format string
* @ param params the parameters */
public void debugv ( String format , Object ... params ) { } } | doLog ( Level . DEBUG , FQCN , format , params , null ) ; |
public class CmsHtmlParser { /** * Internally degrades Composite tags that do have children in the DOM tree
* to simple single tags . This allows to avoid auto correction of unclosed HTML tags . < p >
* @ return A node factory that will not autocorrect open tags specified via < code > { @ link # setNoAutoCloseTags ( List ) } < / code > */
protected PrototypicalNodeFactory configureNoAutoCorrectionTags ( ) { } } | PrototypicalNodeFactory factory = new PrototypicalNodeFactory ( ) ; String tagName ; Iterator < String > it = m_noAutoCloseTags . iterator ( ) ; CmsNoAutoCloseTag noAutoCloseTag ; while ( it . hasNext ( ) ) { tagName = it . next ( ) ; noAutoCloseTag = new CmsNoAutoCloseTag ( new String [ ] { tagName } ) ; // TODO : This might break in case registering / unregistering will change from name based to tag - type based approach :
factory . unregisterTag ( noAutoCloseTag ) ; factory . registerTag ( noAutoCloseTag ) ; } return factory ; |
public class NavigationPresenter { /** * Makes the TreeItems ' text update when the description of a Category changes ( due to i18n ) . */
public void setupCellValueFactory ( ) { } } | navigationView . treeView . setCellFactory ( param -> new TreeCell < Category > ( ) { @ Override protected void updateItem ( Category category , boolean empty ) { super . updateItem ( category , empty ) ; textProperty ( ) . unbind ( ) ; if ( empty || category == null ) { setText ( null ) ; setGraphic ( null ) ; } else { textProperty ( ) . bind ( category . descriptionProperty ( ) ) ; setGraphic ( category . getItemIcon ( ) ) ; } } } ) ; |
public class AbstractMatcher { /** * A utility function to convert a string containing match options to the
* associated integer with the appropriate bits set .
* @ param opts
* string containing matching flags
* @ return integer with appropriate bits set */
protected int convertMatchFlags ( Element opts ) { } } | int flags = 0 ; String sopts = ( ( StringProperty ) opts ) . getValue ( ) ; for ( int i = 0 ; i < sopts . length ( ) ; i ++ ) { char c = sopts . charAt ( i ) ; switch ( c ) { case 'i' : flags |= Pattern . CASE_INSENSITIVE ; break ; case 's' : flags |= Pattern . DOTALL ; break ; case 'm' : flags |= Pattern . MULTILINE ; break ; case 'u' : flags |= Pattern . UNICODE_CASE ; break ; case 'x' : flags |= Pattern . COMMENTS ; break ; default : throw EvaluationException . create ( sourceRange , MSG_INVALID_REGEXP_FLAG , c ) ; } } return flags ; |
public class GoogleV3MapWidget { /** * Add zoom handler , event is not exposed at present
* @ param zoomHandler runnable zoom handler */
@ Override public HandlerRegistration addMapZoomEndHandler ( final Runnable zoomHandler ) { } } | return mapWidget . addZoomChangeHandler ( zoomChangeMapEvent -> zoomHandler . run ( ) ) ; |
public class XLinkUtils { /** * Returns the Classobject to a given clazzString and a given version .
* Throws a ClassNotFoundException if the Class / Version pair is not found . */
public static Class getClassOfOpenEngSBModel ( String clazz , String version , OsgiUtilsService serviceFinder ) throws ClassNotFoundException { } } | ModelRegistry registry = serviceFinder . getService ( ModelRegistry . class ) ; ModelDescription modelDescription = new ModelDescription ( clazz , version ) ; Class clazzObject = registry . loadModel ( modelDescription ) ; return clazzObject ; |
public class RenderVisitor { /** * Check that the given { @ code paramValue } matches the static type of { @ code param } . */
private void checkStrictParamType ( final TemplateNode node , final TemplateParam param , @ Nullable SoyValueProvider paramValue ) { } } | Kind kind = param . type ( ) . getKind ( ) ; if ( kind == Kind . ANY || kind == Kind . UNKNOWN ) { // Nothing to check . ANY and UKNOWN match all types .
return ; } if ( paramValue == null ) { paramValue = NullData . INSTANCE ; } else if ( paramValue instanceof SoyAbstractCachingValueProvider ) { SoyAbstractCachingValueProvider typedValue = ( SoyAbstractCachingValueProvider ) paramValue ; if ( ! typedValue . isComputed ( ) ) { // in order to preserve laziness we tell the value provider to assert the type when
// computation is triggered
typedValue . addValueAssertion ( new ValueAssertion ( ) { @ Override public void check ( SoyValue value ) { checkValueType ( param , value , node ) ; } } ) ; return ; } } else if ( param . hasDefault ( ) && paramValue . resolve ( ) instanceof UndefinedData ) { // Default parameters are undefined if they ' re unset .
return ; } checkValueType ( param , paramValue . resolve ( ) , node ) ; |
public class SQLCommand { /** * available in non - interactive contexts . This function is available to enable that . */
private static boolean executesAsSimpleDirective ( String line ) throws Exception { } } | // SHOW or LIST < blah > statement
String subcommand = SQLParser . parseShowStatementSubcommand ( line ) ; if ( subcommand != null ) { if ( subcommand . equals ( "proc" ) || subcommand . equals ( "procedures" ) ) { execListProcedures ( ) ; } else if ( subcommand . equals ( "functions" ) ) { execListFunctions ( ) ; } else if ( subcommand . equals ( "tables" ) ) { execListTables ( ) ; } else if ( subcommand . equals ( "classes" ) ) { execListClasses ( ) ; } else if ( subcommand . equals ( "config" ) || subcommand . equals ( "configuration" ) ) { execListConfigurations ( ) ; } else { String errorCase = ( subcommand . equals ( "" ) || subcommand . equals ( ";" ) ) ? ( "Incomplete SHOW command.\n" ) : ( "Invalid SHOW command completion: '" + subcommand + "'.\n" ) ; System . out . println ( errorCase + "The valid SHOW command completions are proc, procedures, tables, or classes." ) ; } // Consider it handled here , whether or not it was a good SHOW statement .
return true ; } // HELP commands - ONLY in interactive mode , close batch and parse for execution
// Parser returns null if it isn ' t a HELP command . If no arguments are specified
// the returned string will be empty .
String helpSubcommand = SQLParser . parseHelpStatement ( line ) ; if ( helpSubcommand != null ) { // Ignore the arguments for now .
if ( ! helpSubcommand . isEmpty ( ) ) { System . out . printf ( "Ignoring extra HELP argument(s): %s\n" , helpSubcommand ) ; } printHelp ( System . out ) ; // Print readme to the screen
return true ; } String echoArgs = SQLParser . parseEchoStatement ( line ) ; if ( echoArgs != null ) { System . out . println ( echoArgs ) ; return true ; } String echoErrorArgs = SQLParser . parseEchoErrorStatement ( line ) ; if ( echoErrorArgs != null ) { System . err . println ( echoErrorArgs ) ; return true ; } // DESCRIBE table
String describeArgs = SQLParser . parseDescribeStatement ( line ) ; if ( describeArgs != null ) { // Check if table exists
String tableName = "" ; String type = "" ; VoltTable tableData = m_client . callProcedure ( "@SystemCatalog" , "TABLES" ) . getResults ( ) [ 0 ] ; while ( tableData . advanceRow ( ) ) { String t = tableData . getString ( 2 ) ; if ( t . equalsIgnoreCase ( describeArgs ) ) { tableName = t ; type = tableData . getString ( 3 ) ; break ; } } if ( tableName . equals ( "" ) ) { System . err . println ( "Table does not exist" ) ; return true ; } // Class to temporarily store and sort column attributes
class Column implements Comparable { String name ; String type ; long size ; String remarks ; long position ; String notNull ; @ Override public String toString ( ) { return "" ; } @ Override public int compareTo ( Object obj ) { Column col = ( Column ) obj ; return ( int ) ( this . position - col . position ) ; } } // sort the columns as they are inserted
SortedSet set = new TreeSet ( ) ; // Retrieve Column attributes
VoltTable columnData = m_client . callProcedure ( "@SystemCatalog" , "COLUMNS" ) . getResults ( ) [ 0 ] ; int maxNameWidth = 10 ; while ( columnData . advanceRow ( ) ) { if ( tableName . equalsIgnoreCase ( columnData . getString ( 2 ) ) ) { Column c = new Column ( ) ; c . name = columnData . getString ( 3 ) ; if ( c . name . length ( ) > maxNameWidth ) { maxNameWidth = c . name . length ( ) ; } c . type = columnData . getString ( 5 ) ; c . size = columnData . getLong ( 6 ) ; if ( columnData . wasNull ( ) ) { if ( c . type . equals ( "GEOGRAPHY" ) ) { c . size = 32768 ; } if ( c . type . equals ( "GEOGRAPHY_POINT" ) ) { c . size = 16 ; } } else if ( c . type . equals ( "TINYINT" ) ) { c . size = 1 ; } else if ( c . type . equals ( "SMALLINT" ) ) { c . size = 2 ; } else if ( c . type . equals ( "INTEGER" ) ) { c . size = 4 ; } else if ( c . type . equals ( "BIGINT" ) ) { c . size = 8 ; } else if ( c . type . equals ( "FLOAT" ) ) { c . size = 8 ; } else if ( c . type . equals ( "DECIMAL" ) ) { c . size = 16 ; } else if ( c . type . equals ( "TIMESTAMP" ) ) { c . size = 8 ; } c . remarks = columnData . getString ( 11 ) ; if ( columnData . wasNull ( ) ) { c . remarks = "" ; } c . position = columnData . getLong ( 16 ) ; String nullableYesNo = columnData . getString ( 17 ) ; c . notNull = "" ; if ( nullableYesNo . equals ( "NO" ) ) { c . notNull = "NOT NULL" ; } set . add ( c ) ; } } // print output
String headerFormat = "%-" + maxNameWidth + "s|%-16s|%-11s|%-9s|%-16s\n" ; String rowFormat = "%-" + maxNameWidth + "s|%-16s|%11d|%-9s|%-16s\n" ; System . out . printf ( headerFormat , "COLUMN" , "DATATYPE" , "SIZE" , "NULLABLE" , "REMARKS" ) ; String DASHES = new String ( new char [ 56 + maxNameWidth ] ) . replace ( "\0" , "-" ) ; System . out . println ( DASHES ) ; Iterator it = set . iterator ( ) ; while ( it . hasNext ( ) ) { Column c = ( Column ) it . next ( ) ; System . out . printf ( rowFormat , c . name , c . type , c . size , c . notNull , c . remarks ) ; } System . out . println ( DASHES ) ; // primary key
String primaryKey = "" ; VoltTable keyData = m_client . callProcedure ( "@SystemCatalog" , "PRIMARYKEYS" ) . getResults ( ) [ 0 ] ; while ( keyData . advanceRow ( ) ) { if ( tableName . equalsIgnoreCase ( keyData . getString ( 2 ) ) ) { String colName = keyData . getString ( 3 ) ; if ( ! primaryKey . equals ( "" ) ) { primaryKey += "," ; } primaryKey += colName ; } } if ( ! primaryKey . equals ( "" ) ) { System . out . println ( "Type: " + type + ", Primary Key (" + primaryKey + ")" ) ; } else { System . out . println ( "Type: " + type ) ; } return true ; } // It wasn ' t a locally - interpreted directive .
return false ; |
public class PointSymbolizerWrapper { /** * / / / / / GETTERS / SETTERS */
public void setSize ( String size , boolean isProperty ) { } } | this . size = size ; if ( isProperty ) { graphic . setSize ( ff . property ( size ) ) ; } else { graphic . setSize ( ff . literal ( size ) ) ; } |
public class ApplicationTemplateMngrImpl { /** * Unregisters targets .
* @ param newTargetIds a non - null set of target IDs */
private void unregisterTargets ( Set < String > newTargetIds ) { } } | for ( String targetId : newTargetIds ) { try { this . targetsMngr . deleteTarget ( targetId ) ; } catch ( Exception e ) { this . logger . severe ( "A target ID that has just been registered could not be created. That's weird." ) ; Utils . logException ( this . logger , e ) ; } } |
public class DescribeConfigurationRecorderStatusRequest { /** * The name ( s ) of the configuration recorder . If the name is not specified , the action returns the current status of
* all the configuration recorders associated with the account .
* @ return The name ( s ) of the configuration recorder . If the name is not specified , the action returns the current
* status of all the configuration recorders associated with the account . */
public java . util . List < String > getConfigurationRecorderNames ( ) { } } | if ( configurationRecorderNames == null ) { configurationRecorderNames = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return configurationRecorderNames ; |
public class JmsJcaReferenceUtilsImpl { /** * Takes a map containing a set of properties , the keys of which are
* Strings , and the values of which are immutable objects ( for instance
* primitive wrapper classes ) , and returns a string encoded version of the
* map in which the keys are the original keys prefixed with the data type ,
* and the values are string representations of the original values , but doesn ' t
* include the properties in the defaultProperties map AND have that default value
* @ param raw
* the map to encode
* @ param defaults
* the default set of properties to be used ( if properties in raw are set to
* these defaults , they will be omitted from the encoded map )
* @ return the encoded map */
public Map < String , String > getStringEncodedMap ( final Map raw , final Map defaults ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , "getStringEncodedMap" , new Object [ ] { raw , defaults } ) ; } final Map < String , String > encodedMap = new HashMap < String , String > ( ) ; final Iterator propKeys = raw . keySet ( ) . iterator ( ) ; // Look at each key in turn .
while ( propKeys . hasNext ( ) ) { String key = ( String ) propKeys . next ( ) ; // Only store non - null keys .
if ( key != null ) { // Retrieve the value part of the map .
Object val = raw . get ( key ) ; // Initialize the lookup table if necessary .
if ( prefixTable == null ) { populatePrefixTable ( ) ; } // Should we skip this property
if ( defaults . containsKey ( key ) && defaults . get ( key ) != null && defaults . get ( key ) . equals ( val ) ) continue ; String prefix = null ; String strForm = null ; // Work out the correct class type and prefix , taking care of
// null
// value .
if ( val == null ) { prefix = PREFIX_NULL ; strForm = null ; } else { // Look up the prefix based on the class
prefix = prefixTable . get ( val . getClass ( ) ) ; if ( prefix == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { SibTr . debug ( TRACE , "unsupported type for property: " + val . getClass ( ) . getName ( ) ) ; } // Ignore the unsupported type .
continue ; } // if prefix found .
// We know the object is not null , so convert it to a String
strForm = val . toString ( ) ; } // if val null
// Prepend the prefix to the key
String prefixedKey = prefix + PREFIX_SEPARATOR + key ; encodedMap . put ( prefixedKey , strForm ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { SibTr . debug ( TRACE , "encoded: " + prefixedKey + " = '" + strForm + "'" ) ; } } // if key not null
} // while
if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , "getStringEncodedMap" , encodedMap ) ; } return encodedMap ; |
public class CPMeasurementUnitUtil { /** * Returns the last cp measurement unit in the ordered set where groupId = & # 63 ; .
* @ param groupId the group ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching cp measurement unit , or < code > null < / code > if a matching cp measurement unit could not be found */
public static CPMeasurementUnit fetchByGroupId_Last ( long groupId , OrderByComparator < CPMeasurementUnit > orderByComparator ) { } } | return getPersistence ( ) . fetchByGroupId_Last ( groupId , orderByComparator ) ; |
public class ComparableExpression { /** * Create a { @ code this < = right } expression
* @ param right rhs of the comparison
* @ return this & lt ; = right
* @ see java . lang . Comparable # compareTo ( Object ) */
public final BooleanExpression loe ( T right ) { } } | return Expressions . booleanOperation ( Ops . LOE , mixin , ConstantImpl . create ( right ) ) ; |
public class IntHashSet { /** * Contains method that does not box values .
* @ param value to be check for if the set contains it .
* @ return true if the value is contained in the set otherwise false .
* @ see Collection # contains ( Object ) */
public boolean contains ( final int value ) { } } | if ( value == MISSING_VALUE ) { return containsMissingValue ; } final int [ ] values = this . values ; @ DoNotSub final int mask = values . length - 1 ; @ DoNotSub int index = Hashing . hash ( value , mask ) ; while ( values [ index ] != MISSING_VALUE ) { if ( values [ index ] == value ) { return true ; } index = next ( index , mask ) ; } return false ; |
public class A_CmsEditUserDialog { /** * Initializes the user object to work with depending on the dialog state and request parameters . < p >
* Two initializations of the user object on first dialog call are possible :
* < ul >
* < li > edit an existing user < / li >
* < li > create a new user < / li >
* < / ul > */
protected void initUserObject ( ) { } } | Object o = null ; try { if ( CmsStringUtil . isEmpty ( getParamAction ( ) ) || CmsDialog . DIALOG_INITIAL . equals ( getParamAction ( ) ) ) { // edit an existing user , get the user object from db
m_user = getCms ( ) . readUser ( new CmsUUID ( getParamUserid ( ) ) ) ; m_pwdInfo = new CmsPasswordInfo ( ) ; CmsUserSettings settings = new CmsUserSettings ( m_user ) ; m_language = settings . getLocale ( ) . toString ( ) ; m_site = CmsStringUtil . joinPaths ( settings . getStartSite ( ) , "/" ) ; m_startProject = settings . getStartProject ( ) ; m_startFolder = settings . getStartFolder ( ) ; m_startView = settings . getStartView ( ) ; return ; } else { // this is not the initial call , get the user object from session
o = getDialogObject ( ) ; Map < ? , ? > dialogObject = ( Map < ? , ? > ) o ; m_user = ( CmsUser ) dialogObject . get ( USER_OBJECT ) ; m_pwdInfo = ( CmsPasswordInfo ) dialogObject . get ( PWD_OBJECT ) ; CmsUserSettings settings = new CmsUserSettings ( m_user ) ; m_language = settings . getLocale ( ) . toString ( ) ; m_site = CmsStringUtil . joinPaths ( settings . getStartSite ( ) , "/" ) ; m_startProject = settings . getStartProject ( ) ; m_startFolder = settings . getStartFolder ( ) ; m_startView = settings . getStartView ( ) ; return ; } } catch ( Exception e ) { // noop
} // create a new user object
m_user = new CmsUser ( ) ; m_pwdInfo = new CmsPasswordInfo ( ) ; m_group = "" ; try { m_group = getCms ( ) . readGroup ( getParamOufqn ( ) + OpenCms . getDefaultUsers ( ) . getGroupUsers ( ) ) . getName ( ) ; } catch ( CmsException e ) { // ignore
} m_language = CmsLocaleManager . getDefaultLocale ( ) . toString ( ) ; m_site = CmsStringUtil . joinPaths ( OpenCms . getSiteManager ( ) . getDefaultSite ( ) . getSiteRoot ( ) , "/" ) ; m_startProject = OpenCms . getWorkplaceManager ( ) . getDefaultUserSettings ( ) . getStartProject ( ) ; m_startFolder = OpenCms . getWorkplaceManager ( ) . getDefaultUserSettings ( ) . getStartFolder ( ) ; m_startView = OpenCms . getWorkplaceManager ( ) . getDefaultUserSettings ( ) . getStartView ( ) ; |
public class BaseUtils { /** * Ensures that the directories in the given path exist , creating them if necessary .
* < p > Note : If the path does not end with the separator char ( slash in Linux ) , then the name at
* the end is assumed to be the file name , so directories are only created down to its parent .
* @ param path The path for which to ensure directories exist . */
public static void ensureDirsExistInPath ( String path ) { } } | if ( path == null || path . length ( ) == 0 ) { throw new AssertionError ( "ensureDirsExistInPath called with null or empty path." ) ; } String dirPath = ( path . charAt ( path . length ( ) - 1 ) == File . separatorChar ) ? path . substring ( 0 , path . length ( ) - 1 ) : ( new File ( path ) ) . getParent ( ) ; if ( dirPath == null || knownExistingDirs . contains ( dirPath ) ) { return ; // known to exist
} else { ( new File ( dirPath ) ) . mkdirs ( ) ; knownExistingDirs . add ( dirPath ) ; } |
public class OfflineUpdateRequest { /** * The method generates the update request file .
* @ param outputDir Directory where request file will be created .
* @ param zip Whether or not to zip the request .
* @ param prettyJson Whether or not to parse the json before writing to file ( only if zip is false ) .
* @ return File reference to the resulting request .
* @ throws java . io . IOException In case of errors during file generation process . */
public File generate ( File outputDir , boolean zip , boolean prettyJson ) throws IOException { } } | if ( request == null ) { throw new IllegalStateException ( "Update inventory request is null" ) ; } // prepare working directory
File workDir = new File ( outputDir , "whitesource" ) ; if ( ! workDir . exists ( ) && ! workDir . mkdir ( ) ) { throw new IOException ( "Unable to make output directory: " + workDir ) ; } String json ; if ( zip ) { json = new Gson ( ) . toJson ( request ) ; json = ZipUtils . compressString ( json ) ; } else if ( prettyJson ) { Gson gson = new GsonBuilder ( ) . setPrettyPrinting ( ) . create ( ) ; json = gson . toJson ( request ) ; } else { json = new Gson ( ) . toJson ( request ) ; } // write to file
File requestFile = new File ( workDir , "update-request.txt" ) ; FileUtils . writeStringToFile ( requestFile , json , UTF_8 ) ; return requestFile ; |
public class RootFinder { /** * { @ inheritDoc } */
@ Override public String getDbName ( final FinderObject owner ) { } } | final Root root = ( Root ) owner ; return root . getTheDbName ( ) ; |
public class Twilio { /** * Returns ( and initializes if not initialized ) the Twilio Rest Client .
* @ return the TWilio Rest Client
* @ throws AuthenticationException if initialization required and either accountSid or authToken is null */
public static TwilioRestClient getRestClient ( ) { } } | if ( Twilio . restClient == null ) { if ( Twilio . username == null || Twilio . password == null ) { throw new AuthenticationException ( "TwilioRestClient was used before AccountSid and AuthToken were set, please call Twilio.init()" ) ; } TwilioRestClient . Builder builder = new TwilioRestClient . Builder ( Twilio . username , Twilio . password ) ; if ( Twilio . accountSid != null ) { builder . accountSid ( Twilio . accountSid ) ; } Twilio . restClient = builder . build ( ) ; } return Twilio . restClient ; |
public class DirectoryRegistrationService { /** * Update the uri of the ProvidedServiceInstance by serviceName and providerId .
* @ param serviceName
* the serviceName of the ProvidedServiceInstance .
* @ param providerId
* the providerId of the ProvidedServiceInstance .
* @ param uri
* the new uri . */
public void updateServiceUri ( String serviceName , String providerId , String uri ) { } } | getServiceDirectoryClient ( ) . updateServiceInstanceUri ( serviceName , providerId , uri ) ; |
public class FessMessages { /** * Add the created action message for the key ' errors . failed _ to _ start _ job ' with parameters .
* < pre >
* message : Failed to start job { 0 } .
* < / pre >
* @ param property The property name for the message . ( NotNull )
* @ param arg0 The parameter arg0 for message . ( NotNull )
* @ return this . ( NotNull ) */
public FessMessages addErrorsFailedToStartJob ( String property , String arg0 ) { } } | assertPropertyNotNull ( property ) ; add ( property , new UserMessage ( ERRORS_failed_to_start_job , arg0 ) ) ; return this ; |
public class CollectionUtil { /** * 返回无序集合中的最小值 , 使用元素默认排序 */
public static < T extends Object & Comparable < ? super T > > T min ( Collection < ? extends T > coll ) { } } | return Collections . min ( coll ) ; |
public class CmsLock { /** * Sets the related Lock . < p >
* @ param relatedLock the related Lock to set */
protected void setRelatedLock ( CmsLock relatedLock ) { } } | if ( this == NULL_LOCK ) { throw new RuntimeException ( "null lock" ) ; } if ( ( relatedLock == null ) || relatedLock . isUnlocked ( ) ) { m_relatedLock = null ; } else { m_relatedLock = relatedLock ; m_relatedLock . m_relatedLock = this ; } |
public class PullFileLoader { /** * Find at most one * . properties file in the input { @ link Path } and load it using fallback as fallback .
* @ return The { @ link Config } in path with sysProps as fallback .
* @ throws IOException */
private Config findAndLoadGlobalConfigInDirectory ( Path path , Config fallback ) throws IOException { } } | FileStatus [ ] files = this . fs . listStatus ( path , GLOBAL_PATH_FILTER ) ; if ( files == null ) { log . warn ( "Could not list files at path " + path ) ; return ConfigFactory . empty ( ) ; } if ( files . length > 1 ) { throw new IOException ( "Found more than one global properties file at path " + path ) ; } if ( files . length == 0 ) { return fallback ; } if ( GLOBAL_HOCON_PATH_FILTER . accept ( files [ 0 ] . getPath ( ) ) ) { return loadHoconConfigWithFallback ( files [ 0 ] . getPath ( ) , fallback ) ; } else if ( GLOBAL_PROPS_PATH_FILTER . accept ( files [ 0 ] . getPath ( ) ) ) { return loadJavaPropsWithFallback ( files [ 0 ] . getPath ( ) , fallback ) ; } else { throw new IllegalStateException ( "Unsupported global configuration file: " + files [ 0 ] . getPath ( ) ) ; } |
public class KamImpl { /** * { @ inheritDoc } */
@ Override public Set < KamEdge > getAdjacentEdges ( KamNode kamNode , EdgeFilter filter ) { } } | return getAdjacentEdges ( kamNode , EdgeDirectionType . BOTH , filter ) ; |
public class PdfDocument { /** * Adds a < CODE > PdfWriter < / CODE > to the < CODE > PdfDocument < / CODE > .
* @ param writer the < CODE > PdfWriter < / CODE > that writes everything
* what is added to this document to an outputstream .
* @ throws DocumentException on error */
public void addWriter ( PdfWriter writer ) throws DocumentException { } } | if ( this . writer == null ) { this . writer = writer ; annotationsImp = new PdfAnnotationsImp ( writer ) ; return ; } throw new DocumentException ( "You can only add a writer to a PdfDocument once." ) ; |
public class AbstractFileSystem { /** * Initialize the { @ link alluxio . hadoop . FileSystem } .
* @ param uri file system Uri
* @ param conf hadoop configuration
* @ param alluxioConfiguration [ optional ] alluxio configuration
* @ throws IOException */
public synchronized void initialize ( URI uri , org . apache . hadoop . conf . Configuration conf , @ Nullable AlluxioConfiguration alluxioConfiguration ) throws IOException { } } | Preconditions . checkArgument ( uri . getScheme ( ) . equals ( getScheme ( ) ) , PreconditionMessage . URI_SCHEME_MISMATCH . toString ( ) , uri . getScheme ( ) , getScheme ( ) ) ; super . initialize ( uri , conf ) ; LOG . debug ( "initialize({}, {}). Connecting to Alluxio" , uri , conf ) ; HadoopUtils . addSwiftCredentials ( conf ) ; setConf ( conf ) ; // HDFS doesn ' t allow the authority to be empty ; it must be " / " instead .
String authority = uri . getAuthority ( ) == null ? "/" : uri . getAuthority ( ) ; mAlluxioHeader = getScheme ( ) + "://" + authority ; // Set the statistics member . Use mStatistics instead of the parent class ' s variable .
mStatistics = statistics ; Authority auth = Authority . fromString ( uri . getAuthority ( ) ) ; if ( auth instanceof UnknownAuthority ) { throw new IOException ( String . format ( "Authority \"%s\" is unknown. The client can not be " + "configured with the authority from %s" , auth , uri ) ) ; } mUri = URI . create ( mAlluxioHeader ) ; if ( mFileSystem != null ) { return ; } Map < String , Object > uriConfProperties = getConfigurationFromUri ( uri ) ; AlluxioProperties alluxioProps = ( alluxioConfiguration != null ) ? alluxioConfiguration . copyProperties ( ) : ConfigurationUtils . defaults ( ) ; AlluxioConfiguration alluxioConf = mergeConfigurations ( uriConfProperties , conf , alluxioProps ) ; Subject subject = getHadoopSubject ( ) ; if ( subject != null ) { LOG . debug ( "Using Hadoop subject: {}" , subject ) ; } else { LOG . debug ( "No Hadoop subject. Using context without subject." ) ; } LOG . info ( "Initializing filesystem with connect details {}" , Factory . getConnectDetails ( alluxioConf ) ) ; mFileSystem = FileSystem . Factory . create ( ClientContext . create ( subject , alluxioConf ) ) ; |
public class XmlUtils { /** * 从request中获得参数Map , 并返回可读的Map
* @ param request
* @ return */
public static SortedMap getParameterMap ( HttpServletRequest request ) { } } | // 参数Map
Map properties = request . getParameterMap ( ) ; // 返回值Map
SortedMap returnMap = new TreeMap ( ) ; Iterator entries = properties . entrySet ( ) . iterator ( ) ; Map . Entry entry ; String name = "" ; String value = "" ; while ( entries . hasNext ( ) ) { entry = ( Map . Entry ) entries . next ( ) ; name = ( String ) entry . getKey ( ) ; Object valueObj = entry . getValue ( ) ; if ( null == valueObj ) { value = "" ; } else if ( valueObj instanceof String [ ] ) { String [ ] values = ( String [ ] ) valueObj ; for ( int i = 0 ; i < values . length ; i ++ ) { value = values [ i ] + "," ; } value = value . substring ( 0 , value . length ( ) - 1 ) ; } else { value = valueObj . toString ( ) ; } returnMap . put ( name , value . trim ( ) ) ; } return returnMap ; |
public class NetworkUtils { /** * Set the learning rate schedule for all layers in the network to the specified schedule .
* This schedule will replace any / all existing schedules , and also any fixed learning rate values . < br >
* Note that the iteration / epoch counts will < i > not < / i > be reset . Use { @ link ComputationGraphConfiguration # setIterationCount ( int ) }
* and { @ link ComputationGraphConfiguration # setEpochCount ( int ) } if this is required
* @ param newLrSchedule New learning rate schedule for all layers */
public static void setLearningRate ( ComputationGraph net , ISchedule newLrSchedule ) { } } | setLearningRate ( net , Double . NaN , newLrSchedule ) ; |
public class ProjectCalendar { /** * Retrieves the working hours on the given date .
* @ param date required date
* @ param cal optional calendar instance
* @ param day optional day instance
* @ return working hours */
private ProjectCalendarDateRanges getRanges ( Date date , Calendar cal , Day day ) { } } | ProjectCalendarDateRanges ranges = getException ( date ) ; if ( ranges == null ) { ProjectCalendarWeek week = getWorkWeek ( date ) ; if ( week == null ) { week = this ; } if ( day == null ) { if ( cal == null ) { cal = Calendar . getInstance ( ) ; cal . setTime ( date ) ; } day = Day . getInstance ( cal . get ( Calendar . DAY_OF_WEEK ) ) ; } ranges = week . getHours ( day ) ; } return ranges ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.