signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class EJBSerializerImpl { /** * ( non - Javadoc ) * @ see com . ibm . ws . ejbcontainer . util . EJBSerializer # deserialize ( byte [ ] ) */ @ Override public Object deserialize ( byte [ ] idBytes ) throws Exception { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "deserialize" ) ; } EJSContainer container = EJSContainer . getDefaultContainer ( ) ; Object retObj = null ; WrapperManager wm = container . getWrapperManager ( ) ; // The first bytes of serialized data is a header and // the first byte of header identifies it as either a // BeanId or a WrapperId . So examine first byte to // determine whether it is a BeanId or a WrapperId . if ( idBytes [ 0 ] == ( byte ) 0xAC ) { // First byte indicates it is a BeanId . Use the // WrapperManager to find the wrapper in wrapper cache . ByteArray byteArray = new ByteArray ( idBytes ) ; BeanId beanId = BeanId . getBeanId ( byteArray , container ) ; retObj = wm . getWrapper ( beanId ) . getLocalObject ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "deserialized a BeanId = " + beanId + ", component wrapper = " + retObj ) ; } } else if ( idBytes [ 0 ] == ( byte ) 0xAD ) // d458325 { // First byte indicates it is a WrapperId that was serialized . // Recreate the WrapperId and use it to create the wrapper // for the business interface in the WrapperId represents . WrapperId wrapperId = new WrapperId ( idBytes ) ; int index = wrapperId . ivInterfaceIndex ; String interfaceName = wrapperId . ivInterfaceClassName ; ByteArray byteArray = wrapperId . getBeanIdArray ( ) ; BeanId beanId = BeanId . getBeanId ( byteArray , container ) ; BeanMetaData bmd = beanId . getBeanMetaData ( ) ; Tr . debug ( tc , "deserialized a WrapperId for BeanId = " + beanId + ", primary key = " + beanId . getPrimaryKey ( ) ) ; // Wrapper may be an Aggregate Local , Business Local or Business // Remote . Aggregate Local is easy to determine , otherwise assume // it is Business Local and finally resort to Business Remote last ; // creating the wrapper based on type . F743-34304 if ( index == EJSWrapperBase . AGGREGATE_LOCAL_INDEX ) { // Obtain the home and create the ' set ' of wrappers for the // deserialized BeanId and then get the aggregate wrapper . EJSHome home = bmd . getHome ( ) ; EJSWrapperCommon wc = home . internalCreateWrapper ( beanId ) ; retObj = wc . getAggregateLocalWrapper ( ) ; } else { // Assume it is a BusinessLocalWrapper . // Verify index is still valid . If we fail over to a new server , // the index for the interface may be different than original server . // In that case , we need to determine the new index . Class < ? > [ ] bInterfaces = bmd . ivBusinessLocalInterfaceClasses ; int numberOfLocalInterfaces = bInterfaces . length ; String wrapperInterfaceName = null ; if ( index < numberOfLocalInterfaces ) { wrapperInterfaceName = bInterfaces [ index ] . getName ( ) ; } // Is the BusinessLocalWrapper for the correct interface name ? if ( ( wrapperInterfaceName == null ) || ( ! wrapperInterfaceName . equals ( interfaceName ) ) ) { // Nope , index must be invalid , so we need to get an updated index // that matches the desired interface name . // Fix up the WrapperId with index that matches this server . index = bmd . getRequiredLocalBusinessInterfaceIndex ( interfaceName ) ; } // Yep , create a new instance of the BusinessLocalWrapper object . if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "deserialized a BusinessLocalWrapper, WrapperId = " + wrapperId ) ; } EJSHome home = bmd . getHome ( ) ; EJSWrapperCommon wc = home . internalCreateWrapper ( beanId ) ; retObj = wc . getLocalBusinessObject ( index ) ; } } else { throw new IOException ( "First byte of header not recognized" ) ; } // Return the wrapper if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "deserialize returning: " + retObj ) ; } return retObj ;
public class DefaultPermissionChecker { /** * This method checks requested permission on a given inode , represented by its fileInfo . * @ param user who requests access permission * @ param groups in which user belongs to * @ param inode whose attributes used for permission check logic * @ param bits requested { @ link Mode . Bits } by user * @ param path the path to check permission on * @ throws AccessControlException if permission checking fails */ private void checkInode ( String user , List < String > groups , InodeView inode , Mode . Bits bits , String path ) throws AccessControlException { } }
if ( inode == null ) { return ; } for ( AclAction action : bits . toAclActionSet ( ) ) { if ( ! inode . checkPermission ( user , groups , action ) ) { throw new AccessControlException ( ExceptionMessage . PERMISSION_DENIED . getMessage ( toExceptionMessage ( user , bits , path , inode ) ) ) ; } }
public class QueryObjectsResult { /** * The identifiers that match the query selectors . * @ param ids * The identifiers that match the query selectors . */ public void setIds ( java . util . Collection < String > ids ) { } }
if ( ids == null ) { this . ids = null ; return ; } this . ids = new com . amazonaws . internal . SdkInternalList < String > ( ids ) ;
public class Channel { /** * Approve chaincode to be run on this peer ' s organization . * @ param lifecycleApproveChaincodeDefinitionForMyOrgRequest the request see { @ link LifecycleApproveChaincodeDefinitionForMyOrgRequest } * @ param peers to send the request to . * @ return A { @ link LifecycleApproveChaincodeDefinitionForMyOrgProposalResponse } * @ throws ProposalException * @ throws InvalidArgumentException */ public Collection < LifecycleApproveChaincodeDefinitionForMyOrgProposalResponse > sendLifecycleApproveChaincodeDefinitionForMyOrgProposal ( LifecycleApproveChaincodeDefinitionForMyOrgRequest lifecycleApproveChaincodeDefinitionForMyOrgRequest , Collection < Peer > peers ) throws ProposalException , InvalidArgumentException { } }
if ( null == lifecycleApproveChaincodeDefinitionForMyOrgRequest ) { throw new InvalidArgumentException ( "The lifecycleApproveChaincodeDefinitionForMyOrgRequest parameter can not be null." ) ; } checkChannelState ( ) ; checkPeers ( peers ) ; try { TransactionContext transactionContext = getTransactionContext ( lifecycleApproveChaincodeDefinitionForMyOrgRequest ) ; // transactionContext . verify ( true ) ; LifecycleApproveChaincodeDefinitionForMyOrgProposalBuilder approveChaincodeDefinitionForMyOrgProposalBuilder = LifecycleApproveChaincodeDefinitionForMyOrgProposalBuilder . newBuilder ( ) ; if ( IS_TRACE_LEVEL ) { logger . trace ( format ( "LifecycleApproveChaincodeDefinitionForMyOrg channel: %s, sequence: %d, chaincodeName: %s, chaincodeVersion: %s, packageId: %s" + ", sourceUnavailable: %b, isInitRequired: %s, validationParameter: '%s', endorsementPolicyPlugin: %s, validationPlugin: %s" , name , lifecycleApproveChaincodeDefinitionForMyOrgRequest . getSequence ( ) , lifecycleApproveChaincodeDefinitionForMyOrgRequest . getChaincodeName ( ) , lifecycleApproveChaincodeDefinitionForMyOrgRequest . getChaincodeVersion ( ) , lifecycleApproveChaincodeDefinitionForMyOrgRequest . getPackageId ( ) , lifecycleApproveChaincodeDefinitionForMyOrgRequest . isSourceUnavailable ( ) , lifecycleApproveChaincodeDefinitionForMyOrgRequest . isInitRequired ( ) + "" , toHexString ( lifecycleApproveChaincodeDefinitionForMyOrgRequest . getValidationParameter ( ) ) , lifecycleApproveChaincodeDefinitionForMyOrgRequest . getChaincodeEndorsementPlugin ( ) , lifecycleApproveChaincodeDefinitionForMyOrgRequest . getChaincodeValidationPlugin ( ) ) ) ; } approveChaincodeDefinitionForMyOrgProposalBuilder . context ( transactionContext ) ; approveChaincodeDefinitionForMyOrgProposalBuilder . sequence ( lifecycleApproveChaincodeDefinitionForMyOrgRequest . getSequence ( ) ) ; approveChaincodeDefinitionForMyOrgProposalBuilder . chaincodeName ( lifecycleApproveChaincodeDefinitionForMyOrgRequest . getChaincodeName ( ) ) ; approveChaincodeDefinitionForMyOrgProposalBuilder . version ( lifecycleApproveChaincodeDefinitionForMyOrgRequest . getChaincodeVersion ( ) ) ; String packageId = lifecycleApproveChaincodeDefinitionForMyOrgRequest . getPackageId ( ) ; if ( null != packageId ) { approveChaincodeDefinitionForMyOrgProposalBuilder . setPackageId ( packageId ) ; } else if ( ! lifecycleApproveChaincodeDefinitionForMyOrgRequest . isSourceUnavailable ( ) ) { throw new InvalidArgumentException ( "The request must have a specific packageId or sourceNone set to true." ) ; } Boolean initRequired = lifecycleApproveChaincodeDefinitionForMyOrgRequest . isInitRequired ( ) ; if ( null != initRequired ) { approveChaincodeDefinitionForMyOrgProposalBuilder . initRequired ( initRequired ) ; } final ByteString validationParamter = lifecycleApproveChaincodeDefinitionForMyOrgRequest . getValidationParameter ( ) ; if ( null != validationParamter ) { approveChaincodeDefinitionForMyOrgProposalBuilder . setValidationParamter ( validationParamter ) ; } String chaincodeCodeEndorsementPlugin = lifecycleApproveChaincodeDefinitionForMyOrgRequest . getChaincodeEndorsementPlugin ( ) ; if ( null != chaincodeCodeEndorsementPlugin ) { approveChaincodeDefinitionForMyOrgProposalBuilder . chaincodeCodeEndorsementPlugin ( chaincodeCodeEndorsementPlugin ) ; } String chaincodeCodeValidationPlugin = lifecycleApproveChaincodeDefinitionForMyOrgRequest . getChaincodeValidationPlugin ( ) ; if ( null != chaincodeCodeValidationPlugin ) { approveChaincodeDefinitionForMyOrgProposalBuilder . chaincodeCodeValidationPlugin ( chaincodeCodeValidationPlugin ) ; } ChaincodeCollectionConfiguration chaincodeCollectionConfiguration = lifecycleApproveChaincodeDefinitionForMyOrgRequest . getChaincodeCollectionConfiguration ( ) ; if ( null != chaincodeCollectionConfiguration ) { approveChaincodeDefinitionForMyOrgProposalBuilder . chaincodeCollectionConfiguration ( chaincodeCollectionConfiguration . getCollectionConfigPackage ( ) ) ; } FabricProposal . Proposal deploymentProposal = approveChaincodeDefinitionForMyOrgProposalBuilder . build ( ) ; SignedProposal signedProposal = getSignedProposal ( transactionContext , deploymentProposal ) ; return sendProposalToPeers ( peers , signedProposal , transactionContext , LifecycleApproveChaincodeDefinitionForMyOrgProposalResponse . class ) ; } catch ( Exception e ) { throw new ProposalException ( e ) ; }
public class AbstractParamContainerPanel { /** * Ensures the node of the panel is visible in the view port . * The node is assumed to be already { @ link JTree # isVisible ( TreePath ) visible in the tree } . * @ param nodePath the path to the node of the panel . */ private void ensureNodeVisible ( TreePath nodePath ) { } }
Rectangle bounds = getTreeParam ( ) . getPathBounds ( nodePath ) ; if ( ! getTreeParam ( ) . getVisibleRect ( ) . contains ( bounds ) ) { // Just do vertical scrolling . bounds . x = 0 ; getTreeParam ( ) . scrollRectToVisible ( bounds ) ; }
public class DatastoreActivityMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DatastoreActivity datastoreActivity , ProtocolMarshaller protocolMarshaller ) { } }
if ( datastoreActivity == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( datastoreActivity . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( datastoreActivity . getDatastoreName ( ) , DATASTORENAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class IntIntMap { /** * Removes the value mapped for the specified key . * @ return the value to which the key was mapped or the supplied default value if there was no * mapping for that key . */ public int removeOrElse ( int key , int defval ) { } }
_modCount ++ ; int removed = removeImpl ( key , defval ) ; checkShrink ( ) ; return removed ;
public class StringUtils { /** * Returns the file extension of the value without the dot or an empty string . * @ param value * @ return the extension without dot or an empry string */ public static String getFileExtension ( String value ) { } }
int index = value . lastIndexOf ( '.' ) ; if ( index > - 1 ) { return value . substring ( index + 1 ) ; } return "" ;
public class RawMessageEvent { /** * performance doesn ' t matter , it ' s only being called during tracing */ public UUID getMessageId ( ) { } }
final ByteBuffer wrap = ByteBuffer . wrap ( messageIdBytes ) ; return new UUID ( wrap . asLongBuffer ( ) . get ( 0 ) , wrap . asLongBuffer ( ) . get ( 1 ) ) ;
public class CmsSitemapChange { /** * Adds a property change for a changed title . < p > * @ param title the changed title */ public void addChangeTitle ( String title ) { } }
CmsPropertyModification propChange = new CmsPropertyModification ( m_entryId , CmsClientProperty . PROPERTY_NAVTEXT , title , true ) ; m_propertyModifications . add ( propChange ) ; m_ownInternalProperties . put ( "NavText" , new CmsClientProperty ( "NavText" , title , null ) ) ;
public class AbstractAlpineQueryManager { /** * Retrieves an object by its ID . * @ param < T > A type parameter . This type will be returned * @ param clazz the persistence class to retrive the ID for * @ param id the object id to retrieve * @ return an object of the specified type * @ since 1.0.0 */ public < T > T getObjectById ( Class < T > clazz , Object id ) { } }
return pm . getObjectById ( clazz , id ) ;
public class AmazonCodeDeployClient { /** * Deletes a deployment group . * @ param deleteDeploymentGroupRequest * Represents the input of a DeleteDeploymentGroup operation . * @ return Result of the DeleteDeploymentGroup operation returned by the service . * @ throws ApplicationNameRequiredException * The minimum number of required application names was not specified . * @ throws InvalidApplicationNameException * The application name was specified in an invalid format . * @ throws DeploymentGroupNameRequiredException * The deployment group name was not specified . * @ throws InvalidDeploymentGroupNameException * The deployment group name was specified in an invalid format . * @ throws InvalidRoleException * The service role ARN was specified in an invalid format . Or , if an Auto Scaling group was specified , the * specified service role does not grant the appropriate permissions to Amazon EC2 Auto Scaling . * @ sample AmazonCodeDeploy . DeleteDeploymentGroup * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / codedeploy - 2014-10-06 / DeleteDeploymentGroup " * target = " _ top " > AWS API Documentation < / a > */ @ Override public DeleteDeploymentGroupResult deleteDeploymentGroup ( DeleteDeploymentGroupRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDeleteDeploymentGroup ( request ) ;
public class SessionDAO { /** * Updates session details obtained frm the services . * @ return True if session was updated . If false the update is for a different user or session is not started . */ public boolean updateSessionDetails ( final SessionData session ) { } }
synchronized ( sharedLock ) { if ( session != null ) { SharedPreferences . Editor editor = getSharedPreferences ( ) . edit ( ) ; editor . putString ( KEY_PROFILE_ID , session . getProfileId ( ) ) ; editor . putString ( KEY_SESSION_ID , session . getSessionId ( ) ) ; editor . putString ( KEY_ACCESS_TOKEN , session . getAccessToken ( ) ) ; editor . putLong ( KEY_EXPIRES_ON , session . getExpiresOn ( ) ) ; boolean isUpdated = editor . commit ( ) ; sharedLock . notifyAll ( ) ; return isUpdated ; } sharedLock . notifyAll ( ) ; } return false ;
public class ColorXyz { /** * Conversion from 8 - bit RGB into XYZ . 8 - bit = range of 0 to 255. */ public static void rgbToXyz ( int r , int g , int b , double xyz [ ] ) { } }
srgbToXyz ( r / 255.0 , g / 255.0 , b / 255.0 , xyz ) ;
public class ssl_cert { /** * < pre > * Converts API response of bulk operation into object and returns the object array in case of get request . * < / pre > */ protected base_resource [ ] get_nitro_bulk_response ( nitro_service service , String response ) throws Exception { } }
ssl_cert_responses result = ( ssl_cert_responses ) service . get_payload_formatter ( ) . string_to_resource ( ssl_cert_responses . class , response ) ; if ( result . errorcode != 0 ) { if ( result . errorcode == SESSION_NOT_EXISTS ) service . clear_session ( ) ; throw new nitro_exception ( result . message , result . errorcode , ( base_response [ ] ) result . ssl_cert_response_array ) ; } ssl_cert [ ] result_ssl_cert = new ssl_cert [ result . ssl_cert_response_array . length ] ; for ( int i = 0 ; i < result . ssl_cert_response_array . length ; i ++ ) { result_ssl_cert [ i ] = result . ssl_cert_response_array [ i ] . ssl_cert [ 0 ] ; } return result_ssl_cert ;
public class JCloudsStorageModule { /** * { @ inheritDoc } * @ throws Exception */ @ Override public synchronized void write ( byte [ ] bytes , long storageIndex ) throws IOException { } }
final int bucketIndex = ( int ) ( storageIndex / SIZE_PER_BUCKET ) ; final int bucketOffset = ( int ) ( storageIndex % SIZE_PER_BUCKET ) ; try { // / / DEBUG CODE // writer . write ( bucketIndex + " , " + storageIndex + " , " + // bucketOffset + " , " + bytes . length + // writer . flush ( ) ; byte [ ] data = mByteCache . getIfPresent ( bucketIndex ) ; if ( data == null ) { data = getAndprefetchBuckets ( bucketIndex ) ; } System . arraycopy ( bytes , 0 , data , bucketOffset , bytes . length + bucketOffset > SIZE_PER_BUCKET ? SIZE_PER_BUCKET - bucketOffset : bytes . length ) ; storeBucket ( bucketIndex , data ) ; mByteCache . put ( bucketIndex , data ) ; if ( bucketOffset + bytes . length > SIZE_PER_BUCKET ) { data = mByteCache . getIfPresent ( bucketIndex + 1 ) ; if ( data == null ) { data = getAndprefetchBuckets ( bucketIndex + 1 ) ; } System . arraycopy ( bytes , SIZE_PER_BUCKET - bucketOffset , data , 0 , bytes . length - ( SIZE_PER_BUCKET - bucketOffset ) ) ; storeBucket ( bucketIndex + 1 , data ) ; mByteCache . put ( bucketIndex + 1 , data ) ; } } catch ( ExecutionException | InterruptedException exc ) { throw new IOException ( exc ) ; }
public class MatrixFeatures_ZDRM { /** * Checks to see if a matrix is upper triangular or Hessenberg . A Hessenberg matrix of degree N * has the following property : < br > * < br > * a < sub > ij < / sub > & le ; 0 for all i & lt ; j + N < br > * < br > * A triangular matrix is a Hessenberg matrix of degree 0. * @ param A Matrix being tested . Not modified . * @ param hessenberg The degree of being hessenberg . * @ param tol How close to zero the lower left elements need to be . * @ return If it is an upper triangular / hessenberg matrix or not . */ public static boolean isUpperTriangle ( ZMatrixRMaj A , int hessenberg , double tol ) { } }
tol *= tol ; for ( int i = hessenberg + 1 ; i < A . numRows ; i ++ ) { int maxCol = Math . min ( i - hessenberg , A . numCols ) ; for ( int j = 0 ; j < maxCol ; j ++ ) { int index = ( i * A . numCols + j ) * 2 ; double real = A . data [ index ] ; double imag = A . data [ index + 1 ] ; double mag = real * real + imag * imag ; if ( ! ( mag <= tol ) ) { return false ; } } } return true ;
public class Util { /** * Deletes the contents of the given directory ( but not the directory itself ) * recursively . * It does not take no for an answer - if necessary , it will have multiple * attempts at deleting things . * @ throws IOException * if the operation fails . */ public static void deleteContentsRecursive ( @ Nonnull File file ) throws IOException { } }
deleteContentsRecursive ( fileToPath ( file ) , PathRemover . PathChecker . ALLOW_ALL ) ;
public class CheckMissingAndExtraRequires { /** * or null if no part refers to a class . */ private static ImmutableList < String > getClassNames ( String qualifiedName ) { } }
ImmutableList . Builder < String > classNames = ImmutableList . builder ( ) ; List < String > parts = DOT_SPLITTER . splitToList ( qualifiedName ) ; for ( int i = 0 ; i < parts . size ( ) ; i ++ ) { String part = parts . get ( i ) ; if ( isClassOrConstantName ( part ) ) { classNames . add ( DOT_JOINER . join ( parts . subList ( 0 , i + 1 ) ) ) ; } } return classNames . build ( ) ;
public class XMLConfigurationProvider { /** * This method will return the content of this particular * < code > element < / code > . For example , * < pre > * < result > something < / result > * < / pre > * When the { @ link org . w3c . dom . Element } < code > & lt ; result & gt ; < / code > is * passed in as argument ( < code > element < / code > to this method , it returns * the content of it , namely , < code > something < / code > in the example above . * @ return */ private String getContent ( Element element ) { } }
StringBuilder paramValue = new StringBuilder ( ) ; NodeList childNodes = element . getChildNodes ( ) ; for ( int j = 0 ; j < childNodes . getLength ( ) ; j ++ ) { Node currentNode = childNodes . item ( j ) ; if ( currentNode != null && currentNode . getNodeType ( ) == Node . TEXT_NODE ) { String val = currentNode . getNodeValue ( ) ; if ( val != null ) { paramValue . append ( val . trim ( ) ) ; } } } return paramValue . toString ( ) . trim ( ) ;
public class SystemUtil { /** * Gets the named resource as a stream from the given Class ' Classoader . * If the pGuessSuffix parameter is true , the method will try to append * typical properties file suffixes , such as " . properties " or " . xml " . * @ param pClassLoader the class loader to use * @ param pName name of the resource * @ param pGuessSuffix guess suffix * @ return an input stream reading from the resource */ private static InputStream getResourceAsStream ( ClassLoader pClassLoader , String pName , boolean pGuessSuffix ) { } }
InputStream is ; if ( ! pGuessSuffix ) { is = pClassLoader . getResourceAsStream ( pName ) ; // If XML , wrap stream if ( is != null && pName . endsWith ( XML_PROPERTIES ) ) { is = new XMLPropertiesInputStream ( is ) ; } } else { // Try normal properties is = pClassLoader . getResourceAsStream ( pName + STD_PROPERTIES ) ; // Try XML if ( is == null ) { is = pClassLoader . getResourceAsStream ( pName + XML_PROPERTIES ) ; // Wrap stream if ( is != null ) { is = new XMLPropertiesInputStream ( is ) ; } } } // Return stream return is ;
public class SocketExtensions { /** * Reads an object from the given socket InetAddress . * @ param serverName * The Name from the address to read . * @ param port * The port to read . * @ return the object * @ throws IOException * Signals that an I / O exception has occurred . * @ throws ClassNotFoundException * the class not found exception */ public static Object readObject ( final String serverName , final int port ) throws IOException , ClassNotFoundException { } }
final InetAddress inetAddress = InetAddress . getByName ( serverName ) ; return readObject ( new Socket ( inetAddress , port ) ) ;
public class ParameterValue { /** * Converts a string value ( s ) to the target collection type . You may optionally specify * a string pattern to assist in the type conversion . * @ param collectionClass * @ param classOfT * @ param pattern optional pattern for interpreting the underlying request * string value . ( used for date & time conversions ) * @ return a collection of the values */ @ SuppressWarnings ( "unchecked" ) public < X extends Collection < T > , T > X toCollection ( Class < ? extends Collection > collectionClass , Class < T > classOfT , String pattern ) { } }
if ( collectionClass == null || classOfT == null ) { return null ; } try { // reflectively instantiate the target collection type using the default constructor Constructor < ? > constructor = collectionClass . getConstructor ( ) ; X collection = ( X ) constructor . newInstance ( ) ; // cheat by not instantiating a ParameterValue for every value ParameterValue parameterValue = newParameterValuePlaceHolder ( ) ; List < String > list = toList ( ) ; for ( String value : list ) { parameterValue . values [ 0 ] = value ; T t = ( T ) parameterValue . toObject ( classOfT , pattern ) ; collection . add ( t ) ; } return collection ; } catch ( NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e ) { throw new PippoRuntimeException ( e , "Failed to create collection" ) ; }
public class StandardJdbcProcessor { public Object [ ] executeMultiplePreparedStatements ( String [ ] statements , Collection inParams ) throws SQLException { } }
Object [ ] result ; if ( statements . length == inParams . size ( ) ) { result = new Object [ inParams . size ( ) ] ; Connection conn = null ; conn = dataSource . getConnection ( ) ; conn . setAutoCommit ( false ) ; try { Iterator inParamsIt = inParams . iterator ( ) ; int count = 0 ; while ( inParamsIt . hasNext ( ) ) { Object [ ] params = ( Object [ ] ) inParamsIt . next ( ) ; result [ count ] = executePreparedStatement ( statements [ count ] , new StatementInput ( params ) , false , conn ) ; count ++ ; } conn . commit ( ) ; } catch ( SQLException e ) { throw e ; } finally { if ( conn != null ) { conn . close ( ) ; } } } else { throw new SQLException ( "number of arguments doesn't match" ) ; } return result ;
public class CrossmapActivity { /** * Invokes the builder object for creating new output variable value . */ protected void runScript ( String mapperScript , Slurper slurper , Builder builder ) throws ActivityException , TransformerException { } }
CompilerConfiguration compilerConfig = new CompilerConfiguration ( ) ; compilerConfig . setScriptBaseClass ( CrossmapScript . class . getName ( ) ) ; Binding binding = new Binding ( ) ; binding . setVariable ( "runtimeContext" , getRuntimeContext ( ) ) ; binding . setVariable ( slurper . getName ( ) , slurper . getInput ( ) ) ; binding . setVariable ( builder . getName ( ) , builder ) ; GroovyShell shell = new GroovyShell ( getPackage ( ) . getCloudClassLoader ( ) , binding , compilerConfig ) ; Script gScript = shell . parse ( mapperScript ) ; gScript . run ( ) ;
public class ArduinoLibraryInstaller { /** * Copies the library from the packaged version into the installation directory . * @ param libraryName the library to copy * @ throws IOException if the copy could not complete . */ public void copyLibraryFromPackage ( String libraryName ) throws IOException { } }
Path ardDir = getArduinoDirectory ( ) . orElseThrow ( IOException :: new ) ; Path source = Paths . get ( embeddedDirectory ) . resolve ( libraryName ) ; Path dest = ardDir . resolve ( "libraries/" + libraryName ) ; if ( ! Files . exists ( dest ) ) { Files . createDirectory ( dest ) ; } Path gitRepoDir = dest . resolve ( ".git" ) ; if ( Files . exists ( gitRepoDir ) ) { throw new IOException ( "Git repository inside " + libraryName + "! Not proceeding to update path : " + dest ) ; } copyLibraryRecursive ( source , dest ) ;
public class LogFaxClientSpiInterceptor { /** * This function logs the event . * @ param eventType * The event type * @ param method * The method invoked * @ param arguments * The method arguments * @ param output * The method output * @ param throwable * The throwable while invoking the method */ protected void logEvent ( FaxClientSpiProxyEventType eventType , Method method , Object [ ] arguments , Object output , Throwable throwable ) { } }
// init log data int amount = 3 ; int argumentsAmount = 0 ; if ( arguments != null ) { argumentsAmount = arguments . length ; } if ( eventType == FaxClientSpiProxyEventType . POST_EVENT_TYPE ) { amount = amount + 2 ; } Object [ ] logData = new Object [ amount + argumentsAmount ] ; // set log data values switch ( eventType ) { case PRE_EVENT_TYPE : logData [ 0 ] = "Invoking " ; break ; case POST_EVENT_TYPE : logData [ 0 ] = "Invoked " ; break ; case ERROR_EVENT_TYPE : logData [ 0 ] = "Error while invoking " ; break ; } logData [ 1 ] = method . getName ( ) ; if ( argumentsAmount > 0 ) { logData [ 2 ] = " with data: " ; System . arraycopy ( arguments , 0 , logData , 3 , argumentsAmount ) ; } else { logData [ 2 ] = "" ; } if ( eventType == FaxClientSpiProxyEventType . POST_EVENT_TYPE ) { logData [ 3 + argumentsAmount ] = "\nOutput: " ; logData [ 4 + argumentsAmount ] = output ; } // get logger Logger logger = this . getLogger ( ) ; // log event switch ( eventType ) { case PRE_EVENT_TYPE : case POST_EVENT_TYPE : logger . logDebug ( logData , throwable ) ; break ; case ERROR_EVENT_TYPE : logger . logError ( logData , throwable ) ; break ; }
public class AdapterUtil { /** * Create an XAException with a translated error message and an XA error code . * The XAException constructors provided by the XAException API allow only for either an * error message or an XA error code to be specified . This method constructs an * XAException with both . The error message is created from the NLS key and arguments . * @ param key the NLS key . * @ param args Object or Object [ ] listing parameters for the message ; can be null if none . * @ param xaErrorCode the XA error code . * @ return a newly constructed XAException with the specified XA error code and a * descriptive error message . */ public static XAException createXAException ( String key , Object args , int xaErrorCode ) { } }
XAException xaX = new XAException ( args == null ? getNLSMessage ( key ) : getNLSMessage ( key , args ) ) ; xaX . errorCode = xaErrorCode ; return xaX ;
public class SimpleDialog { /** * Sets the text color , size , style of the message view from the specified TextAppearance resource . * @ param resId The resourceId value . * @ return The SimpleDialog for chaining methods . */ public SimpleDialog messageTextAppearance ( int resId ) { } }
if ( mMessageTextAppearanceId != resId ) { mMessageTextAppearanceId = resId ; if ( mMessage != null ) mMessage . setTextAppearance ( getContext ( ) , mMessageTextAppearanceId ) ; } return this ;
public class ProtoUtils { /** * Returns the expected javascript package for protos based on the . proto file . */ private static String getJsPackage ( FileDescriptor file ) { } }
String protoPackage = file . getPackage ( ) ; if ( ! protoPackage . isEmpty ( ) ) { return "proto." + protoPackage ; } return "proto" ;
public class AbstractResultSetWrapper { /** * { @ inheritDoc } * @ see java . sql . ResultSet # updateBlob ( int , java . sql . Blob ) */ @ Override public void updateBlob ( final int columnIndex , final Blob x ) throws SQLException { } }
wrapped . updateBlob ( columnIndex , x ) ;
public class ZWaveWakeUpCommandClass { /** * Event handler for incoming Z - Wave events . We monitor Z - Wave events for completed * transactions . Once a transaction is completed for the WAKE _ UP _ NO _ MORE _ INFORMATION * event , we set the node state to asleep . * { @ inheritDoc } */ @ Override public void ZWaveIncomingEvent ( ZWaveEvent event ) { } }
if ( event . getEventType ( ) != ZWaveEvent . ZWaveEventType . TRANSACTION_COMPLETED_EVENT ) return ; SerialMessage serialMessage = ( SerialMessage ) event . getEventValue ( ) ; if ( serialMessage . getMessageClass ( ) != SerialMessage . SerialMessageClass . SendData && serialMessage . getMessageType ( ) != SerialMessage . SerialMessageType . Request ) return ; byte [ ] payload = serialMessage . getMessagePayload ( ) ; if ( payload . length < 4 ) return ; if ( ( payload [ 0 ] & 0xFF ) != this . getNode ( ) . getNodeId ( ) ) return ; if ( ( payload [ 2 ] & 0xFF ) != this . getCommandClass ( ) . getKey ( ) ) return ; if ( ( payload [ 3 ] & 0xFF ) != WAKE_UP_NO_MORE_INFORMATION ) return ; logger . debug ( "Node {} went to sleep" , this . getNode ( ) . getNodeId ( ) ) ; this . setAwake ( false ) ;
public class JDBDT { /** * Create a new database handle for given database * URL , user and password . * < p > Calling this method is shorthand for : < br > * & nbsp ; & nbsp ; & nbsp ; & nbsp ; * < code > database ( DriverManager . getConnection ( url , user , password ) ) < / code > . * @ param url Database URL . * @ param user Database user . * @ param password Database password . * @ return A new database handle for the given connection . * @ throws SQLException If the connection cannot be created . * @ see # database ( Connection ) * @ see DriverManager # getConnection ( String , String , String ) */ public static DB database ( String url , String user , String password ) throws SQLException { } }
return database ( DriverManager . getConnection ( url , user , password ) ) ;
public class LogImpl { /** * Add a Log Sink . * @ param logSinkClass The logsink classname or null for the default . */ public synchronized void add ( String logSinkClass ) { } }
try { if ( logSinkClass == null || logSinkClass . length ( ) == 0 ) logSinkClass = "org.browsermob.proxy.jetty.log.OutputStreamLogSink" ; Class sinkClass = Loader . loadClass ( this . getClass ( ) , logSinkClass ) ; LogSink sink = ( LogSink ) sinkClass . newInstance ( ) ; add ( sink ) ; } catch ( Exception e ) { message ( WARN , e , 2 ) ; throw new IllegalArgumentException ( e . toString ( ) ) ; }
public class SoapServerFaultResponseActionBuilder { /** * Sets the response status . * @ param status * @ return */ public SoapServerFaultResponseActionBuilder status ( HttpStatus status ) { } }
soapMessage . header ( SoapMessageHeaders . HTTP_STATUS_CODE , status . value ( ) ) ; return this ;
public class X509CRLImpl { /** * return the AuthorityKeyIdentifier , if any . * @ returns AuthorityKeyIdentifier or null * ( if no AuthorityKeyIdentifierExtension ) * @ throws IOException on error */ public KeyIdentifier getAuthKeyId ( ) throws IOException { } }
AuthorityKeyIdentifierExtension aki = getAuthKeyIdExtension ( ) ; if ( aki != null ) { KeyIdentifier keyId = ( KeyIdentifier ) aki . get ( AuthorityKeyIdentifierExtension . KEY_ID ) ; return keyId ; } else { return null ; }
public class JSError { /** * Creates a JSError with no source information * @ param type The DiagnosticType * @ param arguments Arguments to be incorporated into the message */ public static JSError make ( DiagnosticType type , String ... arguments ) { } }
return new JSError ( null , null , - 1 , - 1 , type , null , arguments ) ;
public class FilterBasedTriggeringPolicy { /** * Add a filter to end of the filter list . * @ param newFilter filter to add to end of list . */ public void addFilter ( final Filter newFilter ) { } }
if ( headFilter == null ) { headFilter = newFilter ; tailFilter = newFilter ; } else { tailFilter . next = newFilter ; tailFilter = newFilter ; }
public class PeerGroup { /** * Convenience for connecting only to peers that can serve specific services . It will configure suitable peer * discoveries . * @ param requiredServices Required services as a bitmask , e . g . { @ link VersionMessage # NODE _ NETWORK } . */ public void setRequiredServices ( long requiredServices ) { } }
lock . lock ( ) ; try { this . requiredServices = requiredServices ; peerDiscoverers . clear ( ) ; addPeerDiscovery ( MultiplexingDiscovery . forServices ( params , requiredServices ) ) ; } finally { lock . unlock ( ) ; }
public class Messages { /** * Looks for a property / message in < code > activejdbc _ messages < / code > bundle . * @ param key key of the property . * @ param params list of substitution parameters for a message . * @ return message merged with parameters ( if provided ) , or key if message not found . */ public static String message ( String key , Object ... params ) { } }
return message ( key , null , params ) ;
public class DataUtil { /** * little - endian or intel format . */ public static byte [ ] getBytesLittleEndian ( long value ) { } }
byte [ ] b = new byte [ 8 ] ; b [ 0 ] = ( byte ) ( value & 0xFF ) ; b [ 1 ] = ( byte ) ( ( value >> 8 ) & 0xFF ) ; b [ 2 ] = ( byte ) ( ( value >> 16 ) & 0xFF ) ; b [ 3 ] = ( byte ) ( ( value >> 24 ) & 0xFF ) ; b [ 4 ] = ( byte ) ( ( value >> 32 ) & 0xFF ) ; b [ 5 ] = ( byte ) ( ( value >> 40 ) & 0xFF ) ; b [ 6 ] = ( byte ) ( ( value >> 48 ) & 0xFF ) ; b [ 7 ] = ( byte ) ( ( value >> 56 ) & 0xFF ) ; return b ;
public class JCusolverSp { /** * < pre > * - - - - - CPU least square solver by QR factorization * solve min | b - A * x | * [ lsq ] stands for least square * [ v ] stands for vector * [ qr ] stands for QR factorization * < / pre > */ public static int cusolverSpScsrlsqvqrHost ( cusolverSpHandle handle , int m , int n , int nnz , cusparseMatDescr descrA , Pointer csrValA , Pointer csrRowPtrA , Pointer csrColIndA , Pointer b , float tol , Pointer rankA , Pointer x , Pointer p , Pointer min_norm ) { } }
return checkResult ( cusolverSpScsrlsqvqrHostNative ( handle , m , n , nnz , descrA , csrValA , csrRowPtrA , csrColIndA , b , tol , rankA , x , p , min_norm ) ) ;
public class InstanceResource { /** * Handles cancellation of leases for this particular instance . * @ param isReplication * a header parameter containing information whether this is * replicated from other nodes . * @ return response indicating whether the operation was a success or * failure . */ @ DELETE public Response cancelLease ( @ HeaderParam ( PeerEurekaNode . HEADER_REPLICATION ) String isReplication ) { } }
try { boolean isSuccess = registry . cancel ( app . getName ( ) , id , "true" . equals ( isReplication ) ) ; if ( isSuccess ) { logger . debug ( "Found (Cancel): {} - {}" , app . getName ( ) , id ) ; return Response . ok ( ) . build ( ) ; } else { logger . info ( "Not Found (Cancel): {} - {}" , app . getName ( ) , id ) ; return Response . status ( Status . NOT_FOUND ) . build ( ) ; } } catch ( Throwable e ) { logger . error ( "Error (cancel): {} - {}" , app . getName ( ) , id , e ) ; return Response . serverError ( ) . build ( ) ; }
public class AnimaQuery { /** * Querying a List < Map > * @ param sql sql statement * @ param params params * @ return List < Map > */ public List < Map < String , Object > > queryListMap ( String sql , Object [ ] params ) { } }
Connection conn = getConn ( ) ; try { return conn . createQuery ( sql ) . withParams ( params ) . setAutoDeriveColumnNames ( true ) . throwOnMappingFailure ( false ) . executeAndFetchTable ( ) . asList ( ) ; } finally { this . closeConn ( conn ) ; this . clean ( null ) ; }
public class CPDefinitionUtil { /** * Returns the first cp definition 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 first matching cp definition , or < code > null < / code > if a matching cp definition could not be found */ public static CPDefinition fetchByGroupId_First ( long groupId , OrderByComparator < CPDefinition > orderByComparator ) { } }
return getPersistence ( ) . fetchByGroupId_First ( groupId , orderByComparator ) ;
public class OperatorFactory { /** * Get operator instance for requested opcode . * @ param opcode requested operator opcode . * @ return operator instance . * @ throws TemplateException if operator is not implemented . */ @ SuppressWarnings ( "unchecked" ) public < T extends Operator > T geInstance ( Opcode opcode ) { } }
Operator operator = this . operators . get ( opcode ) ; if ( operator == null ) { throw new TemplateException ( "Operator |%s| is not implemented." , opcode ) ; } return ( T ) operator ;
public class DbxWebAuth { /** * Call this after the user has visited the authorizaton URL and Dropbox has redirected them * back to you at the redirect URI . * @ param redirectUri The original redirect URI used by { @ link # authorize } , never { @ code null } . * @ param sessionStore Session store used by { @ link # authorize } to store CSRF tokens , never * { @ code null } . * @ param params The query parameters on the GET request to your redirect URI , never { @ code * null } . * @ throws BadRequestException If the redirect request is missing required query parameters , * contains duplicate parameters , or includes mutually exclusive parameters ( e . g . { @ code * " error " } and { @ code " code " } ) . * @ throws BadStateException If the CSRF token retrieved from { @ code sessionStore } is { @ code * null } or malformed . * @ throws CsrfException If the CSRF token passed in { @ code params } does not match the CSRF * token from { @ code sessionStore } . This implies the redirect request may be forged . * @ throws NotApprovedException If the user chose to deny the authorization request . * @ throws ProviderException If an OAuth2 error response besides { @ code " access _ denied " } is * set . * @ throws DbxException If an error occurs communicating with Dropbox . */ public DbxAuthFinish finishFromRedirect ( String redirectUri , DbxSessionStore sessionStore , Map < String , String [ ] > params ) throws DbxException , BadRequestException , BadStateException , CsrfException , NotApprovedException , ProviderException { } }
if ( redirectUri == null ) throw new NullPointerException ( "redirectUri" ) ; if ( sessionStore == null ) throw new NullPointerException ( "sessionStore" ) ; if ( params == null ) throw new NullPointerException ( "params" ) ; String state = getParam ( params , "state" ) ; if ( state == null ) { throw new BadRequestException ( "Missing required parameter: \"state\"." ) ; } String error = getParam ( params , "error" ) ; String code = getParam ( params , "code" ) ; String errorDescription = getParam ( params , "error_description" ) ; if ( code == null && error == null ) { throw new BadRequestException ( "Missing both \"code\" and \"error\"." ) ; } if ( code != null && error != null ) { throw new BadRequestException ( "Both \"code\" and \"error\" are set." ) ; } if ( code != null && errorDescription != null ) { throw new BadRequestException ( "Both \"code\" and \"error_description\" are set." ) ; } state = verifyAndStripCsrfToken ( state , sessionStore ) ; if ( error != null ) { if ( error . equals ( "access_denied" ) ) { // User clicked " Deny " String exceptionMessage = errorDescription == null ? "No additional description from Dropbox" : "Additional description from Dropbox: " + errorDescription ; throw new NotApprovedException ( exceptionMessage ) ; } else { // All other errors String exceptionMessage = errorDescription == null ? error : String . format ( "%s: %s" , error , errorDescription ) ; throw new ProviderException ( exceptionMessage ) ; } } return finish ( code , redirectUri , state ) ;
public class PreparedStatement { /** * { @ inheritDoc } */ public void setBinaryStream ( final int parameterIndex , final InputStream x , final long length ) throws SQLException { } }
setBytes ( parameterIndex , createBytes ( x , length ) ) ;
public class ColorConverter { /** * Creates a new instance of the class . Required by Log4J2. * @ param config the configuration * @ param options the options * @ return a new instance , or { @ code null } if the options are invalid */ public static ColorConverter newInstance ( Configuration config , String [ ] options ) { } }
if ( options . length < 1 ) { LOGGER . error ( "Incorrect number of options on style. " + "Expected at least 1, received {}" , options . length ) ; return null ; } if ( options [ 0 ] == null ) { LOGGER . error ( "No pattern supplied on style" ) ; return null ; } PatternParser parser = PatternLayout . createPatternParser ( config ) ; List < PatternFormatter > formatters = parser . parse ( options [ 0 ] ) ; AnsiElement element = ( options . length != 1 ) ? ELEMENTS . get ( options [ 1 ] ) : null ; return new ColorConverter ( formatters , element ) ;
public class JTATxManager { /** * Return the TransactionManager of the external app */ private TransactionManager getTransactionManager ( ) { } }
TransactionManager retval = null ; try { if ( log . isDebugEnabled ( ) ) log . debug ( "getTransactionManager called" ) ; retval = TransactionManagerFactoryFactory . instance ( ) . getTransactionManager ( ) ; } catch ( TransactionManagerFactoryException e ) { log . warn ( "Exception trying to obtain TransactionManager from Factory" , e ) ; e . printStackTrace ( ) ; } return retval ;
public class AbstractSnapshotTaskRunner { /** * A helper method that takes a json string and extracts the value of the specified * property . * @ param json the json string * @ param propName the name of the property to extract * @ param < T > The type for the value expected to be returned . * @ return the value of the specified property * @ throws IOException */ protected < T > T getValueFromJson ( String json , String propName ) throws IOException { } }
return ( T ) jsonStringToMap ( json ) . get ( propName ) ;
public class AbstractDraweeController { /** * Removes controller listener . */ public void removeControllerListener ( ControllerListener < ? super INFO > controllerListener ) { } }
Preconditions . checkNotNull ( controllerListener ) ; if ( mControllerListener instanceof InternalForwardingListener ) { ( ( InternalForwardingListener < INFO > ) mControllerListener ) . removeListener ( controllerListener ) ; return ; } if ( mControllerListener == controllerListener ) { mControllerListener = null ; }
public class TrialMinutesMarshaller { /** * Marshall the given parameter object . */ public void marshall ( TrialMinutes trialMinutes , ProtocolMarshaller protocolMarshaller ) { } }
if ( trialMinutes == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( trialMinutes . getTotal ( ) , TOTAL_BINDING ) ; protocolMarshaller . marshall ( trialMinutes . getRemaining ( ) , REMAINING_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class AmazonAppStreamWaiters { /** * Builds a FleetStopped waiter by using custom parameters waiterParameters and other parameters defined in the * waiters specification , and then polls until it determines whether the resource entered the desired state or not , * where polling criteria is bound by either default polling strategy or custom polling strategy . */ public Waiter < DescribeFleetsRequest > fleetStopped ( ) { } }
return new WaiterBuilder < DescribeFleetsRequest , DescribeFleetsResult > ( ) . withSdkFunction ( new DescribeFleetsFunction ( client ) ) . withAcceptors ( new FleetStopped . IsINACTIVEMatcher ( ) , new FleetStopped . IsPENDING_ACTIVATEMatcher ( ) , new FleetStopped . IsACTIVEMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 30 ) ) ) . withExecutorService ( executorService ) . build ( ) ;
public class BlockMetadataManager { /** * Modifies the size of a temp block . * @ param tempBlockMeta the temp block to modify * @ param newSize new size in bytes * @ throws InvalidWorkerStateException when newSize is smaller than current size */ public void resizeTempBlockMeta ( TempBlockMeta tempBlockMeta , long newSize ) throws InvalidWorkerStateException { } }
StorageDir dir = tempBlockMeta . getParentDir ( ) ; dir . resizeTempBlockMeta ( tempBlockMeta , newSize ) ;
public class CSP2SourceList { /** * Add a host * @ param aHost * Host to add . Must be a valid URL . * @ return this */ @ Nonnull public CSP2SourceList addHost ( @ Nonnull final ISimpleURL aHost ) { } }
ValueEnforcer . notNull ( aHost , "Host" ) ; return addHost ( aHost . getAsStringWithEncodedParameters ( ) ) ;
public class CassandraClientBase { /** * On column . * @ param m * the m * @ param isRelation * the is relation * @ param relations * the relations * @ param entities * the entities * @ param columns * the columns * @ param subManagedType * the sub managed type * @ param key * the key */ protected void onColumn ( EntityMetadata m , boolean isRelation , List < String > relations , List < Object > entities , List < Column > columns , List < AbstractManagedType > subManagedType , ByteBuffer key ) { } }
if ( ! columns . isEmpty ( ) ) { Object id = PropertyAccessorHelper . getObject ( m . getIdAttribute ( ) . getJavaType ( ) , key . array ( ) ) ; ThriftRow tr = new ThriftRow ( id , m . getTableName ( ) , columns , new ArrayList < SuperColumn > ( 0 ) , new ArrayList < CounterColumn > ( 0 ) , new ArrayList < CounterSuperColumn > ( 0 ) ) ; Object o = null ; if ( ! subManagedType . isEmpty ( ) ) { for ( AbstractManagedType subEntity : subManagedType ) { EntityMetadata subEntityMetadata = KunderaMetadataManager . getEntityMetadata ( kunderaMetadata , subEntity . getJavaType ( ) ) ; o = getDataHandler ( ) . populateEntity ( tr , subEntityMetadata , KunderaCoreUtils . getEntity ( o ) , subEntityMetadata . getRelationNames ( ) , isRelation ) ; if ( o != null ) { break ; } } } else { o = getDataHandler ( ) . populateEntity ( tr , m , KunderaCoreUtils . getEntity ( o ) , relations , isRelation ) ; } if ( log . isInfoEnabled ( ) ) { log . info ( "Populating data for entity of clazz {} and row key {}." , m . getEntityClazz ( ) , tr . getId ( ) ) ; } if ( o != null ) { entities . add ( o ) ; } }
public class NonRecycleableTaglibs { /** * collect all possible attributes given the name of methods available . * @ param cls * the class to look for setter methods to infer properties * @ return the map of possible attributes / types */ private static Map < QMethod , String > getAttributes ( JavaClass cls ) { } }
Map < QMethod , String > atts = new HashMap < > ( ) ; Method [ ] methods = cls . getMethods ( ) ; for ( Method m : methods ) { String name = m . getName ( ) ; if ( name . startsWith ( "set" ) && m . isPublic ( ) && ! m . isStatic ( ) ) { String sig = m . getSignature ( ) ; List < String > args = SignatureUtils . getParameterSignatures ( sig ) ; if ( ( args . size ( ) == 1 ) && Values . SIG_VOID . equals ( SignatureUtils . getReturnSignature ( sig ) ) ) { String parmSig = args . get ( 0 ) ; if ( validAttrTypes . contains ( parmSig ) ) { Code code = m . getCode ( ) ; if ( ( code != null ) && ( code . getCode ( ) . length < MAX_ATTRIBUTE_CODE_LENGTH ) ) { atts . put ( new QMethod ( name , sig ) , parmSig ) ; } } } } } return atts ;
public class CPDefinitionLinkPersistenceImpl { /** * Returns the cp definition link where CPDefinitionId = & # 63 ; and CProductId = & # 63 ; and type = & # 63 ; or throws a { @ link NoSuchCPDefinitionLinkException } if it could not be found . * @ param CPDefinitionId the cp definition ID * @ param CProductId the c product ID * @ param type the type * @ return the matching cp definition link * @ throws NoSuchCPDefinitionLinkException if a matching cp definition link could not be found */ @ Override public CPDefinitionLink findByC_C_T ( long CPDefinitionId , long CProductId , String type ) throws NoSuchCPDefinitionLinkException { } }
CPDefinitionLink cpDefinitionLink = fetchByC_C_T ( CPDefinitionId , CProductId , type ) ; if ( cpDefinitionLink == null ) { StringBundler msg = new StringBundler ( 8 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "CPDefinitionId=" ) ; msg . append ( CPDefinitionId ) ; msg . append ( ", CProductId=" ) ; msg . append ( CProductId ) ; msg . append ( ", type=" ) ; msg . append ( type ) ; msg . append ( "}" ) ; if ( _log . isDebugEnabled ( ) ) { _log . debug ( msg . toString ( ) ) ; } throw new NoSuchCPDefinitionLinkException ( msg . toString ( ) ) ; } return cpDefinitionLink ;
public class OverviewPlot { /** * Do a refresh ( when visibilities have changed ) . */ synchronized void refresh ( ) { } }
if ( reinitOnRefresh ) { LOG . debug ( "Reinitialize in thread " + Thread . currentThread ( ) . getName ( ) ) ; reinitialize ( ) ; reinitOnRefresh = false ; return ; } synchronized ( plot ) { boolean refreshcss = false ; if ( plotmap == null ) { throw new IllegalStateException ( "Plotmap is null" ) ; } final int thumbsize = ( int ) Math . max ( screenwidth / plotmap . getWidth ( ) , screenheight / plotmap . getHeight ( ) ) ; for ( PlotItem pi : plotmap . keySet ( ) ) { for ( Iterator < PlotItem > iter = pi . itemIterator ( ) ; iter . hasNext ( ) ; ) { PlotItem it = iter . next ( ) ; for ( Iterator < VisualizationTask > tit = it . tasks . iterator ( ) ; tit . hasNext ( ) ; ) { VisualizationTask task = tit . next ( ) ; Pair < Element , Visualization > pair = vistoelem . get ( it , task ) ; // New task ? if ( pair == null ) { if ( visibleInOverview ( task ) ) { Element elem = plot . svgElement ( SVGConstants . SVG_G_TAG ) ; pair = new Pair < > ( elem , embedOrThumbnail ( thumbsize , it , task , elem ) ) ; vistoelem . get ( it , null ) . first . appendChild ( elem ) ; vistoelem . put ( it , task , pair ) ; refreshcss = true ; } } else if ( pair . first != null ) { if ( visibleInOverview ( task ) ) { // unhide if hidden . if ( pair . first . hasAttribute ( SVGConstants . CSS_VISIBILITY_PROPERTY ) ) { pair . first . removeAttribute ( SVGConstants . CSS_VISIBILITY_PROPERTY ) ; } } else { // hide if there is anything to hide . if ( pair . first . hasChildNodes ( ) ) { pair . first . setAttribute ( SVGConstants . CSS_VISIBILITY_PROPERTY , SVGConstants . CSS_HIDDEN_VALUE ) ; } } // TODO : unqueue pending thumbnails } } } } if ( refreshcss ) { plot . updateStyleElement ( ) ; } }
public class Threads { /** * Returns a ListeningExecutorService based off of the global ThreadFactory */ public static ListeningExecutorService executor ( ) { } }
final ExecutorService svc = Executors . newCachedThreadPool ( MoreExecutors . platformThreadFactory ( ) ) ; return MoreExecutors . listeningDecorator ( svc ) ;
public class Position { /** * Returns a great circle bearing in degrees in the range 0 to 360. * @ param position * @ return */ public final double getBearingDegrees ( Position position ) { } }
double lat1 = toRadians ( lat ) ; double lat2 = toRadians ( position . lat ) ; double lon1 = toRadians ( lon ) ; double lon2 = toRadians ( position . lon ) ; double dLon = lon2 - lon1 ; double sinDLon = sin ( dLon ) ; double cosLat2 = cos ( lat2 ) ; double y = sinDLon * cosLat2 ; double x = cos ( lat1 ) * sin ( lat2 ) - sin ( lat1 ) * cosLat2 * cos ( dLon ) ; double course = FastMath . toDegrees ( atan2 ( y , x ) ) ; if ( course < 0 ) course += 360 ; return course ;
public class TextUtilities { /** * Converts the specified string to title case , by capitalizing the * first letter . * @ param str The string * @ since jEdit 4.0pre1 */ public static String toTitleCase ( String str ) { } }
if ( str . length ( ) == 0 ) { return str ; } else { return Character . toUpperCase ( str . charAt ( 0 ) ) + str . substring ( 1 ) . toLowerCase ( ) ; }
public class MethodBuilder { /** * Add proxy method to get unique id */ private void addGetId ( TypeSpec . Builder classBuilder ) { } }
MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "__getStubID" ) . addModifiers ( Modifier . PRIVATE ) . returns ( int . class ) . addStatement ( "android.os.Parcel data = android.os.Parcel.obtain()" ) . addStatement ( "android.os.Parcel reply = android.os.Parcel.obtain()" ) . addStatement ( "int result" ) ; methodBuilder . beginControlFlow ( "try" ) ; // write the descriptor methodBuilder . addStatement ( "data.writeInterfaceToken(DESCRIPTOR)" ) ; methodBuilder . addStatement ( "mRemote.transact(TRANSACTION__getStubID, data, reply, 0)" ) ; // read exception if any methodBuilder . addStatement ( "Throwable exception = checkException(reply)" ) ; methodBuilder . beginControlFlow ( "if(exception != null)" ) ; methodBuilder . addStatement ( "throw ($T)exception" , RuntimeException . class ) ; methodBuilder . endControlFlow ( ) ; methodBuilder . addStatement ( "result = reply.readInt()" ) ; // end of try methodBuilder . endControlFlow ( ) ; // catch rethrow methodBuilder . beginControlFlow ( "catch ($T re)" , ClassName . get ( "android.os" , "RemoteException" ) ) ; methodBuilder . addStatement ( "throw new $T(re)" , RuntimeException . class ) ; methodBuilder . endControlFlow ( ) ; // finally block methodBuilder . beginControlFlow ( "finally" ) ; methodBuilder . addStatement ( "reply.recycle()" ) ; methodBuilder . addStatement ( "data.recycle()" ) ; methodBuilder . endControlFlow ( ) ; methodBuilder . addStatement ( "return result" ) ; classBuilder . addMethod ( methodBuilder . build ( ) ) ;
public class CodedConstant { /** * get mapped type defined java expression . * @ param order field order * @ param type field type * @ param express java expression * @ param isList is field type is a { @ link List } * @ param isMap is field type is a { @ link Map } * @ return full java expression */ public static String getMappedTypeDefined ( int order , FieldType type , String express , boolean isList , boolean isMap ) { } }
StringBuilder code = new StringBuilder ( ) ; String fieldName = getFieldName ( order ) ; if ( ( type == FieldType . STRING || type == FieldType . BYTES ) && ! isList ) { // add null check code . append ( "com.google.protobuf.ByteString " ) . append ( fieldName ) . append ( " = null" ) . append ( CodeGenerator . JAVA_LINE_BREAK ) ; code . append ( "if (!CodedConstant.isNull(" ) . append ( express ) . append ( ")) {" ) . append ( CodeGenerator . LINE_BREAK ) ; String method = "copyFromUtf8" ; if ( type == FieldType . BYTES ) { method = "copyFrom" ; } code . append ( fieldName ) . append ( " = com.google.protobuf.ByteString." ) . append ( method ) . append ( "(" ) . append ( express ) . append ( ")" ) . append ( CodeGenerator . JAVA_LINE_BREAK ) ; code . append ( "}" ) . append ( CodeGenerator . LINE_BREAK ) ; return code . toString ( ) ; } // add null check String defineType = type . getJavaType ( ) ; if ( isList ) { defineType = "List" ; } else if ( isMap ) { defineType = "Map" ; } code . setLength ( 0 ) ; code . append ( defineType ) . append ( " " ) . append ( fieldName ) . append ( " = null" ) . append ( CodeGenerator . JAVA_LINE_BREAK ) ; code . append ( "if (!CodedConstant.isNull(" ) . append ( express ) . append ( ")) {" ) . append ( CodeGenerator . LINE_BREAK ) ; code . append ( fieldName ) . append ( " = " ) . append ( express ) . append ( CodeGenerator . JAVA_LINE_BREAK ) ; code . append ( "}" ) . append ( CodeGenerator . LINE_BREAK ) ; return code . toString ( ) ;
public class ImageTransformProcess { /** * Deserialize a JSON String ( created by { @ link # toJson ( ) } ) to a ImageTransformProcess * @ return ImageTransformProcess , from JSON */ public static ImageTransformProcess fromYaml ( String yaml ) { } }
try { return JsonMappers . getMapperYaml ( ) . readValue ( yaml , ImageTransformProcess . class ) ; } catch ( IOException e ) { // TODO better exceptions throw new RuntimeException ( e ) ; }
public class SARLQuickfixProvider { /** * Remove the element related to the issue , and the whitespaces before the element until one of the given * keywords is encountered . * @ param issue the issue . * @ param document the document . * @ param keyword1 the first keyword to consider . * @ param otherKeywords other keywords . * @ return < code > true < / code > if one keyword was found , < code > false < / code > if not . * @ throws BadLocationException if there is a problem with the location of the element . */ public boolean removeToPreviousKeyword ( Issue issue , IXtextDocument document , String keyword1 , String ... otherKeywords ) throws BadLocationException { } }
// Skip spaces before the element int index = issue . getOffset ( ) - 1 ; char c = document . getChar ( index ) ; while ( Character . isWhitespace ( c ) ) { index -- ; c = document . getChar ( index ) ; } // Skip non - spaces before the identifier final StringBuffer kw = new StringBuffer ( ) ; while ( ! Character . isWhitespace ( c ) ) { kw . insert ( 0 , c ) ; index -- ; c = document . getChar ( index ) ; } if ( kw . toString ( ) . equals ( keyword1 ) || Arrays . contains ( otherKeywords , kw . toString ( ) ) ) { // Skip spaces before the previous keyword while ( Character . isWhitespace ( c ) ) { index -- ; c = document . getChar ( index ) ; } final int delta = issue . getOffset ( ) - index - 1 ; document . replace ( index + 1 , issue . getLength ( ) + delta , "" ) ; // $ NON - NLS - 1 $ return true ; } return false ;
public class BusItinerary { /** * Replies the distance between two bus halt . * @ param firsthaltIndex is the index of the first bus halt . * @ param lasthaltIndex is the index of the last bus halt . * @ return the distance in meters between the given bus halts . */ @ Pure public double getDistanceBetweenBusHalts ( int firsthaltIndex , int lasthaltIndex ) { } }
if ( firsthaltIndex < 0 || firsthaltIndex >= this . validHalts . size ( ) - 1 ) { throw new ArrayIndexOutOfBoundsException ( firsthaltIndex ) ; } if ( lasthaltIndex <= firsthaltIndex || lasthaltIndex >= this . validHalts . size ( ) ) { throw new ArrayIndexOutOfBoundsException ( lasthaltIndex ) ; } double length = 0 ; final BusItineraryHalt b1 = this . validHalts . get ( firsthaltIndex ) ; final BusItineraryHalt b2 = this . validHalts . get ( lasthaltIndex ) ; final int firstSegment = b1 . getRoadSegmentIndex ( ) ; final int lastSegment = b2 . getRoadSegmentIndex ( ) ; for ( int i = firstSegment + 1 ; i < lastSegment ; ++ i ) { final RoadSegment segment = this . roadSegments . getRoadSegmentAt ( i ) ; length += segment . getLength ( ) ; } Direction1D direction = getRoadSegmentDirection ( firstSegment ) ; if ( direction . isRevertedSegmentDirection ( ) ) { length += b1 . getPositionOnSegment ( ) ; } else { length += this . roadSegments . getRoadSegmentAt ( firstSegment ) . getLength ( ) - b1 . getPositionOnSegment ( ) ; } direction = getRoadSegmentDirection ( lastSegment ) ; if ( direction . isSegmentDirection ( ) ) { length += b2 . getPositionOnSegment ( ) ; } else { length += this . roadSegments . getRoadSegmentAt ( firstSegment ) . getLength ( ) - b2 . getPositionOnSegment ( ) ; } return length ;
public class PositionDecoder { /** * Shortcut for live decoding ; no reasonableness check on distance to receiver * @ param reference used for reasonableness test and to decide which of the four resulting positions of the CPR algorithm is the right one * @ param msg airborne position message * @ return WGS84 coordinates with latitude and longitude in dec degrees , and altitude in meters . altitude might be null if unavailable * On error , the returned position is null . Check the . isReasonable ( ) flag before using the position . */ public Position decodePosition ( SurfacePositionV0Msg msg , Position reference ) { } }
return decodePosition ( System . currentTimeMillis ( ) / 1000.0 , msg , reference ) ;
public class RegexHashMap { /** * checks whether a specific value is container within either container or cache */ public boolean containsValue ( Object value ) { } }
// the value is a direct hit from our cache if ( cache . containsValue ( value ) ) return true ; // the value is a direct hit from our hashmap if ( container . containsValue ( value ) ) return true ; // otherwise , the value isn ' t within this object return false ;
public class CaptureStreamHandler { /** * Runs an executable and captures the output in a String array * @ param cmdline * command line arguments * @ return output of process * @ see CaptureStreamHandler # getOutput ( ) */ public static String [ ] run ( final String [ ] cmdline ) { } }
final CaptureStreamHandler handler = execute ( cmdline ) ; return handler . getOutput ( ) != null ? handler . getOutput ( ) : new String [ 0 ] ;
public class SeaGlassViewportUI { /** * Invokes the specified getter method if it exists . * @ param obj * The object on which to invoke the method . * @ param methodName * The name of the method . * @ param defaultValue * This value is returned , if the method does not exist . * @ return The value returned by the getter method or the default value . */ private static Object invokeGetter ( Object obj , String methodName , Object defaultValue ) { } }
try { Method method = obj . getClass ( ) . getMethod ( methodName , new Class [ 0 ] ) ; Object result = method . invoke ( obj , new Object [ 0 ] ) ; return result ; } catch ( NoSuchMethodException e ) { return defaultValue ; } catch ( IllegalAccessException e ) { return defaultValue ; } catch ( InvocationTargetException e ) { return defaultValue ; }
public class AccessControlFinder { /** * - - - - - window management */ public void openWindow ( final String title , final int width , final int height , final IsWidget content ) { } }
closeWindow ( ) ; window = new DefaultWindow ( title ) ; window . setWidth ( 480 ) ; window . setHeight ( 360 ) ; window . trapWidget ( content . asWidget ( ) ) ; window . setGlassEnabled ( true ) ; window . center ( ) ;
public class Vector4d { /** * Read this vector from the supplied { @ link ByteBuffer } starting at the specified * absolute buffer position / index . * This method will not increment the position of the given ByteBuffer . * @ param index * the absolute position into the ByteBuffer * @ param buffer * values will be read in < code > x , y , z , w < / code > order * @ return this */ public Vector4d set ( int index , ByteBuffer buffer ) { } }
MemUtil . INSTANCE . get ( this , index , buffer ) ; return this ;
public class Task { /** * { @ inheritDoc } */ @ Override public Object getCurrentValue ( FieldType field ) { } }
Object result = null ; if ( field != null ) { switch ( ( TaskField ) field ) { case PARENT_TASK_UNIQUE_ID : { result = m_parent == null ? Integer . valueOf ( - 1 ) : m_parent . getUniqueID ( ) ; break ; } case START_VARIANCE : { result = getStartVariance ( ) ; break ; } case FINISH_VARIANCE : { result = getFinishVariance ( ) ; break ; } case START_SLACK : { result = getStartSlack ( ) ; break ; } case FINISH_SLACK : { result = getFinishSlack ( ) ; break ; } case COST_VARIANCE : { result = getCostVariance ( ) ; break ; } case DURATION_VARIANCE : { result = getDurationVariance ( ) ; break ; } case WORK_VARIANCE : { result = getWorkVariance ( ) ; break ; } case CV : { result = getCV ( ) ; break ; } case SV : { result = getSV ( ) ; break ; } case TOTAL_SLACK : { result = getTotalSlack ( ) ; break ; } case CRITICAL : { result = Boolean . valueOf ( getCritical ( ) ) ; break ; } case COMPLETE_THROUGH : { result = getCompleteThrough ( ) ; break ; } default : { result = m_array [ field . getValue ( ) ] ; break ; } } } return ( result ) ;
public class Criteria { /** * Checks whether the property specified is supported by this { @ code Criteria } object . * @ param property * the property * @ return true , if the property is supported */ public final boolean appliesTo ( final URI property ) { } }
if ( this . properties . isEmpty ( ) || this . properties . contains ( property ) ) { return true ; } Preconditions . checkNotNull ( property ) ; return false ;
public class JsHdrsImpl { /** * Clear the fingerprint list from the message . * Javadoc description supplied by JsMessage interface . */ public void clearFingerprints ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "clearFingerprints" ) ; getHdr2 ( ) . setChoiceField ( JsHdr2Access . FINGERPRINTS , JsHdr2Access . IS_FINGERPRINTS_EMPTY ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "clearFingerprints" ) ;
public class ResourceConverter { /** * Sets an id attribute value to a target object . * @ param target target POJO * @ param idValue id node * @ throws IllegalAccessException thrown in case target field is not accessible */ private void setIdValue ( Object target , JsonNode idValue ) throws IllegalAccessException { } }
Field idField = configuration . getIdField ( target . getClass ( ) ) ; ResourceIdHandler idHandler = configuration . getIdHandler ( target . getClass ( ) ) ; if ( idValue != null ) { idField . set ( target , idHandler . fromString ( idValue . asText ( ) ) ) ; }
public class ViewHolder { /** * Obtain instance based on passed < code > view < / code > . * Newly created instance of < code > ViewHolder < / code > will be saved as a tag for passed < code > view < / code > . * Make sure the method { @ link View # setTag ( Object ) } won ' t be invoked from other scopes . * @ param view not null * @ return not null */ public static ViewHolder obtain ( View view ) { } }
if ( view . getTag ( ) instanceof ViewHolder ) { return ( ViewHolder ) view . getTag ( ) ; } return new ViewHolder ( view ) ;
public class MediaServicesInner { /** * Lists the keys for a Media Service . * @ param resourceGroupName Name of the resource group within the Azure subscription . * @ param mediaServiceName Name of the Media Service . * @ 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 < ServiceKeysInner > listKeysAsync ( String resourceGroupName , String mediaServiceName , final ServiceCallback < ServiceKeysInner > serviceCallback ) { } }
return ServiceFuture . fromResponse ( listKeysWithServiceResponseAsync ( resourceGroupName , mediaServiceName ) , serviceCallback ) ;
public class HeapDisk { /** * Allocates the given number of blocks and adds them to the given file . */ public synchronized void allocate ( RegularFile file , int count ) throws IOException { } }
int newAllocatedBlockCount = allocatedBlockCount + count ; if ( newAllocatedBlockCount > maxBlockCount ) { throw new IOException ( "out of disk space" ) ; } int newBlocksNeeded = Math . max ( count - blockCache . blockCount ( ) , 0 ) ; for ( int i = 0 ; i < newBlocksNeeded ; i ++ ) { file . addBlock ( new byte [ blockSize ] ) ; } if ( newBlocksNeeded != count ) { blockCache . transferBlocksTo ( file , count - newBlocksNeeded ) ; } allocatedBlockCount = newAllocatedBlockCount ;
public class DropboxClient { /** * Copy file from specified source to specified target . * @ param from source * @ param to target * @ return metadata of target file * @ see Entry */ public Entry copy ( String from , String to ) { } }
OAuthRequest request = new OAuthRequest ( Verb . GET , FILE_OPS_COPY_URL ) ; request . addQuerystringParameter ( "root" , "dropbox" ) ; request . addQuerystringParameter ( "from_path" , encode ( from ) ) ; request . addQuerystringParameter ( "to_path" , encode ( to ) ) ; service . signRequest ( accessToken , request ) ; String content = checkCopy ( request . send ( ) ) . getBody ( ) ; return Json . parse ( content , Entry . class ) ;
public class MockEC2QueryHandler { /** * Handles " authorizeSecurityGroupIngress " request to SecurityGroup and returns response with a SecurityGroup . * @ param groupId group Id for SecurityGroup . * @ param ipProtocol Ip protocol Name . * @ param fromPort from port ranges . * @ param toPort to port ranges . * @ param cidrIp cidr Ip for Permission * @ return a AuthorizeSecurityGroupIngressResponseType with our new SecurityGroup */ private AuthorizeSecurityGroupIngressResponseType authorizeSecurityGroupIngress ( final String groupId , final String ipProtocol , final Integer fromPort , final Integer toPort , final String cidrIp ) { } }
AuthorizeSecurityGroupIngressResponseType ret = new AuthorizeSecurityGroupIngressResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; mockSecurityGroupController . authorizeSecurityGroupIngress ( groupId , ipProtocol , fromPort , toPort , cidrIp ) ; return ret ;
public class RequestHelper { /** * Get the session ID of the passed string ( like in * " test . html ; JSESSIONID = 1234 " ) . < br > * Attention : this methods does not consider eventually present request * parameters . If parameters are present , they must be stripped away * explicitly ! * @ param aURL * The URL to get the session ID from . May not be < code > null < / code > . * @ return The session ID of the value or < code > null < / code > if no session ID * is present . */ @ Nullable public static String getSessionID ( @ Nonnull final ISimpleURL aURL ) { } }
ValueEnforcer . notNull ( aURL , "URL" ) ; // Ignore everything except the path return getSessionID ( aURL . getPath ( ) ) ;
public class CpeMemoryIndex { /** * Searches the index using the given search string . * @ param searchString the query text * @ param maxQueryResults the maximum number of documents to return * @ return the TopDocs found by the search * @ throws ParseException thrown when the searchString is invalid * @ throws IndexException thrown when there is an internal error resetting * the search analyzer * @ throws IOException is thrown if there is an issue with the underlying * Index */ public synchronized TopDocs search ( String searchString , int maxQueryResults ) throws ParseException , IndexException , IOException { } }
final Query query = parseQuery ( searchString ) ; return search ( query , maxQueryResults ) ;
public class AbstractRunMojo { /** * Log a warning indicating that fork mode has been explicitly disabled while some * conditions are present that require to enable it . * @ see # enableForkByDefault ( ) */ protected void logDisabledFork ( ) { } }
if ( getLog ( ) . isWarnEnabled ( ) ) { if ( hasAgent ( ) ) { getLog ( ) . warn ( "Fork mode disabled, ignoring agent" ) ; } if ( hasJvmArgs ( ) ) { RunArguments runArguments = resolveJvmArguments ( ) ; getLog ( ) . warn ( "Fork mode disabled, ignoring JVM argument(s) [" + Arrays . stream ( runArguments . asArray ( ) ) . collect ( Collectors . joining ( " " ) ) + "]" ) ; } if ( hasWorkingDirectorySet ( ) ) { getLog ( ) . warn ( "Fork mode disabled, ignoring working directory configuration" ) ; } }
public class ExampleConverterPlugin { /** * Returns a { @ link HasInputStream } as a lazy way to wrap an input stream with a base64 encode / decode stream * @ param hasResourceStream source * @ param doEncode true to encode * @ return lazy stream */ private static HasInputStream wrap ( final HasInputStream hasResourceStream , final boolean doEncode ) { } }
return new HasInputStream ( ) { @ Override public InputStream getInputStream ( ) throws IOException { return new Base64InputStream ( hasResourceStream . getInputStream ( ) , doEncode ) ; } @ Override public long writeContent ( OutputStream outputStream ) throws IOException { Base64OutputStream codec = new Base64OutputStream ( outputStream , doEncode ) ; try { return hasResourceStream . writeContent ( codec ) ; } finally { codec . flush ( ) ; codec . close ( ) ; } } } ;
public class CommandReader { /** * Make the request to the Twilio API to perform the read . * @ param client TwilioRestClient with which to make the request * @ return Command ResourceSet */ @ Override public ResourceSet < Command > read ( final TwilioRestClient client ) { } }
return new ResourceSet < > ( this , client , firstPage ( client ) ) ;
public class Widgets { /** * Makes the supplied widget " actionable " which means adding the " actionLabel " style to it and * binding the supplied click handler . * @ param enabled an optional value that governs the enabled state of the target . When the * value becomes false , the target ' s click handler and " actionLabel " style will be removed , * when it becomes true they will be reinstated . */ public static < T extends Widget & HasClickHandlers > T makeActionable ( final T target , final ClickHandler onClick , Value < Boolean > enabled ) { } }
if ( onClick != null ) { if ( enabled != null ) { enabled . addListenerAndTrigger ( new Value . Listener < Boolean > ( ) { public void valueChanged ( Boolean enabled ) { if ( ! enabled && _regi != null ) { _regi . removeHandler ( ) ; _regi = null ; target . removeStyleName ( "actionLabel" ) ; } else if ( enabled && _regi == null ) { _regi = target . addClickHandler ( onClick ) ; target . addStyleName ( "actionLabel" ) ; } } protected HandlerRegistration _regi ; } ) ; } else { target . addClickHandler ( onClick ) ; target . addStyleName ( "actionLabel" ) ; } } return target ;
public class LogBridge { /** * Utility method to reduce unchecked area . */ @ SuppressWarnings ( "unchecked" ) private static Enumeration < LogEntry > getLogEntries ( LogReaderService lrs ) { } }
return ( Enumeration < LogEntry > ) lrs . getLog ( ) ;
public class LeaseManager { /** * Remove the specified lease and src . */ synchronized LeaseOpenTime removeLease ( Lease lease , String src ) { } }
LeaseOpenTime leaseOpenTime = sortedLeasesByPath . remove ( src ) ; if ( ! lease . removePath ( src ) ) { LOG . error ( src + " not found in lease.paths (=" + lease . paths + ")" ) ; } if ( ! lease . hasPath ( ) ) { leases . remove ( lease . holder ) ; if ( ! sortedLeases . remove ( lease ) ) { LOG . error ( lease + " not found in sortedLeases" ) ; } } return leaseOpenTime ;
public class RequestHandler { /** * Helper method to dispatch the incoming { @ link CouchbaseRequest } to one or more nodes . * @ param request the request to dispatch . */ private void dispatchRequest ( final CouchbaseRequest request ) { } }
RingBufferMonitor . instance ( ) . removeRequest ( request ) ; ClusterConfig config = configuration ; // prevent non - bootstrap requests to go through if bucket not part of config if ( ! ( request instanceof BootstrapMessage ) ) { BucketConfig bucketConfig = config == null ? null : config . bucketConfig ( request . bucket ( ) ) ; if ( config == null || ( request . bucket ( ) != null && bucketConfig == null ) ) { failSafe ( environment . scheduler ( ) , true , request . observable ( ) , new BucketClosedException ( request . bucket ( ) + " has been closed" ) ) ; return ; } // short - circuit some kind of requests for which we know there won ' t be any handler to respond . try { checkFeaturesForRequest ( request , bucketConfig ) ; } catch ( ServiceNotAvailableException e ) { failSafe ( environment . scheduler ( ) , true , request . observable ( ) , e ) ; return ; } // don ' t send timed out requests to server if ( ! request . isActive ( ) ) { return ; } } locator ( request ) . locateAndDispatch ( request , nodes , config , environment , responseBuffer ) ;
public class RoseWebAppContext { /** * 如果配置文件没有自定义的messageSource定义 , 则由Rose根据最佳实践进行预设 */ public static void registerMessageSourceIfNecessary ( BeanDefinitionRegistry registry , String [ ] messageBaseNames ) { } }
if ( ! registry . containsBeanDefinition ( MESSAGE_SOURCE_BEAN_NAME ) ) { GenericBeanDefinition messageSource = new GenericBeanDefinition ( ) ; messageSource . setBeanClass ( ReloadableResourceBundleMessageSource . class ) ; MutablePropertyValues propertyValues = new MutablePropertyValues ( ) ; propertyValues . addPropertyValue ( "useCodeAsDefaultMessage" , true ) ; propertyValues . addPropertyValue ( "defaultEncoding" , "UTF-8" ) ; // properties文件也将使用UTF - 8编辑 , 而非默认的ISO - 9959-1 propertyValues . addPropertyValue ( "cacheSeconds" , 60 ) ; // 暂时hardcode ! seconds propertyValues . addPropertyValue ( "basenames" , messageBaseNames ) ; messageSource . setPropertyValues ( propertyValues ) ; registry . registerBeanDefinition ( MESSAGE_SOURCE_BEAN_NAME , messageSource ) ; }
public class Config { /** * Retrieves a configuration value with the given key constant ( e . g . Key . APPLICATION _ NAME ) * @ param key The key of the configuration value ( e . g . application . name ) * @ param defaultValue The default value to return of no key is found * @ return The configured value as String or the passed defautlValue if the key is not configured */ public String getString ( Key key , String defaultValue ) { } }
return getString ( key . toString ( ) , defaultValue ) ;
public class RequestContext { /** * Returns the identifier of the logged in user . If the user hasn ' t logged in , returns * < code > null < / code > . * @ return The identifier of the logged in user , or < code > null < / code > if the user hasn ' t logged in */ public Long getLoggedUserId ( ) { } }
HttpSession session = getRequest ( ) . getSession ( false ) ; return session == null ? null : ( Long ) session . getAttribute ( "loggedUserId" ) ;
public class QueryParamsMap { /** * loads keys * @ param key the key * @ param value the values */ protected final void loadKeys ( String key , String [ ] value ) { } }
String [ ] parsed = parseKey ( key ) ; if ( parsed == null ) { return ; } if ( ! queryMap . containsKey ( parsed [ 0 ] ) ) { queryMap . put ( parsed [ 0 ] , new QueryParamsMap ( ) ) ; } if ( ! parsed [ 1 ] . isEmpty ( ) ) { queryMap . get ( parsed [ 0 ] ) . loadKeys ( parsed [ 1 ] , value ) ; } else { queryMap . get ( parsed [ 0 ] ) . values = value . clone ( ) ; }
public class BaseGraph { /** * Initializes the node area with the empty edge value and default additional value . */ void initNodeRefs ( long oldCapacity , long newCapacity ) { } }
for ( long pointer = oldCapacity + N_EDGE_REF ; pointer < newCapacity ; pointer += nodeEntryBytes ) { nodes . setInt ( pointer , EdgeIterator . NO_EDGE ) ; } if ( extStorage . isRequireNodeField ( ) ) { for ( long pointer = oldCapacity + N_ADDITIONAL ; pointer < newCapacity ; pointer += nodeEntryBytes ) { nodes . setInt ( pointer , extStorage . getDefaultNodeFieldValue ( ) ) ; } }
public class NamespacesInner { /** * The Get Operation Status operation returns the status of the specified operation . After calling an asynchronous operation , you can call Get Operation Status to determine whether the operation has succeeded , failed , or is still in progress . * @ param operationStatusLink Location value returned by the Begin operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceResponse } object if successful . */ public Observable < ServiceResponse < Void > > getLongRunningOperationStatusWithServiceResponseAsync ( String operationStatusLink ) { } }
if ( operationStatusLink == null ) { throw new IllegalArgumentException ( "Parameter operationStatusLink is required and cannot be null." ) ; } return service . getLongRunningOperationStatus ( operationStatusLink , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < Void > > > ( ) { @ Override public Observable < ServiceResponse < Void > > call ( Response < ResponseBody > response ) { try { ServiceResponse < Void > clientResponse = getLongRunningOperationStatusDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
public class Murmur3Hash32 { /** * Special - purpose version for hashing a single int value . Value is treated as little - endian */ public static int hash ( int input ) { } }
int k1 = mixK1 ( input ) ; int h1 = mixH1 ( DEFAULT_SEED , k1 ) ; return fmix ( h1 , SizeOf . SIZE_OF_INT ) ;
public class ZFSInstaller { /** * Called from the management screen . */ @ RequirePOST public HttpResponse doAct ( StaplerRequest req ) throws ServletException , IOException { } }
Jenkins . getInstance ( ) . checkPermission ( Jenkins . ADMINISTER ) ; if ( req . hasParameter ( "n" ) ) { // we ' ll shut up disable ( true ) ; return HttpResponses . redirectViaContextPath ( "/manage" ) ; } return new HttpRedirect ( "confirm" ) ;