signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class YokeSecurity { /** * Signs a String value with a given MAC */ public static String sign ( @ NotNull String val , @ NotNull Mac mac ) { } }
return val + "." + Base64 . getEncoder ( ) . encodeToString ( val . getBytes ( ) ) ;
public class AuditEvent { /** * Set the observer keys / values . The provided Map will completely replace * the existing observer , i . e . all current observer keys / values will be removed * and the new observer keys / values will be added . * @ param observer - Map of all the observer keys / values */ public v...
removeEntriesStartingWith ( OBSERVER ) ; eventMap . putAll ( observer ) ;
public class AmazonConfigClient { /** * Returns status information for each of your AWS managed Config rules . The status includes information such as the * last time AWS Config invoked the rule , the last time AWS Config failed to invoke the rule , and the related error * for the last failure . * @ param describ...
request = beforeClientExecution ( request ) ; return executeDescribeConfigRuleEvaluationStatus ( request ) ;
public class Validators { /** * Creates and returns a validator , which allows to validate texts to ensure , that they only * contain numbers . Empty texts are also accepted . * @ param context * The context , which should be used to retrieve the error message , as an instance of * the class { @ link Context } ...
return new NumberValidator ( context , R . string . default_error_message ) ;
public class EstimateSceneCalibrated { /** * Adds features which were triangulated using the stereo pair after the scale factor has been determined . * Don ' t mark the other view as being processed . It ' s 3D pose will be estimated later on using PNP with the * new features and features determined later on */ voi...
View viewA = edge . viewSrc ; View viewB = edge . viewDst ; boolean baseIsA = base == viewA ; View other = baseIsA ? viewB : viewA ; // Determine transform from other to world edge . a_to_b . T . scale ( scale ) ; Se3_F64 otherToBase = baseIsA ? edge . a_to_b . invert ( null ) : edge . a_to_b . copy ( ) ; otherToBase ....
public class JpaNamingStrategy { /** * CHECKSTYLE : OFF */ public String getRequestName ( JpaMethod jpaMethod , Method javaMethod , Object [ ] args , Query query ) { } }
// CHECKSTYLE : ON switch ( jpaMethod ) { case CREATE_QUERY : case CREATE_NAMED_QUERY : case CREATE_NATIVE_QUERY : case CREATE_STORED_PROCEDURE_QUERY : case CREATE_NAMED_STORED_PROCEDURE_QUERY : return getQueryRequestName ( javaMethod , args , query ) ; case FIND : return getMethodWithClassArgRequestName ( javaMethod ,...
public class PayCloseRequest { /** * 扩展信息 */ @ Override public void checkVaild ( ) { } }
super . checkVaild ( ) ; if ( this . paymoney < 1 ) throw new RuntimeException ( "paymoney is illegal" ) ; if ( this . thirdpayno == null || this . thirdpayno . isEmpty ( ) ) throw new RuntimeException ( "thirdpayno is illegal" ) ;
public class RDBMServices { /** * Gets a named DataSource from JNDI , with special handling for the PORTAL _ DB datasource . * Successful lookups are cached and not done again . Lookup failure is remembered and blocks * retry for a number of milliseconds specified by JNDI _ RETRY _ TIME to reduce JNDI overhead and ...
if ( PORTAL_DB . equals ( name ) ) { return PortalDbLocator . getPortalDb ( ) ; } final ApplicationContext applicationContext = PortalApplicationContextLocator . getApplicationContext ( ) ; final DataSource dataSource = ( DataSource ) applicationContext . getBean ( name , DataSource . class ) ; return dataSource ;
public class LineInput { public synchronized int read ( byte b [ ] , int off , int len ) throws IOException { } }
int avail = _avail - _pos ; if ( avail <= 0 ) { fill ( ) ; avail = _avail - _pos ; } if ( avail <= 0 ) len = - 1 ; else { len = ( avail < len ) ? avail : len ; System . arraycopy ( _buf , _pos , b , off , len ) ; _pos += len ; } return len ;
public class WebUtil { /** * find cookie from request * @ param request current request * @ param name cookie name * @ return cookie value or null */ public static Cookie findCookie ( HttpServletRequest request , String name ) { } }
if ( request != null ) { Cookie [ ] cookies = request . getCookies ( ) ; if ( cookies != null && cookies . length > 0 ) { for ( Cookie cookie : cookies ) { if ( cookie . getName ( ) . equals ( name ) ) { return cookie ; } } } } return null ;
public class TimeZoneNamesImpl { /** * Initialize the transient fields , called from the constructor and * readObject . * @ param locale The locale */ private void initialize ( ULocale locale ) { } }
ICUResourceBundle bundle = ( ICUResourceBundle ) ICUResourceBundle . getBundleInstance ( ICUData . ICU_ZONE_BASE_NAME , locale ) ; _zoneStrings = ( ICUResourceBundle ) bundle . get ( ZONE_STRINGS_BUNDLE ) ; // TODO : Access is synchronized , can we use a non - concurrent map ? _tzNamesMap = new ConcurrentHashMap < Stri...
public class RankMap { /** * This method gets all elements with a { @ link # getRank ( Object ) rank } greater or equal to the given { @ code threshold } . * @ param threshold is the minimum accepted { @ link # getRank ( Object ) rank } . * @ return the list with all elements better or equal to the given { @ code t...
List < E > bests = new ArrayList < > ( ) ; for ( E element : this . map . keySet ( ) ) { Ranking ranking = this . map . get ( element ) ; if ( ( ranking != null ) && ( ranking . rank >= threshold ) ) { bests . add ( element ) ; } } return bests ;
public class GeoLocationUtil { /** * Replies if the specified distances are approximatively equal , * less or greater than . * @ param distance1 the first distance . * @ param distance2 the second distance . * @ return a negative value if the parameter < var > distance1 < / var > is * lower than < var > dista...
final double min = distance2 - distancePrecision ; final double max = distance2 + distancePrecision ; if ( distance1 >= min && distance1 <= max ) { return 0 ; } if ( distance1 < min ) { return - 1 ; } return 1 ;
public class FileUtils { /** * Verify that the file is within the base directory . { @ link org . mapfish . print . IllegalFileAccessException } * will be thrown if the assertion does not hold . * @ param descriptorOfBase a simple description of the base file , for example : configuration * @ param child the file...
File canonicalChild ; try { canonicalChild = child . getCanonicalFile ( ) ; } catch ( IOException e ) { throw new Error ( "Unable to get the canonical file of '" + child + "'. Therefore it is not possible to verify if it is a " + "child of '" + Arrays . toString ( baseFiles ) + "'." ) ; } for ( File base : baseFiles )...
public class NeighborhoodQuery { /** * Executes the query . * @ return Neighborhood */ public Set < GraphObject > run ( ) { } }
// result set of neighborhood query Set < GraphObject > queryResult = new HashSet < GraphObject > ( ) ; // if upstream is selected if ( direction == Direction . UPSTREAM || direction == Direction . BOTHSTREAM ) { // run BFS in upstream direction BFS bfsBackward = new BFS ( sourceNodes , null , Direction . UPSTREAM , th...
public class Jenkins { /** * Accepts submission from the configuration page . */ @ RequirePOST public synchronized void doConfigSubmit ( StaplerRequest req , StaplerResponse rsp ) throws IOException , ServletException , FormException { } }
BulkChange bc = new BulkChange ( this ) ; try { checkPermission ( ADMINISTER ) ; JSONObject json = req . getSubmittedForm ( ) ; systemMessage = Util . nullify ( req . getParameter ( "system_message" ) ) ; boolean result = true ; for ( Descriptor < ? > d : Functions . getSortedDescriptorsForGlobalConfigUnclassified ( ) ...
public class AsyncLibrary { /** * @ see com . ibm . io . async . IAsyncProvider # getNewCompletionPort ( ) */ @ Override public synchronized long getNewCompletionPort ( ) throws AsyncException { } }
long port = aio_newCompletionPort ( ) ; completionPorts . add ( Long . valueOf ( port ) ) ; return port ;
public class TableWriterServiceImpl { /** * Writes a page to the current segment * @ param page * @ param sOut * @ param oldSequence * @ param saveLength * @ param saveTail * @ param sequenceWrite page sequence to correlate write requests with * flush completions */ @ InService ( TableWriterService . clas...
try { sOut . writePage ( this , page , saveLength , saveTail , sequenceWrite , result ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; }
public class References { /** * Gets a required component reference that matches specified locator . * @ param locator the locator to find a reference by . * @ return a matching component reference . * @ throws ReferenceException when no references found . */ public Object getOneRequired ( Object locator ) throws...
List < Object > components = find ( Object . class , locator , true ) ; return components . size ( ) > 0 ? components . get ( 0 ) : null ;
public class EvaluationContext { /** * Tries to resolve variables . * @ throws ConfigEvaluatorException */ public String resolveString ( String value , boolean ignoreWarnings ) throws ConfigEvaluatorException { } }
value = variableEvaluator . resolveVariables ( value , this , ignoreWarnings ) ; return value ;
public class Digester { /** * 初始化 * @ param algorithm 算法 * @ param provider 算法提供者 , null表示JDK默认 , 可以引入Bouncy Castle等来提供更多算法支持 * @ return { @ link Digester } * @ throws CryptoException Cause by IOException */ public Digester init ( String algorithm , Provider provider ) { } }
if ( null == provider ) { this . digest = SecureUtil . createMessageDigest ( algorithm ) ; } else { try { this . digest = MessageDigest . getInstance ( algorithm , provider ) ; } catch ( NoSuchAlgorithmException e ) { throw new CryptoException ( e ) ; } } return this ;
public class ComputeFunction { /** * Sends the given message to the vertex identified by the given key . If the target vertex does not exist , * the next superstep will cause an exception due to a non - deliverable message . * @ param target The key ( id ) of the target vertex to message . * @ param m The message...
outMsg . f0 = target ; outMsg . f1 = m ; out . collect ( Either . Right ( outMsg ) ) ;
public class TempByteHolder { /** * Override directory to create temporary file in . * Does not affect already open temp file . * @ param dir File object representing temporary directory . * May be null which means that system default * ( java . io . tmpdir system property ) should be used . * @ throws IOExce...
File td = dir . getCanonicalFile ( ) ; if ( td . isDirectory ( ) ) { _temp_directory = td ; }
public class Vertex { /** * 创建一个音译人名实例 * @ param realWord * @ return */ public static Vertex newTranslatedPersonInstance ( String realWord , int frequency ) { } }
return new Vertex ( Predefine . TAG_PEOPLE , realWord , new CoreDictionary . Attribute ( Nature . nrf , frequency ) ) ;
public class WorkerPool { /** * { @ inheritDoc } */ @ Override public void setExceptionHandler ( final ExceptionHandler exceptionHandler ) { } }
for ( final Worker worker : this . workers ) { worker . setExceptionHandler ( exceptionHandler ) ; }
public class ThriftConnectionHandle { /** * 获取多服务模式下所有thrift客户端的方法 * @ return 多服务下所有thrift客户端集合 */ public Map < String , T > getMuiltServiceClients ( ) { } }
if ( this . thriftConnection instanceof MulitServiceThriftConnecion ) { MulitServiceThriftConnecion < T > connection = ( MulitServiceThriftConnecion < T > ) thriftConnection ; return connection . getMuiltServiceClients ( ) ; } throw new IllegalStateException ( "单服务运行模式下不允许调用该方法" ) ;
public class CommerceOrderNotePersistenceImpl { /** * Returns the last commerce order note in the ordered set where commerceOrderId = & # 63 ; and restricted = & # 63 ; . * @ param commerceOrderId the commerce order ID * @ param restricted the restricted * @ param orderByComparator the comparator to order the set...
CommerceOrderNote commerceOrderNote = fetchByC_R_Last ( commerceOrderId , restricted , orderByComparator ) ; if ( commerceOrderNote != null ) { return commerceOrderNote ; } StringBundler msg = new StringBundler ( 6 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "commerceOrderId=" ) ; msg . append ( comm...
public class HelloCLR { /** * Start Hello REEF job . Runs method runHelloCLR ( ) . * @ param args command line parameters . * @ throws org . apache . reef . tang . exceptions . BindException configuration error . * @ throws org . apache . reef . tang . exceptions . InjectionException configuration error . */ publ...
final Configuration runtimeConfiguration = LocalRuntimeConfiguration . CONF . set ( LocalRuntimeConfiguration . MAX_NUMBER_OF_EVALUATORS , 2 ) . build ( ) ; final File dotNetFolder = new File ( args [ 0 ] ) . getAbsoluteFile ( ) ; final LauncherStatus status = runHelloCLR ( runtimeConfiguration , JOB_TIMEOUT , dotNetFo...
public class FilePathUtil { /** * 获得上层目录的路径 */ public static String getParentPath ( String path ) { } }
String parentPath = path ; if ( Platforms . FILE_PATH_SEPARATOR . equals ( parentPath ) ) { return parentPath ; } parentPath = MoreStringUtil . removeEnd ( parentPath , Platforms . FILE_PATH_SEPARATOR_CHAR ) ; int idx = parentPath . lastIndexOf ( Platforms . FILE_PATH_SEPARATOR_CHAR ) ; if ( idx >= 0 ) { parentPath = p...
public class Settings { /** * Value is split by comma and trimmed . Never returns null . * < br > * Examples : * < ul > * < li > " one , two , three " - & gt ; [ " one " , " two " , " three " ] < / li > * < li > " one , two , three " - & gt ; [ " one " , " two " , " three " ] < / li > * < li > " one , , thr...
String effectiveKey = definitions . validKey ( key ) ; Optional < PropertyDefinition > def = getDefinition ( effectiveKey ) ; if ( ( def . isPresent ( ) ) && ( def . get ( ) . multiValues ( ) ) ) { String value = getString ( key ) ; if ( value == null ) { return ArrayUtils . EMPTY_STRING_ARRAY ; } List < String > value...
public class Strings { /** * Returns the joined { @ code properties } with a < code > . < / code > delimiter , including a trailing * delimiter . */ public static String join ( List < ? extends PropertyInfo > properties ) { } }
StringBuilder sb = new StringBuilder ( ) ; for ( PropertyInfo info : properties ) sb . append ( info . getName ( ) ) . append ( '.' ) ; return sb . toString ( ) ;
public class LocationFormatter { /** * Formats the given location elements using { @ code this } formatter . * @ see # format ( Location ) * @ param lat the latitude part of the location * @ param lon the longitude part of the location * @ param ele the elevation part of the location * @ return the format str...
return format ( Location . of ( lat , lon , ele ) ) ;
public class Equation { /** * Removes all commas from the token list */ private void stripCommas ( TokenList tokens ) { } }
TokenList . Token t = tokens . getFirst ( ) ; while ( t != null ) { TokenList . Token next = t . next ; if ( t . getSymbol ( ) == Symbol . COMMA ) { tokens . remove ( t ) ; } t = next ; }
public class Consumers { /** * Yields the only element . * @ param < E > the element type parameter * @ param iterable the iterable to be searched * @ throws IllegalStateException if more than one element is found * @ throws IllegalArgumentException if no element matches * @ return the found element */ public...
dbc . precondition ( iterable != null , "cannot call one with a null iterable" ) ; return new OneElement < E > ( ) . apply ( iterable . iterator ( ) ) ;
public class CommerceAccountOrganizationRelPersistenceImpl { /** * Clears the cache for all commerce account organization rels . * The { @ link EntityCache } and { @ link FinderCache } are both cleared by this method . */ @ Override public void clearCache ( ) { } }
entityCache . clearCache ( CommerceAccountOrganizationRelImpl . class ) ; finderCache . clearCache ( FINDER_CLASS_NAME_ENTITY ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ;
public class Header { /** * setter for citationStatus - sets Indicates the status of citation of a PubMed document , O * @ generated * @ param v value to set into the feature */ public void setCitationStatus ( String v ) { } }
if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_citationStatus == null ) jcasType . jcas . throwFeatMissing ( "citationStatus" , "de.julielab.jules.types.pubmed.Header" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_citationStatus , v ) ;
public class NFAppenderAttachableImpl { /** * ( non - Javadoc ) * @ see * org . apache . log4j . helpers . AppenderAttachableImpl # appendLoopOnAppenders * ( org . apache . log4j . spi . LoggingEvent ) */ @ Override public int appendLoopOnAppenders ( LoggingEvent event ) { } }
int size = 0 ; Appender appender ; if ( appenderList != null ) { size = appenderList . size ( ) ; Iterator < Appender > it = appenderList . iterator ( ) ; while ( it . hasNext ( ) ) { appender = ( Appender ) it . next ( ) ; appender . doAppend ( event ) ; } } return size ;
public class ContactValidator { /** * { @ inheritDoc } */ @ Override public void validate ( ValidationHelper helper , Context context , String key , Contact t ) { } }
if ( t != null ) { String url = t . getUrl ( ) ; if ( url != null ) { if ( ! ValidatorUtils . isValidURI ( url ) ) { final String message = Tr . formatMessage ( tc , "contactInvalidURL" , url ) ; helper . addValidationEvent ( new ValidationEvent ( ValidationEvent . Severity . ERROR , context . getLocation ( "url" ) , m...
public class DatabaseMetaData { /** * { @ inheritDoc } */ public ResultSet getSuperTables ( final String catalog , final String schemaPattern , final String tableNamePattern ) throws SQLException { } }
return RowLists . rowList4 ( String . class , String . class , String . class , String . class ) . withLabel ( 1 , "TABLE_CAT" ) . withLabel ( 2 , "TABLE_SCHEM" ) . withLabel ( 3 , "TABLE_NAME" ) . withLabel ( 4 , "SUPERTABLE_NAME" ) . resultSet ( ) ;
public class Channel { /** * Register a block listener . * @ param listener function with single argument with type { @ link BlockEvent } * @ return The handle of the registered block listener . * @ throws InvalidArgumentException if the channel is shutdown . */ public String registerBlockListener ( BlockListener...
if ( shutdown ) { throw new InvalidArgumentException ( format ( "Channel %s has been shutdown." , name ) ) ; } if ( null == listener ) { throw new InvalidArgumentException ( "Listener parameter is null." ) ; } String handle = new BL ( listener ) . getHandle ( ) ; logger . trace ( format ( "Register event BlockEvent lis...
public class CoreUtils { /** * Spin on a ReentrantLock before blocking . Default behavior is not to spin . */ public static void spinLock ( ReentrantLock lock ) { } }
if ( LOCK_SPIN_MICROSECONDS > 0 ) { long nanos = - 1 ; for ( ; ; ) { if ( lock . tryLock ( ) ) return ; if ( nanos == - 1 ) { nanos = System . nanoTime ( ) ; } else if ( System . nanoTime ( ) - nanos > LOCK_SPIN_MICROSECONDS ) { lock . lock ( ) ; return ; } } } else { lock . lock ( ) ; }
public class TrajectoryEnvelopeSolver { /** * Get all { @ link TrajectoryEnvelope } s that have no super - envelopes . * @ return All { @ link TrajectoryEnvelope } s that have no super - envelopes . */ public TrajectoryEnvelope [ ] getRootTrajectoryEnvelopes ( ) { } }
ArrayList < TrajectoryEnvelope > ret = new ArrayList < TrajectoryEnvelope > ( ) ; for ( Variable var : this . getVariables ( ) ) { TrajectoryEnvelope te = ( TrajectoryEnvelope ) var ; if ( ! te . hasSuperEnvelope ( ) ) ret . add ( te ) ; } return ret . toArray ( new TrajectoryEnvelope [ ret . size ( ) ] ) ;
public class PdfLine { /** * Gets the biggest descender for all the fonts used * in this line . Note that this is a negative number . * @ return maximum size of all the ascenders used in this line */ public float getDescender ( ) { } }
float descender = 0 ; for ( int k = 0 ; k < line . size ( ) ; ++ k ) { PdfChunk ck = ( PdfChunk ) line . get ( k ) ; if ( ck . isImage ( ) ) descender = Math . min ( descender , ck . getImageOffsetY ( ) ) ; else { PdfFont font = ck . font ( ) ; descender = Math . min ( descender , font . getFont ( ) . getFontDescriptor...
public class ReflectiveInterceptor { /** * Performs all necessary checks that need to be done before a field set should be allowed . * @ throws IllegalAccessException */ private static Field asSetableField ( Field field , Object target , Class < ? > valueType , Object value , boolean makeAccessibleCopy ) throws Illeg...
// Must do the checks exactly in the same order as JVM if we want identical error messages . // JVM doesn ' t do this , since it cannot happen without reloading , we do it first of all . if ( isDeleted ( field ) ) { throw Exceptions . noSuchFieldError ( field ) ; } Class < ? > clazz = field . getDeclaringClass ( ) ; in...
public class JinxUtils { /** * Convert a Flickr geo context id to the corresponding { @ link net . jeremybrooks . jinx . JinxConstants . GeoContext } enum . * @ param contextId Flickr geo context id to convert . * @ return corresponding GeoContext enum , or null if the parameter is not a valid Flickr geo context id...
JinxConstants . GeoContext ret ; switch ( contextId ) { case 0 : ret = JinxConstants . GeoContext . not_defined ; break ; case 1 : ret = JinxConstants . GeoContext . indoors ; break ; case 2 : ret = JinxConstants . GeoContext . outdoors ; break ; default : ret = null ; break ; } return ret ;
public class SMPPOutboundServerSession { /** * Wait for outbind request . * @ param timeout is the timeout . * @ return the { @ link OutbindRequest } . * @ throws IllegalStateException if this invocation of this method has been made or invoke when state is not OPEN . * @ throws TimeoutException if the timeout h...
SessionState currentSessionState = getSessionState ( ) ; if ( currentSessionState . equals ( SessionState . OPEN ) ) { new SMPPOutboundServerSession . PDUReaderWorker ( ) . start ( ) ; try { return outbindRequestReceiver . waitForRequest ( timeout ) ; } catch ( IllegalStateException e ) { throw new IllegalStateExceptio...
public class CmsSearchWorkplaceBean { /** * Sets the fields parameter value . < p > * @ param fields the fields parameter value to set */ public void setFields ( String fields ) { } }
if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( fields ) ) { throw new CmsIllegalStateException ( Messages . get ( ) . container ( Messages . ERR_VALIDATE_SEARCH_PARAMS_0 ) ) ; } m_fields = fields ;
public class CheckAccessControls { /** * Determines whether the given OBJECTLIT property visibility violates the coding convention . * @ param key The objectlit key node ( STRING _ KEY , GETTER _ DEF , SETTER _ DEF , MEMBER _ FUNCTION _ DEF ) . */ private void checkKeyVisibilityConvention ( Node key , Node parent ) {...
JSDocInfo info = key . getJSDocInfo ( ) ; if ( info == null ) { return ; } if ( ! isPrivateByConvention ( key . getString ( ) ) ) { return ; } Node assign = parent . getParent ( ) ; if ( assign == null || ! assign . isAssign ( ) ) { return ; } Node left = assign . getFirstChild ( ) ; if ( ! left . isGetProp ( ) || ! le...
public class RedisClient { /** * Initialize indexer . */ private void initializeIndexer ( ) { } }
if ( this . indexManager . getIndexer ( ) != null && this . indexManager . getIndexer ( ) . getClass ( ) . getSimpleName ( ) . equals ( "RedisIndexer" ) ) { ( ( RedisIndexer ) this . indexManager . getIndexer ( ) ) . assignConnection ( getConnection ( ) ) ; }
public class AssetRenditionContentDispositionFilter { /** * This filter only processes GET requests that targets a nt : file resource . * @ param request * @ return true if the filter accepts the given request */ @ SuppressWarnings ( "null" ) private boolean accepts ( SlingHttpServletRequest request ) { } }
return request . getMethod ( ) . equalsIgnoreCase ( METHOD_GET ) && request . getResource ( ) != null && StringUtils . equals ( request . getResource ( ) . getValueMap ( ) . get ( JCR_PRIMARYTYPE , String . class ) , NT_FILE ) ;
public class GedLinkDocumentMongoToGedObjectConverterVisitor { /** * { @ inheritDoc } */ @ Override public final void visit ( final SubmissionLinkDocumentMongo document ) { } }
setGedObject ( new SubmissionLink ( getParent ( ) , "Submission" , new ObjectId ( document . getString ( ) ) ) ) ;
public class DigestHelper { /** * @ param key * @ param text * @ return * @ throws IllegalArgumentException */ public static byte [ ] sha1hmac ( byte [ ] key , byte [ ] text ) throws IllegalArgumentException { } }
try { SecretKey sk = new SecretKeySpec ( key , "HMACSHA1" ) ; Mac m = Mac . getInstance ( sk . getAlgorithm ( ) ) ; m . init ( sk ) ; return m . doFinal ( text ) ; } catch ( InvalidKeyException e ) { throw new IllegalArgumentException ( e ) ; } catch ( NoSuchAlgorithmException e ) { throw new IllegalArgumentException (...
public class NovaException { /** * / / { " badRequest " : { " message " : " AddressLimitExceeded : Address quota exceeded . You cannot allocate any more addresses " , " code " : 400 } } */ static public ExceptionItems parseException ( int code , String json ) { } }
ExceptionItems items = new ExceptionItems ( ) ; items . code = code ; items . type = CloudErrorType . GENERAL ; items . message = "unknown" ; items . details = "The cloud returned an error code with explanation: " ; if ( items . code == HttpStatus . SC_UNAUTHORIZED ) { items . type = CloudErrorType . AUTHENTICATION ; }...
public class CmsModule { /** * Adjusts the site root and returns a cloned CmsObject , iff the module has set an import site that differs * from the site root of the CmsObject provided as argument . Otherwise returns the provided CmsObject unchanged . * @ param cms The original CmsObject . * @ param module The mod...
CmsObject cmsClone ; if ( ( null == module . getSite ( ) ) || cms . getRequestContext ( ) . getSiteRoot ( ) . equals ( module . getSite ( ) ) ) { cmsClone = cms ; } else { cmsClone = OpenCms . initCmsObject ( cms ) ; cmsClone . getRequestContext ( ) . setSiteRoot ( module . getSite ( ) ) ; } return cmsClone ;
public class JettyBootstrap { /** * Blocks the calling thread until the server stops . * @ return this instance * @ throws JettyBootstrapException * if an exception occurs while blocking the thread */ public JettyBootstrap joinServer ( ) throws JettyBootstrapException { } }
try { if ( isServerStarted ( ) ) { LOG . debug ( "Joining Server..." ) ; server . join ( ) ; } else { LOG . warn ( "Can't join Server. Not started" ) ; } } catch ( InterruptedException e ) { throw new JettyBootstrapException ( e ) ; } return this ;
public class StringUtils { /** * Converts an object into a tab delimited string with given fields * Requires the object has public access for the specified fields * @ param object Object to convert * @ param delimiter delimiter * @ param fieldNames fieldnames * @ return String representing object */ public st...
StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < fieldNames . length ; i ++ ) { if ( sb . length ( ) > 0 ) { sb . append ( delimiter ) ; } try { Field field = object . getClass ( ) . getDeclaredField ( fieldNames [ i ] ) ; sb . append ( field . get ( object ) ) ; } catch ( IllegalAccessException ex ) { ...
public class NumericComparator { /** * Converts the lhs and rhs JsonNodes to the numeric values * and delegates to the matches method that operates on the * numeric values alone . * @ param lhs Lhs expression * @ param rhs Rhs expression * @ return Boolean result of the matches method of the * corresponding...
return matches ( lhs . decimalValue ( ) , rhs . decimalValue ( ) ) ;
public class TagUtils { /** * String - - > long * @ param value * @ return */ public static long getLong ( Object value ) { } }
if ( value == null ) { return 0 ; } return Long . valueOf ( value . toString ( ) ) . longValue ( ) ;
public class ASTTransformationVisitor { /** * Main loop entry . * First , it delegates to the super visitClass so we can collect the * relevant annotations in an AST tree walk . * Second , it calls the visit method on the transformation for each relevant * annotation found . * @ param classNode the class to v...
// only descend if we have annotations to look for Map < Class < ? extends ASTTransformation > , Set < ASTNode > > baseTransforms = classNode . getTransforms ( phase ) ; if ( ! baseTransforms . isEmpty ( ) ) { final Map < Class < ? extends ASTTransformation > , ASTTransformation > transformInstances = new HashMap < Cla...
public class Resolver { /** * Implementation of { @ link URIResolver # resolve ( String , String ) } . */ public Source resolve ( String pHref , String pBase ) throws TransformerException { } }
URL url = null ; final Source source = resolver . resolve ( pHref , pBase ) ; if ( source != null ) { if ( xincludeAware ) { /* * Avoid risky cast use correct resolved systemid * to configure a xinclude aware source . */ try { url = new URI ( source . getSystemId ( ) ) . toURL ( ) ; } catch ( Exception e ) { throw ne...
public class LimitHelper { /** * Retrieve the indicated first row for pagination * @ param selection The row selection options * @ return The first row */ public static int getFirstRow ( RowSelection selection ) { } }
return ( selection == null || selection . getFirstRow ( ) == null ) ? 0 : selection . getFirstRow ( ) ;
public class TypicalFaicliApiFailureHook { protected FaicliUnifiedFailureResult createFailureResult ( FaicliUnifiedFailureType failureType , ApiFailureResource resource , RuntimeException cause ) { } }
final Map < String , List < String > > propertyMessageMap = extractPropertyMessageMap ( resource , cause ) ; final List < FaicliFailureErrorPart > errors = toErrors ( resource , propertyMessageMap ) ; return newUnifiedFailureResult ( failureType , errors ) ;
public class FileDownloadNotificationHelper { /** * Show the notification with indeterminate progress . * @ param id The download id . * @ param status { @ link FileDownloadStatus } */ public void showIndeterminate ( final int id , int status ) { } }
final BaseNotificationItem notification = get ( id ) ; if ( notification == null ) { return ; } notification . updateStatus ( status ) ; notification . show ( false ) ;
public class ZoomableDraweeView { /** * Sets a custom zoomable controller , instead of using the default one . */ public void setZoomableController ( ZoomableController zoomableController ) { } }
Preconditions . checkNotNull ( zoomableController ) ; mZoomableController . setListener ( null ) ; mZoomableController = zoomableController ; mZoomableController . setListener ( mZoomableListener ) ;
public class JerseyConnector { /** * This method is used to lazy - initialize the connector on the first request . * The method uses the request object to obtain a reference to the client making the request . The configuration of * the client is then inspected to determine if a proxy is needed and how to handle inv...
/* * If we ' ve already set up the client , return it . Otherwise , set it up and cache the client for subsequent use . */ if ( client != null ) { return ; } OpenStackClient osClient = request . getOpenStackClient ( ) ; Properties properties = osClient . getProperties ( ) ; logger = osClient . getLogger ( ) ; filter = ...
public class AnalysisScreen { /** * Get the matching basis field given the summary field . * Override this if you don ' t want the defaults . * @ param fldSummary The summary field to match . * @ param recBasic The basis record . * @ param iSummarySeq The position in the summary record . * @ return The basis ...
BaseField fldBasis = null ; String strFieldName = fldSummary . getFieldName ( ) ; if ( ( strFieldName != null ) && ( strFieldName . indexOf ( '.' ) != - 1 ) ) { Record record = this . getRecord ( strFieldName . substring ( 0 , strFieldName . indexOf ( '.' ) ) ) ; if ( ( strFieldName . indexOf ( '.' ) == 0 ) || ( "Scree...
public class PasswordEditText { /** * Returns the helper text , which corresponds to a specific password strength . * @ param score * The password strength as a { @ link Float } value between 0.0 and 1.0 , which represents * the fraction of constraints , which are satisfied * @ return The helper text as an inst...
if ( ! helperTexts . isEmpty ( ) ) { float interval = 1.0f / helperTexts . size ( ) ; int index = ( int ) Math . floor ( score / interval ) - 1 ; index = Math . max ( index , 0 ) ; index = Math . min ( index , helperTexts . size ( ) - 1 ) ; return helperTexts . get ( index ) ; } return null ;
public class BoxDeveloperEditionAPIConnection { /** * Creates a new Box Developer Edition connection with App User token . * @ param userId the user ID to use for an App User . * @ param clientId the client ID to use when exchanging the JWT assertion for an access token . * @ param clientSecret the client secret ...
BoxDeveloperEditionAPIConnection connection = new BoxDeveloperEditionAPIConnection ( userId , DeveloperEditionEntityType . USER , clientId , clientSecret , encryptionPref ) ; connection . authenticate ( ) ; return connection ;
public class RoundLcdClockSkin { /** * * * * * * Canvas * * * * * */ private void drawForeground ( final ZonedDateTime TIME ) { } }
foregroundCtx . clearRect ( 0 , 0 , size , size ) ; Locale locale = clock . getLocale ( ) ; // draw the time if ( clock . isTextVisible ( ) ) { foregroundCtx . setFill ( textColor ) ; foregroundCtx . setTextBaseline ( VPos . CENTER ) ; foregroundCtx . setTextAlign ( TextAlignment . CENTER ) ; if ( Locale . US == locale...
public class ClassInfo { /** * Returns information on all visible fields declared by this class , or by its superclasses . See also : * < ul > * < li > { @ link # getFieldInfo ( String ) } * < li > { @ link # getDeclaredFieldInfo ( String ) } * < li > { @ link # getDeclaredFieldInfo ( ) } * < / ul > * Requi...
if ( ! scanResult . scanSpec . enableFieldInfo ) { throw new IllegalArgumentException ( "Please call ClassGraph#enableFieldInfo() before #scan()" ) ; } // Implement field overriding final FieldInfoList fieldInfoList = new FieldInfoList ( ) ; final Set < String > fieldNameSet = new HashSet < > ( ) ; for ( final ClassInf...
public class Apptentive { /** * Add a custom data String to the Device . Custom data will be sent to the server , is displayed * in the Conversation view , and can be used in Interaction targeting . Calls to this method are * idempotent . * @ param key The key to store the data under . * @ param value A String ...
dispatchConversationTask ( new ConversationDispatchTask ( ) { @ Override protected boolean execute ( Conversation conversation ) { conversation . getDevice ( ) . getCustomData ( ) . put ( key , trim ( value ) ) ; return true ; } } , "add custom device data" ) ;
public class DefaultRdfStream { /** * Create an RdfStream from an existing Model . * @ param node The subject node * @ param model An input Model * @ return a new RdfStream object */ public static RdfStream fromModel ( final Node node , final Model model ) { } }
return new DefaultRdfStream ( node , stream ( spliteratorUnknownSize ( model . listStatements ( ) , IMMUTABLE ) , false ) . map ( Statement :: asTriple ) ) ;
public class AdminListUserAuthEventsResult { /** * The response object . It includes the < code > EventID < / code > , < code > EventType < / code > , < code > CreationDate < / code > , * < code > EventRisk < / code > , and < code > EventResponse < / code > . * < b > NOTE : < / b > This method appends the values to...
if ( this . authEvents == null ) { setAuthEvents ( new java . util . ArrayList < AuthEventType > ( authEvents . length ) ) ; } for ( AuthEventType ele : authEvents ) { this . authEvents . add ( ele ) ; } return this ;
public class RowIndexSearcher { /** * { @ inheritDoc } */ @ Override public IndexExpression highestSelectivityPredicate ( List < IndexExpression > clause , boolean trace ) { } }
for ( IndexExpression expression : clause ) { ByteBuffer columnName = expression . column ; boolean sameName = indexedColumnName . equals ( columnName ) ; if ( expression . operator . equals ( EQ ) && sameName ) { return expression ; } } return null ;
public class DOTranslationUtility { /** * Make URLs that are relative to the local Fedora repository ABSOLUTE URLs . * First , see if any URLs are expressed in relative URL syntax ( beginning * with " fedora / get " or " fedora / search " ) and convert these to the special * Fedora local URL syntax ( " http : / /...
String output = input ; // First pass : convert fedora app context URLs via variable substitution output = m_fedoraLocalAppContextPattern . matcher ( output ) . replaceAll ( m_hostContextInfo ) ; // Second pass : convert non - fedora - app - context URLs via variable substitution output = m_fedoraLocalPattern . matcher...
public class ListAcceptedPortfolioSharesResult { /** * Information about the portfolios . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setPortfolioDetails ( java . util . Collection ) } or { @ link # withPortfolioDetails ( java . util . Collection ) } if y...
if ( this . portfolioDetails == null ) { setPortfolioDetails ( new java . util . ArrayList < PortfolioDetail > ( portfolioDetails . length ) ) ; } for ( PortfolioDetail ele : portfolioDetails ) { this . portfolioDetails . add ( ele ) ; } return this ;
public class GroupImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public void setGuardCondition ( Condition newGuardCondition ) { } }
if ( newGuardCondition != guardCondition ) { NotificationChain msgs = null ; if ( guardCondition != null ) msgs = ( ( InternalEObject ) guardCondition ) . eInverseRemove ( this , EOPPOSITE_FEATURE_BASE - XtextPackage . GROUP__GUARD_CONDITION , null , msgs ) ; if ( newGuardCondition != null ) msgs = ( ( InternalEObject ...
public class WebApp { /** * createServlet only called when adding / creating programmatically */ @ Override public < T extends Servlet > T createServlet ( Class < T > classToCreate ) throws ServletException { } }
logger . logp ( Level . FINE , CLASS_NAME , "createServlet" , "called for class: " + classToCreate ) ; return super . createServlet ( classToCreate ) ;
public class Terminals { /** * Returns a { @ link Terminals } object for lexing and parsing the operators with names specified in * { @ code ops } , and for lexing and parsing the keywords case sensitively . Parsers for operators * and keywords can be obtained through { @ link # token } ; parsers for identifiers th...
return operators ( ops ) . words ( wordScanner ) . keywords ( keywords ) . build ( ) ;
public class SFTrustManager { /** * Gets OCSP URLs associated with the certificate . * @ param bcCert Bouncy Castle Certificate * @ return a set of OCSP URLs */ private Set < String > getOcspUrls ( Certificate bcCert ) { } }
TBSCertificate bcTbsCert = bcCert . getTBSCertificate ( ) ; Extensions bcExts = bcTbsCert . getExtensions ( ) ; if ( bcExts == null ) { throw new RuntimeException ( "Failed to get Tbs Certificate." ) ; } Set < String > ocsp = new HashSet < > ( ) ; for ( Enumeration en = bcExts . oids ( ) ; en . hasMoreElements ( ) ; ) ...
public class SpringAopHelper { /** * 获取 目标对象 * @ param proxy 代理对象 * @ return * @ throws Exception */ public static Object getTarget ( Object proxy ) throws Exception { } }
if ( ! AopUtils . isAopProxy ( proxy ) ) { return proxy ; // 不是代理对象 } if ( AopUtils . isJdkDynamicProxy ( proxy ) ) { Object object = getJdkDynamicProxyTargetObject ( proxy ) ; return getTarget ( object ) ; } else { // cglib Object object = getCglibProxyTargetObject ( proxy ) ; return getTarget ( object ) ; }
public class BigIntegerMapper { /** * { @ inheritDoc } */ @ Override protected String doBase ( String name , Object value ) { } }
// Parse big decimal String svalue = value . toString ( ) ; BigInteger bi ; try { bi = new BigInteger ( svalue ) ; } catch ( NumberFormatException e ) { throw new IndexException ( "Field '{}' requires a base 10 integer, but found '{}'" , name , svalue ) ; } // Check size if ( bi . abs ( ) . toString ( ) . length ( ) > ...
public class AmazonRoute53ResolverClient { /** * Associates a resolver rule with a VPC . When you associate a rule with a VPC , Resolver forwards all DNS queries * for the domain name that is specified in the rule and that originate in the VPC . The queries are forwarded to the * IP addresses for the DNS resolvers ...
request = beforeClientExecution ( request ) ; return executeAssociateResolverRule ( request ) ;
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcRelVoidsElement ( ) { } }
if ( ifcRelVoidsElementEClass == null ) { ifcRelVoidsElementEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 563 ) ; } return ifcRelVoidsElementEClass ;
public class FullMappingPropertiesBasedBundlesHandlerFactory { /** * Returns the list of joinable resource bundle * @ param properties * the properties * @ return the list of joinable resource bundle */ public List < JoinableResourceBundle > getResourceBundles ( Properties properties ) { } }
PropertiesConfigHelper props = new PropertiesConfigHelper ( properties , resourceType ) ; String fileExtension = "." + resourceType ; // Initialize custom bundles List < JoinableResourceBundle > customBundles = new ArrayList < > ( ) ; // Check if we should use the bundle names property or // find the bundle name using ...
public class DFAState { /** * Optimizes transition by merging ranges */ void optimizeTransitions ( ) { } }
HashMap < DFAState < T > , RangeSet > hml = new HashMap < > ( ) ; for ( Transition < DFAState < T > > t : transitions . values ( ) ) { RangeSet rs = hml . get ( t . getTo ( ) ) ; if ( rs == null ) { rs = new RangeSet ( ) ; hml . put ( t . getTo ( ) , rs ) ; } rs . add ( t . getCondition ( ) ) ; } transitions . clear ( ...
public class Config { /** * Returns the ScheduledExecutorConfig for the given name , creating one * if necessary and adding it to the collection of known configurations . * The configuration is found by matching the configuration name * pattern to the provided { @ code name } without the partition qualifier * (...
return ConfigUtils . getConfig ( configPatternMatcher , scheduledExecutorConfigs , name , ScheduledExecutorConfig . class ) ;
public class SmartLdapGroupStore { /** * Return an UnsupportedOperationException ! * @ param entityType * @ return * @ throws GroupsException */ @ Override public IEntityGroup newInstance ( Class entityType ) throws GroupsException { } }
log . warn ( "Unsupported method accessed: SmartLdapGroupStore.newInstance" ) ; throw new UnsupportedOperationException ( UNSUPPORTED_MESSAGE ) ;
public class ServiceManagerSparql { /** * Obtains a list of service URIs with all the services known to the system * @ return list of URIs with all the services in the registry */ @ Override public Set < URI > listServices ( ) { } }
String queryStr = new StringBuilder ( ) . append ( "SELECT DISTINCT ?svc WHERE { \n" ) . append ( " GRAPH ?g { \n" ) . append ( "?svc " ) . append ( "<" ) . append ( RDF . type . getURI ( ) ) . append ( ">" ) . append ( " " ) . append ( "<" ) . append ( MSM . Service . getURI ( ) ) . append ( "> . \n" ) . append ( " } ...
public class Shutdown { /** * / * The actual shutdown sequence is defined here . * If it weren ' t for runFinalizersOnExit , this would be simple - - we ' d just * run the hooks and then halt . Instead we need to keep track of whether * we ' re running hooks or finalizers . In the latter case a finalizer could ...
synchronized ( lock ) { /* Guard against the possibility of a daemon thread invoking exit * after DestroyJavaVM initiates the shutdown sequence */ if ( state != HOOKS ) return ; } runHooks ( ) ; boolean rfoe ; synchronized ( lock ) { state = FINALIZERS ; rfoe = runFinalizersOnExit ; } if ( rfoe ) runAllFinalizers ( )...
public class CommerceDiscountPersistenceImpl { /** * Returns the commerce discount with the primary key or throws a { @ link com . liferay . portal . kernel . exception . NoSuchModelException } if it could not be found . * @ param primaryKey the primary key of the commerce discount * @ return the commerce discount ...
CommerceDiscount commerceDiscount = fetchByPrimaryKey ( primaryKey ) ; if ( commerceDiscount == null ) { if ( _log . isDebugEnabled ( ) ) { _log . debug ( _NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey ) ; } throw new NoSuchDiscountException ( _NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey ) ; } return commerceDiscount ;
public class FlattenMojo { /** * This method determines if the given { @ link Repository } section is identical to what is defined from the super * POM . * @ param repo is the { @ link Repository } section to check . * @ return < code > true < / code > if maven central default configuration , < code > false < / c...
if ( repo != null ) { if ( "central" . equals ( repo . getId ( ) ) ) { RepositoryPolicy snapshots = repo . getSnapshots ( ) ; if ( snapshots != null && ! snapshots . isEnabled ( ) ) { return true ; } } } return false ;
public class RPC { /** * called on a timeout . */ public synchronized RPC < V > call ( ) { } }
++ _callCnt ; // completer will not be carried over to remote // add it to the RPC call . if ( _dt . getCompleter ( ) != null ) { CountedCompleter cc = _dt . getCompleter ( ) ; assert cc instanceof H2OCountedCompleter ; boolean alreadyIn = false ; if ( _fjtasks != null ) for ( H2OCountedCompleter hcc : _fjtasks ) if ( ...
public class SwaggerExtension { /** * Associate the InterceptorBinding annotation . */ public void processBeforeBeanDiscovery ( @ Observes BeforeBeanDiscovery event , BeanManager beanManager ) { } }
event . addInterceptorBinding ( beanManager . createAnnotatedType ( AddSwaggerResources . class ) ) ; event . addAnnotatedType ( beanManager . createAnnotatedType ( SwaggerRestApplicationInterceptor . class ) , SwaggerRestApplicationInterceptor . class . getName ( ) ) ;
public class NotificationRegistry { /** * We don ' t throw any errors because the connector is about to be closed . */ private void sendClosingSignal ( ) { } }
URL clientURL = null ; HttpsURLConnection connection = null ; try { // Get the appropriate URL to delete notification client if ( serverConnection . serverVersion >= 4 ) { // V4 + clients use / { clientID } to delete the notification client clientURL = getNotificationClientURL ( ) ; } else { // Pre - V4 clients use / {...
public class SharedTorrent { /** * Peer disconnection handler . * When a peer disconnects , we need to mark in all of the pieces it had * available that they can ' t be reached through this peer anymore . * @ param peer The peer we got this piece from . */ @ Override public synchronized void handlePeerDisconnecte...
BitSet availablePieces = peer . getAvailablePieces ( ) ; for ( int i = availablePieces . nextSetBit ( 0 ) ; i >= 0 ; i = availablePieces . nextSetBit ( i + 1 ) ) { this . pieces [ i ] . noLongerAt ( peer ) ; } Set < Piece > requested = peer . getRequestedPieces ( ) ; if ( requested != null ) { for ( Piece piece : reque...
public class ObjectWriterImpl { /** * { @ inheritDoc } */ public void writeString ( String str ) throws IOException { } }
byte [ ] bytes = str . getBytes ( Constants . DEFAULT_ENCODING ) ; writeInt ( bytes . length ) ; write ( bytes ) ;
public class LinkedList { /** * Removes all of the elements from this list . * The list will be empty after this call returns . */ public void clear ( ) { } }
// Clearing all of the links between nodes is " unnecessary " , but : // - helps a generational GC if the discarded nodes inhabit // more than one generation // - is sure to free memory even if there is a reachable Iterator for ( Node < E > x = first ; x != null ; ) { Node < E > next = x . next ; x . item = null ; x . ...
public class LinearSkin { /** * * * * * * Initialization * * * * * */ private void initGraphics ( ) { } }
// Set initial size if ( Double . compare ( gauge . getPrefWidth ( ) , 0.0 ) <= 0 || Double . compare ( gauge . getPrefHeight ( ) , 0.0 ) <= 0 || Double . compare ( gauge . getWidth ( ) , 0.0 ) <= 0 || Double . compare ( gauge . getHeight ( ) , 0.0 ) <= 0 ) { if ( gauge . getPrefWidth ( ) > 0 && gauge . getPrefHeight (...
public class SimpleRandomSampling { /** * Calculates Variance for Pbar for a finite population size * @ param pbar * @ param sampleN * @ param populationN * @ return */ public static double pbarVariance ( double pbar , int sampleN , int populationN ) { } }
if ( populationN <= 0 || sampleN <= 0 || sampleN > populationN ) { throw new IllegalArgumentException ( "All the parameters must be positive and sampleN smaller than populationN." ) ; } double f = ( double ) sampleN / populationN ; double pbarVariance = ( ( 1.0 - f ) * pbar * ( 1.0 - pbar ) ) / ( sampleN - 1.0 ) ; retu...