signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class NetUtils { /** * Find a non - occupied port . * @ return A non - occupied port . */ public static int getAvailablePort ( ) { } }
for ( int i = 0 ; i < 50 ; i ++ ) { try ( ServerSocket serverSocket = new ServerSocket ( 0 ) ) { int port = serverSocket . getLocalPort ( ) ; if ( port != 0 ) { return port ; } } catch ( IOException ignored ) { } } throw new RuntimeException ( "Could not find a free permitted port on the machine." ) ;
public class UpdateApplicationBase { /** * Check if something should run based on admin / paused / internal status */ static protected boolean allowPausedModeWork ( boolean internalCall , boolean adminConnection ) { } }
return ( VoltDB . instance ( ) . getMode ( ) != OperationMode . PAUSED || internalCall || adminConnection ) ;
public class StorageUtil { /** * create xml file from a resource definition * @ param res * @ param resourcePath * @ throws IOException */ public void loadFile ( Resource res , String resourcePath ) throws IOException { } }
res . createFile ( true ) ; InputStream is = InfoImpl . class . getResourceAsStream ( resourcePath ) ; IOUtil . copy ( is , res , true ) ;
public class SourceLineAnnotation { /** * Factory method for creating a source line annotation describing the * source line number for a visited instruction . * @ param classContext * the ClassContext * @ param methodGen * the MethodGen object representing the method * @ param handle * the InstructionHand...
LineNumberTable table = methodGen . getLineNumberTable ( methodGen . getConstantPool ( ) ) ; String className = methodGen . getClassName ( ) ; int bytecodeOffset = handle . getPosition ( ) ; if ( table == null ) { return createUnknown ( className , sourceFile , bytecodeOffset , bytecodeOffset ) ; } int lineNumber = tab...
public class AbstractHylaFAXClientConnectionFactory { /** * This function initializes the connection factory . */ @ Override protected void initializeImpl ( ) { } }
// get values this . host = this . factoryConfigurationHolder . getConfigurationValue ( FaxClientSpiConfigurationConstants . HOST_PROPERTY_KEY ) ; if ( this . host == null ) { throw new FaxException ( "Host name not defined in fax4j.properties. Property: " + FaxClientSpiConfigurationConstants . HOST_PROPERTY_KEY ) ; } ...
public class LibGmp { /** * Set rop from an array of word data at op . * The parameters specify the format of the data . count many words are read , each size bytes . * order can be 1 for most significant word first or - 1 for least significant first . Within each * word endian can be 1 for most significant byte ...
if ( SIZE_T_CLASS == SizeT4 . class ) { SizeT4 . __gmpz_import ( rop , count , order , size , endian , nails , buffer ) ; } else { SizeT8 . __gmpz_import ( rop , count , order , size , endian , nails , buffer ) ; }
public class DefaultLogger { /** * Get the project name or null * @ param event the event * @ return the project that raised this event * @ since Ant1.7.1 */ protected String extractProjectName ( final BuildEvent event ) { } }
final Project project = event . getProject ( ) ; return ( project != null ) ? project . getName ( ) : null ;
public class ServerTaskExecutor { /** * Execute the operation . * @ param listener the transactional operation listener * @ param client the transactional protocol client * @ param identity the server identity * @ param operation the operation * @ param transformer the operation result transformer * @ retur...
if ( client == null ) { return false ; } final OperationMessageHandler messageHandler = new DelegatingMessageHandler ( context ) ; final OperationAttachments operationAttachments = new DelegatingOperationAttachments ( context ) ; final ServerOperation serverOperation = new ServerOperation ( identity , operation , messa...
public class SerializerBase { /** * Report the comment trace event * @ param chars content of comment * @ param start starting index of comment to output * @ param length number of characters to output */ protected void fireCommentEvent ( char [ ] chars , int start , int length ) throws org . xml . sax . SAXExcep...
if ( m_tracer != null ) { flushMyWriter ( ) ; m_tracer . fireGenerateEvent ( SerializerTrace . EVENTTYPE_COMMENT , new String ( chars , start , length ) ) ; }
public class SObject { /** * Construct an sobject with key , content and attributes specified in sequence * key1 , val1 , key2 , val2 , . . . * @ see # of ( String , String , Map ) */ public static SObject of ( String key , String content , String ... attrs ) { } }
SObject sobj = of ( key , content ) ; Map < String , String > map = C . Map ( attrs ) ; sobj . setAttributes ( map ) ; return sobj ;
public class ConstructorTypeImpl { /** * If not already created , a new < code > return - value < / code > element with the given value will be created . * Otherwise , the existing < code > return - value < / code > element will be returned . * @ return a new or existing instance of < code > ReturnValueType < Const...
Node node = childNode . getOrCreate ( "return-value" ) ; ReturnValueType < ConstructorType < T > > returnValue = new ReturnValueTypeImpl < ConstructorType < T > > ( this , "return-value" , childNode , node ) ; return returnValue ;
public class AmazonPinpointClient { /** * Returns information about a segment . * @ param getSegmentRequest * @ return Result of the GetSegment operation returned by the service . * @ throws BadRequestException * 400 response * @ throws InternalServerErrorException * 500 response * @ throws ForbiddenExcep...
request = beforeClientExecution ( request ) ; return executeGetSegment ( request ) ;
public class AbstractController { /** * Link the creation of a wave to an event triggered on a node . * This method doesn ' t use any callback function to trigger the launch the wave . * @ param node the node to follow * @ param eventType the type of the event to follow * @ param waveType the type of the wave t...
linkWave ( node , eventType , waveType , null , waveData ) ;
public class ClassLoaderDistribution { /** * { @ inheritDoc } * Note : requested resources will automatically be prefixed with " resources / " . */ @ Override public InputStream get ( String path ) throws IOException { } }
InputStream stream = _cl . getResourceAsStream ( rewritePath ( path ) ) ; if ( stream == null ) { throw new FileNotFoundException ( "Not found in classpath: " + path ) ; } else { return stream ; }
public class PathBuilder { /** * Create a new List typed path * @ param < A > * @ param property property name * @ param type property type * @ return property path */ public < A > ListPath < A , PathBuilder < A > > getList ( String property , Class < A > type ) { } }
return this . < A , PathBuilder < A > > getList ( property , type , PathBuilder . class ) ;
public class StatefulBeanO { /** * StatefulBeanO */ @ Override protected void injectInstance ( ManagedObject < ? > managedObject , Object instance , InjectionTargetContext injectionContext ) throws EJBException { } }
// If present , setSessionContext should be called before performing injection if ( sessionBean != null ) { try { sessionBean . setSessionContext ( this ) ; } catch ( RemoteException rex ) { // RemoteException is only on the signature for backwards compatibility // with EJB 1.0 ; should throw an EJBException instead . ...
public class Application { /** * Given the servlet path ( the part of the URI after the context path ) this generates the * classname of the logic class that should handle the request . */ protected String generateClass ( String path ) { } }
// remove the trailing file extension int ldidx = path . lastIndexOf ( "." ) ; if ( ldidx != - 1 ) { path = path . substring ( 0 , ldidx ) ; } // convert slashes to dots path = path . replace ( '/' , '.' ) ; // prepend the base logic package and we ' re all set return _logicPkg + path ;
public class AsmDiagramClass { /** * SGS : */ public IAsmListElementsUml < IAsmElementUml < ClassFull < ClassUml > , DRI , SD , PRI > , DRI , SD , IMG , PRI , ClassFull < ClassUml > > getAsmListAsmClassesFull ( ) { } }
return assemblyListClassesUml ;
public class RandomAccessStorageModule { /** * Creating a new file if not existing at the path defined in the config . Note that it is advised to create the file * beforehand . * @ param pConf configuration to be updated * @ return true if creation successful , false if file already exists . * @ throws IOExcept...
FileOutputStream outStream = null ; try { // if file exists , remove it after questioning . if ( pToCreate . exists ( ) ) { if ( ! pToCreate . delete ( ) ) { LOGGER . debug ( "Removal of old storage " + pToCreate . toString ( ) + " unsucessful." ) ; return false ; } LOGGER . debug ( "Removal of old storage " + pToCreat...
public class Zendesk { /** * https : / / support . zendesk . com / hc / communities / public / posts / 203464106 - Managing - Organization - Memberships - via - the - Zendesk - API */ public List < OrganizationMembership > getOrganizationMembershipByUser ( long user_id ) { } }
return complete ( submit ( req ( "GET" , tmpl ( "/users/{user_id}/organization_memberships.json" ) . set ( "user_id" , user_id ) ) , handleList ( OrganizationMembership . class , "organization_memberships" ) ) ) ;
public class AppearancePreferenceFragment { /** * Creates and returns a listener , which allows to adapt the width of the navigation , when the * value of the corresponding preference has been changed . * @ return The listener , which has been created , as an instance of the type { @ link * OnPreferenceChangeList...
return new OnPreferenceChangeListener ( ) { @ Override public boolean onPreferenceChange ( final Preference preference , final Object newValue ) { int width = Integer . valueOf ( ( String ) newValue ) ; ( ( PreferenceActivity ) getActivity ( ) ) . setNavigationWidth ( dpToPixels ( getActivity ( ) , width ) ) ; return t...
public class LicenseWriter { /** * Write the license into the output . * @ param license the license itself * @ param format the desired format of the license , can be { @ link IOFormat # STRING } , * { @ link IOFormat # BASE64 } or { @ link IOFormat # BINARY } * @ throws IOException if the output cannot be wri...
switch ( format ) { case BINARY : os . write ( license . serialized ( ) ) ; return ; case BASE64 : os . write ( Base64 . getEncoder ( ) . encode ( license . serialized ( ) ) ) ; return ; case STRING : os . write ( license . toString ( ) . getBytes ( StandardCharsets . UTF_8 ) ) ; return ; } throw new IllegalArgumentExc...
public class GwtBootstrap3EntryPoint { /** * { @ inheritDoc } */ @ Override public void onModuleLoad ( ) { } }
ScriptInjector . fromString ( GwtBootstrap3ClientBundle . INSTANCE . gwtBootstrap3 ( ) . getText ( ) ) . setWindow ( ScriptInjector . TOP_WINDOW ) . inject ( ) ; if ( ! isjQueryLoaded ( ) ) { ScriptInjector . fromString ( GwtBootstrap3ClientBundle . INSTANCE . jQuery ( ) . getText ( ) ) . setWindow ( ScriptInjector . T...
public class UdpServer { /** * Setup all lifecycle callbacks called on or after { @ link io . netty . channel . Channel } * has been bound and after it has been unbound . * @ param onBind a consumer observing server start event * @ param onBound a consumer observing server started event * @ param onUnbound a co...
Objects . requireNonNull ( onBind , "onBind" ) ; Objects . requireNonNull ( onBound , "onBound" ) ; Objects . requireNonNull ( onUnbound , "onUnbound" ) ; return new UdpServerDoOn ( this , onBind , onBound , onUnbound ) ;
public class CmsRequestUtil { /** * Converts the given parameter map into an JSON object . < p > * @ param params the parameters map to convert * @ return the JSON representation of the given parameter map */ public static JSONObject getJsonParameterMap ( Map < String , String [ ] > params ) { } }
JSONObject result = new JSONObject ( ) ; for ( Map . Entry < String , String [ ] > entry : params . entrySet ( ) ) { String paramKey = entry . getKey ( ) ; JSONArray paramValue = new JSONArray ( ) ; for ( int i = 0 , l = entry . getValue ( ) . length ; i < l ; i ++ ) { paramValue . put ( entry . getValue ( ) [ i ] ) ; ...
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link BigInteger } * { @ code > } */ @ XmlElementDecl ( namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/" , name = "skipCount" , scope = GetObjectRelationships . class ) public JAXBElement < BigInteger > c...
return new JAXBElement < BigInteger > ( _GetTypeChildrenSkipCount_QNAME , BigInteger . class , GetObjectRelationships . class , value ) ;
public class FormatUtil { /** * Formats the array of double arrays d with the specified separators and * fraction digits . * @ param buf Output buffer * @ param d the double array to be formatted * @ param pre Row prefix ( e . g . " [ " ) * @ param pos Row postfix ( e . g . " ] \ n " ) * @ param csep Separa...
if ( d == null ) { return buf . append ( "null" ) ; } if ( d . length == 0 ) { return buf ; } for ( int i = 0 ; i < d . length ; i ++ ) { formatTo ( buf . append ( pre ) , d [ i ] , csep , nf ) . append ( pos ) ; } return buf ;
public class CommandWrapper { /** * Unwrap a wrapped command . * @ param wrapped * @ return */ @ SuppressWarnings ( "unchecked" ) public static < K , V , T > RedisCommand < K , V , T > unwrap ( RedisCommand < K , V , T > wrapped ) { } }
RedisCommand < K , V , T > result = wrapped ; while ( result instanceof DecoratedCommand < ? , ? , ? > ) { result = ( ( DecoratedCommand < K , V , T > ) result ) . getDelegate ( ) ; } return result ;
public class AnnotatedViewDialogController { /** * Creates instance of the managed dialog actor . */ public void prepareDialogInstance ( ) { } }
final LmlParser parser = interfaceService . getParser ( ) ; if ( actionContainer != null ) { parser . getData ( ) . addActionContainer ( getId ( ) , actionContainer ) ; } dialog = ( Window ) parser . createView ( wrappedObject , Gdx . files . internal ( dialogData . value ( ) ) ) . first ( ) ; if ( actionContainer != n...
public class UtilIO { /** * Reads an entire file and converts it into a text string */ public static String readAsString ( String path ) { } }
InputStream stream = openStream ( path ) ; if ( stream == null ) { System . err . println ( "Failed to open " + path ) ; return null ; } return readAsString ( stream ) ;
public class CountMessageLabel { /** * TenantAwareEvent Listener to show the message count . * @ param event * ManagementUIEvent which describes the action to execute */ @ EventBusListenerMethod ( scope = EventScope . UI ) public void onEvent ( final ManagementUIEvent event ) { } }
if ( event == ManagementUIEvent . TARGET_TABLE_FILTER || event == ManagementUIEvent . SHOW_COUNT_MESSAGE ) { displayTargetCountStatus ( ) ; }
public class LongStream { /** * Returns a { @ code LongStream } produced by iterative application of a accumulation function * to reduction value and next element of the current stream . * Produces a { @ code LongStream } consisting of { @ code value1 } , { @ code acc ( value1 , value2 ) } , * { @ code acc ( acc ...
Objects . requireNonNull ( accumulator ) ; return new LongStream ( params , new LongScan ( iterator , accumulator ) ) ;
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcNonNegativeLengthMeasure ( ) { } }
if ( ifcNonNegativeLengthMeasureEClass == null ) { ifcNonNegativeLengthMeasureEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 898 ) ; } return ifcNonNegativeLengthMeasureEClass ;
public class Tree { /** * Changes this node ' s name . Sample code : < br > * < br > * Tree node = new Tree ( " { \ " a \ " : 3 } " ) ; < br > * node . get ( " a " ) . setName ( " b " ) ; < br > * System . out . println ( node . toJSON ( ) ) ; < br > * < br > * This code above prints " { \ " b \ " : 3 } " ....
if ( parent == null ) { throw new UnsupportedOperationException ( "Root node has no name!" ) ; } if ( ! parent . isMap ( ) ) { throw new UnsupportedOperationException ( "Unable to set name (this node's parent is not a Map)!" ) ; } parent . remove ( ( String ) key ) ; key = name ; parent . putObjectInternal ( name , val...
public class PoliciesCache { /** * Create a cache from a single file source * @ param singleFile file * @ return cache */ public static PoliciesCache fromFile ( File singleFile , Set < Attribute > forcedContext ) { } }
return fromSourceProvider ( YamlProvider . getFileProvider ( singleFile ) , forcedContext ) ;
public class ContentValues { /** * Gets a value and converts it to a Boolean . * @ param key the value to get * @ return the Boolean value , or false if the value is missing or cannot be converted */ public Boolean getAsBoolean ( String key ) { } }
Object value = mValues . get ( key ) ; try { return ( Boolean ) value ; } catch ( ClassCastException e ) { if ( value instanceof CharSequence ) { return Boolean . valueOf ( value . toString ( ) ) ; } else if ( value instanceof Number ) { return ( ( Number ) value ) . intValue ( ) != 0 ; } else { logger . log ( Level . ...
public class CmsSitemapView { /** * Reloads the sitemap editor for the currently selected locale when leaving locale compare mode . < p > * @ param editorMode the new editor mode */ private void reloadForLocaleCompareRoot ( final EditorMode editorMode ) { } }
final String localeRootIdStr = CmsJsUtil . getAttributeString ( CmsJsUtil . getWindow ( ) , CmsGwtConstants . VAR_LOCALE_ROOT ) ; CmsRpcAction < String > action = new CmsRpcAction < String > ( ) { @ SuppressWarnings ( "synthetic-access" ) @ Override public void execute ( ) { start ( 0 , false ) ; m_controller . getServ...
public class SignalSlot { /** * Get and clear the slot - MUST be called while holding the lock ! ! * @ return The data or null if no data or error exists * @ throws Throwable If producer encountered an error */ private T getAndClearUnderLock ( ) throws Throwable { } }
if ( error != null ) { throw error ; } else { // Return and clear current T retValue = data ; data = null ; return retValue ; }
public class RulesPlugin { /** * Clear all the fields that were originally flagged as unknown on this object * we should assume the dynamic flag has been removed and we need to reset it . * Also set the current value of each to null , ie we lose any data from the unknown fields for this object . * Because you onl...
ObjectMetadata objectMetadata = object . getMetadata ( ) ; ValidationSession session = object . getMetadata ( ) . getProxyObject ( ) . getSession ( ) ; session . setEnabled ( false ) ; Map < String , ProxyField > fieldMap = objectMetadata . getProxyObject ( ) . getFieldMap ( ) ; for ( Map . Entry < String , ProxyField ...
public class ResourceMapper { /** * The age old json . org library in Android doesn ' t support * mapping bean - style objects directly to JSON , so we have * to call this from a more recent version of JSONObject that * we include in our jar . */ public byte [ ] toJsonBytes ( final Object resource ) throws Unsupp...
if ( resource instanceof JSONObject ) { final JSONObject json = ( JSONObject ) resource ; return json . toString ( ) . getBytes ( "UTF-8" ) ; } final HashMap < String , Object > out = new HashMap < String , Object > ( ) ; final JSONObject res = beanSerialize ( resource , out ) ; if ( res == null || res . length ( ) == ...
public class BlobStoreUtils { /** * Download missing blobs from potential nimbodes */ public static boolean downloadMissingBlob ( Map conf , BlobStore blobStore , String key , Set < NimbusInfo > nimbusInfos ) throws TTransportException { } }
NimbusClient client ; ReadableBlobMeta rbm ; ClientBlobStore remoteBlobStore ; InputStreamWithMeta in ; boolean isSuccess = false ; LOG . debug ( "Download blob NimbusInfos {}" , nimbusInfos ) ; for ( NimbusInfo nimbusInfo : nimbusInfos ) { if ( isSuccess ) { break ; } try { client = new NimbusClient ( conf , nimbusInf...
public class ConfigRuleComplianceSummaryFiltersMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ConfigRuleComplianceSummaryFilters configRuleComplianceSummaryFilters , ProtocolMarshaller protocolMarshaller ) { } }
if ( configRuleComplianceSummaryFilters == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( configRuleComplianceSummaryFilters . getAccountId ( ) , ACCOUNTID_BINDING ) ; protocolMarshaller . marshall ( configRuleComplianceSummaryFilters . get...
public class Queue { /** * Gets the next item from the queue , blocking until an item is added * to the queue if the queue is empty at time of invocation . */ public synchronized T get ( ) { } }
while ( _count == 0 ) { try { wait ( ) ; } catch ( InterruptedException e ) { } } // pull the object off , and clear our reference to it T retval = _items [ _start ] ; _items [ _start ] = null ; _start = ( _start + 1 ) % _size ; _count -- ; // if we are only filling 1/8th of the space , shrink by half if ( ( _size > MI...
public class EmailSender { /** * blocking sending emails . * TODO Make this asynchronous in the future . */ public void blockingSend ( ) { } }
Properties prop = new Properties ( ) ; prop . setProperty ( "mail.transport.protocol" , protocol ) ; prop . setProperty ( "mail.smtp.host" , host ) ; prop . setProperty ( "mail.smtp.port" , port ) ; prop . setProperty ( "mail.smtp.auth" , "true" ) ; // 使用smtp身份验证 // 使用SSL , 企业邮箱必需 ! // 开启安全协议 MailSSLSocketFactory sf = ...
public class SocialWebUtils { /** * Invalidates the original request URL cookie or removes the same respective session attributes , depending on how the data * was saved . */ public void removeRequestUrlAndParameters ( HttpServletRequest request , HttpServletResponse response ) { } }
ReferrerURLCookieHandler referrerURLCookieHandler = getCookieHandler ( ) ; referrerURLCookieHandler . invalidateReferrerURLCookie ( request , response , ReferrerURLCookieHandler . REFERRER_URL_COOKIENAME ) ; WebAppSecurityConfig webAppSecConfig = getWebAppSecurityConfig ( ) ; if ( isPostDataSavedInCookie ( webAppSecCon...
public class RowMapperFactory { /** * Sets the rowmapper for XmlObject . class * @ param rowMapperClass */ public static Class < ? extends RowMapper > setDefaultXmlRowMapping ( Class mapToClass , Class < ? extends RowMapper > rowMapperClass ) { } }
Class < ? extends RowMapper > ret = DEFAULT_XMLOBJ_ROWMAPPING ; DEFAULT_XMLOBJ_ROWMAPPING = rowMapperClass ; XMLOBJ_CLASS = mapToClass ; return ret ;
public class PathConstraint { /** * Uses the encapsulated PAthAccessor to generate satisfying elements . * @ param match current pattern match * @ param ind mapped indices * @ return generated elements */ @ Override public Collection < BioPAXElement > generate ( Match match , int ... ind ) { } }
BioPAXElement ele0 = match . get ( ind [ 0 ] ) ; if ( ele0 == null ) throw new RuntimeException ( "Constraint cannot generate based on null value" ) ; Set vals = pa . getValueFromBean ( ele0 ) ; List < BioPAXElement > list = new ArrayList < BioPAXElement > ( vals . size ( ) ) ; for ( Object o : vals ) { assert o instan...
public class CmsDriverManager { /** * Deletes all log entries matching the given filter . < p > * @ param dbc the current db context * @ param filter the filter to use for deletion * @ throws CmsException if something goes wrong * @ see CmsSecurityManager # deleteLogEntries ( CmsRequestContext , CmsLogFilter ) ...
updateLog ( dbc ) ; m_projectDriver . deleteLog ( dbc , filter ) ;
public class Versions { /** * Resolves the asset index . * @ param minecraftDir the minecraft directory * @ param assets the name of the asset index , you can get this via * { @ link Version # getAssets ( ) } * @ return the asset index , null if the asset index does not exist * @ throws IOException if an I / ...
Objects . requireNonNull ( minecraftDir ) ; Objects . requireNonNull ( assets ) ; if ( ! minecraftDir . getAssetIndex ( assets ) . isFile ( ) ) { return null ; } try { return getVersionParser ( ) . parseAssetIndex ( IOUtils . toJson ( minecraftDir . getAssetIndex ( assets ) ) ) ; } catch ( JSONException e ) { throw new...
public class SearchUsersRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( SearchUsersRequest searchUsersRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( searchUsersRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( searchUsersRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( searchUsersRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; protocol...
public class StorageHandlerImpl { /** * Legacy hashing method to calculate the SHA256 hash of a key . * In some circumstances , this approach produces hashes with incorrect encoding , leading to issues * with loading preferences ( see # 53 ) . * This method is only present for migration reasons , to ensure prefer...
Objects . requireNonNull ( key ) ; MessageDigest messageDigest = null ; try { messageDigest = MessageDigest . getInstance ( "SHA-256" ) ; } catch ( NoSuchAlgorithmException e ) { LOGGER . error ( "Hashing algorithm not found!" ) ; } messageDigest . update ( key . getBytes ( ) ) ; return new String ( messageDigest . dig...
public class InternalXbaseParser { /** * $ ANTLR start synpred8 _ InternalXbase */ public final void synpred8_InternalXbase_fragment ( ) throws RecognitionException { } }
// InternalXbase . g : 1005:6 : ( ( ' > ' ' > ' ) ) // InternalXbase . g : 1005:7 : ( ' > ' ' > ' ) { // InternalXbase . g : 1005:7 : ( ' > ' ' > ' ) // InternalXbase . g : 1006:7 : ' > ' ' > ' { match ( input , 20 , FOLLOW_16 ) ; if ( state . failed ) return ; match ( input , 20 , FOLLOW_2 ) ; if ( state . failed ) re...
public class BaseRTMPTConnection { /** * Decode data sent by the client . * @ param data * the data to decode * @ return a list of decoded objects */ public List < ? > decode ( IoBuffer data ) { } }
log . debug ( "decode - state: {}" , state ) ; if ( closing || state . getState ( ) == RTMP . STATE_DISCONNECTED ) { // Connection is being closed , don ' t decode any new packets return Collections . EMPTY_LIST ; } readBytes . addAndGet ( data . limit ( ) ) ; buffer . put ( data ) ; buffer . flip ( ) ; return decoder ...
public class OrcFile { /** * For full ORC compatibility , field names should be unique when lowercased . */ private void validateNamesUnique ( List < String > names ) { } }
List < String > seenNames = new ArrayList < > ( names . size ( ) ) ; for ( int i = 0 ; i < names . size ( ) ; i ++ ) { String lowerCaseName = names . get ( i ) . toLowerCase ( ) ; int index = seenNames . indexOf ( lowerCaseName ) ; if ( index != - 1 ) { throw new IllegalArgumentException ( "Duplicate field: " + lowerCa...
public class UCharacterName { /** * Sets the token data * @ param token array of tokens * @ param tokenstring array of string values of the tokens * @ return false if there is a data error */ boolean setToken ( char token [ ] , byte tokenstring [ ] ) { } }
if ( token != null && tokenstring != null && token . length > 0 && tokenstring . length > 0 ) { m_tokentable_ = token ; m_tokenstring_ = tokenstring ; return true ; } return false ;
public class RouteClient { /** * Get the detail information of route table for specific route table or / and vpc * @ param routeTableId id of route table , routeTableId and vpcId cannot be empty at the same time * @ param vpcId vpcId , routeTableId and vpcId cannot be empty at the same time * @ return A route tab...
GetRouteRequest request = new GetRouteRequest ( ) ; if ( Strings . isNullOrEmpty ( vpcId ) && Strings . isNullOrEmpty ( routeTableId ) ) { throw new IllegalArgumentException ( "routeTableId and vpcId should not be empty at the same time" ) ; } else if ( ! Strings . isNullOrEmpty ( routeTableId ) ) { request . withRoute...
public class EditGeometryBaseController { public void onActivate ( MapPresenter mapPresenter ) { } }
super . onActivate ( mapPresenter ) ; idleController . onActivate ( mapPresenter ) ; insertController . setMaxBounds ( mapPresenter . getConfiguration ( ) . getMaxBounds ( ) ) ; dragController . setMaxBounds ( mapPresenter . getConfiguration ( ) . getMaxBounds ( ) ) ;
public class XSLTAttributeDef { /** * StringBuffer containing comma delimited list of valid values for ENUM type . * Used to build error message . */ private StringBuffer getListOfEnums ( ) { } }
StringBuffer enumNamesList = new StringBuffer ( ) ; String [ ] enumValues = this . getEnumNames ( ) ; for ( int i = 0 ; i < enumValues . length ; i ++ ) { if ( i > 0 ) { enumNamesList . append ( ' ' ) ; } enumNamesList . append ( enumValues [ i ] ) ; } return enumNamesList ;
public class TaskAction { /** * Clears the error status . */ @ RequirePOST public synchronized void doClearError ( StaplerRequest req , StaplerResponse rsp ) throws IOException , ServletException { } }
getACL ( ) . checkPermission ( getPermission ( ) ) ; if ( workerThread != null && ! workerThread . isRunning ( ) ) workerThread = null ; rsp . sendRedirect ( "." ) ;
public class FontResolutionImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eUnset ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . FONT_RESOLUTION__MET_TECH : setMetTech ( MET_TECH_EDEFAULT ) ; return ; case AfplibPackage . FONT_RESOLUTION__RPU_BASE : setRPuBase ( RPU_BASE_EDEFAULT ) ; return ; case AfplibPackage . FONT_RESOLUTION__RP_UNITS : setRPUnits ( RP_UNITS_EDEFAULT ) ; return ; } super . eUnset (...
public class AbstractProducerBean { /** * Initializes the type */ protected void initType ( ) { } }
try { this . type = getEnhancedAnnotated ( ) . getJavaClass ( ) ; } catch ( ClassCastException e ) { Type type = Beans . getDeclaredBeanType ( getClass ( ) ) ; throw BeanLogger . LOG . producerCastError ( getEnhancedAnnotated ( ) . getJavaClass ( ) , ( type == null ? " unknown " : type ) , e ) ; }
public class NetworkServiceRecordAgent { /** * Executes a script at runtime for a VNFR of a defined VNFD in a running NSR . * @ param idNsr the ID of the NetworkServiceRecord * @ param idVnfr the ID of the VNFR to be upgraded * @ param script the script to execute * @ throws SDKException if the request fails */...
String url = idNsr + "/vnfrecords" + "/" + idVnfr + "/execute-script" ; requestPost ( url , script ) ;
public class ScheduledDropwizardReporter { @ Override public void report ( ) { } }
// we do not need to lock here , because the dropwizard registry is // internally a concurrent map @ SuppressWarnings ( "rawtypes" ) final SortedMap < String , com . codahale . metrics . Gauge > gauges = registry . getGauges ( ) ; final SortedMap < String , com . codahale . metrics . Counter > counters = registry . get...
public class EmptyView { /** * Set the Icon by resource identifier * @ param resId the icon resource identifier */ public void setIcon ( @ DrawableRes int resId ) { } }
mIcon . setImageResource ( resId ) ; mIcon . setVisibility ( View . VISIBLE ) ;
public class BoundedInputStreamBuffer { /** * Convenience method for checking if we can get the byte at the specified * index . If we can ' t , then we will try and read the missing bytes off of * the underlying { @ link InputStream } . If that fails , e . g . we don ' t ready * enough bytes off of the stream , t...
final long missingBytes = index + 1 - this . writerIndex ; if ( missingBytes <= 0 ) { // we got all the bytes needed return ; } try { final int read = readFromStream ( missingBytes ) ; if ( read == - 1 || read < missingBytes ) { throw new IndexOutOfBoundsException ( ) ; } } catch ( final IOException e ) { throw new Ind...
public class EventLog { /** * Closes the session . */ public boolean close ( ) { } }
if ( open . compareAndSet ( true , false ) ) { futures . forEach ( future -> future . completeExceptionally ( new IllegalStateException ( "Closed session" ) ) ) ; return true ; } return false ;
public class Where { /** * This method needs to be used carefully . This will absorb a number of clauses that were registered previously with * calls to { @ link Where # eq ( String , Object ) } or other methods and will string them together with AND ' s . There is no * way to verify the number of previous clauses ...
if ( numClauses == 0 ) { throw new IllegalArgumentException ( "Must have at least one clause in and(numClauses)" ) ; } Clause [ ] clauses = new Clause [ numClauses ] ; for ( int i = numClauses - 1 ; i >= 0 ; i -- ) { clauses [ i ] = pop ( "AND" ) ; } addClause ( new ManyClause ( clauses , ManyClause . AND_OPERATION ) )...
public class CryptoPrimitives { /** * Resets curve name , hash algorithm and cert factory . Call this method when a config value changes * @ throws CryptoException * @ throws InvalidArgumentException */ private void resetConfiguration ( ) throws CryptoException , InvalidArgumentException { } }
setSecurityLevel ( securityLevel ) ; setHashAlgorithm ( hashAlgorithm ) ; try { cf = CertificateFactory . getInstance ( CERTIFICATE_FORMAT ) ; } catch ( CertificateException e ) { CryptoException ex = new CryptoException ( "Cannot initialize " + CERTIFICATE_FORMAT + " certificate factory. Error = " + e . getMessage ( )...
public class MMCImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public boolean eIsSet ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . MMC__MM_CID : return MM_CID_EDEFAULT == null ? mmCid != null : ! MM_CID_EDEFAULT . equals ( mmCid ) ; case AfplibPackage . MMC__PARAMETER1 : return PARAMETER1_EDEFAULT == null ? parameter1 != null : ! PARAMETER1_EDEFAULT . equals ( parameter1 ) ; case AfplibPackage . MMC__RG ...
public class AWSSimpleSystemsManagementClient { /** * Describes a specific delete inventory operation . * @ param describeInventoryDeletionsRequest * @ return Result of the DescribeInventoryDeletions operation returned by the service . * @ throws InternalServerErrorException * An error occurred on the server si...
request = beforeClientExecution ( request ) ; return executeDescribeInventoryDeletions ( request ) ;
public class FctBnCnvIbnToColumnValues { /** * < p > Get CnvIbnDoubleToCv ( create and put into map ) . < / p > * @ return requested CnvIbnDoubleToCv * @ throws Exception - an exception */ protected final CnvIbnDoubleToCv createPutCnvIbnDoubleToCv ( ) throws Exception { } }
CnvIbnDoubleToCv convrt = new CnvIbnDoubleToCv ( ) ; this . convertersMap . put ( CnvIbnDoubleToCv . class . getSimpleName ( ) , convrt ) ; return convrt ;
public class JsonWriter { /** * Marshall an enum value . * @ param value The value to marshall . Can be { @ code null } . * @ param enumType The OData enum type . */ private void marshallEnum ( Object value , EnumType enumType ) throws IOException { } }
LOG . trace ( "Enum value: {} of type: {}" , value , enumType ) ; jsonGenerator . writeString ( value . toString ( ) ) ;
public class JulianChronology { /** * Obtains a local date in Julian calendar system from the * era , year - of - era and day - of - year fields . * @ param era the Julian era , not null * @ param yearOfEra the year - of - era * @ param dayOfYear the day - of - year * @ return the Julian local date , not null...
return dateYearDay ( prolepticYear ( era , yearOfEra ) , dayOfYear ) ;
public class AdditionalHeaderSegment { /** * This method checks the integrity of the this Additional Header Segment object to garantee a valid specification . * @ throws InternetSCSIException If the fields are not valid for this AHS type . */ private final void checkIntegrity ( ) throws InternetSCSIException { } }
switch ( type ) { case EXTENDED_CDB : case EXPECTED_BIDIRECTIONAL_READ_DATA_LENGTH : break ; default : throw new InternetSCSIException ( "AHS Package is not valid." ) ; } // this field is AHSType independent specificField . rewind ( ) ; Utils . isReserved ( specificField . get ( ) ) ; switch ( type ) { case EXTENDED_CD...
public class AppClassLoader { /** * { @ inheritDoc } */ @ Override @ Trivial public Enumeration < URL > getResources ( String name ) throws IOException { } }
/* * The default implementation of getResources never calls getResources on its parent , instead it just calls findResources on all of the loaders parents . We know that our * parent will be a gateway class loader that changes the order that resources are loaded but it does this in getResources ( as that is where the...
public class Neo4JIndexManager { /** * Deletes a { @ link Node } from manually created index if auto - indexing is * disabled * @ param entityMetadata * @ param graphDb * @ param node */ public void deleteNodeIndex ( EntityMetadata entityMetadata , GraphDatabaseService graphDb , Node node ) { } }
if ( ! isNodeAutoIndexingEnabled ( graphDb ) && entityMetadata . isIndexable ( ) ) { Index < Node > nodeIndex = graphDb . index ( ) . forNodes ( entityMetadata . getIndexName ( ) ) ; nodeIndex . remove ( node ) ; }
public class StreamDescription { /** * The shards that comprise the stream . * @ return The shards that comprise the stream . */ public java . util . List < Shard > getShards ( ) { } }
if ( shards == null ) { shards = new com . amazonaws . internal . SdkInternalList < Shard > ( ) ; } return shards ;
public class GenericTemplate { /** * Set Element Button * @ param index the element index * @ param title the element title * @ param type the element type * @ param url the element url * @ param messenger _ extensions the messenger extensions * @ param webview _ height _ ratio the webview height ratio * ...
if ( this . elements . get ( index ) . containsKey ( "buttons" ) ) { HashMap < String , String > button = new HashMap < String , String > ( ) ; button . put ( "title" , title ) ; button . put ( "type" , type ) ; button . put ( "url" , url ) ; button . put ( "messenger_extensions" , String . valueOf ( messenger_extensio...
public class StringContext { /** * Replaces the first exact match of the given pattern in the source * string with the provided replacement . * @ param source the source string * @ param pattern the simple string pattern to search for * @ param replacement the string to use for replacing matched patterns * @ ...
return StringReplacer . replaceFirst ( source , pattern , replacement ) ;
public class MolgenisInterceptor { /** * Make sure Spring does not add the attributes as query parameters to the url when doing a * redirect . You can do this by introducing an object instead of a string key value pair . * < p > See < a * href = " https : / / github . com / molgenis / molgenis / issues / 6515 " >...
Map < String , String > environmentAttributes = new HashMap < > ( ) ; environmentAttributes . put ( ATTRIBUTE_ENVIRONMENT_TYPE , environment ) ; return environmentAttributes ;
public class BundledTileSetRepository { /** * Extracts the tileset bundle from the supplied resource bundle * and registers it . */ protected void addBundle ( HashIntMap < TileSet > idmap , HashMap < String , Integer > namemap , ResourceBundle bundle ) { } }
try { TileSetBundle tsb = BundleUtil . extractBundle ( bundle ) ; // initialize it and add it to the list tsb . init ( bundle ) ; addBundle ( idmap , namemap , tsb ) ; } catch ( Exception e ) { log . warning ( "Unable to load tileset bundle '" + BundleUtil . METADATA_PATH + "' from resource bundle [rbundle=" + bundle +...
public class Requests { /** * < p > headers . < / p > * @ param name a { @ link java . lang . String } object . * @ param values a { @ link java . lang . Iterable } object . * @ return a { @ link org . glassfish . jersey . message . internal . InboundMessageContext } object . */ public static InboundMessageContex...
return getRequest ( ) . headers ( name , values ) ;
public class SibRaMessagingEngineConnection { /** * Creates a new listener to the given destination . * @ param destination * the destination to listen to * @ return a listener * @ throws ResourceException * if the creation fails */ SibRaListener createListener ( final SIDestinationAddress destination , Messa...
final String methodName = "createListener" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , new Object [ ] { destination , messageEndpointFactory } ) ; } if ( _closed ) { throw new IllegalStateException ( NLS . getString ( "LISTENER_CLOSED_CWS...
public class DistributedStore { /** * Issue a { @ link KayVeeCommand . GETCommand } . * Returns the value associated with a key . * @ param key key for which to get the value * @ return future that will be triggered when the command is successfully * < strong > committed < / strong > to replicated storage or is...
checkThatDistributedStoreIsActive ( ) ; KayVeeCommand . GETCommand getCommand = new KayVeeCommand . GETCommand ( getCommandId ( ) , key ) ; return issueCommandToCluster ( getCommand ) ;
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 ...
return createOrUpdateWithServiceResponseAsync ( resourceGroupName , localNetworkGatewayName , parameters ) . map ( new Func1 < ServiceResponse < LocalNetworkGatewayInner > , LocalNetworkGatewayInner > ( ) { @ Override public LocalNetworkGatewayInner call ( ServiceResponse < LocalNetworkGatewayInner > response ) { retur...
public class JSONArray { /** * Get the collection type from a getter or setter , or null if no type was * found . < br / > * Contributed by [ Matt Small @ WaveMaker ] . */ public static Class [ ] getCollectionType ( PropertyDescriptor pd , boolean useGetter ) throws JSONException { } }
Type type ; if ( useGetter ) { Method m = pd . getReadMethod ( ) ; type = m . getGenericReturnType ( ) ; } else { Method m = pd . getWriteMethod ( ) ; Type [ ] gpts = m . getGenericParameterTypes ( ) ; if ( 1 != gpts . length ) { throw new JSONException ( "method " + m + " is not a standard setter" ) ; } type = gpts [ ...
public class DefaultParser { /** * Tells if the token looks like a long option . * @ param token */ private boolean isLongOption ( String token ) { } }
if ( ! token . startsWith ( "-" ) || token . length ( ) == 1 ) { return false ; } int pos = token . indexOf ( "=" ) ; String t = pos == - 1 ? token : token . substring ( 0 , pos ) ; if ( ! options . getMatchingOptions ( t ) . isEmpty ( ) ) { // long or partial long options ( - - L , - L , - - L = V , - L = V , - - l , ...
public class AbstractAttributeDefinitionBuilder { /** * Sets the { @ link AttributeDefinition # getName ( ) name } for the attribute , which is only needed * if the attribute was created from an existing { @ link SimpleAttributeDefinition } using * { @ link SimpleAttributeDefinitionBuilder # create ( org . jboss . ...
assert name != null ; // noinspection deprecation this . name = name ; return ( BUILDER ) this ;
public class AsyncTask { /** * Start asynchronous task execution . */ public void start ( ) { } }
Thread thread = new Thread ( new Runnable ( ) { @ Override public void run ( ) { try { onPreExecute ( ) ; Value value = execute ( ) ; onPostExecute ( value ) ; } catch ( Throwable throwable ) { onThrowable ( throwable ) ; } } } ) ; thread . start ( ) ;
public class ColumnDataUtils { /** * Performs a database query to find the next integer in the sequence reserved for * the given column . * @ param autoIncrementIntegerColumn Column data where a new integer is required * @ return The next integer in sequence * @ throws Exception */ static public int obtainNextI...
try { String sqlQuery = "SELECT nextval(?);" ; // Create SQL command PreparedStatement pstmt = null ; { pstmt = connection . prepareStatement ( sqlQuery ) ; // Populate prepared statement pstmt . setString ( 1 , autoIncrementIntegerColumn . getAutoIncrementSequence ( ) ) ; } if ( pstmt . execute ( ) ) { ResultSet rs = ...
public class TimePickerDialog { /** * Show either Hours or Minutes . */ private void setCurrentItemShowing ( int index , boolean animateCircle , boolean delayLabelAnimate , boolean announce ) { } }
mTimePicker . setCurrentItemShowing ( index , animateCircle ) ; TextView labelToAnimate ; switch ( index ) { case HOUR_INDEX : int hours = mTimePicker . getHours ( ) ; if ( ! mIs24HourMode ) { hours = hours % 12 ; } mTimePicker . setContentDescription ( mHourPickerDescription + ": " + hours ) ; if ( announce ) { Utils ...
public class gslbsite { /** * Use this API to fetch gslbsite resources of given names . */ public static gslbsite [ ] get ( nitro_service service , String sitename [ ] ) throws Exception { } }
if ( sitename != null && sitename . length > 0 ) { gslbsite response [ ] = new gslbsite [ sitename . length ] ; gslbsite obj [ ] = new gslbsite [ sitename . length ] ; for ( int i = 0 ; i < sitename . length ; i ++ ) { obj [ i ] = new gslbsite ( ) ; obj [ i ] . set_sitename ( sitename [ i ] ) ; response [ i ] = ( gslbs...
public class MOMBI2History { /** * Adds a new vector of maxs values to the history . The method ensures that only the * newest MAX _ LENGTH vectors will be kept in the history * @ param maxs */ public void add ( List < Double > maxs ) { } }
List < Double > aux = new ArrayList < > ( this . numberOfObjectives ) ; aux . addAll ( maxs ) ; this . history . add ( aux ) ; if ( history . size ( ) > MAX_LENGHT ) history . remove ( 0 ) ;
public class Elements { /** * Get all of the parents and ancestor elements of the matched elements . * @ return all of the parents and ancestor elements of the matched elements */ public Elements parents ( ) { } }
HashSet < Element > combo = new LinkedHashSet < > ( ) ; for ( Element e : this ) { combo . addAll ( e . parents ( ) ) ; } return new Elements ( combo ) ;
public class ConstraintContextProperties { /** * Returns the names of all activities with routing constraints . * @ return A set of all activities with routing constraints . */ public Set < String > getActivitiesWithRoutingConstraints ( ) { } }
Set < String > result = new HashSet < > ( ) ; String propertyValue = getProperty ( ConstraintContextProperty . ACTIVITIES_WITH_CONSTRAINTS ) ; if ( propertyValue == null ) return result ; StringTokenizer activityTokens = StringUtils . splitArrayString ( propertyValue , " " ) ; while ( activityTokens . hasMoreTokens ( )...
public class PersonBuilderImpl { /** * { @ inheritDoc } */ @ Override public Person createPerson ( final String idString ) { } }
if ( idString == null ) { return new Person ( ) ; } final Person person = new Person ( getRoot ( ) , new ObjectId ( idString ) ) ; getRoot ( ) . insert ( person ) ; return person ;
public class HtmlServlet { /** * Check if the given page is visible for the requested site defined by * a hostname and a port . * @ param request * @ param page * @ return */ private boolean isVisibleForSite ( final HttpServletRequest request , final Page page ) { } }
final Site site = page . getSite ( ) ; if ( site == null ) { return true ; } final String serverName = request . getServerName ( ) ; final int serverPort = request . getServerPort ( ) ; if ( StringUtils . isNotBlank ( serverName ) && ! serverName . equals ( site . getHostname ( ) ) ) { return false ; } final Integer si...
public class MessageProtocol { /** * Parse a message protocol from a content type header , if defined . * @ param contentType The content type header to parse . * @ return The parsed message protocol . */ public static MessageProtocol fromContentTypeHeader ( Optional < String > contentType ) { } }
return contentType . map ( ct -> { String [ ] parts = ct . split ( ";" ) ; String justContentType = parts [ 0 ] ; Optional < String > charset = Optional . empty ( ) ; for ( int i = 1 ; i < parts . length ; i ++ ) { String toTest = parts [ i ] . trim ( ) ; if ( toTest . startsWith ( "charset=" ) ) { charset = Optional ....
public class AlignedBlock { /** * Outputs the block , with the given separator appended to each line except the last , and the given * terminator appended to the last line . * @ param separator text added to each line except the last / * @ param terminator text added to the last line . */ public void print ( Stri...
for ( int i = 0 ; i < maxColumnLength . size ( ) ; i ++ ) { maxColumnLength . set ( i , ( ( ( maxColumnLength . get ( i ) / TAB_SIZE ) + 1 ) * TAB_SIZE ) ) ; } for ( int r = 0 ; r < rows . size ( ) ; r ++ ) { String [ ] s = rows . get ( r ) ; for ( int i = 0 ; i < s . length ; i ++ ) { out . print ( s [ i ] ) ; if ( i ...
public class DirectorySelector { /** * Show the monitor dialog . If called outside the EDT this method will switch * to the UI thread using * < code > SwingUtilities . invokeAndWait ( Runnable ) < / code > . */ public final void show ( ) { } }
if ( firstTime ) { firstTime = false ; if ( SwingUtilities . isEventDispatchThread ( ) ) { showIntern ( ) ; } else { try { SwingUtilities . invokeAndWait ( new Runnable ( ) { public void run ( ) { showIntern ( ) ; } } ) ; } catch ( final Exception ex ) { ignore ( ) ; } } } else { throw new IllegalStateException ( "This...