signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class WebArchiveResourceListSource { /** * Returns a list of entries in the given directory . This method is
* separated so that unit tests can override it to return test - friendly
* file names .
* @ param dir the dir containing the files to return
* @ return the files and directories in the given directory , or
* an empty array if the given directory does not exist or is
* a file . */
protected String [ ] getLibEntries ( String dir ) { } } | String [ ] entries = new String [ 0 ] ; File libdir = new File ( dir ) ; if ( libdir . exists ( ) && libdir . isDirectory ( ) ) { entries = libdir . list ( ) ; } return entries ; |
public class MultipleMappedEnumsPropertyWidget { /** * Creates a combobox for a particular input column .
* @ param inputColumn
* @ param mappedEnum
* @ return */
protected DCComboBox < EnumerationValue > createComboBox ( final InputColumn < ? > inputColumn , EnumerationValue mappedEnum ) { } } | if ( mappedEnum == null && inputColumn != null ) { mappedEnum = getSuggestedValue ( inputColumn ) ; } final EnumerationValue [ ] enumConstants = getEnumConstants ( inputColumn , _mappedEnumsProperty ) ; final DCComboBox < EnumerationValue > comboBox = new DCComboBox < > ( enumConstants ) ; comboBox . setRenderer ( getComboBoxRenderer ( inputColumn , _mappedEnumComboBoxes , enumConstants ) ) ; _mappedEnumComboBoxes . put ( inputColumn , comboBox ) ; if ( mappedEnum != null ) { comboBox . setEditable ( true ) ; comboBox . setSelectedItem ( mappedEnum ) ; comboBox . setEditable ( false ) ; } comboBox . addListener ( item -> _mappedEnumsPropertyWidget . fireValueChanged ( ) ) ; return comboBox ; |
public class PutRecordRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( PutRecordRequest putRecordRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( putRecordRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( putRecordRequest . getStreamName ( ) , STREAMNAME_BINDING ) ; protocolMarshaller . marshall ( putRecordRequest . getData ( ) , DATA_BINDING ) ; protocolMarshaller . marshall ( putRecordRequest . getPartitionKey ( ) , PARTITIONKEY_BINDING ) ; protocolMarshaller . marshall ( putRecordRequest . getExplicitHashKey ( ) , EXPLICITHASHKEY_BINDING ) ; protocolMarshaller . marshall ( putRecordRequest . getSequenceNumberForOrdering ( ) , SEQUENCENUMBERFORORDERING_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class RequestUtil { /** * Parse the character encoding from the specified content type header . If
* the content type is null , or there is no explicit character encoding ,
* < code > null < / code > is returned .
* @ param contentType
* a content type header */
public static String parseCharacterEncoding ( final String contentType ) { } } | if ( contentType == null ) { return ( null ) ; } final int start = contentType . indexOf ( "charset=" ) ; if ( start < 0 ) { return ( null ) ; } String encoding = contentType . substring ( start + 8 ) ; final int end = encoding . indexOf ( ';' ) ; if ( end >= 0 ) { encoding = encoding . substring ( 0 , end ) ; } encoding = encoding . trim ( ) ; if ( ( encoding . length ( ) > 2 ) && ( encoding . startsWith ( "\"" ) ) && ( encoding . endsWith ( "\"" ) ) ) { encoding = encoding . substring ( 1 , encoding . length ( ) - 1 ) ; } return ( encoding . trim ( ) ) ; |
public class LocalNetworkGatewaysInner { /** * Creates or updates a local network gateway in the specified resource group .
* @ param resourceGroupName The name of the resource group .
* @ param localNetworkGatewayName The name of the local network gateway .
* @ param parameters Parameters supplied to the create or update local network gateway operation .
* @ 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 < LocalNetworkGatewayInner > createOrUpdateAsync ( String resourceGroupName , String localNetworkGatewayName , LocalNetworkGatewayInner parameters , final ServiceCallback < LocalNetworkGatewayInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( createOrUpdateWithServiceResponseAsync ( resourceGroupName , localNetworkGatewayName , parameters ) , serviceCallback ) ; |
public class ArgumentListBuilder { /** * Wrap command in a { @ code CMD . EXE } call so we can return the exit code ( { @ code ERRORLEVEL } ) .
* This method takes care of escaping special characters in the command , which
* is needed since the command is now passed as a string to the { @ code CMD . EXE } shell .
* This is done as follows :
* Wrap arguments in double quotes if they contain any of :
* { @ code space * ? , ; ^ & < > | " }
* and if { @ code escapeVars } is true , { @ code % } followed by a letter .
* < p > When testing from command prompt , these characters also need to be
* prepended with a ^ character : { @ code ^ & < > | } — however , invoking { @ code cmd . exe } from
* Jenkins does not seem to require this extra escaping so it is not added by
* this method .
* < p > A { @ code " } is prepended with another { @ code " } character . Note : Windows has issues
* escaping some combinations of quotes and spaces . Quotes should be avoided .
* < p > If { @ code escapeVars } is true , a { @ code % } followed by a letter has that letter wrapped
* in double quotes , to avoid possible variable expansion .
* ie , { @ code % foo % } becomes { @ code " % " f " oo % " } . The second { @ code % } does not need special handling
* because it is not followed by a letter . < p >
* Example : { @ code " - Dfoo = * abc ? def ; ghi ^ jkl & mno < pqr > stu | vwx " " yz % " e " nd " }
* @ param escapeVars True to escape { @ code % VAR % } references ; false to leave these alone
* so they may be expanded when the command is run
* @ return new { @ link ArgumentListBuilder } that runs given command through { @ code cmd . exe / C }
* @ since 1.386 */
public ArgumentListBuilder toWindowsCommand ( boolean escapeVars ) { } } | ArgumentListBuilder windowsCommand = new ArgumentListBuilder ( ) . add ( "cmd.exe" , "/C" ) ; boolean quoted , percent ; for ( int i = 0 ; i < args . size ( ) ; i ++ ) { StringBuilder quotedArgs = new StringBuilder ( ) ; String arg = args . get ( i ) ; quoted = percent = false ; for ( int j = 0 ; j < arg . length ( ) ; j ++ ) { char c = arg . charAt ( j ) ; if ( ! quoted && ( c == ' ' || c == '*' || c == '?' || c == ',' || c == ';' ) ) { quoted = startQuoting ( quotedArgs , arg , j ) ; } else if ( c == '^' || c == '&' || c == '<' || c == '>' || c == '|' ) { if ( ! quoted ) quoted = startQuoting ( quotedArgs , arg , j ) ; // quotedArgs . append ( ' ^ ' ) ; See note in javadoc above
} else if ( c == '"' ) { if ( ! quoted ) quoted = startQuoting ( quotedArgs , arg , j ) ; quotedArgs . append ( '"' ) ; } else if ( percent && escapeVars && ( ( c >= 'A' && c <= 'Z' ) || ( c >= 'a' && c <= 'z' ) ) ) { if ( ! quoted ) quoted = startQuoting ( quotedArgs , arg , j ) ; quotedArgs . append ( '"' ) . append ( c ) ; c = '"' ; } percent = ( c == '%' ) ; if ( quoted ) quotedArgs . append ( c ) ; } if ( i == 0 && quoted ) quotedArgs . insert ( 0 , '"' ) ; else if ( i == 0 && ! quoted ) quotedArgs . append ( '"' ) ; if ( quoted ) quotedArgs . append ( '"' ) ; else quotedArgs . append ( arg ) ; windowsCommand . add ( quotedArgs , mask . get ( i ) ) ; } // ( comment copied from old code in hudson . tasks . Ant )
// on Windows , executing batch file can ' t return the correct error code ,
// so we need to wrap it into cmd . exe .
// double % % is needed because we want ERRORLEVEL to be expanded after
// batch file executed , not before . This alone shows how broken Windows is . . .
windowsCommand . add ( "&&" ) . add ( "exit" ) . add ( "%%ERRORLEVEL%%\"" ) ; return windowsCommand ; |
public class BoxApiUser { /** * Gets a request that deletes an enterprise user
* The session provided must be associated with an enterprise admin user
* @ param userId id of the user
* @ return request to delete an enterprise user */
public BoxRequestsUser . DeleteEnterpriseUser getDeleteEnterpriseUserRequest ( String userId ) { } } | BoxRequestsUser . DeleteEnterpriseUser request = new BoxRequestsUser . DeleteEnterpriseUser ( getUserInformationUrl ( userId ) , mSession , userId ) ; return request ; |
public class DetectCircleGrid { /** * Reverse the order of elements inside the grid */
void reverse ( Grid g ) { } } | work . clear ( ) ; int N = g . rows * g . columns ; for ( int i = 0 ; i < N ; i ++ ) { work . add ( g . ellipses . get ( N - i - 1 ) ) ; } g . ellipses . clear ( ) ; g . ellipses . addAll ( work ) ; |
public class HessianOutput { /** * Removes a reference . */
public boolean removeRef ( Object obj ) throws IOException { } } | if ( _refs != null ) { _refs . remove ( obj ) ; return true ; } else return false ; |
public class BooleanConverter { /** * Converts value into boolean or returns null when conversion is not possible .
* @ param value the value to convert .
* @ return boolean value or null when conversion is not supported . */
public static Boolean toNullableBoolean ( Object value ) { } } | if ( value == null ) return null ; if ( value instanceof Boolean ) return ( boolean ) value ; if ( value instanceof Duration ) return ( ( Duration ) value ) . toMillis ( ) > 0 ; String strValue = value . toString ( ) . toLowerCase ( ) ; if ( strValue . equals ( "1" ) || strValue . equals ( "true" ) || strValue . equals ( "t" ) || strValue . equals ( "yes" ) || strValue . equals ( "y" ) ) return true ; if ( strValue . equals ( "0" ) || strValue . equals ( "false" ) || strValue . equals ( "f" ) || strValue . equals ( "no" ) || strValue . equals ( "n" ) ) return false ; return null ; |
public class EntitiesDetectionJobFilterMarshaller { /** * Marshall the given parameter object . */
public void marshall ( EntitiesDetectionJobFilter entitiesDetectionJobFilter , ProtocolMarshaller protocolMarshaller ) { } } | if ( entitiesDetectionJobFilter == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( entitiesDetectionJobFilter . getJobName ( ) , JOBNAME_BINDING ) ; protocolMarshaller . marshall ( entitiesDetectionJobFilter . getJobStatus ( ) , JOBSTATUS_BINDING ) ; protocolMarshaller . marshall ( entitiesDetectionJobFilter . getSubmitTimeBefore ( ) , SUBMITTIMEBEFORE_BINDING ) ; protocolMarshaller . marshall ( entitiesDetectionJobFilter . getSubmitTimeAfter ( ) , SUBMITTIMEAFTER_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class FactoryBldServices { /** * < p > Get HndlEntityFileReportReq in lazy mode . < / p >
* @ return HndlEntityFileReportReq - HndlEntityFileReportReq
* @ throws Exception - an exception */
@ Override public final HndlEntityFileReportReq < RS > lazyGetHndlEntityFileReportReq ( ) throws Exception { } } | String beanName = this . factoryAppBeans . getHndlEntityFileReportReqName ( ) ; @ SuppressWarnings ( "unchecked" ) HndlEntityFileReportReq < RS > hndlEfrr = ( HndlEntityFileReportReq < RS > ) this . factoryAppBeans . getBeansMap ( ) . get ( beanName ) ; if ( hndlEfrr == null ) { hndlEfrr = new HndlEntityFileReportReq < RS > ( ) ; hndlEfrr . setSrvDatabase ( this . factoryAppBeans . lazyGetSrvDatabase ( ) ) ; hndlEfrr . setReadTi ( this . factoryAppBeans . getReadTi ( ) ) ; hndlEfrr . setFillEntityFromReq ( this . factoryAppBeans . lazyGetFillEntityFromReq ( ) ) ; hndlEfrr . setEntitiesFactoriesFatory ( lazyGetFctBcFctSimpleEntities ( ) ) ; hndlEfrr . setFctEntitiesFileReporters ( this . fctEntitiesFileReporters ) ; @ SuppressWarnings ( "unchecked" ) HashMap < String , Class < ? > > mcl = ( HashMap < String , Class < ? > > ) this . factoryAppBeans . getEntitiesMap ( ) . clone ( ) ; hndlEfrr . setEntitiesMap ( mcl ) ; this . factoryAppBeans . getBeansMap ( ) . put ( beanName , hndlEfrr ) ; this . factoryAppBeans . lazyGetLogger ( ) . info ( null , AFactoryAppBeans . class , beanName + " has been created." ) ; } return hndlEfrr ; |
public class PatternBox { /** * Finds cases where protein A changes state of B , and B is then degraded .
* NOTE : THIS PATTERN DOES NOT WORK . KEEPING ONLY FOR HISTORICAL REASONS .
* @ return the pattern */
public static Pattern controlsDegradationIndirectly ( ) { } } | Pattern p = controlsStateChange ( ) ; p . add ( new Size ( new ParticipatesInConv ( RelType . INPUT ) , 1 , Size . Type . EQUAL ) , "output PE" ) ; p . add ( new Empty ( peToControl ( ) ) , "output PE" ) ; p . add ( new ParticipatesInConv ( RelType . INPUT ) , "output PE" , "degrading Conv" ) ; p . add ( new NOT ( type ( ComplexAssembly . class ) ) , "degrading Conv" ) ; p . add ( new Size ( participant ( ) , 1 , Size . Type . EQUAL ) , "degrading Conv" ) ; p . add ( new Empty ( new Participant ( RelType . OUTPUT ) ) , "degrading Conv" ) ; p . add ( new Empty ( convToControl ( ) ) , "degrading Conv" ) ; p . add ( equal ( false ) , "degrading Conv" , "Conversion" ) ; return p ; |
public class ObjectUtils { /** * This method returns the provided value unchanged .
* This can prevent javac from inlining a constant
* field , e . g . ,
* < pre >
* public final static short MAGIC _ SHORT = ObjectUtils . CONST _ SHORT ( 127 ) ;
* < / pre >
* This way any jars that refer to this field do not
* have to recompile themselves if the field ' s value
* changes at some future date .
* @ param v the short literal ( as an int ) value to return
* @ throws IllegalArgumentException if the value passed to v
* is larger than a short , that is , smaller than - 32768 or
* larger than 32767.
* @ return the byte v , unchanged
* @ since 3.2 */
public static short CONST_SHORT ( final int v ) throws IllegalArgumentException { } } | if ( v < Short . MIN_VALUE || v > Short . MAX_VALUE ) { throw new IllegalArgumentException ( "Supplied value must be a valid byte literal between -32768 and 32767: [" + v + "]" ) ; } return ( short ) v ; |
public class EKBCommit { /** * Adds a model to the list of models which shall be updated in the EDB . If the given object is not a model , an
* IllegalArgumentException is thrown . */
public EKBCommit addUpdate ( Object update ) { } } | if ( update != null ) { checkIfModel ( update ) ; updates . add ( ( OpenEngSBModel ) update ) ; } return this ; |
public class ControlBeanContextServicesSupport { /** * Deserialization support .
* @ param ois
* @ throws IOException
* @ throws ClassNotFoundException */
private synchronized void readObject ( ObjectInputStream ois ) throws IOException , ClassNotFoundException { } } | ois . defaultReadObject ( ) ; int svcsSize = ois . readInt ( ) ; for ( int i = 0 ; i < svcsSize ; i ++ ) { _serviceProviders . put ( ( Class ) ois . readObject ( ) , ( ServiceProvider ) ois . readObject ( ) ) ; } int listenersSize = ois . readInt ( ) ; for ( int i = 0 ; i < listenersSize ; i ++ ) { _bcsListeners . add ( ( BeanContextServicesListener ) ois . readObject ( ) ) ; } |
public class TagStreamRequest { /** * A list of tags to associate with the specified stream . Each tag is a key - value pair ( the value is optional ) .
* @ param tags
* A list of tags to associate with the specified stream . Each tag is a key - value pair ( the value is
* optional ) .
* @ return Returns a reference to this object so that method calls can be chained together . */
public TagStreamRequest withTags ( java . util . Map < String , String > tags ) { } } | setTags ( tags ) ; return this ; |
public class Options { /** * Puts an short value for the given option name .
* @ param key
* the option name .
* @ param value
* the short value . */
public Options putShort ( String key , IModel < Short > value ) { } } | putOption ( key , new ShortOption ( value ) ) ; return this ; |
public class PPORGImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setProcFlgs ( Integer newProcFlgs ) { } } | Integer oldProcFlgs = procFlgs ; procFlgs = newProcFlgs ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . PPORG__PROC_FLGS , oldProcFlgs , procFlgs ) ) ; |
public class CreateFiducialDocumentPDF { /** * Draws the grid in light grey on the document */
private void printGrid ( PDPageContentStream pcs , float offsetX , float offsetY , int numRows , int numCols , float sizeBox ) throws IOException { } } | float pageWidth = ( float ) paper . convertWidth ( units ) * UNIT_TO_POINTS ; float pageHeight = ( float ) paper . convertHeight ( units ) * UNIT_TO_POINTS ; // pcs . setLineCapStyle ( 1 ) ;
pcs . setStrokingColor ( 0.75 ) ; for ( int i = 0 ; i <= numCols ; i ++ ) { float x = offsetX + i * sizeBox ; pcs . moveTo ( x , 0 ) ; pcs . lineTo ( x , pageHeight ) ; } for ( int i = 0 ; i <= numRows ; i ++ ) { float y = offsetY + i * sizeBox ; pcs . moveTo ( 0 , y ) ; pcs . lineTo ( pageWidth , y ) ; } pcs . closeAndStroke ( ) ; |
public class AncientJulianLeapYears { /** * / * [ deutsch ]
* < p > Erzeugt eine neue historische Sequenz von julianischen Schaltjahren vor dem Jahre AD 8 . < / p >
* < p > Beispiel : Um den Vorschlag von Matzat ( 1883 ) zu modellieren , k & ouml ; nnen Anwender den Ausdruck
* { @ code of ( 44 , 41 , 38 , 35 , 32 , 29 , 26 , 23 , 20 , 17 , 14 , 11 , - 3 ) } verwenden . Der letzte Parameter
* { @ code - 3 } steht hier f & uuml ; r das Jahr AD 4 ( Formel : { @ code 1 - year } ) , das laut Matzat auch ein
* Schaltjahr gewesen sein soll . Eine & Uuml ; bersicht der verschiedenen Versionen und Vorschl & auml ; ge
* gibt es auf < a href = " http : / / en . wikipedia . org / wiki / Julian _ calendar " > Wikipedia < / a > . < / p >
* @ param bcYears positive numbers for BC - years
* @ return new instance
* @ throws IllegalArgumentException if given years are missing or out of range { @ code BC 45 < = bcYear < AD 8}
* @ since 3.11/4.8 */
public static AncientJulianLeapYears of ( int ... bcYears ) { } } | if ( Arrays . equals ( bcYears , SEQUENCE_SCALIGER ) ) { return SCALIGER ; } return new AncientJulianLeapYears ( bcYears ) ; |
public class ProcessorGlobalVariableDecl { /** * Append the current template element to the current
* template element , and then push it onto the current template
* element stack .
* @ param handler non - null reference to current StylesheetHandler that is constructing the Templates .
* @ param elem The non - null reference to the ElemVariable element .
* @ throws org . xml . sax . SAXException Any SAX exception , possibly
* wrapping another exception . */
protected void appendAndPush ( StylesheetHandler handler , ElemTemplateElement elem ) throws org . xml . sax . SAXException { } } | // Just push , but don ' t append .
handler . pushElemTemplateElement ( elem ) ; |
public class PropertiesManager { /** * Retrieve the value of the given property as an Enum constant of the given
* type . If the current value of the specified property cannot be converted
* to the appropriate Enum , the default value will be retrieved . < br >
* < br >
* Note that this method requires the Enum constants to all have upper case
* names ( following Java naming conventions ) . This allows for case
* insensitivity in the properties file .
* @ param < E >
* the type of Enum that will be returned
* @ param property
* the property to retrieve
* @ param type
* the Enum type to which the property will be converted
* @ return the Enum constant corresponding to the value of the given
* property or the default value if the current value is not a valid
* instance of the given type
* @ throws IllegalArgumentException
* if both the current and default values are not valid
* constants of the given type */
public < E extends Enum < E > > E getEnumPropertyFallback ( T property , Class < E > type ) throws IllegalArgumentException { } } | try { return Enum . valueOf ( type , getProperty ( property ) . toUpperCase ( ) ) ; } catch ( IllegalArgumentException e ) { return Enum . valueOf ( type , getDefaultProperty ( property ) . toUpperCase ( ) ) ; } |
public class AbstractBigtableAdmin { /** * { @ inheritDoc } */
@ Override public Pair < Integer , Integer > getAlterStatus ( byte [ ] tableName ) throws IOException { } } | return getAlterStatus ( TableName . valueOf ( tableName ) ) ; |
public class ComponentFactory { /** * Get a new instance of a supported component .
* @ param name
* The name of the component ; for example " 3des - cbc "
* @ return the newly instantiated object
* @ throws ClassNotFoundException */
public Object getInstance ( String name ) throws SshException { } } | if ( supported . containsKey ( name ) ) { try { return createInstance ( name , ( Class < ? > ) supported . get ( name ) ) ; } catch ( Throwable t ) { throw new SshException ( t . getMessage ( ) , SshException . INTERNAL_ERROR ) ; } } throw new SshException ( name + " is not supported" , SshException . UNSUPPORTED_ALGORITHM ) ; |
public class Controller { /** * Remove Cookie . */
public Controller removeCookie ( String name ) { } } | return doSetCookie ( name , null , 0 , null , null , null ) ; |
public class ApplicationProtocolNegotiationHandler { /** * Invoked on failed initial SSL / TLS handshake . */
protected void handshakeFailure ( ChannelHandlerContext ctx , Throwable cause ) throws Exception { } } | logger . warn ( "{} TLS handshake failed:" , ctx . channel ( ) , cause ) ; ctx . close ( ) ; |
public class SystemOutLoggingTool { /** * { @ inheritDoc } */
@ Override public void warn ( Object object , Object ... objects ) { } } | if ( level <= WARN ) { StringBuilder result = new StringBuilder ( ) ; result . append ( object ) ; for ( Object obj : objects ) { result . append ( obj ) ; } warnString ( result . toString ( ) ) ; } |
public class MultiplexFile { /** * Returns 0 if referring block is 0. */
final long getBlockId ( long refBlockId , int index ) throws IOException { } } | if ( refBlockId == 0 ) { return 0 ; } return getBlockId ( mBackingFile , refBlockId * mBlockSize + index ) ; |
public class CommerceWishListLocalServiceWrapper { /** * Returns the commerce wish list with the primary key .
* @ param commerceWishListId the primary key of the commerce wish list
* @ return the commerce wish list
* @ throws PortalException if a commerce wish list with the primary key could not be found */
@ Override public com . liferay . commerce . wish . list . model . CommerceWishList getCommerceWishList ( long commerceWishListId ) throws com . liferay . portal . kernel . exception . PortalException { } } | return _commerceWishListLocalService . getCommerceWishList ( commerceWishListId ) ; |
public class HttpHeaders { /** * @ deprecated Use { @ link # set ( CharSequence , Object ) } instead .
* @ see # setDateHeader ( HttpMessage , CharSequence , Date ) */
@ Deprecated public static void setDateHeader ( HttpMessage message , String name , Date value ) { } } | setDateHeader ( message , ( CharSequence ) name , value ) ; |
public class CommerceDiscountUsageEntryPersistenceImpl { /** * Removes all the commerce discount usage entries where groupId = & # 63 ; from the database .
* @ param groupId the group ID */
@ Override public void removeByGroupId ( long groupId ) { } } | for ( CommerceDiscountUsageEntry commerceDiscountUsageEntry : findByGroupId ( groupId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ) { remove ( commerceDiscountUsageEntry ) ; } |
public class InternalSARLLexer { /** * $ ANTLR start " T _ _ 142" */
public final void mT__142 ( ) throws RecognitionException { } } | try { int _type = T__142 ; int _channel = DEFAULT_TOKEN_CHANNEL ; // InternalSARL . g : 128:8 : ( ' catch ' )
// InternalSARL . g : 128:10 : ' catch '
{ match ( "catch" ) ; } state . type = _type ; state . channel = _channel ; } finally { } |
public class TableDefinition { /** * Indicate if the given string is a valid table name . Table names must begin with a
* letter and consist of all letters , digits , and underscores .
* @ param tableName Candidate table name .
* @ return True if the name is not null , not empty , starts with a letter , and
* consists of only letters , digits , and underscores . */
public static boolean isValidTableName ( String tableName ) { } } | return tableName != null && tableName . length ( ) > 0 && Utils . isLetter ( tableName . charAt ( 0 ) ) && Utils . allAlphaNumUnderscore ( tableName ) ; |
public class OrderComparator { /** * Determine the order value for the given object .
* < p > The default implementation checks against the given { @ link OrderSourceProvider }
* using { @ link # findOrder } and falls back to a regular { @ link # getOrder ( Object ) } call .
* @ param obj the object to check
* @ return the order value , or { @ code Ordered . LOWEST _ PRECEDENCE } as fallback */
private int getOrder ( Object obj , OrderSourceProvider sourceProvider ) { } } | Integer order = null ; if ( sourceProvider != null ) { order = findOrder ( sourceProvider . getOrderSource ( obj ) ) ; } return ( order != null ? order : getOrder ( obj ) ) ; |
public class OperaLauncherProtocol { /** * Send a request and receive a result .
* @ param type the request type to be sent
* @ param body the serialized request payload
* @ return the response
* @ throws IOException if socket read error or protocol parse error */
public ResponseEncapsulation sendRequest ( MessageType type , byte [ ] body ) throws IOException { } } | sendRequestHeader ( type , ( body != null ) ? body . length : 0 ) ; if ( body != null ) { os . write ( body ) ; } return recvMessage ( ) ; |
public class ScalingInstructionMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ScalingInstruction scalingInstruction , ProtocolMarshaller protocolMarshaller ) { } } | if ( scalingInstruction == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( scalingInstruction . getServiceNamespace ( ) , SERVICENAMESPACE_BINDING ) ; protocolMarshaller . marshall ( scalingInstruction . getResourceId ( ) , RESOURCEID_BINDING ) ; protocolMarshaller . marshall ( scalingInstruction . getScalableDimension ( ) , SCALABLEDIMENSION_BINDING ) ; protocolMarshaller . marshall ( scalingInstruction . getMinCapacity ( ) , MINCAPACITY_BINDING ) ; protocolMarshaller . marshall ( scalingInstruction . getMaxCapacity ( ) , MAXCAPACITY_BINDING ) ; protocolMarshaller . marshall ( scalingInstruction . getTargetTrackingConfigurations ( ) , TARGETTRACKINGCONFIGURATIONS_BINDING ) ; protocolMarshaller . marshall ( scalingInstruction . getPredefinedLoadMetricSpecification ( ) , PREDEFINEDLOADMETRICSPECIFICATION_BINDING ) ; protocolMarshaller . marshall ( scalingInstruction . getCustomizedLoadMetricSpecification ( ) , CUSTOMIZEDLOADMETRICSPECIFICATION_BINDING ) ; protocolMarshaller . marshall ( scalingInstruction . getScheduledActionBufferTime ( ) , SCHEDULEDACTIONBUFFERTIME_BINDING ) ; protocolMarshaller . marshall ( scalingInstruction . getPredictiveScalingMaxCapacityBehavior ( ) , PREDICTIVESCALINGMAXCAPACITYBEHAVIOR_BINDING ) ; protocolMarshaller . marshall ( scalingInstruction . getPredictiveScalingMaxCapacityBuffer ( ) , PREDICTIVESCALINGMAXCAPACITYBUFFER_BINDING ) ; protocolMarshaller . marshall ( scalingInstruction . getPredictiveScalingMode ( ) , PREDICTIVESCALINGMODE_BINDING ) ; protocolMarshaller . marshall ( scalingInstruction . getScalingPolicyUpdateBehavior ( ) , SCALINGPOLICYUPDATEBEHAVIOR_BINDING ) ; protocolMarshaller . marshall ( scalingInstruction . getDisableDynamicScaling ( ) , DISABLEDYNAMICSCALING_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class WaybackRequest { /** * create WaybackRequet for Replay request .
* @ param url target URL
* @ param replay requested date
* @ param start start timestamp ( 14 - digit )
* @ param end end timestamp ( 14 - digit )
* @ return WaybackRequet */
public static WaybackRequest createReplayRequest ( String url , String replay , String start , String end ) { } } | WaybackRequest r = new WaybackRequest ( ) ; r . setReplayRequest ( ) ; r . setRequestUrl ( url ) ; r . setReplayTimestamp ( replay ) ; r . setStartTimestamp ( start ) ; r . setEndTimestamp ( end ) ; return r ; |
public class Document { /** * Returns the set of all namespaces contained within the document .
* @ return Set of namespaces , which may be empty */
public Set < Namespace > getAllNamespaces ( ) { } } | if ( namespaceGroup == null ) { return emptySet ( ) ; } return new HashSet < Namespace > ( namespaceGroup . getAllNamespaces ( ) ) ; |
public class spilloverpolicy_binding { /** * Use this API to fetch spilloverpolicy _ binding resource of given name . */
public static spilloverpolicy_binding get ( nitro_service service , String name ) throws Exception { } } | spilloverpolicy_binding obj = new spilloverpolicy_binding ( ) ; obj . set_name ( name ) ; spilloverpolicy_binding response = ( spilloverpolicy_binding ) obj . get_resource ( service ) ; return response ; |
public class AbstractAlpineQueryManager { /** * Refreshes and detaches an objects .
* @ param pcs the instances to detach
* @ param < T > the type to return
* @ return the detached instances
* @ since 1.3.0 */
public < T > Set < T > detach ( Set < T > pcs ) { } } | pm . getFetchPlan ( ) . setDetachmentOptions ( FetchPlan . DETACH_LOAD_FIELDS ) ; return new LinkedHashSet < > ( pm . detachCopyAll ( pcs ) ) ; |
public class ValueMap { /** * Sets the value of the specified key in the current ValueMap to the
* given value . */
public ValueMap withBinarySet ( String key , byte [ ] ... val ) { } } | super . put ( key , new LinkedHashSet < byte [ ] > ( Arrays . asList ( val ) ) ) ; return this ; |
public class ReconnectionHandler { /** * Initiate reconnect and return a { @ link ChannelFuture } for synchronization . The resulting future either succeeds or fails .
* It can be { @ link ChannelFuture # cancel ( boolean ) canceled } to interrupt reconnection and channel initialization . A failed
* { @ link ChannelFuture } will close the channel .
* @ return reconnect { @ link ChannelFuture } . */
protected Tuple2 < CompletableFuture < Channel > , CompletableFuture < SocketAddress > > reconnect ( ) { } } | CompletableFuture < Channel > future = new CompletableFuture < > ( ) ; CompletableFuture < SocketAddress > address = new CompletableFuture < > ( ) ; socketAddressSupplier . subscribe ( remoteAddress -> { address . complete ( remoteAddress ) ; if ( future . isCancelled ( ) ) { return ; } reconnect0 ( future , remoteAddress ) ; } , ex -> { if ( ! address . isDone ( ) ) { address . completeExceptionally ( ex ) ; } future . completeExceptionally ( ex ) ; } ) ; this . currentFuture = future ; return Tuples . of ( future , address ) ; |
public class Generics { /** * Returns the class for the specified type variable , or null if it is not known .
* @ return May be null . */
public Class resolveTypeVariable ( TypeVariable typeVariable ) { } } | for ( int i = argumentsSize - 2 ; i >= 0 ; i -= 2 ) if ( arguments [ i ] == typeVariable ) return ( Class ) arguments [ i + 1 ] ; return null ; |
public class ClassInfo { /** * Checks whether this class declares a field with the named annotation .
* @ param fieldAnnotationName
* The name of a field annotation .
* @ return true if this class declares a field with the named annotation . */
public boolean hasDeclaredFieldAnnotation ( final String fieldAnnotationName ) { } } | for ( final FieldInfo fi : getDeclaredFieldInfo ( ) ) { if ( fi . hasAnnotation ( fieldAnnotationName ) ) { return true ; } } return false ; |
public class CircularView { /** * TODO always draw the animating markers on top . */
@ Override protected void onDraw ( Canvas canvas ) { } } | super . onDraw ( canvas ) ; int contentWidth = mWidth - paddingLeft - paddingRight ; int contentHeight = mHeight - paddingTop - paddingBottom ; mCirclePaint . setStyle ( Paint . Style . FILL ) ; mCirclePaint . setColor ( Color . RED ) ; // Draw CircularViewObject
mCircle . draw ( canvas ) ; // Draw non - highlighted Markers
if ( mMarkerList != null && ! mMarkerList . isEmpty ( ) ) { for ( final Marker marker : mMarkerList ) { if ( ! mDrawHighlightedMarkerOnTop || ! marker . equals ( mHighlightedMarker ) ) { marker . draw ( canvas ) ; } } } // Draw highlighted marker
if ( mDrawHighlightedMarkerOnTop && mHighlightedMarker != null ) { mHighlightedMarker . draw ( canvas ) ; } // Draw line
if ( mIsAnimating ) { final float radiusFromCenter = mCircle . getRadius ( ) + CIRCLE_TO_MARKER_PADDING + BASE_MARKER_RADIUS ; final float x = ( float ) Math . cos ( Math . toRadians ( mHighlightedDegree ) ) * radiusFromCenter + mCircle . getX ( ) ; final float y = ( float ) Math . sin ( Math . toRadians ( mHighlightedDegree ) ) * radiusFromCenter + mCircle . getY ( ) ; canvas . drawLine ( mCircle . getX ( ) , mCircle . getY ( ) , x , y , mCirclePaint ) ; } // Draw the text .
if ( ! TextUtils . isEmpty ( mText ) ) { canvas . drawText ( mText , mCircle . getX ( ) - mTextWidth / 2f , mCircle . getY ( ) - mTextHeight / 2f , // paddingLeft + ( contentWidth - mTextWidth ) / 2,
// paddingTop + ( contentHeight + mTextHeight ) / 2,
mTextPaint ) ; } |
public class SingleProviderResolver { /** * Return a provider for this interface .
* @ param c the provider interface that is implemented
* @ param defaultImpl if no provider is found , instantiate the default implementation
* @ param < T > type of provider interface
* @ return instance of the provider or { @ code null } if not found
* @ throws java . lang . LinkageError if there is a problem instantiating the provider */
@ SuppressWarnings ( "unchecked" ) public synchronized static < T > T resolve ( Class < T > c , Class < ? extends T > defaultImpl ) { } } | if ( providers . containsKey ( c ) ) { return ( T ) providers . get ( c ) ; } try { String _className = readFile ( "org/cache2k/services/" + c . getName ( ) ) ; T obj = null ; if ( _className == null ) { ServiceLoader < T > sl = ServiceLoader . load ( c ) ; Iterator < T > it = sl . iterator ( ) ; if ( it . hasNext ( ) ) { obj = it . next ( ) ; } } else { obj = ( T ) SingleProviderResolver . class . getClassLoader ( ) . loadClass ( _className ) . newInstance ( ) ; } if ( obj == null && defaultImpl != null ) { obj = defaultImpl . newInstance ( ) ; } providers . put ( c , obj ) ; return obj ; } catch ( Exception ex ) { Error err = new LinkageError ( "Error instantiating " + c . getName ( ) , ex ) ; err . printStackTrace ( ) ; throw err ; } |
public class DatasetUtils { /** * Find { @ link HivePartitionDataset } given complete partition name from a list of datasets
* @ param partitionName Complete partition name ie dbName @ tableName @ partitionName */
public static Optional < HivePartitionDataset > findDataset ( String partitionName , List < HivePartitionDataset > datasets ) { } } | for ( HivePartitionDataset dataset : datasets ) { if ( dataset . datasetURN ( ) . equalsIgnoreCase ( partitionName ) ) { return Optional . fromNullable ( dataset ) ; } } log . warn ( "Unable to find dataset corresponding to " + partitionName ) ; return Optional . < HivePartitionDataset > absent ( ) ; |
public class JmsJcaActivationSpecImpl { /** * Set the target type property .
* @ param targetType */
@ Override public void setTargetType ( String targetType ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { SibTr . debug ( this , TRACE , "setTargetType" , targetType ) ; } _targetType = targetType ; |
public class AbstractView { /** * Process view annotation .
* This will define if callback action will the view itself or its dedicated controller */
private void processViewAnnotation ( ) { } } | // Find the AutoHandler annotation if any because it ' s optional
final AutoHandler ah = ClassUtility . getLastClassAnnotation ( this . getClass ( ) , AutoHandler . class ) ; // Use the annotation value to define the callbackObject : View or Controller
// When controller is null always use the view as callbackObject
if ( ah != null && ah . value ( ) == CallbackObject . View || controller ( ) == null ) { this . callbackObject = this ; } else { // by default use the controller object as callback object
this . callbackObject = this . controller ( ) ; } // Find the RootNodeId annotation
final RootNodeId rni = ClassUtility . getLastClassAnnotation ( this . getClass ( ) , RootNodeId . class ) ; if ( rni != null ) { node ( ) . setId ( rni . value ( ) . isEmpty ( ) ? this . getClass ( ) . getSimpleName ( ) : rni . value ( ) ) ; } // Find the RootNodeClass annotation
final RootNodeClass rnc = ClassUtility . getLastClassAnnotation ( this . getClass ( ) , RootNodeClass . class ) ; if ( rnc != null && rnc . value ( ) . length > 0 ) { for ( final String styleClass : rnc . value ( ) ) { if ( styleClass != null && ! styleClass . isEmpty ( ) ) { node ( ) . getStyleClass ( ) . add ( styleClass ) ; } } } // Process Event Handler Annotation
// For each View class annotation we will attach an event handler to the root node
for ( final Annotation a : this . getClass ( ) . getAnnotations ( ) ) { // Manage only JRebirth OnXxxxx annotations
if ( a . annotationType ( ) . getName ( ) . startsWith ( BASE_ANNOTATION_NAME ) ) { try { // Process the annotation if the node is not null
if ( node ( ) != null && controller ( ) instanceof AbstractController ) { addHandler ( node ( ) , a ) ; } } catch ( IllegalArgumentException | CoreException e ) { LOGGER . log ( UIMessages . VIEW_ANNO_PROCESSING_FAILURE , e , this . getClass ( ) . getName ( ) ) ; } } } |
public class MediaApi { /** * Switch to monitor
* Switch to the monitor mode for the specified chat . The supervisor can & # 39 ; t send messages in this mode and only another supervisor can see that the monitoring supervisor joined the chat .
* @ param mediatype The media channel . ( required )
* @ param id The ID of the chat interaction . ( required )
* @ param mediaSwicthToCoachData Request parameters . ( optional )
* @ return ApiResponse & lt ; ApiSuccessResponse & gt ;
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiResponse < ApiSuccessResponse > mediaSwicthToMonitorWithHttpInfo ( String mediatype , String id , MediaSwicthToCoachData2 mediaSwicthToCoachData ) throws ApiException { } } | com . squareup . okhttp . Call call = mediaSwicthToMonitorValidateBeforeCall ( mediatype , id , mediaSwicthToCoachData , null , null ) ; Type localVarReturnType = new TypeToken < ApiSuccessResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; |
public class Transition { /** * This method is called automatically by the Transition and
* TransitionSet classes when a transition finishes , either because
* a transition did nothing ( returned a null Animator from
* { @ link Transition # createAnimator ( ViewGroup , TransitionValues ,
* TransitionValues ) } ) or because the transition returned a valid
* Animator and end ( ) was called in the onAnimationEnd ( )
* callback of the AnimatorListener .
* @ hide */
protected void end ( ) { } } | -- mNumInstances ; if ( mNumInstances == 0 ) { if ( mListeners != null && mListeners . size ( ) > 0 ) { ArrayList < TransitionListener > tmpListeners = ( ArrayList < TransitionListener > ) mListeners . clone ( ) ; int numListeners = tmpListeners . size ( ) ; for ( int i = 0 ; i < numListeners ; ++ i ) { tmpListeners . get ( i ) . onTransitionEnd ( this ) ; } } for ( int i = 0 ; i < mStartValues . itemIdValues . size ( ) ; ++ i ) { View view = mStartValues . itemIdValues . valueAt ( i ) ; if ( view != null ) { ViewUtils . setHasTransientState ( view , false ) ; } } for ( int i = 0 ; i < mEndValues . itemIdValues . size ( ) ; ++ i ) { View view = mEndValues . itemIdValues . valueAt ( i ) ; if ( view != null ) { ViewUtils . setHasTransientState ( view , false ) ; } } mEnded = true ; } |
public class SyncListItemReader { /** * Make the request to the Twilio API to perform the read .
* @ param client TwilioRestClient with which to make the request
* @ return SyncListItem ResourceSet */
@ Override public ResourceSet < SyncListItem > read ( final TwilioRestClient client ) { } } | return new ResourceSet < > ( this , client , firstPage ( client ) ) ; |
public class LineNumberReader { /** * Read a line of text . Whenever a < a href = " # lt " > line terminator < / a > is
* read the current line number is incremented .
* @ return A String containing the contents of the line , not including
* any < a href = " # lt " > line termination characters < / a > , or
* < tt > null < / tt > if the end of the stream has been reached
* @ throws IOException
* If an I / O error occurs */
public String readLine ( ) throws IOException { } } | synchronized ( lock ) { String l = super . readLine ( skipLF ) ; skipLF = false ; if ( l != null ) lineNumber ++ ; return l ; } |
public class SelectStatement { /** * Get qualified star select items .
* @ return qualified star select items */
public Collection < StarSelectItem > getQualifiedStarSelectItems ( ) { } } | Collection < StarSelectItem > result = new LinkedList < > ( ) ; for ( SelectItem each : items ) { if ( each instanceof StarSelectItem && ( ( StarSelectItem ) each ) . getOwner ( ) . isPresent ( ) ) { result . add ( ( StarSelectItem ) each ) ; } } return result ; |
public class CuratorFactory { /** * Create a new instance { @ link LeaderLatch }
* @ param serverId the ID used to register this instance with curator .
* This ID should typically be obtained using
* { @ link org . apache . atlas . ha . AtlasServerIdSelector # selectServerId ( Configuration ) }
* @ param zkRoot the root znode under which the leader latch node is added .
* @ return */
public LeaderLatch leaderLatchInstance ( String serverId , String zkRoot ) { } } | return new LeaderLatch ( curatorFramework , zkRoot + APACHE_ATLAS_LEADER_ELECTOR_PATH , serverId ) ; |
public class ForkJoinPool { /** * Removes all available unexecuted submitted and forked tasks
* from scheduling queues and adds them to the given collection ,
* without altering their execution status . These may include
* artificially generated or wrapped tasks . This method is
* designed to be invoked only when the pool is known to be
* quiescent . Invocations at other times may not remove all
* tasks . A failure encountered while attempting to add elements
* to collection { @ code c } may result in elements being in
* neither , either or both collections when the associated
* exception is thrown . The behavior of this operation is
* undefined if the specified collection is modified while the
* operation is in progress .
* @ param c the collection to transfer elements into
* @ return the number of elements transferred */
protected int drainTasksTo ( Collection < ? super ForkJoinTask < ? > > c ) { } } | int count = 0 ; WorkQueue [ ] ws ; WorkQueue w ; ForkJoinTask < ? > t ; if ( ( ws = workQueues ) != null ) { for ( int i = 0 ; i < ws . length ; ++ i ) { if ( ( w = ws [ i ] ) != null ) { while ( ( t = w . poll ( ) ) != null ) { c . add ( t ) ; ++ count ; } } } } return count ; |
public class DirectoryConnection { /** * On the DirectoryConnection receive Response from DirectorySocket .
* @ param header
* the Response Header .
* @ param response
* the Response . */
public void onReceivedPesponse ( ResponseHeader header , Response response ) { } } | Packet packet = null ; updateRecv ( ) ; if ( header . getXid ( ) == - 4 ) { // -4 is the xid for AuthPacket
if ( ErrorCode . AUTHENT_FAILED . equals ( header . getErr ( ) ) ) { if ( getStatus ( ) . isAlive ( ) ) { setStatus ( ConnectionStatus . AUTH_FAILED ) ; } } LOGGER . info ( "Got auth sessionid:0x" + session . id + ", error=" + header . getErr ( ) ) ; return ; } if ( header . getXid ( ) == - 1 ) { // -1 means watcher notification
WatcherEvent event = ( WatcherEvent ) response ; if ( LOGGER . isTraceEnabled ( ) ) { LOGGER . trace ( "Got Watcher " + event + " for sessionid 0x" + session . id ) ; } eventThread . queueWatcherEvent ( event ) ; return ; } if ( header . getXid ( ) == - 8 ) { // -8 means server notification
ServerEvent event = ( ServerEvent ) response ; if ( response instanceof CloseSessionEvent ) { closeSession ( ) ; return ; } if ( LOGGER . isTraceEnabled ( ) ) { LOGGER . trace ( "Got Server " + event + " for sessionid 0x" + session . id ) ; } eventThread . queueServerEvent ( event ) ; return ; } if ( header . getXid ( ) == - 2 ) { // -2 is the xid for pings
if ( LOGGER . isTraceEnabled ( ) ) { LOGGER . info ( "Got ping response for sessionid: 0x" + session . id + " after " + ( System . currentTimeMillis ( ) - lastPingSentNs ) + "ms" ) ; } pingResponse . set ( header ) ; synchronized ( pingResponse ) { pingResponse . notifyAll ( ) ; } return ; } synchronized ( pendingQueue ) { // the XID out of order , we don ' t close session here .
// it doesn ' t mean the data integrate has problem .
if ( pendingQueue . isEmpty ( ) ) { LOGGER . warn ( "The request queue is empty, but get packet xid=" + header . getXid ( ) ) ; // we don ' t close session here .
return ; } int recvXid = header . getXid ( ) ; packet = pendingQueue . remove ( ) ; if ( packet . protoHeader . getXid ( ) != recvXid ) { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Packet xid out of order, type=" + packet . protoHeader . getType ( ) + ", queuedXid=" + packet . protoHeader . getXid ( ) + ", xid=" + header . getXid ( ) ) ; } // trim the pendingQueue to the received packet .
if ( packet . protoHeader . getXid ( ) > recvXid ) { LOGGER . error ( "Packet xid out of order, drop the received packet, xid=" + header . getXid ( ) ) ; pendingQueue . addLast ( packet ) ; packet = null ; } else { while ( packet . protoHeader . getXid ( ) != recvXid ) { LOGGER . error ( "Packet xid out of order, drop the queued packet, type=" + packet . protoHeader . getType ( ) + ", queuedXid=" + packet . protoHeader . getXid ( ) ) ; packet . respHeader . setErr ( ErrorCode . CONNECTION_LOSS ) ; finishPacket ( packet ) ; if ( ! pendingQueue . isEmpty ( ) ) { packet = pendingQueue . remove ( ) ; } else { return ; } } } } } PacketLatency . receivePacket ( packet ) ; packet . respHeader . setXid ( header . getXid ( ) ) ; packet . respHeader . setErr ( header . getErr ( ) ) ; packet . respHeader . setDxid ( header . getDxid ( ) ) ; if ( header . getDxid ( ) > 0 ) { lastDxid = header . getDxid ( ) ; } if ( ErrorCode . OK . equals ( header . getErr ( ) ) ) { packet . response = response ; } if ( LOGGER . isTraceEnabled ( ) ) { LOGGER . trace ( "Reading reply sessionid:0x" + session . id + ", packet=" + packet ) ; } finishPacket ( packet ) ; |
public class ConsumerSessionImpl { /** * ( non - Javadoc )
* @ see com . ibm . wsspi . sib . core . ConsumerSession # close ( ) */
@ Override public void close ( ) throws SIResourceException , SIConnectionLostException , SIErrorException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && CoreSPIConsumerSession . tc . isEntryEnabled ( ) ) SibTr . entry ( CoreSPIConsumerSession . tc , "close" , this ) ; // perform the actual closing operations
_close ( ) ; // remove ourselves from the connection
_connection . removeConsumerSession ( this ) ; if ( _bifurcatedConsumers != null ) { // Close any associated Bifurcated Consumers .
// We take a copy of the list of bifucated consumers , as the close
// method of each will remove itself from the list ( so an iterator
// would see concurrent modifications ) .
// We let the bifurcated consumer do the work , as they need to
// unlock the associated messages ( and the code is re - used from
// ConnectionImpl . close ( ) which also calls into the BCS directly ) .
BifurcatedConsumerSessionImpl [ ] bifurcatedConsumersCopy ; synchronized ( _bifurcatedConsumers ) { bifurcatedConsumersCopy = new BifurcatedConsumerSessionImpl [ _bifurcatedConsumers . size ( ) ] ; bifurcatedConsumersCopy = _bifurcatedConsumers . toArray ( bifurcatedConsumersCopy ) ; } for ( int i = 0 ; i < bifurcatedConsumersCopy . length ; i ++ ) { bifurcatedConsumersCopy [ i ] . _close ( ) ; } _bifurcatedConsumers = null ; } if ( TraceComponent . isAnyTracingEnabled ( ) && CoreSPIConsumerSession . tc . isEntryEnabled ( ) ) SibTr . exit ( CoreSPIConsumerSession . tc , "close" ) ; |
public class GeoJsonReaderDriver { /** * Parses Json Array .
* Syntax :
* Json Array :
* { " member1 " : value1 } , value2 , value3 , { " member4 " : value4 } ]
* @ param jp the json parser
* @ return the array but written like a String */
private void parseArrayMetadata ( JsonParser jp ) throws IOException { } } | JsonToken value = jp . nextToken ( ) ; while ( value != JsonToken . END_ARRAY ) { if ( value == JsonToken . START_OBJECT ) { parseObjectMetadata ( jp ) ; } else if ( value == JsonToken . START_ARRAY ) { parseArrayMetadata ( jp ) ; } value = jp . nextToken ( ) ; } |
public class Notification { /** * Adds a field ( kind of property ) to the notification
* @ param field the name of the field ( = the key )
* @ param value the value of the field
* @ return the notification itself */
public Notification setFieldValue ( String field , @ Nullable String value ) { } } | fields . put ( field , value ) ; return this ; |
public class CompareMatcher { /** * @ see DiffBuilder # withNamespaceContext ( Map )
* @ since XMLUnit 2.1.0 */
@ Override public CompareMatcher withNamespaceContext ( Map < String , String > prefix2Uri ) { } } | diffBuilder . withNamespaceContext ( prefix2Uri ) ; return this ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link TargetPropertyType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link TargetPropertyType } { @ code > } */
@ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "subject" , substitutionHeadNamespace = "http://www.opengis.net/gml" , substitutionHeadName = "target" ) public JAXBElement < TargetPropertyType > createSubject ( TargetPropertyType value ) { } } | return new JAXBElement < TargetPropertyType > ( _Subject_QNAME , TargetPropertyType . class , null , value ) ; |
public class StreamBootstrapper { /** * Factory method used when the underlying data provider is a pre - allocated
* block source , and no stream is used .
* Additionally the buffer passed is not owned by the bootstrapper
* or Reader that is created , so it is not to be recycled . */
public static StreamBootstrapper getInstance ( String pubId , SystemId sysId , byte [ ] data , int start , int end ) { } } | return new StreamBootstrapper ( pubId , sysId , data , start , end ) ; |
public class Http2ConnectionManager { /** * Get or creat the per route pool .
* @ param eventLoopPool the pool that is bound to the eventloop
* @ param key the route key
* @ return PerRouteConnectionPool */
private EventLoopPool . PerRouteConnectionPool getOrCreatePerRoutePool ( EventLoopPool eventLoopPool , String key ) { } } | final EventLoopPool . PerRouteConnectionPool perRouteConnectionPool = eventLoopPool . fetchPerRoutePool ( key ) ; if ( perRouteConnectionPool != null ) { return perRouteConnectionPool ; } return eventLoopPool . getPerRouteConnectionPools ( ) . computeIfAbsent ( key , p -> new EventLoopPool . PerRouteConnectionPool ( poolConfiguration . getHttp2MaxActiveStreamsPerConnection ( ) ) ) ; |
public class ASTHelpers { /** * Returns the method tree that matches the given symbol within the compilation unit , or null if
* none was found . */
@ Nullable public static MethodTree findMethod ( MethodSymbol symbol , VisitorState state ) { } } | return JavacTrees . instance ( state . context ) . getTree ( symbol ) ; |
public class GoogleMapShape { /** * Expand the bounding box by the markers
* @ param boundingBox bounding box
* @ param markers list of markers */
private void expandBoundingBoxMarkers ( BoundingBox boundingBox , List < Marker > markers ) { } } | for ( Marker marker : markers ) { expandBoundingBox ( boundingBox , marker . getPosition ( ) ) ; } |
public class BaseFolder { /** * Add this field in the Record ' s field sequence . */
public BaseField setupField ( int iFieldSeq ) { } } | BaseField field = null ; // if ( iFieldSeq = = 0)
// field = new CounterField ( this , ID , Constants . DEFAULT _ FIELD _ LENGTH , null , null ) ;
// field . setHidden ( true ) ;
// if ( iFieldSeq = = 1)
// field = new RecordChangedField ( this , LAST _ CHANGED , Constants . DEFAULT _ FIELD _ LENGTH , null , null ) ;
// field . setHidden ( true ) ;
// if ( iFieldSeq = = 2)
// field = new BooleanField ( this , DELETED , Constants . DEFAULT _ FIELD _ LENGTH , null , new Boolean ( false ) ) ;
// field . setHidden ( true ) ;
if ( iFieldSeq == 3 ) field = new StringField ( this , NAME , 40 , null , null ) ; if ( iFieldSeq == 4 ) field = new ReferenceField ( this , PARENT_FOLDER_ID , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( field == null ) field = super . setupField ( iFieldSeq ) ; return field ; |
public class Storage { /** * Factory method to create a new storage backed by a concurrent hash map .
* @ param < K >
* @ param < V >
* @ return */
public static < K , V > Storage < K , V > createConcurrentHashMapStorage ( ) { } } | return new Storage < K , V > ( new MapStorageWrapper < K , V > ( new ConcurrentHashMap < K , V > ( ) ) ) ; |
public class XStreamTransformer { /** * xml - > pojo
* @ param clazz
* @ param xml
* @ return */
@ SuppressWarnings ( "unchecked" ) public static < T > T fromXml ( Class < T > clazz , String xml ) { } } | T object = ( T ) CLASS_2_XSTREAM_INSTANCE . get ( clazz ) . fromXML ( xml ) ; return object ; |
public class UserRegistration { /** * Get the table name . */
public String getTableNames ( boolean bAddQuotes ) { } } | return ( m_tableName == null ) ? Record . formatTableNames ( USER_REGISTRATION_FILE , bAddQuotes ) : super . getTableNames ( bAddQuotes ) ; |
public class GerritSendCommandQueue { /** * Checks queue size . */
private void checkQueueSize ( ) { } } | int queueSize = getQueueSize ( ) ; if ( SEND_QUEUE_SIZE_WARNING_THRESHOLD > 0 && queueSize >= SEND_QUEUE_SIZE_WARNING_THRESHOLD ) { logger . warn ( "The Gerrit send commands queue contains {} items!" + " Something might be stuck, or your system can't process the commands fast enough." + " Try to increase the number of sending worker threads." + " Current thread-pool size: {}" , queueSize , executor . getPoolSize ( ) ) ; logger . info ( "Nr of active pool-threads: {}" , executor . getActiveCount ( ) ) ; } |
public class OrExpressionImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public NotificationChain basicSetRight ( Expression newRight , NotificationChain msgs ) { } } | Expression oldRight = right ; right = newRight ; if ( eNotificationRequired ( ) ) { ENotificationImpl notification = new ENotificationImpl ( this , Notification . SET , SimpleExpressionsPackage . OR_EXPRESSION__RIGHT , oldRight , newRight ) ; if ( msgs == null ) msgs = notification ; else msgs . add ( notification ) ; } return msgs ; |
public class AbsSetting { /** * 获取数字型型属性值
* @ param key 属性名
* @ param group 分组名
* @ param defaultValue 默认值
* @ return 属性值 */
public Integer getInt ( String key , String group , Integer defaultValue ) { } } | return Convert . toInt ( getByGroup ( key , group ) , defaultValue ) ; |
public class DefaultReconfigurationPlan { /** * Iterate over the actions .
* The action are automatically sorted increasingly by their starting moment .
* @ return an iterator . */
@ Override public Iterator < Action > iterator ( ) { } } | Set < Action > sorted = new TreeSet < > ( startFirstComparator ) ; sorted . addAll ( actions ) ; return sorted . iterator ( ) ; |
public class MPP9Reader { /** * This method is called to try to catch any invalid tasks that may have sneaked past all our other checks .
* This is done by validating the tasks by task ID . */
private void postProcessTasks ( ) { } } | List < Task > allTasks = m_file . getTasks ( ) ; if ( allTasks . size ( ) > 1 ) { Collections . sort ( allTasks ) ; int taskID = - 1 ; int lastTaskID = - 1 ; for ( int i = 0 ; i < allTasks . size ( ) ; i ++ ) { Task task = allTasks . get ( i ) ; taskID = NumberHelper . getInt ( task . getID ( ) ) ; // In Project the tasks IDs are always contiguous so we can spot invalid tasks by making sure all
// IDs are represented .
if ( ! task . getNull ( ) && lastTaskID != - 1 && taskID > lastTaskID + 1 ) { // This task looks to be invalid .
task . setNull ( true ) ; } else { lastTaskID = taskID ; } } } |
public class FileSupport { /** * Retrieves contents from a directory and its subdirectories matching a given mask .
* @ param directory directory
* @ param includeMask file name to match
* @ param returnFiles return files
* @ param returnDirs return directories
* @ return a list containing the found contents */
private static ArrayList < File > getContentsInDirectoryTree ( File directory , String includeMask , boolean returnFiles , boolean returnDirs ) { } } | return getContentsInDirectoryTree ( directory , new FileFilterRuleSet ( directory . getPath ( ) ) . setIncludeFilesWithNameMask ( includeMask ) , returnFiles , returnDirs ) ; |
public class SharedStateRegistry { /** * Releases one reference to the given shared state in the registry . This decreases the
* reference count by one . Once the count reaches zero , the shared state is deleted .
* @ param registrationKey the shared state for which we release a reference .
* @ return the result of the request , consisting of the reference count after this operation
* and the state handle , or null if the state handle was deleted through this request . Returns null if the registry
* was previously closed . */
public Result unregisterReference ( SharedStateRegistryKey registrationKey ) { } } | Preconditions . checkNotNull ( registrationKey ) ; final Result result ; final StreamStateHandle scheduledStateDeletion ; SharedStateRegistry . SharedStateEntry entry ; synchronized ( registeredStates ) { entry = registeredStates . get ( registrationKey ) ; Preconditions . checkState ( entry != null , "Cannot unregister a state that is not registered." ) ; entry . decreaseReferenceCount ( ) ; // Remove the state from the registry when it ' s not referenced any more .
if ( entry . getReferenceCount ( ) <= 0 ) { registeredStates . remove ( registrationKey ) ; scheduledStateDeletion = entry . getStateHandle ( ) ; result = new Result ( null , 0 ) ; } else { scheduledStateDeletion = null ; result = new Result ( entry ) ; } } LOG . trace ( "Unregistered shared state {} under key {}." , entry , registrationKey ) ; scheduleAsyncDelete ( scheduledStateDeletion ) ; return result ; |
public class CmsGwtService { /** * Converts a list of properties to a map . < p >
* @ param properties the list of properties
* @ return a map from property names to properties */
protected Map < String , CmsProperty > getPropertiesByName ( List < CmsProperty > properties ) { } } | Map < String , CmsProperty > result = new HashMap < String , CmsProperty > ( ) ; for ( CmsProperty property : properties ) { String key = property . getName ( ) ; result . put ( key , property . clone ( ) ) ; } return result ; |
public class RiakAttackStore { /** * { @ inheritDoc } */
@ Override public void addAttack ( Attack attack ) { } } | logger . warn ( "Security attack " + attack . getDetectionPoint ( ) . getLabel ( ) + " triggered by user: " + attack . getUser ( ) . getUsername ( ) ) ; String json = gson . toJson ( attack ) ; try { client . execute ( new UpdateSet . Builder ( attacks , new SetUpdate ( ) . add ( json ) ) . build ( ) ) ; } catch ( ExecutionException e ) { if ( logger != null ) { logger . error ( "Adding attack to RiakDB failed" , e ) ; } e . printStackTrace ( ) ; } catch ( InterruptedException e ) { if ( logger != null ) { logger . error ( "Adding attack to RiakDB was interrupted" , e ) ; } e . printStackTrace ( ) ; } super . notifyListeners ( attack ) ; |
public class PeerReplicationResource { /** * / * Visible for testing */
InstanceResource createInstanceResource ( ReplicationInstance instanceInfo , ApplicationResource applicationResource ) { } } | return new InstanceResource ( applicationResource , instanceInfo . getId ( ) , serverConfig , registry ) ; |
public class JsDocInfoParser { /** * Parse a TypeName :
* < pre > { @ code
* TypeName : = NameExpression | NameExpression TypeApplication
* TypeApplication : = ' . ' ? ' < ' TypeExpressionList ' > '
* } < / pre > */
private Node parseTypeName ( JsDocToken token ) { } } | Node typeNameNode = parseNameExpression ( token ) ; if ( match ( JsDocToken . LEFT_ANGLE ) ) { next ( ) ; skipEOLs ( ) ; Node memberType = parseTypeExpressionList ( typeNameNode . getString ( ) , next ( ) ) ; if ( memberType != null ) { typeNameNode . addChildToFront ( memberType ) ; skipEOLs ( ) ; if ( ! match ( JsDocToken . RIGHT_ANGLE ) ) { return reportTypeSyntaxWarning ( "msg.jsdoc.missing.gt" ) ; } next ( ) ; } } return typeNameNode ; |
public class CmsUgcSession { /** * Finishes the session and publishes the changed resources if necessary . < p >
* @ throws CmsException if something goes wrong */
public void finish ( ) throws CmsException { } } | m_finished = true ; m_requiresCleanup = false ; CmsProject project = getProject ( ) ; CmsObject projectCms = OpenCms . initCmsObject ( m_adminCms ) ; projectCms . getRequestContext ( ) . setCurrentProject ( project ) ; if ( m_configuration . isAutoPublish ( ) ) { // we don ' t necessarily publish with the user who has the locks on the resources , so we need to steal the locks
List < CmsResource > projectResources = projectCms . readProjectView ( project . getUuid ( ) , CmsResource . STATE_KEEP ) ; for ( CmsResource projectResource : projectResources ) { CmsLock lock = projectCms . getLock ( projectResource ) ; if ( ! lock . isUnlocked ( ) && ! lock . isLockableBy ( projectCms . getRequestContext ( ) . getCurrentUser ( ) ) ) { projectCms . changeLock ( projectResource ) ; } } OpenCms . getPublishManager ( ) . publishProject ( projectCms , new CmsLogReport ( Locale . ENGLISH , CmsUgcSession . class ) ) ; } else { // try to unlock everything - we don ' t need this in case of auto - publish , since publishing already unlocks the resources
projectCms . unlockProject ( project . getUuid ( ) ) ; } |
public class ForkJoinPool { /** * If there is a security manager , makes sure caller has
* permission to modify threads . */
private static void checkPermission ( ) { } } | SecurityManager security = System . getSecurityManager ( ) ; if ( security != null ) security . checkPermission ( modifyThreadPermission ) ; |
public class HTCashbillServiceImp { /** * ( non - Javadoc )
* @ see com . popbill . api . HTCashbillService # getCertificateExpireDate ( java . lang . String ) */
@ Override public Date getCertificateExpireDate ( String CorpNum ) throws PopbillException { } } | CertResponse response = httpget ( "/HomeTax/Cashbill/CertInfo" , CorpNum , null , CertResponse . class ) ; try { return new SimpleDateFormat ( "yyyyMMddHHmmss" ) . parse ( response . certificateExpiration ) ; } catch ( ParseException e ) { throw new PopbillException ( - 99999999 , "날자형식 포맷변환 실패[" + response . certificateExpiration + "]" , e ) ; } |
public class CommitsApi { /** * Add a comment to a commit . In order to post a comment in a particular line of a particular file ,
* you must specify the full commit SHA , the path , the line and lineType should be NEW .
* < pre > < code > GitLab Endpoint : POST / projects / : id / repository / commits / : sha / comments < / code > < / pre >
* @ param projectIdOrPath the project in the form of an Integer ( ID ) , String ( path ) , or Project instance
* @ param sha a commit hash or name of a branch or tag
* @ param note the text of the comment , required
* @ param path the file path relative to the repository , optional
* @ param line the line number where the comment should be placed , optional
* @ param lineType the line type , optional
* @ return a Comment instance for the posted comment
* @ throws GitLabApiException GitLabApiException if any exception occurs during execution */
public Comment addComment ( Object projectIdOrPath , String sha , String note , String path , Integer line , LineType lineType ) throws GitLabApiException { } } | GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "note" , note , true ) . withParam ( "path" , path ) . withParam ( "line" , line ) . withParam ( "line_type" , lineType ) ; Response response = post ( Response . Status . CREATED , formData , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "repository" , "commits" , sha , "comments" ) ; return ( response . readEntity ( Comment . class ) ) ; |
public class GridIndex { /** * Finds a triangle near the given point
* @ param point a query point
* @ return a triangle at the same cell of the point */
public Triangle findCellTriangleOf ( Point3D point ) { } } | int x_index = ( int ) ( ( point . x - indexRegion . minX ( ) ) / x_size ) ; int y_index = ( int ) ( ( point . y - indexRegion . minY ( ) ) / y_size ) ; return grid [ x_index ] [ y_index ] ; |
public class FileLogProperties { /** * Returns the physical log size of a recovery log constructed from the target
* object .
* @ return int The phyisical log size ( in kilobytes ) */
public int logFileSize ( ) { } } | if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "logFileSize" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "logFileSize" , new Integer ( _logFileSize ) ) ; return _logFileSize ; |
public class TaskInProgress { /** * Finalize the < b > completed < / b > task ; note that this might not be the first
* task - attempt of the { @ link TaskInProgress } and hence might be declared
* { @ link TaskStatus . State . SUCCEEDED } or { @ link TaskStatus . State . KILLED }
* @ param taskId id of the completed task - attempt
* @ param finalTaskState final { @ link TaskStatus . State } of the task - attempt */
private void completedTask ( TaskAttemptID taskId , TaskStatus . State finalTaskState ) { } } | TaskStatus status = taskStatuses . get ( taskId ) ; status . setRunState ( finalTaskState ) ; activeTasks . remove ( taskId ) ; |
public class OldNameCollector { /** * This is not an expression */
@ Override public LexNameList caseARecordModifier ( ARecordModifier rm ) throws AnalysisException { } } | return af . createPExpAssistant ( ) . getOldNames ( rm . getValue ( ) ) ; |
public class DataSourceResourceFactoryBuilder { /** * Scan the shared libraries for the application to determine which library provides the data source class .
* Update the jdbcDriver and dataSource configuration accordingly . For example ,
* < jdbcDriver libraryRef = " { service . pid for libraryRef } " library = " { libraryRef } " sharedLib . target = " ( service . pid = { libraryRef } ) " { type } = " { className } " / >
* < dataSource type = " { type } " / >
* @ param applicationName name of the application with the DataSourceDefinition . Is set to null when java : global is specified
* @ param declaringApplication name of the application with the DataSourceDefinition .
* @ param className data source or driver implementation class name , including package . NULL means infer the implementation class .
* @ param url URL with which the Driver will connect to the database . NULL if data source should be used instead of Driver .
* @ param driverProps properties for the jdbcDriver .
* @ param dsSvcProps properties for the dataSource .
* @ return the supplied className unless NULL , in which case the inferred class name is returned .
* @ throws Exception if an error occurs or unable to locate a library containing the data source class or unable to infer a data source / driver class . */
private final String updateWithLibraries ( BundleContext bundleContext , String applicationName , String declaringApplication , String className , String url , Hashtable < String , Object > driverProps , Hashtable < String , Object > dsSvcProps ) throws Exception { } } | final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "updateWithLibraries" , applicationName , className ) ; ConfigurationAdmin configAdmin = configAdminRef . getServiceWithException ( ) ; // Find the application
Configuration [ ] classloaderConfigs = null ; ServiceReference < ? > [ ] refs = DataSourceService . priv . getServiceReferences ( bundleContext , "com.ibm.wsspi.application.Application" , FilterUtils . createPropertyFilter ( "name" , declaringApplication ) ) ; if ( refs != null && refs . length > 0 ) { ServiceReference < ? > appRef = refs [ 0 ] ; String parentPid = ( String ) appRef . getProperty ( Constants . SERVICE_PID ) ; String sourcePid = ( String ) appRef . getProperty ( "ibm.extends.source.pid" ) ; if ( sourcePid != null ) { parentPid = sourcePid ; } // Find the classloaders for the application
StringBuilder classloaderFilter = new StringBuilder ( 200 ) ; classloaderFilter . append ( "(&" ) ; classloaderFilter . append ( FilterUtils . createPropertyFilter ( "service.factoryPid" , "com.ibm.ws.classloading.classloader" ) ) ; classloaderFilter . append ( FilterUtils . createPropertyFilter ( "config.parentPID" , parentPid ) ) ; classloaderFilter . append ( ')' ) ; if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "filter for classloaders" , classloaderFilter ) ; if ( classloaderFilter . length ( ) > 3 ) classloaderConfigs = configAdmin . listConfigurations ( classloaderFilter . toString ( ) ) ; } // Find the shared libraries for the classloaders
StringBuilder commonLibraryFilter = new StringBuilder ( 500 ) ; StringBuilder libraryFilter = new StringBuilder ( 500 ) ; commonLibraryFilter . append ( "(|" ) ; libraryFilter . append ( "(|" ) ; if ( classloaderConfigs != null ) { for ( Configuration classloaderConfig : classloaderConfigs ) { Dictionary < ? , ? > classloaderProps = classloaderConfig . getProperties ( ) ; if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "classloader" , classloaderProps ) ; // Do not check for privateLibraryRef for java : global data source definitions , applicationName is null when java : global is used
if ( applicationName != null ) { Object privateLibraryRef = classloaderProps . get ( "privateLibraryRef" ) ; if ( privateLibraryRef != null && privateLibraryRef instanceof String [ ] ) for ( String pid : ( String [ ] ) privateLibraryRef ) libraryFilter . append ( FilterUtils . createPropertyFilter ( Constants . SERVICE_PID , pid ) ) ; } Object commonLibraryRef = classloaderProps . get ( "commonLibraryRef" ) ; if ( commonLibraryRef != null && commonLibraryRef instanceof String [ ] ) for ( String pid : ( String [ ] ) commonLibraryRef ) commonLibraryFilter . append ( FilterUtils . createPropertyFilter ( Constants . SERVICE_PID , pid ) ) ; } } commonLibraryFilter . append ( ')' ) ; libraryFilter . append ( ')' ) ; if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "filters for libraries" , commonLibraryFilter , libraryFilter ) ; // Give commonLibraryRef higher priority than libraryRef by adding it first
List < ServiceReference < Library > > libraryRefs = new LinkedList < ServiceReference < Library > > ( ) ; if ( commonLibraryFilter . length ( ) > 3 ) libraryRefs . addAll ( DataSourceService . priv . getServiceReferences ( bundleContext , Library . class , commonLibraryFilter . toString ( ) ) ) ; if ( libraryFilter . length ( ) > 3 ) libraryRefs . addAll ( DataSourceService . priv . getServiceReferences ( bundleContext , Library . class , libraryFilter . toString ( ) ) ) ; // If no commonLibraryRef or privateLibraryRef was specified , use the global shared lib
if ( libraryRefs . size ( ) == 0 ) { if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "No direct library refs found on datasource, using global shared lib" ) ; StringBuilder globalLibFilter = new StringBuilder ( "(&" ) ; globalLibFilter . append ( FilterUtils . createPropertyFilter ( "service.factoryPid" , "com.ibm.ws.classloading.sharedlibrary" ) ) ; globalLibFilter . append ( FilterUtils . createPropertyFilter ( "id" , "global" ) ) ; globalLibFilter . append ( ")" ) ; Collection < ServiceReference < Library > > globalLib = DataSourceService . priv . getServiceReferences ( bundleContext , Library . class , globalLibFilter . toString ( ) ) ; libraryRefs . addAll ( globalLib ) ; } if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "libraries" , libraryRefs . toArray ( ) ) ; // this structure is populated only if className and url properties are absent .
String [ ] [ ] dsClassInfo = new String [ JDBCDrivers . NUM_DATA_SOURCE_INTERFACES ] [ 2 ] ; final int CLASS_NAME = 0 , LIBRARY_PID = 1 ; // indices for the second dimension
// determine if we need to search for an implementation class , and if so , of which type ( s )
int [ ] dsTypeSearchOrder ; Set < String > searchedLibraryFiles = new TreeSet < String > ( ) ; Set < String > searchedPackages ; boolean hasImplClassName = className != null && className . length ( ) > 0 ; if ( hasImplClassName ) { if ( XADataSource . class . getName ( ) . equals ( className ) ) { dsTypeSearchOrder = new int [ ] { JDBCDrivers . XA_DATA_SOURCE } ; searchedPackages = new TreeSet < String > ( ) ; hasImplClassName = false ; } else if ( ConnectionPoolDataSource . class . getName ( ) . equals ( className ) ) { dsTypeSearchOrder = new int [ ] { JDBCDrivers . CONNECTION_POOL_DATA_SOURCE } ; searchedPackages = new TreeSet < String > ( ) ; hasImplClassName = false ; } else if ( DataSource . class . getName ( ) . equals ( className ) ) { dsTypeSearchOrder = new int [ ] { JDBCDrivers . DATA_SOURCE } ; searchedPackages = new TreeSet < String > ( ) ; hasImplClassName = false ; } else if ( Driver . class . getName ( ) . equals ( className ) ) { dsTypeSearchOrder = null ; searchedPackages = Collections . singleton ( "META-INF/services/java.sql.Driver" ) ; hasImplClassName = false ; } else { dsTypeSearchOrder = null ; // if we know the impl class , there is no need to search for one
searchedPackages = null ; } } else if ( url == null ) { dsTypeSearchOrder = new int [ ] { JDBCDrivers . XA_DATA_SOURCE , JDBCDrivers . CONNECTION_POOL_DATA_SOURCE , JDBCDrivers . DATA_SOURCE } ; searchedPackages = new TreeSet < String > ( ) ; } else { // assume java . sql . Driver due to presence of URL
dsTypeSearchOrder = null ; searchedPackages = Collections . singleton ( "META-INF/services/java.sql.Driver" ) ; } // Determine which shared library can load className
for ( ServiceReference < Library > libraryRef : libraryRefs ) { Library library = DataSourceService . priv . getService ( bundleContext , libraryRef ) ; try { String libraryPid = ( String ) libraryRef . getProperty ( Constants . SERVICE_PID ) ; if ( library == null ) { if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "library not found" , libraryPid ) ; } else { try { ClassLoader loader = AdapterUtil . getClassLoaderWithPriv ( library ) ; String type = null ; if ( hasImplClassName ) { Class < ? > cl = DataSourceService . priv . loadClass ( loader , className ) ; type = XADataSource . class . isAssignableFrom ( cl ) ? XADataSource . class . getName ( ) : ConnectionPoolDataSource . class . isAssignableFrom ( cl ) ? ConnectionPoolDataSource . class . getName ( ) : DataSource . class . isAssignableFrom ( cl ) ? DataSource . class . getName ( ) : Driver . class . getName ( ) ; } else { searchedLibraryFiles . addAll ( JDBCDriverService . getClasspath ( library , false ) ) ; if ( dsTypeSearchOrder == null ) { type = Driver . class . getName ( ) ; for ( Iterator < Driver > it = ServiceLoader . load ( Driver . class , loader ) . iterator ( ) ; it . hasNext ( ) ; ) { Driver driver = it . next ( ) ; if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "trying driver" , driver ) ; try { if ( driver . acceptsURL ( url ) ) { if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , driver + " accepts " + PropertyService . filterURL ( url ) ) ; className = driver . getClass ( ) . getName ( ) ; break ; } else { if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , driver + " does not accept " + PropertyService . filterURL ( url ) ) ; } } catch ( SQLException x ) { if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , driver + " does not accept " + PropertyService . filterURL ( url ) , x ) ; } } } else { SimpleEntry < Integer , String > dsEntry = JDBCDrivers . inferDataSourceClassFromDriver ( loader , searchedPackages , dsTypeSearchOrder ) ; if ( dsEntry != null ) { int dsType = dsEntry . getKey ( ) ; if ( dsClassInfo [ dsType ] [ CLASS_NAME ] == null ) { dsClassInfo [ dsType ] [ CLASS_NAME ] = dsEntry . getValue ( ) ; dsClassInfo [ dsType ] [ LIBRARY_PID ] = libraryPid ; } } } } if ( className != null && type != null ) { driverProps . put ( JDBCDriverService . LIBRARY_REF , new String [ ] { libraryPid } ) ; driverProps . put ( JDBCDriverService . TARGET_LIBRARY , FilterUtils . createPropertyFilter ( "service.pid" , libraryPid ) ) ; driverProps . put ( type , className ) ; dsSvcProps . put ( DSConfig . TYPE , type ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "updateWithLibraries" , driverProps ) ; return className ; } } catch ( ClassNotFoundException x ) { if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( tc , className + " not found in" , libraryPid ) ; searchedLibraryFiles . addAll ( JDBCDriverService . getClasspath ( library , false ) ) ; } catch ( Exception x ) { FFDCFilter . processException ( x , DataSourceResourceFactoryBuilder . class . getName ( ) , "444" , new Object [ ] { libraryRef } ) ; if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( tc , libraryRef . toString ( ) , x ) ; searchedLibraryFiles . addAll ( JDBCDriverService . getClasspath ( library , false ) ) ; // Continue to try other libraryRefs
} } } finally { bundleContext . ungetService ( libraryRef ) ; } } // Inferred data source class name when className and url properties are absent
for ( int dsType : new int [ ] { JDBCDrivers . XA_DATA_SOURCE , JDBCDrivers . CONNECTION_POOL_DATA_SOURCE , JDBCDrivers . DATA_SOURCE } ) if ( dsClassInfo [ dsType ] [ CLASS_NAME ] != null ) { String type = dsType == JDBCDrivers . XA_DATA_SOURCE ? XADataSource . class . getName ( ) : dsType == JDBCDrivers . CONNECTION_POOL_DATA_SOURCE ? ConnectionPoolDataSource . class . getName ( ) : DataSource . class . getName ( ) ; driverProps . put ( JDBCDriverService . LIBRARY_REF , new String [ ] { dsClassInfo [ dsType ] [ LIBRARY_PID ] } ) ; driverProps . put ( JDBCDriverService . TARGET_LIBRARY , FilterUtils . createPropertyFilter ( "service.pid" , dsClassInfo [ dsType ] [ LIBRARY_PID ] ) ) ; driverProps . put ( type , dsClassInfo [ dsType ] [ CLASS_NAME ] ) ; dsSvcProps . put ( DSConfig . TYPE , type ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "updateWithLibraries" , driverProps ) ; return dsClassInfo [ dsType ] [ CLASS_NAME ] ; } String message ; if ( searchedPackages == null ) { // className couldn ' t be found in any of the shared libraries
message = ConnectorService . getMessage ( "MISSING_LIBRARY_J2CA8022" , declaringApplication , className , DataSourceService . DATASOURCE , dsSvcProps . get ( DataSourceService . JNDI_NAME ) ) ; } else { List < String > types = dsTypeSearchOrder == null ? Collections . singletonList ( "java.sql.Driver" ) : new ArrayList < String > ( dsTypeSearchOrder . length ) ; if ( dsTypeSearchOrder != null ) for ( int dsType : dsTypeSearchOrder ) switch ( dsType ) { case JDBCDrivers . DATA_SOURCE : types . add ( "javax.sql.DataSource" ) ; break ; case JDBCDrivers . CONNECTION_POOL_DATA_SOURCE : types . add ( "javax.sql.ConnectionPoolDataSource" ) ; break ; case JDBCDrivers . XA_DATA_SOURCE : types . add ( "javax.sql.XADataSource" ) ; break ; } message = AdapterUtil . getNLSMessage ( "DSRA4001.no.suitable.driver.nested" , types , dsSvcProps . get ( DataSourceService . JNDI_NAME ) , searchedLibraryFiles , searchedPackages ) ; } SQLNonTransientException x = new SQLNonTransientException ( message ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "updateWithLibraries" , x ) ; throw x ; |
public class GuardedByChecker { /** * Validates that { @ code @ GuardedBy } strings can be resolved . */
Description validate ( Tree tree , VisitorState state ) { } } | GuardedByValidationResult result = GuardedByUtils . isGuardedByValid ( tree , state ) ; if ( result . isValid ( ) ) { return Description . NO_MATCH ; } return buildDescription ( tree ) . setMessage ( String . format ( "Invalid @GuardedBy expression: %s" , result . message ( ) ) ) . build ( ) ; |
public class AccumulatorHelper { /** * Transform the Map with accumulators into a Map containing only the
* results . */
public static Map < String , OptionalFailure < Object > > toResultMap ( Map < String , Accumulator < ? , ? > > accumulators ) { } } | Map < String , OptionalFailure < Object > > resultMap = new HashMap < > ( ) ; for ( Map . Entry < String , Accumulator < ? , ? > > entry : accumulators . entrySet ( ) ) { resultMap . put ( entry . getKey ( ) , wrapUnchecked ( entry . getKey ( ) , ( ) -> entry . getValue ( ) . getLocalValue ( ) ) ) ; } return resultMap ; |
public class Branch { /** * Attempts to compile the branch ID for this branch . In order to successfully
* compile , the { @ code tree _ id } , { @ code path } and { @ code display _ name } must
* be set . The path may be empty , which indicates this is a root branch , but
* it must be a valid Map object .
* @ return The branch ID as a byte array
* @ throws IllegalArgumentException if any required parameters are missing */
public byte [ ] compileBranchId ( ) { } } | if ( tree_id < 1 || tree_id > 65535 ) { throw new IllegalArgumentException ( "Missing or invalid tree ID" ) ; } // root branch path may be empty
if ( path == null ) { throw new IllegalArgumentException ( "Missing branch path" ) ; } if ( display_name == null || display_name . isEmpty ( ) ) { throw new IllegalArgumentException ( "Missing display name" ) ; } // first , make sure the display name is at the tip of the tree set
if ( path . isEmpty ( ) ) { path . put ( 0 , display_name ) ; } else if ( ! path . lastEntry ( ) . getValue ( ) . equals ( display_name ) ) { final int depth = path . lastEntry ( ) . getKey ( ) + 1 ; path . put ( depth , display_name ) ; } final byte [ ] branch_id = new byte [ Tree . TREE_ID_WIDTH ( ) + ( ( path . size ( ) - 1 ) * INT_WIDTH ) ] ; int index = 0 ; final byte [ ] tree_bytes = Tree . idToBytes ( tree_id ) ; System . arraycopy ( tree_bytes , 0 , branch_id , index , tree_bytes . length ) ; index += tree_bytes . length ; for ( Map . Entry < Integer , String > entry : path . entrySet ( ) ) { // skip the root , keeps the row keys 4 bytes shorter
if ( entry . getKey ( ) == 0 ) { continue ; } final byte [ ] hash = Bytes . fromInt ( entry . getValue ( ) . hashCode ( ) ) ; System . arraycopy ( hash , 0 , branch_id , index , hash . length ) ; index += hash . length ; } return branch_id ; |
public class GeoBBoxConditionBuilder { /** * Returns the { @ link GeoBBoxCondition } represented by this builder .
* @ return a new geo bounding box condition */
@ Override public GeoBBoxCondition build ( ) { } } | return new GeoBBoxCondition ( boost , field , minLatitude , maxLatitude , minLongitude , maxLongitude ) ; |
public class JSONAssert { /** * Asserts that the JSONObject provided does not match the expected string . If it is it throws an
* { @ link AssertionError } .
* @ see # assertEquals ( String , JSONObject , JSONCompareMode )
* @ param expectedStr Expected JSON string
* @ param actual JSONObject to compare
* @ param compareMode Specifies which comparison mode to use
* @ throws JSONException JSON parsing error */
public static void assertNotEquals ( String expectedStr , JSONObject actual , JSONCompareMode compareMode ) throws JSONException { } } | assertNotEquals ( "" , expectedStr , actual , compareMode ) ; |
public class LRActivity { /** * Add a related object to this activity
* @ param objectType The type of the object ( required )
* @ param id Id of the ojbect
* @ param content String describing the content of the object
* @ return True if added , false if not ( due to missing required fields ) */
public boolean addRelatedObject ( String objectType , String id , String content ) { } } | Map < String , Object > container = new HashMap < String , Object > ( ) ; if ( objectType != null ) { container . put ( "objectType" , objectType ) ; } else { return false ; } if ( id != null ) { container . put ( "id" , id ) ; } if ( content != null ) { container . put ( "content" , content ) ; } related . add ( container ) ; return true ; |
public class JavaNetHttpTransport { /** * Parses response , whether or not the request was successful , if possible .
* Reads entire input stream and closes it so the socket knows it is
* finished and may be put back into a pool for reuse . */
private String response ( HttpURLConnection connection ) throws LightblueHttpClientException { } } | try ( InputStream responseStream = connection . getInputStream ( ) ) { return readResponseStream ( responseStream , connection ) ; } catch ( IOException e ) { return readErrorStream ( connection , e ) ; } |
public class NodeReportsInner { /** * Retrieve the Dsc node report data by node id and report id .
* @ param resourceGroupName Name of an Azure Resource group .
* @ param automationAccountName The name of the automation account .
* @ param nodeId The Dsc node id .
* @ param reportId The report id .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws ErrorResponseException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the DscNodeReportInner object if successful . */
public DscNodeReportInner get ( String resourceGroupName , String automationAccountName , String nodeId , String reportId ) { } } | return getWithServiceResponseAsync ( resourceGroupName , automationAccountName , nodeId , reportId ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class LazyList { /** * Get the real List from a LazyList .
* @ param list A LazyList returned from LazyList . add ( Object ) or null
* @ param nullForEmpty If true , null is returned instead of an
* empty list .
* @ return The List of added items , which may be null , an EMPTY _ LIST
* or a SingletonList . */
public static List getList ( Object list , boolean nullForEmpty ) { } } | if ( list == null ) return nullForEmpty ? null : Collections . EMPTY_LIST ; if ( list instanceof List ) return ( List ) list ; List l = new ArrayList ( 1 ) ; l . add ( list ) ; return l ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.