signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class OntopModelSettingsImpl { /** * Returns the boolean value of the given key . */ Optional < Boolean > getBoolean ( String key ) { } }
Object value = get ( key ) ; if ( value == null ) { return Optional . empty ( ) ; } if ( value instanceof Boolean ) { return Optional . of ( ( Boolean ) value ) ; } else if ( value instanceof String ) { return Optional . of ( Boolean . parseBoolean ( ( String ) value ) ) ; } else { throw new InvalidOntopConfigurationException ( "A boolean was expected: " + value ) ; }
public class DnsCacheManipulator { /** * Remove dns cache entry , cause lookup dns server for host after . * @ param host host * @ throws DnsCacheManipulatorException Operation fail * @ see DnsCacheManipulator # clearDnsCache */ public static void removeDnsCache ( String host ) { } }
try { InetAddressCacheUtil . removeInetAddressCache ( host ) ; } catch ( Exception e ) { final String message = String . format ( "Fail to removeDnsCache for host %s, cause: %s" , host , e . toString ( ) ) ; throw new DnsCacheManipulatorException ( message , e ) ; }
public class CouchbaseClientFactory { /** * Query and get a result by username . * @ param usernameAttribute the username attribute * @ param usernameValue the username value * @ return the n1ql query result * @ throws GeneralSecurityException the general security exception */ public N1qlQueryResult query ( final String usernameAttribute , final String usernameValue ) throws GeneralSecurityException { } }
val theBucket = getBucket ( ) ; val statement = Select . select ( "*" ) . from ( Expression . i ( theBucket . name ( ) ) ) . where ( Expression . x ( usernameAttribute ) . eq ( '\'' + usernameValue + '\'' ) ) ; LOGGER . debug ( "Running query [{}] on bucket [{}]" , statement . toString ( ) , theBucket . name ( ) ) ; val query = N1qlQuery . simple ( statement ) ; val result = theBucket . query ( query , timeout , TimeUnit . MILLISECONDS ) ; if ( ! result . finalSuccess ( ) ) { LOGGER . error ( "Couchbase query failed with [{}]" , result . errors ( ) . stream ( ) . map ( JsonObject :: toString ) . collect ( Collectors . joining ( "," ) ) ) ; throw new GeneralSecurityException ( "Could not locate account for user " + usernameValue ) ; } return result ;
public class CSSDataURLHelper { /** * Parse a data URL into this type . * < pre > * Syntax * dataurl : = " data : " [ mediatype ] [ " ; base64 " ] " , " data * mediatype : = [ type " / " subtype ] * ( " ; " parameter ) * data : = * urlchar * parameter : = attribute " = " value * < / pre > * @ param sDataURL * The data URL to be parsed . May be < code > null < / code > . * @ return < code > null < / code > if parsing failed */ @ Nullable public static CSSDataURL parseDataURL ( @ Nullable final String sDataURL ) { } }
if ( ! isDataURL ( sDataURL ) ) return null ; // Skip the constant prefix final String sRest = sDataURL . trim ( ) . substring ( PREFIX_DATA_URL . length ( ) ) ; if ( StringHelper . hasNoText ( sRest ) ) { // Plain " data : " URL - no content return new CSSDataURL ( ) ; } // comma is a special character and must be quoted in MIME type parameters final int nIndexComma = sRest . indexOf ( SEPARATOR_CONTENT ) ; int nIndexBase64 = sRest . indexOf ( BASE64_MARKER ) ; boolean bBase64EncodingUsed = false ; int nMIMETypeEnd ; if ( nIndexBase64 >= 0 ) { // We have Base64 if ( nIndexBase64 < nIndexComma || nIndexComma < 0 ) { // Base64 before comma or no comma // = = > check if it is a MIME type parameter name ( in // which case it is followed by a ' = ' character before the comma ) or if // it is really the base64 - encoding flag ( no further ' = ' or ' = ' after // the comma ) . while ( true ) { final int nIndexEquals = sRest . indexOf ( CMimeType . SEPARATOR_PARAMETER_NAME_VALUE , nIndexBase64 ) ; if ( nIndexEquals < 0 || nIndexEquals > nIndexComma || nIndexComma < 0 ) { // It ' s a real base64 indicator nMIMETypeEnd = nIndexBase64 ; bBase64EncodingUsed = true ; break ; } // base64 as a MIME type parameter - check for next ; base64 nIndexBase64 = sRest . indexOf ( BASE64_MARKER , nIndexBase64 + BASE64_MARKER . length ( ) ) ; if ( nIndexBase64 < 0 ) { // Found no base64 encoding nMIMETypeEnd = nIndexComma ; break ; } // Found another base64 marker - > continue } } else { // Base64 as part of data ! nMIMETypeEnd = nIndexComma ; } } else { // No Base64 found nMIMETypeEnd = nIndexComma ; } String sMimeType = nMIMETypeEnd < 0 ? null : sRest . substring ( 0 , nMIMETypeEnd ) . trim ( ) ; IMimeType aMimeType ; Charset aCharset = null ; if ( StringHelper . hasNoText ( sMimeType ) ) { // If no MIME type is specified , the default is used aMimeType = DEFAULT_MIME_TYPE . getClone ( ) ; aCharset = DEFAULT_CHARSET ; } else { // A MIME type is present if ( sMimeType . charAt ( 0 ) == CMimeType . SEPARATOR_PARAMETER ) { // Weird stuff from the specs : if only " ; charset = utf - 8 " is present than // text / plain should be used sMimeType = DEFAULT_MIME_TYPE . getAsStringWithoutParameters ( ) + sMimeType ; } // try to parse it aMimeType = MimeTypeParser . safeParseMimeType ( sMimeType , EMimeQuoting . URL_ESCAPE ) ; if ( aMimeType == null ) { LOGGER . warn ( "Data URL contains invalid MIME type: '" + sMimeType + "'" ) ; return null ; } // Check if a " charset " MIME type parameter is present final String sCharsetParam = MimeTypeHelper . getCharsetNameFromMimeType ( aMimeType ) ; if ( sCharsetParam != null ) { aCharset = CharsetHelper . getCharsetFromNameOrNull ( sCharsetParam ) ; if ( aCharset == null ) { LOGGER . warn ( "Illegal charset '" + sCharsetParam + "' contained. Defaulting to '" + DEFAULT_CHARSET . name ( ) + "'" ) ; } } if ( aCharset == null ) aCharset = DEFAULT_CHARSET ; } // Get the main content data String sContent = nIndexComma < 0 ? "" : sRest . substring ( nIndexComma + 1 ) . trim ( ) ; byte [ ] aContent = sContent . getBytes ( aCharset ) ; if ( bBase64EncodingUsed ) { // Base64 decode the content data aContent = Base64 . safeDecode ( aContent ) ; if ( aContent == null ) { LOGGER . warn ( "Failed to decode Base64 value: " + sContent ) ; return null ; } // Ignore the String content ( and don ' t create it ) because for binary // stuff like images , it does not make sense and it is most likely , that // the String content will never be used . In case it is required , the // String content is lazily initialized . sContent = null ; } final CSSDataURL ret = new CSSDataURL ( aMimeType , bBase64EncodingUsed , aContent , aCharset , sContent ) ; return ret ;
public class CheckAccessControls { /** * Returns the instance object type that best represents a method or constructor definition , or * { @ code null } if there is no representative type . * < ul > * < li > Prototype methods = > The instance type having that prototype * < li > Instance methods = > The type the method is attached to * < li > Constructors = > The type that constructor instantiates * < li > Object - literal members = > The object - literal type * < / ul > */ @ Nullable private ObjectType bestInstanceTypeForMethodOrCtor ( Node n ) { } }
checkState ( isFunctionOrClass ( n ) , n ) ; Node parent = n . getParent ( ) ; // We need to handle declaration syntaxes separately in a way that we can ' t determine based on // the type of just one node . // TODO ( nickreid ) : Determine if these can be replaced with FUNCTION and CLASS cases below . if ( NodeUtil . isFunctionDeclaration ( n ) || NodeUtil . isClassDeclaration ( n ) ) { return instanceTypeFor ( n . getJSType ( ) ) ; } // All the remaining cases can be isolated based on ` parent ` . switch ( parent . getToken ( ) ) { case NAME : return instanceTypeFor ( n . getJSType ( ) ) ; case ASSIGN : { Node lValue = parent . getFirstChild ( ) ; if ( NodeUtil . isGet ( lValue ) ) { // We have an assignment of the form ` a . b = . . . ` . JSType lValueType = lValue . getJSType ( ) ; if ( lValueType != null && ( lValueType . isConstructor ( ) || lValueType . isInterface ( ) ) ) { // Case ` a . B = . . . ` return instanceTypeFor ( lValueType ) ; } else if ( NodeUtil . isPrototypeProperty ( lValue ) ) { // Case ` a . B . prototype = . . . ` return instanceTypeFor ( NodeUtil . getPrototypeClassName ( lValue ) . getJSType ( ) ) ; } else { // Case ` a . b = . . . ` return instanceTypeFor ( lValue . getFirstChild ( ) . getJSType ( ) ) ; } } else { // We have an assignment of the form " a = . . . " , so pull the type off the " a " . return instanceTypeFor ( lValue . getJSType ( ) ) ; } } case STRING_KEY : case GETTER_DEF : case SETTER_DEF : case MEMBER_FUNCTION_DEF : case COMPUTED_PROP : { Node grandparent = parent . getParent ( ) ; Node greatGrandparent = grandparent . getParent ( ) ; if ( grandparent . isObjectLit ( ) ) { return grandparent . getJSType ( ) . isFunctionPrototypeType ( ) // Case : ` grandparent ` is an object - literal prototype . // Example : ` Foo . prototype = { a : function ( ) { } } ; ` where ` parent ` is " a " . ? instanceTypeFor ( grandparent . getJSType ( ) ) : null ; } else if ( greatGrandparent . isClass ( ) ) { // Case : ` n ` is a class member definition . // Example : ` class Foo { a ( ) { } } ` where ` parent ` is " a " . return instanceTypeFor ( greatGrandparent . getJSType ( ) ) ; } else { // This would indicate the AST is malformed . throw new AssertionError ( greatGrandparent ) ; } } default : return null ; }
public class DirectoryLookupService { /** * Get the ModelServiceInstance list of the Service . * @ param serviceName * the service name . * @ return * the ModelServiceInstance list of the Service . */ public List < ModelServiceInstance > getModelInstances ( String serviceName ) { } }
ModelService service = getModelService ( serviceName ) ; if ( service == null || service . getServiceInstances ( ) . size ( ) == 0 ) { return Collections . emptyList ( ) ; } else { return new ArrayList < ModelServiceInstance > ( service . getServiceInstances ( ) ) ; }
public class TokenLifeCycleManager { /** * Logic for getting token : < br > * 1 . If has a valid token stored , send it . < br > * 2 . If the stored token has expired , replace it with a new fetched token . < br > * Note : This method is thread - safe and makes only one call to IAM API to replace an expired IAM token . */ @ Override public String getToken ( ) throws TokenManagerException { } }
if ( hasTokenExpired ( ) ) { synchronized ( this ) { if ( hasTokenExpired ( ) ) { try { final IAMToken iamToken = invokeTokenApi ( ) ; expiresAt = ( long ) ( TimeUnit . SECONDS . toNanos ( iamToken . expires_in ) * tokenExpiryThreshold ) + System . nanoTime ( ) ; token = iamToken . access_token ; } catch ( final IAMTokenException e ) { throw new TokenManagerException ( "Failed getting Token." , e ) ; } } } } return token ;
public class SeleniumHelper { /** * Sets how long to wait when executing asynchronous script calls . * @ param scriptTimeout time in milliseconds to wait . */ public void setScriptWait ( int scriptTimeout ) { } }
try { driver ( ) . manage ( ) . timeouts ( ) . setScriptTimeout ( scriptTimeout , TimeUnit . MILLISECONDS ) ; } catch ( Exception e ) { // https : / / code . google . com / p / selenium / issues / detail ? id = 6015 System . err . println ( "Unable to set script timeout (known issue for Safari): " + e . getMessage ( ) ) ; }
public class FnJodaTimeUtils { /** * It creates a { @ link Period } with the specified { @ link Chronology } . The input received by the { @ link Function } * must have size 2 and represents the start and end instants of the { @ link Period } * @ param chronology { @ link Chronology } to be used * @ return the { @ link Period } created from the input and arguments */ public static final < T extends BaseDateTime > Function < T [ ] , Period > baseDateTimeFieldArrayToPeriod ( final Chronology chronology ) { } }
return FnPeriod . baseDateTimeFieldArrayToPeriod ( chronology ) ;
public class AbstractFaxClientSpi { /** * This function adds the fax monitor event listener to the internal fax * event listeners data structure . < br > * Fax jobs will be monitored only if there are active listeners registered . < br > * If the listeners are added after a fob job was submitted , that fax job would not be monitored . < br > * < b > Not all SPIs support monitoring events , in which case this method will throw an exception . < / b > * @ param listener * The fax monitor event listener */ public void addFaxMonitorEventListener ( FaxMonitorEventListener listener ) { } }
boolean faxMonitorEventsSupported = this . isFaxMonitorEventsSupported ( ) ; if ( faxMonitorEventsSupported ) { synchronized ( this . faxMonitorEventListeners ) { this . faxMonitorEventListeners . add ( listener ) ; } } else { this . throwUnsupportedException ( ) ; }
public class JideAbstractView { /** * Returns the view specific menu bar constructed from * the command group given by the toolBarCommandGroupName or * its default * @ return */ public JComponent getViewToolBar ( ) { } }
CommandGroup commandGroup = getCommandGroup ( getToolBarCommandGroupName ( ) ) ; if ( commandGroup == null ) { return null ; } return commandGroup . createToolBar ( ) ;
public class AbstractPac4jDecoder { /** * Populate the context which carries information specific to this binding . * @ param messageContext the current message context */ protected void populateBindingContext ( final SAML2MessageContext messageContext ) { } }
SAMLBindingContext bindingContext = messageContext . getSubcontext ( SAMLBindingContext . class , true ) ; bindingContext . setBindingUri ( getBindingURI ( messageContext ) ) ; bindingContext . setHasBindingSignature ( false ) ; bindingContext . setIntendedDestinationEndpointURIRequired ( SAMLBindingSupport . isMessageSigned ( messageContext ) ) ;
public class CudaZeroHandler { /** * This method returns total amount of memory allocated within system * @ return */ @ Override public Table < AllocationStatus , Integer , Long > getAllocationStatistics ( ) { } }
Table < AllocationStatus , Integer , Long > table = HashBasedTable . create ( ) ; table . put ( AllocationStatus . HOST , 0 , zeroUseCounter . get ( ) ) ; for ( Integer deviceId : configuration . getAvailableDevices ( ) ) { table . put ( AllocationStatus . DEVICE , deviceId , getAllocatedDeviceMemory ( deviceId ) ) ; } return table ;
public class Ray { /** * Sets this ray from the given ray . * @ param ray The ray * @ return this ray for chaining . */ public Ray < T > set ( Ray < T > ray ) { } }
start . set ( ray . start ) ; end . set ( ray . end ) ; return this ;
public class AnnotationTypeRequiredMemberWriterImpl { /** * { @ inheritDoc } */ public List < String > getSummaryTableHeader ( Element member ) { } }
List < String > header = Arrays . asList ( writer . getModifierTypeHeader ( ) , resources . getText ( "doclet.Annotation_Type_Required_Member" ) , resources . getText ( "doclet.Description" ) ) ; return header ;
public class RequestedGlobalProperties { /** * Filters these properties by what can be preserved by the given SemanticProperties when propagated down * to the given input . * @ param props The SemanticProperties which define which fields are preserved . * @ param input The index of the operator ' s input . * @ return The filtered RequestedGlobalProperties */ public RequestedGlobalProperties filterBySemanticProperties ( SemanticProperties props , int input ) { } }
// no semantic properties available . All global properties are filtered . if ( props == null ) { throw new NullPointerException ( "SemanticProperties may not be null." ) ; } RequestedGlobalProperties rgProp = new RequestedGlobalProperties ( ) ; switch ( this . partitioning ) { case FULL_REPLICATION : case FORCED_REBALANCED : case CUSTOM_PARTITIONING : case RANDOM_PARTITIONED : case ANY_DISTRIBUTION : // make sure that certain properties are not pushed down return null ; case HASH_PARTITIONED : case ANY_PARTITIONING : FieldSet newFields ; if ( this . partitioningFields instanceof FieldList ) { newFields = new FieldList ( ) ; } else { newFields = new FieldSet ( ) ; } for ( Integer targetField : this . partitioningFields ) { int sourceField = props . getForwardingSourceField ( input , targetField ) ; if ( sourceField >= 0 ) { newFields = newFields . addField ( sourceField ) ; } else { // partial partitionings are not preserved to avoid skewed partitioning return null ; } } rgProp . partitioning = this . partitioning ; rgProp . partitioningFields = newFields ; return rgProp ; case RANGE_PARTITIONED : // range partitioning Ordering newOrdering = new Ordering ( ) ; for ( int i = 0 ; i < this . ordering . getInvolvedIndexes ( ) . size ( ) ; i ++ ) { int value = this . ordering . getInvolvedIndexes ( ) . get ( i ) ; int sourceField = props . getForwardingSourceField ( input , value ) ; if ( sourceField >= 0 ) { newOrdering . appendOrdering ( sourceField , this . ordering . getType ( i ) , this . ordering . getOrder ( i ) ) ; } else { return null ; } } rgProp . partitioning = this . partitioning ; rgProp . ordering = newOrdering ; rgProp . dataDistribution = this . dataDistribution ; return rgProp ; default : throw new RuntimeException ( "Unknown partitioning type encountered." ) ; }
public class SQLTransformer { /** * Checks if is supported JDK type . * @ param typeName * the type name * @ return true , if is supported JDK type */ public static boolean isSupportedJDKType ( TypeName typeName ) { } }
if ( typeName . isPrimitive ( ) ) { return getPrimitiveTransform ( typeName ) != null ; } String name = typeName . toString ( ) ; if ( name . startsWith ( "java.lang" ) ) { return getLanguageTransform ( typeName ) != null ; } if ( name . startsWith ( "java.util" ) ) { return getUtilTransform ( typeName ) != null ; } if ( name . startsWith ( "java.math" ) ) { return getMathTransform ( typeName ) != null ; } if ( name . startsWith ( "java.net" ) ) { return getNetTransform ( typeName ) != null ; } if ( name . startsWith ( "java.sql" ) ) { return getSqlTransform ( typeName ) != null ; } return false ;
public class IOUtils { /** * Returns the lines of an < code > InputStream < / code > as a list of Strings . * @ param input the < code > InputStream < / code > to read from . * @ return the list of lines . */ public static List < String > readLines ( InputStream input ) throws IOException { } }
final InputStreamReader reader = new InputStreamReader ( input ) ; return readLines ( reader ) ;
public class Form { /** * Sets a new Object value to a given form ' s field . In fact , the object representation * ( i . e . # toString ) will be the actual value of the field . < p > * If the value to set to the field is not a basic type ( e . g . String , boolean , int , etc . ) you * will need to use { @ link # setAnswer ( String , String ) } where the String value is the * String representation of the object . < p > * Before setting the new value to the field we will check if the form is of type submit . If * the form isn ' t of type submit means that it ' s not possible to complete the form and an * exception will be thrown . * @ param field the form field that was completed . * @ param value the Object value that was answered . The object representation will be the * actual value . * @ throws IllegalStateException if the form is not of type " submit " . */ private void setAnswer ( FormField field , Object value ) { } }
if ( ! isSubmitType ( ) ) { throw new IllegalStateException ( "Cannot set an answer if the form is not of type " + "\"submit\"" ) ; } field . resetValues ( ) ; field . addValue ( value . toString ( ) ) ;
public class ContentsDao { /** * Get the bounding box for all tables in the provided projection * @ param projection * desired bounding box projection * @ return bounding box * @ since 3.1.0 */ public BoundingBox getBoundingBox ( Projection projection ) { } }
BoundingBox boundingBox = null ; List < String > tables = null ; try { tables = getTables ( ) ; } catch ( SQLException e ) { throw new GeoPackageException ( "Failed to query for contents tables" , e ) ; } for ( String table : tables ) { BoundingBox tableBoundingBox = getBoundingBox ( projection , table ) ; if ( tableBoundingBox != null ) { if ( boundingBox != null ) { boundingBox = boundingBox . union ( tableBoundingBox ) ; } else { boundingBox = tableBoundingBox ; } } } return boundingBox ;
public class AbstractRoutingClient { /** * Builds a unique ID . * @ param ownerKind the owner kind ( not null ) * @ param applicationName the application name ( can be null ) * @ param scopedInstancePath the scoped instance path ( can be null ) * @ return a non - null string */ public static String buildOwnerId ( RecipientKind ownerKind , String applicationName , String scopedInstancePath ) { } }
StringBuilder sb = new StringBuilder ( ) ; if ( ownerKind == RecipientKind . DM ) { sb . append ( "@DM@" ) ; } else { if ( scopedInstancePath != null ) { sb . append ( scopedInstancePath ) ; sb . append ( " " ) ; } if ( applicationName != null ) { sb . append ( "@ " ) ; sb . append ( applicationName ) ; } } // The " domain " is not used here . // " domain " was not designed for self - hosted messaging but for " real " messaging servers . return sb . toString ( ) . trim ( ) ;
public class SeaGlassSliderUI { /** * { @ inheritDoc } */ @ Override protected void paintMinorTickForHorizSlider ( Graphics g , Rectangle tickBounds , int x ) { } }
setTickColor ( g ) ; super . paintMinorTickForHorizSlider ( g , tickBounds , x ) ;
public class LogHandle { /** * Package access method to close the recovery log . This method directs closes the * two log files and then clears its internal state . * @ exception InternalLogException An unexpected error has occured . */ void closeLog ( ) throws InternalLogException { } }
if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "closeLog" , this ) ; // Check that the file is actually open if ( _activeFile == null ) { if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "closeLog" , "InternalLogException" ) ; throw new InternalLogException ( null ) ; } try { _file1 . fileClose ( ) ; _file2 . fileClose ( ) ; } catch ( InternalLogException exc ) { FFDCFilter . processException ( exc , "com.ibm.ws.recoverylog.spi.LogHandle.closeLog" , "736" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "closeLog" , exc ) ; throw exc ; } catch ( Throwable exc ) { FFDCFilter . processException ( exc , "com.ibm.ws.recoverylog.spi.LogHandle.closeLog" , "742" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "closeLog" , "InternalLogException" ) ; throw new InternalLogException ( exc ) ; } _file1 = null ; _file2 = null ; _activeFile = null ; _recoveredRecords = null ; _physicalFreeBytes = 0 ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "closeLog" ) ;
public class Statement { /** * Return an Observable that emits the emissions from a specified Observable * if a condition evaluates to true , otherwise return an empty Observable * that runs on a specified Scheduler . * < img width = " 640 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / ifThen . s . png " alt = " " > * @ param < R > * the result value type * @ param condition * the condition that decides whether to emit the emissions * from the < code > then < / code > Observable * @ param then * the Observable sequence to emit to if { @ code condition } is { @ code true } * @ param scheduler * the Scheduler on which the empty Observable runs if the * in case the condition returns false * @ return an Observable that mimics the { @ code then } Observable if the { @ code condition } function evaluates to true , or an empty * Observable running on the specified Scheduler otherwise */ public static < R > Observable < R > ifThen ( Func0 < Boolean > condition , Observable < ? extends R > then , Scheduler scheduler ) { } }
return ifThen ( condition , then , Observable . < R > empty ( ) . subscribeOn ( scheduler ) ) ;
public class BaseTraceService { /** * Publish a trace log record . * @ param detailLog the trace writer * @ param logRecord * @ param id the trace object id * @ param formattedMsg the result of { @ link BaseTraceFormatter # formatMessage } * @ param formattedVerboseMsg the result of { @ link BaseTraceFormatter # formatVerboseMessage } */ protected void publishTraceLogRecord ( TraceWriter detailLog , LogRecord logRecord , Object id , String formattedMsg , String formattedVerboseMsg ) { } }
// check if tracefilename is stdout if ( formattedVerboseMsg == null ) { formattedVerboseMsg = formatter . formatVerboseMessage ( logRecord , formattedMsg , false ) ; } RoutedMessage routedTrace = new RoutedMessageImpl ( formattedMsg , formattedVerboseMsg , null , logRecord ) ; invokeTraceRouters ( routedTrace ) ; /* * Avoid any feedback traces that are emitted after this point . * The first time the counter increments is the first pass - through . * The second time the counter increments is the second pass - through due * to trace emitted . We do not want any more pass - throughs . */ try { if ( ! ( counterForTraceSource . incrementCount ( ) > 2 ) ) { if ( logRecord != null ) { Level level = logRecord . getLevel ( ) ; int levelValue = level . intValue ( ) ; if ( levelValue < Level . INFO . intValue ( ) ) { String levelName = level . getName ( ) ; if ( ! ( levelName . equals ( "SystemOut" ) || levelName . equals ( "SystemErr" ) ) ) { // SystemOut / Err = 700 if ( traceSource != null ) { traceSource . publish ( routedTrace , id ) ; } } } } } } finally { counterForTraceSource . decrementCount ( ) ; } try { if ( ! ( counterForTraceWriter . incrementCount ( ) > 1 ) ) { // write to trace . log if ( detailLog != systemOut ) { String traceDetail = formatter . traceLogFormat ( logRecord , id , formattedMsg , formattedVerboseMsg ) ; detailLog . writeRecord ( traceDetail ) ; } } } finally { counterForTraceWriter . decrementCount ( ) ; }
public class AbstractScaleThesisQueryPageHandler { /** * Updates field caption if field can be found . Used only when query already contains replies . * @ param queryPage query page * @ param fieldName field name * @ param fieldCaption field caption */ protected void synchronizeFieldCaption ( QueryPage queryPage , String fieldName , String fieldCaption ) { } }
QueryFieldDAO queryFieldDAO = new QueryFieldDAO ( ) ; QueryOptionField queryField = ( QueryOptionField ) queryFieldDAO . findByQueryPageAndName ( queryPage , fieldName ) ; if ( queryField != null ) queryFieldDAO . updateCaption ( queryField , fieldCaption ) ;
public class HmacSignatureBuilder { /** * 完成HMAC认证消息的构建 , 并获得base64编码表示的签名摘要值 . * @ param builderMode * 构建模式的枚举 * @ return HMAC的base64编码表示的签名摘要值字符串 . 若构建失败 , 则返回 < code > null < / code > * @ author zhd * @ since 1.0.0 */ public String buildAsBase64 ( BuilderMode builderMode ) { } }
byte [ ] ret = build ( builderMode ) ; if ( Validator . isEmpty ( ret ) ) { return null ; } return DatatypeConverter . printBase64Binary ( ret ) ;
public class XPathContext { /** * Create a new < code > DTMIterator < / code > that holds exactly one node . * @ param node The node handle that the DTMIterator will iterate to . * @ return The newly created < code > DTMIterator < / code > . */ public DTMIterator createDTMIterator ( int node ) { } }
// DescendantIterator iter = new DescendantIterator ( ) ; DTMIterator iter = new org . apache . xpath . axes . OneStepIteratorForward ( Axis . SELF ) ; iter . setRoot ( node , this ) ; return iter ; // return m _ dtmManager . createDTMIterator ( node ) ;
public class ParserUtils { /** * PArses a URL with all the required parameters * @ param url of the document to parse * @ return the jsoup document * @ throws IOException if the connection fails */ public static Document parseDocument ( String url ) throws IOException { } }
return Jsoup . connect ( url ) . timeout ( Constants . PARSING_TIMEOUT ) . userAgent ( "Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" ) . referrer ( "http://www.google.com" ) . get ( ) ;
public class ResourceUtil { /** * retrieves the primary type of the resources node */ public static String getPrimaryType ( Resource resource ) { } }
String result = null ; if ( resource != null ) { if ( resource instanceof JcrResource ) { // use the resource itself if it implements the JcrResource interface ( maybe a version of a resource ) result = ( ( JcrResource ) resource ) . getPrimaryType ( ) ; } else { Node node = resource . adaptTo ( Node . class ) ; if ( node != null ) { try { NodeType type = node . getPrimaryNodeType ( ) ; if ( type != null ) { result = type . getName ( ) ; } } catch ( RepositoryException ignore ) { } } if ( result == null ) { ValueMap values = resource . adaptTo ( ValueMap . class ) ; if ( values != null ) { result = values . get ( JcrConstants . JCR_PRIMARYTYPE , ( String ) null ) ; } } } } return result ;
public class LoopingDatasetFinderSource { /** * Sort input stream lexicographically . Noop if the input stream is already sorted . */ private < T extends URNIdentified > Stream < T > sortStreamLexicographically ( Stream < T > inputStream ) { } }
Spliterator < T > spliterator = inputStream . spliterator ( ) ; if ( spliterator . hasCharacteristics ( Spliterator . SORTED ) && spliterator . getComparator ( ) . equals ( this . lexicographicalComparator ) ) { return StreamSupport . stream ( spliterator , false ) ; } return StreamSupport . stream ( spliterator , false ) . sorted ( this . lexicographicalComparator ) ;
public class MapRow { /** * Retrieve row from a nested table . * @ param name column name * @ return nested table rows */ @ SuppressWarnings ( "unchecked" ) public final List < MapRow > getRows ( String name ) { } }
return ( List < MapRow > ) getObject ( name ) ;
public class Dictionary { /** * 通过词典文件建立词典 * @ param path * @ return * @ throws FileNotFoundException */ private ArrayList < String [ ] > loadDict ( String path ) throws IOException { } }
Scanner scanner = new Scanner ( new FileInputStream ( path ) , "utf-8" ) ; ArrayList < String [ ] > al = new ArrayList < String [ ] > ( ) ; while ( scanner . hasNext ( ) ) { String line = scanner . nextLine ( ) . trim ( ) ; if ( line . length ( ) > 0 ) { String [ ] s = line . split ( "\\s" ) ; al . add ( s ) ; } } scanner . close ( ) ; return al ;
public class CmsRoleManager { /** * Returns all roles , in the given organizational unit . < p > * @ param cms the opencms context * @ param ouFqn the fully qualified name of the organizational unit of the role * @ param includeSubOus include roles of child organizational units * @ return a list of all < code > { @ link CmsRole } < / code > objects * @ throws CmsException if operation was not successful */ public List < CmsRole > getRoles ( CmsObject cms , String ouFqn , boolean includeSubOus ) throws CmsException { } }
CmsOrganizationalUnit ou = OpenCms . getOrgUnitManager ( ) . readOrganizationalUnit ( cms , ouFqn ) ; List < CmsGroup > groups = m_securityManager . getGroups ( cms . getRequestContext ( ) , ou , includeSubOus , true ) ; List < CmsRole > roles = new ArrayList < CmsRole > ( groups . size ( ) ) ; Iterator < CmsGroup > itGroups = groups . iterator ( ) ; while ( itGroups . hasNext ( ) ) { CmsGroup group = itGroups . next ( ) ; roles . add ( CmsRole . valueOf ( group ) ) ; } return roles ;
public class ListManagementImageListsImpl { /** * Creates an image list . * @ param contentType The content type . * @ param bodyParameter Schema of the body . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the ImageList object */ public Observable < ServiceResponse < ImageList > > createWithServiceResponseAsync ( String contentType , BodyModel bodyParameter ) { } }
if ( this . client . baseUrl ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.baseUrl() is required and cannot be null." ) ; } if ( contentType == null ) { throw new IllegalArgumentException ( "Parameter contentType is required and cannot be null." ) ; } if ( bodyParameter == null ) { throw new IllegalArgumentException ( "Parameter bodyParameter is required and cannot be null." ) ; } Validator . validate ( bodyParameter ) ; String parameterizedHost = Joiner . on ( ", " ) . join ( "{baseUrl}" , this . client . baseUrl ( ) ) ; return service . create ( contentType , bodyParameter , this . client . acceptLanguage ( ) , parameterizedHost , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < ImageList > > > ( ) { @ Override public Observable < ServiceResponse < ImageList > > call ( Response < ResponseBody > response ) { try { ServiceResponse < ImageList > clientResponse = createDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
public class DirectoryIterator { /** * Command line method to walk the directories provided on the command line * and print out their contents * @ param args Directory names */ public static void main ( String [ ] args ) { } }
DirectoryIterator iter = new DirectoryIterator ( args ) ; while ( iter . hasNext ( ) ) System . out . println ( iter . next ( ) . getAbsolutePath ( ) ) ;
public class CloudDNSResourceRecordSetApi { /** * Has the side effect of removing the priority from the mutableRData . * @ return null or the priority , if it exists for a MX or SRV record */ private Integer getPriority ( Map < String , Object > mutableRData ) { } }
Integer priority = null ; if ( mutableRData . containsKey ( "priority" ) ) { // SRVData priority = Integer . class . cast ( mutableRData . remove ( "priority" ) ) ; } else if ( mutableRData . containsKey ( "preference" ) ) { // MXData priority = Integer . class . cast ( mutableRData . remove ( "preference" ) ) ; } return priority ;
public class EPubParserUtils { /** * 路径链接 * @ param path1 前路径 * @ param path2 后路径 * @ return */ public static String pathLinker ( String path1 , String path2 ) { } }
if ( ( path1 == null || path1 . equals ( "" ) ) && ( path2 == null || path2 . equals ( "" ) ) ) { return null ; } if ( path1 == null || path1 . equals ( "" ) ) { return path2 ; } if ( path2 == null || path2 . equals ( "" ) ) { return path1 ; } if ( path1 . endsWith ( File . separator ) ) { path1 = path1 . substring ( 0 , path1 . length ( ) - 1 ) ; } if ( path2 . startsWith ( File . separator ) ) { path2 = path2 . substring ( 1 , path2 . length ( ) ) ; } if ( path2 . endsWith ( File . separator ) ) { path2 = path2 . substring ( 0 , path2 . length ( ) - 1 ) ; } return path1 + File . separator + path2 ;
public class GroovyCategorySupport { /** * Create a scope based on given categoryClass and invoke closure within that scope . * @ param categoryClass the class containing category methods * @ param closure the closure during which to make the category class methods available * @ return the value returned from the closure */ public static < T > T use ( Class categoryClass , Closure < T > closure ) { } }
return THREAD_INFO . getInfo ( ) . use ( categoryClass , closure ) ;
public class Sort { /** * get the median of the left , center and right * order these and hide the pivot by put it the end of of the array * @ param arr an array of Comparable * @ param left the most - left index of the subarray * @ param right the most - right index of the subarray * @ return T */ private static < T extends Comparable < ? super T > > T median ( T [ ] arr , int left , int right ) { } }
int center = ( left + right ) / 2 ; if ( arr [ left ] . compareTo ( arr [ center ] ) > 0 ) swapReferences ( arr , left , center ) ; if ( arr [ left ] . compareTo ( arr [ right ] ) > 0 ) swapReferences ( arr , left , right ) ; if ( arr [ center ] . compareTo ( arr [ right ] ) > 0 ) swapReferences ( arr , center , right ) ; swapReferences ( arr , center , right - 1 ) ; return arr [ right - 1 ] ;
public class FileAwareInputStreamDataWriter { /** * Write the contents of input stream into staging path . * WriteAt indicates the path where the contents of the input stream should be written . When this method is called , * the path writeAt . getParent ( ) will exist already , but the path writeAt will not exist . When this method is returned , * the path writeAt must exist . Any data written to any location other than writeAt or a descendant of writeAt * will be ignored . * @ param inputStream { @ link FSDataInputStream } whose contents should be written to staging path . * @ param writeAt { @ link Path } at which contents should be written . * @ param copyableFile { @ link org . apache . gobblin . data . management . copy . CopyEntity } that generated this copy operation . * @ param record The actual { @ link FileAwareInputStream } passed to the write method . * @ throws IOException */ protected void writeImpl ( InputStream inputStream , Path writeAt , CopyableFile copyableFile , FileAwareInputStream record ) throws IOException { } }
final short replication = copyableFile . getReplication ( this . fs ) ; final long blockSize = copyableFile . getBlockSize ( this . fs ) ; final long fileSize = copyableFile . getFileStatus ( ) . getLen ( ) ; long expectedBytes = fileSize ; Long maxBytes = null ; // Whether writer must write EXACTLY maxBytes . boolean mustMatchMaxBytes = false ; if ( record . getSplit ( ) . isPresent ( ) ) { maxBytes = record . getSplit ( ) . get ( ) . getHighPosition ( ) - record . getSplit ( ) . get ( ) . getLowPosition ( ) ; if ( record . getSplit ( ) . get ( ) . isLastSplit ( ) ) { expectedBytes = fileSize % blockSize ; mustMatchMaxBytes = false ; } else { expectedBytes = maxBytes ; mustMatchMaxBytes = true ; } } Predicate < FileStatus > fileStatusAttributesFilter = new Predicate < FileStatus > ( ) { @ Override public boolean apply ( FileStatus input ) { return input . getReplication ( ) == replication && input . getBlockSize ( ) == blockSize ; } } ; Optional < FileStatus > persistedFile = this . recoveryHelper . findPersistedFile ( this . state , copyableFile , fileStatusAttributesFilter ) ; if ( persistedFile . isPresent ( ) ) { log . info ( String . format ( "Recovering persisted file %s to %s." , persistedFile . get ( ) . getPath ( ) , writeAt ) ) ; this . fs . rename ( persistedFile . get ( ) . getPath ( ) , writeAt ) ; } else { // Copy empty directories if ( copyableFile . getFileStatus ( ) . isDirectory ( ) ) { this . fs . mkdirs ( writeAt ) ; return ; } OutputStream os = this . fs . create ( writeAt , true , this . fs . getConf ( ) . getInt ( "io.file.buffer.size" , 4096 ) , replication , blockSize ) ; if ( encryptionConfig != null ) { os = EncryptionFactory . buildStreamCryptoProvider ( encryptionConfig ) . encodeOutputStream ( os ) ; } try { FileSystem defaultFS = FileSystem . get ( new Configuration ( ) ) ; StreamThrottler < GobblinScopeTypes > throttler = this . taskBroker . getSharedResource ( new StreamThrottler . Factory < GobblinScopeTypes > ( ) , new EmptyKey ( ) ) ; ThrottledInputStream throttledInputStream = throttler . throttleInputStream ( ) . inputStream ( inputStream ) . sourceURI ( copyableFile . getOrigin ( ) . getPath ( ) . makeQualified ( defaultFS . getUri ( ) , defaultFS . getWorkingDirectory ( ) ) . toUri ( ) ) . targetURI ( this . fs . makeQualified ( writeAt ) . toUri ( ) ) . build ( ) ; StreamCopier copier = new StreamCopier ( throttledInputStream , os , maxBytes ) . withBufferSize ( this . bufferSize ) ; log . info ( "File {}: Starting copy" , copyableFile . getOrigin ( ) . getPath ( ) ) ; if ( isInstrumentationEnabled ( ) ) { copier . withCopySpeedMeter ( this . copySpeedMeter ) ; } long numBytes = copier . copy ( ) ; if ( ( this . checkFileSize || mustMatchMaxBytes ) && numBytes != expectedBytes ) { throw new IOException ( String . format ( "Incomplete write: expected %d, wrote %d bytes." , expectedBytes , numBytes ) ) ; } this . bytesWritten . addAndGet ( numBytes ) ; if ( isInstrumentationEnabled ( ) ) { log . info ( "File {}: copied {} bytes, average rate: {} B/s" , copyableFile . getOrigin ( ) . getPath ( ) , this . copySpeedMeter . getCount ( ) , this . copySpeedMeter . getMeanRate ( ) ) ; } else { log . info ( "File {} copied." , copyableFile . getOrigin ( ) . getPath ( ) ) ; } } catch ( NotConfiguredException nce ) { log . warn ( "Broker error. Some features of stream copier may not be available." , nce ) ; } finally { os . close ( ) ; inputStream . close ( ) ; } }
public class MembersInterface { /** * Get a list of the members of a group . The call must be signed on behalf of a Flickr member , and the ability to see the group membership will be * determined by the Flickr member ' s group privileges . * @ param groupId * Return a list of members for this group . The group must be viewable by the Flickr member on whose behalf the API call is made . * @ param memberTypes * A set of Membertypes as available as constants in { @ link Member } . * @ param perPage * Number of records per page . * @ param page * Result - section . * @ return A members - list * @ throws FlickrException * @ see < a href = " http : / / www . flickr . com / services / api / flickr . groups . members . getList . html " > API Documentation < / a > */ public MembersList < Member > getList ( String groupId , Set < String > memberTypes , int perPage , int page ) throws FlickrException { } }
MembersList < Member > members = new MembersList < Member > ( ) ; Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_LIST ) ; parameters . put ( "group_id" , groupId ) ; if ( perPage > 0 ) { parameters . put ( "per_page" , "" + perPage ) ; } if ( page > 0 ) { parameters . put ( "page" , "" + page ) ; } if ( memberTypes != null ) { parameters . put ( "membertypes" , StringUtilities . join ( memberTypes , "," ) ) ; } Response response = transportAPI . get ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element mElement = response . getPayload ( ) ; members . setPage ( mElement . getAttribute ( "page" ) ) ; members . setPages ( mElement . getAttribute ( "pages" ) ) ; members . setPerPage ( mElement . getAttribute ( "perpage" ) ) ; members . setTotal ( mElement . getAttribute ( "total" ) ) ; NodeList mNodes = mElement . getElementsByTagName ( "member" ) ; for ( int i = 0 ; i < mNodes . getLength ( ) ; i ++ ) { Element element = ( Element ) mNodes . item ( i ) ; members . add ( parseMember ( element ) ) ; } return members ;
public class EmailIntentSender { /** * Creates a temporary file with the given content and name , to be used as an email attachment * @ param context a context * @ param name the name * @ param content the content * @ return a content uri for the file */ @ Nullable protected Uri createAttachmentFromString ( @ NonNull Context context , @ NonNull String name , @ NonNull String content ) { } }
final File cache = new File ( context . getCacheDir ( ) , name ) ; try { IOUtils . writeStringToFile ( cache , content ) ; return AcraContentProvider . getUriForFile ( context , cache ) ; } catch ( IOException ignored ) { } return null ;
public class PropertiesManagerCore { /** * Close GeoPackages not specified in the retain GeoPackage names * @ param retain * GeoPackages to retain */ public void closeRetainGeoPackages ( Collection < String > retain ) { } }
Set < String > close = new HashSet < > ( propertiesMap . keySet ( ) ) ; close . removeAll ( retain ) ; for ( String name : close ) { closeGeoPackage ( name ) ; }
public class PvmExecutionImpl { /** * Ends an execution . Invokes end listeners for the current activity and notifies the flow scope execution * of this happening which may result in the flow scope ending . * @ param completeScope true if ending the execution contributes to completing the BPMN 2.0 scope */ @ Override public void end ( boolean completeScope ) { } }
setCompleteScope ( completeScope ) ; isActive = false ; isEnded = true ; if ( hasReplacedParent ( ) ) { getParent ( ) . replacedBy = null ; } performOperation ( PvmAtomicOperation . ACTIVITY_NOTIFY_LISTENER_END ) ;
public class CocoQuery { /** * Show toast message with long duration * @ param strId */ public void longToast ( final int strId ) { } }
if ( act == null ) return ; act . runOnUiThread ( new Runnable ( ) { public void run ( ) { Toast . makeText ( act , strId , Toast . LENGTH_LONG ) . show ( ) ; } } ) ;
public class MiriamLink { /** * Retrieves the location ( or country ) of a resource ( example : " United Kingdom " ) . * @ param resourceId identifier of a resource ( example : " MIR : 00100009 " ) * @ return the location ( the country ) where the resource is managed */ public static String getResourceLocation ( String resourceId ) { } }
Resource resource = getResource ( resourceId ) ; return resource . getDataLocation ( ) ;
public class CmsHtmlList { /** * Sets the sorted column . < p > * @ param sortedColumn the sorted column to set * @ throws CmsIllegalArgumentException if the < code > sortedColumn < / code > argument is invalid */ public void setSortedColumn ( String sortedColumn ) throws CmsIllegalArgumentException { } }
// check if the parameter is valid if ( ( getMetadata ( ) . getColumnDefinition ( sortedColumn ) == null ) || ! getMetadata ( ) . getColumnDefinition ( sortedColumn ) . isSorteable ( ) ) { return ; } // reset view setCurrentPage ( 1 ) ; // only reverse order if the column to sort is already sorted if ( sortedColumn . equals ( m_sortedColumn ) ) { if ( m_currentSortOrder == CmsListOrderEnum . ORDER_ASCENDING ) { m_currentSortOrder = CmsListOrderEnum . ORDER_DESCENDING ; } else { m_currentSortOrder = CmsListOrderEnum . ORDER_ASCENDING ; } if ( ! m_metadata . isSelfManaged ( ) ) { if ( m_filteredItems == null ) { m_filteredItems = new ArrayList < CmsListItem > ( getAllContent ( ) ) ; } Collections . reverse ( m_filteredItems ) ; } return ; } // sort new column m_sortedColumn = sortedColumn ; m_currentSortOrder = CmsListOrderEnum . ORDER_ASCENDING ; if ( ! m_metadata . isSelfManaged ( ) ) { if ( m_filteredItems == null ) { m_filteredItems = new ArrayList < CmsListItem > ( getAllContent ( ) ) ; } I_CmsListItemComparator c = getMetadata ( ) . getColumnDefinition ( sortedColumn ) . getListItemComparator ( ) ; Collections . sort ( m_filteredItems , c . getComparator ( sortedColumn , getWp ( ) . getLocale ( ) ) ) ; }
public class StartExportTaskRequest { /** * The file format for the returned export data . Default value is < code > CSV < / code > . < b > Note : < / b > < i > The < / i > * < code > GRAPHML < / code > < i > option has been deprecated . < / i > * @ param exportDataFormat * The file format for the returned export data . Default value is < code > CSV < / code > . < b > Note : < / b > < i > The < / i > * < code > GRAPHML < / code > < i > option has been deprecated . < / i > * @ see ExportDataFormat */ public void setExportDataFormat ( java . util . Collection < String > exportDataFormat ) { } }
if ( exportDataFormat == null ) { this . exportDataFormat = null ; return ; } this . exportDataFormat = new java . util . ArrayList < String > ( exportDataFormat ) ;
public class MutationsUtil { /** * This one shifts indels to the left at homopolymer regions Applicable to KAligner data , which normally put indels * randomly along such regions Required for filterMutations algorithm to work correctly Works inplace * @ param seq1 reference sequence for the mutations * @ param mutations array of mutations */ public static < S extends Sequence < S > > Mutations < S > shiftIndelsAtHomopolymers ( S seq1 , Mutations < S > mutations ) { } }
return shiftIndelsAtHomopolymers ( seq1 , 0 , mutations ) ;
public class PaginatedResult { /** * Retrieves a Set of objects from the result . * @ param < T > the type defined in the Set * @ param clazz the type defined in the Set * @ return a Collection of objects from the result . * @ since 1.0.0 */ @ SuppressWarnings ( "unchecked" ) public < T > Set < T > getSet ( Class < T > clazz ) { } }
return ( Set < T > ) objects ;
public class GradleDependencyResolver { /** * append new task to bom file */ private boolean appendTaskToBomFile ( File buildGradleTmp ) { } }
FileReader fileReader ; BufferedReader bufferedReader = null ; InputStream inputStream = null ; boolean hasDependencies = false ; try { // appending the task only if the build . gradle file has ' dependencies { ' node ( only at the beginning of the line ) // otherwise , later when the task is ran it ' ll fail fileReader = new FileReader ( buildGradleTmp ) ; bufferedReader = new BufferedReader ( fileReader ) ; String currLine ; while ( ( currLine = bufferedReader . readLine ( ) ) != null ) { if ( currLine . indexOf ( DEPENDENCIES + Constants . WHITESPACE + CURLY_BRACKETS_OPEN ) == 0 || currLine . indexOf ( DEPENDENCIES + CURLY_BRACKETS_OPEN ) == 0 ) { hasDependencies = true ; break ; } } if ( hasDependencies ) { byte [ ] bytes ; List < String > lines = getDependenciesTree ( buildGradleTmp . getParent ( ) , buildGradleTmp . getParentFile ( ) . getName ( ) ) ; if ( lines != null ) { List < String > scopes = getScopes ( lines ) ; String copyDependenciesTask = Constants . NEW_LINE + TASK_COPY_DEPENDENCIES_HEADER + Constants . NEW_LINE ; for ( String scope : scopes ) { copyDependenciesTask = copyDependenciesTask . concat ( " from configurations." + scope + Constants . NEW_LINE ) ; } copyDependenciesTask = copyDependenciesTask . concat ( TASK_COPY_DEPENDENCIES_FOOTER + Constants . NEW_LINE + CURLY_BRACKTES_CLOSE ) ; bytes = copyDependenciesTask . getBytes ( ) ; } else { ClassLoader classLoader = Main . class . getClassLoader ( ) ; inputStream = classLoader . getResourceAsStream ( COPY_DEPENDENCIES_TASK_TXT ) ; bytes = IOUtils . toByteArray ( inputStream ) ; } if ( bytes . length > 0 ) { Files . write ( Paths . get ( buildGradleTmp . getPath ( ) ) , bytes , StandardOpenOption . APPEND ) ; } else if ( lines == null ) { logger . warn ( "Could not read {}" , COPY_DEPENDENCIES_TASK_TXT ) ; } else { logger . warn ( "Could not read dependencies' tree" ) ; } } } catch ( IOException e ) { logger . error ( "Could not write into the file {}, the cause {}" , buildGradleTmp . getPath ( ) , e . getMessage ( ) ) ; hasDependencies = false ; } try { if ( inputStream != null ) { inputStream . close ( ) ; } if ( bufferedReader != null ) { bufferedReader . close ( ) ; } } catch ( IOException e ) { logger . error ( "Could close the file, cause" , e . getMessage ( ) ) ; } return hasDependencies ;
public class JsonActionInvocation { /** * If the DefaultActionInvocation has been executed before and the Result is * an instance of ActionChainResult , this method will walk down the chain of * ActionChainResults until it finds a non - chain result , which will be * returned . If the DefaultActionInvocation ' s result has not been executed * before , the Result instance will be created and populated with the result * params . * @ return a Result instance * @ throws Exception */ @ Override public Result getResult ( ) throws Exception { } }
Result returnResult = result ; // If we ' ve chained to other Actions , we need to find the last result while ( returnResult instanceof ActionChainResult ) { ActionProxy aProxy = ( ( ActionChainResult ) returnResult ) . getProxy ( ) ; if ( aProxy != null ) { Result proxyResult = aProxy . getInvocation ( ) . getResult ( ) ; if ( ( proxyResult != null ) && ( aProxy . getExecuteResult ( ) ) ) { returnResult = proxyResult ; } else { break ; } } else { break ; } } return returnResult ;
public class Stopwatch { /** * Gets the total elapsed time measured by the current instance , in hours . * 3600000 Ticks = 1 hour ( 60 minutes ) */ public long getElapsedHours ( ) { } }
long elapsed ; if ( running ) { elapsed = ( System . nanoTime ( ) - startTime ) ; } else { elapsed = ( stopTime - startTime ) ; } return elapsed / nsPerHh ;
public class YearMonth { /** * Obtains the current year - month from the specified clock . * This will query the specified clock to obtain the current year - month . * Using this method allows the use of an alternate clock for testing . * The alternate clock may be introduced using { @ link Clock dependency injection } . * @ param clock the clock to use , not null * @ return the current year - month , not null */ public static YearMonth now ( Clock clock ) { } }
final LocalDate now = LocalDate . now ( clock ) ; // called once return YearMonth . of ( now . getYear ( ) , now . getMonth ( ) ) ;
public class GenericEncodingStrategy { /** * Generates code to get a Lob from a locator from RawSupport . RawSupport * instance , Storable instance , property name and long locator must be on * the stack . Result is a Lob on the stack , which may be null . */ private void getLobFromLocator ( CodeAssembler a , StorablePropertyInfo info ) { } }
if ( ! info . isLob ( ) ) { throw new IllegalArgumentException ( ) ; } TypeDesc type = info . getStorageType ( ) ; String name ; if ( Blob . class . isAssignableFrom ( type . toClass ( ) ) ) { name = "getBlob" ; } else if ( Clob . class . isAssignableFrom ( type . toClass ( ) ) ) { name = "getClob" ; } else { throw new IllegalArgumentException ( ) ; } a . invokeInterface ( TypeDesc . forClass ( RawSupport . class ) , name , type , new TypeDesc [ ] { TypeDesc . forClass ( Storable . class ) , TypeDesc . STRING , TypeDesc . LONG } ) ;
public class CkyPcfgParser { /** * Process a cell ( binary rules only ) using the left - child to constrain the set of rules we consider . * This follows the description in ( Dunlop et al . , 2010 ) . */ private static final void processCellRightChild ( final CnfGrammar grammar , final Chart chart , final int start , final int end , final ChartCell cell , final Scorer scorer ) { } }
// Apply binary rules . for ( int mid = start + 1 ; mid <= end - 1 ; mid ++ ) { ChartCell leftCell = chart . getCell ( start , mid ) ; ChartCell rightCell = chart . getCell ( mid , end ) ; // Loop through each right child non - terminal . for ( final int rightChildNt : rightCell . getNts ( ) ) { double rightScoreForNt = rightCell . getScore ( rightChildNt ) ; // Lookup all rules with that right child . for ( final Rule r : grammar . getBinaryRulesWithRightChild ( rightChildNt ) ) { // Check whether the left child of that rule is in the left child cell . double leftScoreForNt = leftCell . getScore ( r . getLeftChild ( ) ) ; if ( leftScoreForNt > Double . NEGATIVE_INFINITY ) { double score = scorer . score ( r , start , mid , end ) + leftScoreForNt + rightScoreForNt ; cell . updateCell ( r . getParent ( ) , score , mid , r ) ; } } } }
public class SQLiteDatabaseSchema { /** * property in different class , but same name , must have same column name . * @ param listEntity * the list entity * @ param p * the p */ private void checkName ( Set < SQLProperty > listEntity , SQLProperty p ) { } }
for ( SQLProperty item : listEntity ) { AssertKripton . assertTrueOrInvalidPropertyName ( item . columnName . equals ( p . columnName ) , item , p ) ; }
public class BigFloat { /** * Returns the the minimum of two { @ link BigFloat } values . * @ param value1 the first { @ link BigFloat } value to compare * @ param value2 the second { @ link BigFloat } value to compare * @ return the minimum { @ link BigFloat } value */ public static BigFloat min ( BigFloat value1 , BigFloat value2 ) { } }
return value1 . compareTo ( value2 ) < 0 ? value1 : value2 ;
public class ReadOnlyObjectPropertyAssert { /** * Verifies that the actual observable has the same value as the given observable . * @ param expectedValue the observable value to compare with the actual observables current value . * @ return { @ code this } assertion instance . */ public ReadOnlyObjectPropertyAssert < T > hasSameValue ( ObservableObjectValue < T > expectedValue ) { } }
new ObservableValueAssertions < > ( actual ) . hasSameValue ( expectedValue ) ; return this ;
public class PropertyResolverFactory { /** * Return All property values for the input property set mapped by name to value . * @ param list property list * @ param resolver property resolver * @ return All mapped properties by name and value . */ public static Map < String , Object > mapPropertyValues ( final List < Property > list , final PropertyResolver resolver ) { } }
final Map < String , Object > inputConfig = new HashMap < String , Object > ( ) ; for ( final Property property : list ) { final Object value = resolver . resolvePropertyValue ( property . getName ( ) , property . getScope ( ) ) ; if ( null == value ) { continue ; } inputConfig . put ( property . getName ( ) , value ) ; } return inputConfig ;
public class AbstractDb { /** * 分页查询 < br > * 查询条件为多个key value对表示 , 默认key = value , 如果使用其它条件可以使用 : where . put ( " key " , " & gt ; 1 " ) , value也可以传Condition对象 , key被忽略 * @ param < T > 结果对象类型 * @ param fields 返回的字段列表 , null则返回所有字段 * @ param where 条件实体类 ( 包含表名 ) * @ param page 页码 * @ param numPerPage 每页条目数 * @ param rsh 结果集处理对象 * @ return 结果对象 * @ throws SQLException SQL执行异常 */ public < T > T page ( Collection < String > fields , Entity where , int page , int numPerPage , RsHandler < T > rsh ) throws SQLException { } }
Connection conn = null ; try { conn = this . getConnection ( ) ; return runner . page ( conn , fields , where , page , numPerPage , rsh ) ; } catch ( SQLException e ) { throw e ; } finally { this . closeConnection ( conn ) ; }
public class GsonUtil { /** * 反序列化 * @ param json * @ return */ public static Option fromJSON ( String json ) { } }
Gson gson = new GsonBuilder ( ) . setPrettyPrinting ( ) . registerTypeAdapter ( Series . class , new SeriesDeserializer ( ) ) . registerTypeAdapter ( Axis . class , new AxisDeserializer ( ) ) . create ( ) ; Option option = gson . fromJson ( json , Option . class ) ; return option ;
public class AbstractApi { /** * Perform a file upload with the specified File instance and path objects , returning * a ClientResponse instance with the data returned from the endpoint . * @ param expectedStatus the HTTP status that should be returned from the server * @ param name the name for the form field that contains the file name * @ param fileToUpload a File instance pointing to the file to upload * @ param mediaType the content - type of the uploaded file , if null will be determined from fileToUpload * @ param url the fully formed path to the GitLab API endpoint * @ return a ClientResponse instance with the data returned from the endpoint * @ throws GitLabApiException if any exception occurs during execution */ protected Response upload ( Response . Status expectedStatus , String name , File fileToUpload , String mediaType , URL url ) throws GitLabApiException { } }
try { return validate ( getApiClient ( ) . upload ( name , fileToUpload , mediaType , url ) , expectedStatus ) ; } catch ( Exception e ) { throw handle ( e ) ; }
public class DatabasesInner { /** * Returns a list of databases in a server . * @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal . * @ param serverName The name of the server . * @ param expand A comma separated list of child objects to expand in the response . Possible properties : serviceTierAdvisors , transparentDataEncryption . * @ param filter An OData filter expression that describes a subset of databases to return . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws CloudException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the List & lt ; DatabaseInner & gt ; object if successful . */ public List < DatabaseInner > listByServer ( String resourceGroupName , String serverName , String expand , String filter ) { } }
return listByServerWithServiceResponseAsync ( resourceGroupName , serverName , expand , filter ) . toBlocking ( ) . single ( ) . body ( ) ;
public class MethodResource { /** * Invokes a Service Definition method on an object , using GET . */ @ Path ( "/{sDef}/{method}" ) @ GET public Response invokeSDefMethodUsingGET ( @ javax . ws . rs . core . Context UriInfo uriInfo , @ PathParam ( RestParam . PID ) String pid , @ PathParam ( RestParam . SDEF ) String sDef , @ PathParam ( RestParam . METHOD ) String method , @ QueryParam ( RestParam . AS_OF_DATE_TIME ) String dTime , @ QueryParam ( RestParam . FLASH ) @ DefaultValue ( "false" ) boolean flash ) { } }
try { Date asOfDateTime = DateUtility . parseDateOrNull ( dTime ) ; return buildResponse ( m_access . getDissemination ( getContext ( ) , pid , sDef , method , toProperties ( uriInfo . getQueryParameters ( ) , asOfDateTime != null ) , asOfDateTime ) ) ; } catch ( Exception e ) { return handleException ( e , flash ) ; }
public class HttpClientPipelineConfigurator { /** * See < a href = " https : / / http2 . github . io / http2 - spec / # discover - https " > HTTP / 2 specification < / a > . */ private void configureAsHttps ( Channel ch , InetSocketAddress remoteAddr ) { } }
assert sslCtx != null ; final ChannelPipeline p = ch . pipeline ( ) ; final SslHandler sslHandler = sslCtx . newHandler ( ch . alloc ( ) , remoteAddr . getHostString ( ) , remoteAddr . getPort ( ) ) ; p . addLast ( configureSslHandler ( sslHandler ) ) ; p . addLast ( TrafficLoggingHandler . CLIENT ) ; p . addLast ( new ChannelInboundHandlerAdapter ( ) { private boolean handshakeFailed ; @ Override public void userEventTriggered ( ChannelHandlerContext ctx , Object evt ) throws Exception { if ( ! ( evt instanceof SslHandshakeCompletionEvent ) ) { ctx . fireUserEventTriggered ( evt ) ; return ; } final SslHandshakeCompletionEvent handshakeEvent = ( SslHandshakeCompletionEvent ) evt ; if ( ! handshakeEvent . isSuccess ( ) ) { // The connection will be closed automatically by SslHandler . logger . warn ( "{} TLS handshake failed:" , ctx . channel ( ) , handshakeEvent . cause ( ) ) ; handshakeFailed = true ; return ; } final SessionProtocol protocol ; if ( isHttp2Protocol ( sslHandler ) ) { if ( httpPreference == HttpPreference . HTTP1_REQUIRED ) { finishWithNegotiationFailure ( ctx , H1 , H2 , "unexpected protocol negotiation result" ) ; return ; } addBeforeSessionHandler ( p , newHttp2ConnectionHandler ( ch ) ) ; protocol = H2 ; } else { if ( httpPreference != HttpPreference . HTTP1_REQUIRED ) { SessionProtocolNegotiationCache . setUnsupported ( ctx . channel ( ) . remoteAddress ( ) , H2 ) ; } if ( httpPreference == HttpPreference . HTTP2_REQUIRED ) { finishWithNegotiationFailure ( ctx , H2 , H1 , "unexpected protocol negotiation result" ) ; return ; } addBeforeSessionHandler ( p , newHttp1Codec ( clientFactory . http1MaxInitialLineLength ( ) , clientFactory . http1MaxHeaderSize ( ) , clientFactory . http1MaxChunkSize ( ) ) ) ; protocol = H1 ; } finishSuccessfully ( p , protocol ) ; p . remove ( this ) ; } @ Override public void exceptionCaught ( ChannelHandlerContext ctx , Throwable cause ) throws Exception { if ( handshakeFailed && cause instanceof DecoderException && cause . getCause ( ) instanceof SSLException ) { // Swallow an SSLException raised after handshake failure . return ; } Exceptions . logIfUnexpected ( logger , ctx . channel ( ) , cause ) ; ctx . close ( ) ; } } ) ;
public class LdapNameBuilder { /** * Add a Rdn to the built LdapName . * @ param key the rdn attribute key . * @ param value the rdn value . * @ return this builder . */ public LdapNameBuilder add ( String key , Object value ) { } }
Assert . hasText ( key , "key must not be blank" ) ; Assert . notNull ( key , "value must not be null" ) ; try { ldapName . add ( new Rdn ( key , value ) ) ; return this ; } catch ( InvalidNameException e ) { throw new org . springframework . ldap . InvalidNameException ( e ) ; }
public class Types { /** * Adapt a type by computing a substitution which maps a source * type to a target type . * @ param source the source type * @ param target the target type * @ param from the type variables of the computed substitution * @ param to the types of the computed substitution . */ public void adapt ( Type source , Type target , ListBuffer < Type > from , ListBuffer < Type > to ) throws AdaptFailure { } }
new Adapter ( from , to ) . adapt ( source , target ) ;
public class PBKDF2Engine { /** * Core Password Based Key Derivation Function 2. * @ see < a href = " http : / / tools . ietf . org / html / rfc2898 " > RFC 2898 5.2 < / a > * @ param prf * Pseudo Random Function ( i . e . HmacSHA1) * @ param S * Salt as array of bytes . < code > null < / code > means no salt . * @ param c * Iteration count ( see RFC 2898 4.2) * @ param dkLen * desired length of derived key . * @ return internal byte array */ protected byte [ ] PBKDF2 ( PRF prf , byte [ ] S , int c , int dkLen ) { } }
if ( S == null ) { S = new byte [ 0 ] ; } int hLen = prf . getHLen ( ) ; int l = ceil ( dkLen , hLen ) ; int r = dkLen - ( l - 1 ) * hLen ; byte T [ ] = new byte [ l * hLen ] ; int ti_offset = 0 ; for ( int i = 1 ; i <= l ; i ++ ) { _F ( T , ti_offset , prf , S , c , i ) ; ti_offset += hLen ; } if ( r < hLen ) { // Incomplete last block byte DK [ ] = new byte [ dkLen ] ; System . arraycopy ( T , 0 , DK , 0 , dkLen ) ; return DK ; } return T ;
public class StringParser { /** * Parse the given { @ link String } as { @ link BigInteger } with the specified * radix . * @ param sStr * The String to parse . May be < code > null < / code > . * @ param nRadix * The radix to use . Must be & ge ; { @ link Character # MIN _ RADIX } and & le ; * { @ link Character # MAX _ RADIX } . * @ return < code > null < / code > if the string does not represent a valid value . */ @ Nullable public static BigInteger parseBigInteger ( @ Nullable final String sStr , @ Nonnegative final int nRadix ) { } }
return parseBigInteger ( sStr , nRadix , null ) ;
public class ApplicationUrl { /** * Get Resource Url for RenamePackageFile * @ param applicationKey The application key uniquely identifies the developer namespace , application ID , version , and package in Dev Center . The format is { Dev Account namespace } . { Application ID } . { Application Version } . { Package name } . * @ param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object . This parameter should only be used to retrieve data . Attempting to update data using this parameter may cause data loss . * @ return String Resource Url */ public static MozuUrl renamePackageFileUrl ( String applicationKey , String responseFields ) { } }
UrlFormatter formatter = new UrlFormatter ( "/api/platform/developer/packages/{applicationKey}/files_rename?responseFields={responseFields}" ) ; formatter . formatUrl ( "applicationKey" , applicationKey ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . HOME_POD ) ;
public class SimpleBase { /** * Copy matrix B into this matrix at location ( insertRow , insertCol ) . * @ param insertRow First row the matrix is to be inserted into . * @ param insertCol First column the matrix is to be inserted into . * @ param B The matrix that is being inserted . */ public void insertIntoThis ( int insertRow , int insertCol , T B ) { } }
convertType . specify ( this , B ) ; B = convertType . convert ( B ) ; // See if this type ' s need to be changed or not if ( convertType . commonType == getType ( ) ) { insert ( B . mat , mat , insertRow , insertCol ) ; } else { T A = convertType . convert ( this ) ; A . insert ( B . mat , A . mat , insertRow , insertCol ) ; setMatrix ( A . mat ) ; }
public class GosuDocument { /** * Returns a style code for the absolute position in the document or null if * no code is mapped . */ public Integer getStyleCodeAtPosition ( int iPosition ) { } }
if ( _locations == null || _locations . isEmpty ( ) ) { return null ; } IParseTree l ; try { l = IParseTree . Search . getDeepestLocation ( _locations , iPosition - _locationsOffset , true ) ; } catch ( Throwable t ) { // Ok , what we are guarding against here is primarly a InnerClassNotFoundException . These can happen here in the UI // Thread when the intellisense thread is midway though parsing . The UI thread gets an old parsedelement which has // an old anonymous gosu class type in it and fails to load due the how anonymous class names are encoded with // offsets into the enclosing class file . return null ; } if ( l == null ) { return null ; } if ( ! l . contains ( iPosition - _locationsOffset ) ) { return null ; } IParsedElement parsedElem = l . getParsedElement ( ) ; try { return getStyleCodeForParsedElement ( iPosition , parsedElem ) ; } catch ( Throwable t ) { // Ok , what we are guarding against here is primarly a InnerClassNotFoundException . These can happen here in the UI // Thread when the intellisense thread is midway though parsing . The UI thread gets an old parsedelement which has // an old anonymous gosu class type in it and fails to load due the how anonymous class names are encoded with // offsets into the enclosing class file . return null ; }
public class MailAccount { /** * 获得SMTP相关信息 * @ return { @ link Properties } */ public Properties getSmtpProps ( ) { } }
// 全局系统参数 System . setProperty ( SPLIT_LONG_PARAMS , String . valueOf ( this . splitlongparameters ) ) ; final Properties p = new Properties ( ) ; p . put ( MAIL_PROTOCOL , "smtp" ) ; p . put ( SMTP_HOST , this . host ) ; p . put ( SMTP_PORT , String . valueOf ( this . port ) ) ; p . put ( SMTP_AUTH , String . valueOf ( this . auth ) ) ; if ( this . timeout > 0 ) { p . put ( SMTP_TIMEOUT , String . valueOf ( this . timeout ) ) ; } if ( this . connectionTimeout > 0 ) { p . put ( SMTP_CONNECTION_TIMEOUT , String . valueOf ( this . connectionTimeout ) ) ; } p . put ( MAIL_DEBUG , String . valueOf ( this . debug ) ) ; if ( this . startttlsEnable ) { // STARTTLS是对纯文本通信协议的扩展 。 它将纯文本连接升级为加密连接 ( TLS或SSL ) , 而不是使用一个单独的加密通信端口 。 p . put ( STARTTTLS_ENABLE , String . valueOf ( this . startttlsEnable ) ) ; if ( null == this . sslEnable ) { // 为了兼容旧版本 , 当用户没有此项配置时 , 按照startttlsEnable开启状态时对待 this . sslEnable = true ; } } // SSL if ( null != this . sslEnable && this . sslEnable ) { p . put ( SOCKEY_FACTORY , socketFactoryClass ) ; p . put ( SOCKEY_FACTORY_FALLBACK , String . valueOf ( this . socketFactoryFallback ) ) ; p . put ( SOCKEY_FACTORY_PORT , String . valueOf ( this . socketFactoryPort ) ) ; } return p ;
public class AdGroupCriterionOperation { /** * Gets the exemptionRequests value for this AdGroupCriterionOperation . * @ return exemptionRequests * List of exemption requests for policy violations flagged by * this criterion . * < p > Only set this field when adding criteria that * trigger policy violations * for which you wish to get exemptions for . */ public com . google . api . ads . adwords . axis . v201809 . cm . ExemptionRequest [ ] getExemptionRequests ( ) { } }
return exemptionRequests ;
public class UrlBeautifier { /** * < code > * Adds a new replacement rule that will only be applied to the specified refinement . The original * search term and refinements will be put back into the query object . * If replacement is null the target character will be removed . * Note : Replacements that are chained may still contain the original target character . * For example : * addReplacementRule ( ' x ' , ' y ' , " brand " ) ; * addReplacementRule ( ' z ' , ' x ' , " brand " ) ; * The result of this may contain x ' s in the final result . * www . example . com / xyz / b will become www . example . com / yyz / b after the first replacement and www . example . com / yyx / b * after the second replacement . * < / code > * @ param target * The char values to be replaced * @ param replacement * The replacement char value * @ param refinementName * The name of the refinement that this replacement should be applied to . */ public void addReplacementRule ( char target , Character replacement , String refinementName ) { } }
if ( ! ( ( Character ) target ) . equals ( replacement ) ) { replacementRules . add ( new UrlReplacementRule ( target , replacement , refinementName ) ) ; }
public class ListTablesResult { /** * The names of the tables associated with the current account at the current endpoint . The maximum size of this * array is 100. * If < code > LastEvaluatedTableName < / code > also appears in the output , you can use this value as the * < code > ExclusiveStartTableName < / code > parameter in a subsequent < code > ListTables < / code > request and obtain the * next page of results . * @ param tableNames * The names of the tables associated with the current account at the current endpoint . The maximum size of * this array is 100 . < / p > * If < code > LastEvaluatedTableName < / code > also appears in the output , you can use this value as the * < code > ExclusiveStartTableName < / code > parameter in a subsequent < code > ListTables < / code > request and obtain * the next page of results . */ public void setTableNames ( java . util . Collection < String > tableNames ) { } }
if ( tableNames == null ) { this . tableNames = null ; return ; } this . tableNames = new java . util . ArrayList < String > ( tableNames ) ;
public class MFVec2f { /** * Insert a new value prior to the index location in the existing value array , * increasing the field length accordingly . * @ param index - where the new values in an SFVec2f object will be placed in the array list * @ param newValue - the new x , y value for the array list */ public void insertValue ( int index , float [ ] newValue ) { } }
if ( newValue . length == 2 ) { try { value . add ( index , new SFVec2f ( newValue [ 0 ] , newValue [ 1 ] ) ) ; } catch ( IndexOutOfBoundsException e ) { Log . e ( TAG , "X3D MFVec2f get1Value(index) out of bounds." + e ) ; } catch ( Exception e ) { Log . e ( TAG , "X3D MFVec2f get1Value(index) exception " + e ) ; } } else { Log . e ( TAG , "X3D MFVec2f insertValue set with array length not equal to 2" ) ; }
public class ChainedRow { /** * Returns values aggregated from all the delegates , without overriding * values that already exist . * @ return The Map of aggregated values */ @ Override public Map < String , String > values ( ) { } }
Map < String , String > values = new LinkedHashMap < > ( ) ; for ( Row each : delegates ) { for ( Entry < String , String > entry : each . values ( ) . entrySet ( ) ) { String name = entry . getKey ( ) ; if ( ! values . containsKey ( name ) ) { values . put ( name , entry . getValue ( ) ) ; } } } return values ;
public class NodeSetDTM { /** * Same as setElementAt . * @ param node The node to be set . * @ param index The index of the node to be replaced . * @ throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type . */ public void setItem ( int node , int index ) { } }
if ( ! m_mutable ) throw new RuntimeException ( XSLMessages . createXPATHMessage ( XPATHErrorResources . ER_NODESETDTM_NOT_MUTABLE , null ) ) ; // " This NodeSetDTM is not mutable ! " ) ; super . setElementAt ( node , index ) ;
public class WriteBuffer { /** * Writes a single octet to the buffer , expanding if necessary . */ public void writeByte ( final byte octet ) { } }
if ( remaining ( ) < 1 ) { if ( index == blocks . size ( ) - 1 ) { allocateNewBlock ( ) ; } index ++ ; current = blocks . get ( index ) ; } final Block block = current ; block . data [ block . limit ] = octet ; block . limit ++ ;
public class CmsDriverManager { /** * Returns the set of users that are responsible for a specific resource . < p > * @ param dbc the current database context * @ param resource the resource to get the responsible users from * @ return the set of users that are responsible for a specific resource * @ throws CmsException if something goes wrong */ public Set < CmsUser > readResponsibleUsers ( CmsDbContext dbc , CmsResource resource ) throws CmsException { } }
Set < CmsUser > result = new HashSet < CmsUser > ( ) ; Iterator < I_CmsPrincipal > principals = readResponsiblePrincipals ( dbc , resource ) . iterator ( ) ; while ( principals . hasNext ( ) ) { I_CmsPrincipal principal = principals . next ( ) ; if ( principal . isGroup ( ) ) { try { result . addAll ( getUsersOfGroup ( dbc , principal . getName ( ) , true , false , false ) ) ; } catch ( CmsException e ) { if ( LOG . isInfoEnabled ( ) ) { LOG . info ( e ) ; } } } else { result . add ( ( CmsUser ) principal ) ; } } return result ;
public class GZIPArchiveReader { /** * Reads a short in little - endian from the stream . */ private static short readLEShort ( InputStream in ) throws IOException { } }
short s = ( byte ) in . read ( ) ; s |= ( byte ) in . read ( ) << 8 ; return s ;
public class Person { /** * Method to get the Language of the UserInterface for this Person . Default * is english . * @ return iso code of a language */ public String getLanguage ( ) { } }
return this . attrValues . get ( Person . AttrName . LANGUAGE ) != null ? this . attrValues . get ( Person . AttrName . LANGUAGE ) : Locale . ENGLISH . getISO3Language ( ) ;
public class CPOptionLocalServiceWrapper { /** * Returns the cp option matching the UUID and group . * @ param uuid the cp option ' s UUID * @ param groupId the primary key of the group * @ return the matching cp option , or < code > null < / code > if a matching cp option could not be found */ @ Override public com . liferay . commerce . product . model . CPOption fetchCPOptionByUuidAndGroupId ( String uuid , long groupId ) { } }
return _cpOptionLocalService . fetchCPOptionByUuidAndGroupId ( uuid , groupId ) ;
public class CmsDefaultXmlContentHandler { /** * Writes the categories if a category widget is present . < p > * @ param cms the cms context * @ param file the file * @ param content the xml content to set the categories for * @ return the perhaps modified file * @ throws CmsException if something goes wrong */ protected CmsFile writeCategories ( CmsObject cms , CmsFile file , CmsXmlContent content ) throws CmsException { } }
if ( CmsWorkplace . isTemporaryFile ( file ) ) { // ignore temporary file if the original file exists ( not the case for direct edit : " new " ) if ( CmsResource . isTemporaryFileName ( file . getRootPath ( ) ) ) { String originalFileName = CmsResource . getFolderPath ( file . getRootPath ( ) ) + CmsResource . getName ( file . getRootPath ( ) ) . substring ( CmsResource . TEMP_FILE_PREFIX . length ( ) ) ; if ( cms . existsResource ( cms . getRequestContext ( ) . removeSiteRoot ( originalFileName ) ) ) { // original file exists , ignore it return file ; } } else { // file name does not start with temporary prefix , ignore the file return file ; } } // check the presence of a category widget boolean hasCategoryWidget = false ; Iterator < I_CmsWidget > it = m_elementWidgets . values ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { Object widget = it . next ( ) ; if ( widget instanceof CmsCategoryWidget ) { hasCategoryWidget = true ; break ; } } if ( ! hasCategoryWidget ) { // nothing to do if no category widget is present return file ; } boolean modified = false ; // clone the cms object , and use the root site CmsObject tmpCms = OpenCms . initCmsObject ( cms ) ; tmpCms . getRequestContext ( ) . setSiteRoot ( "" ) ; // read all siblings try { List < CmsResource > listsib = tmpCms . readSiblings ( file . getRootPath ( ) , CmsResourceFilter . ALL ) ; for ( int i = 0 ; i < listsib . size ( ) ; i ++ ) { CmsResource resource = listsib . get ( i ) ; // get the default locale of the sibling List < Locale > locales = getLocalesForResource ( tmpCms , resource . getRootPath ( ) ) ; Locale locale = locales . get ( 0 ) ; for ( Locale l : locales ) { if ( content . hasLocale ( l ) ) { locale = l ; break ; } } // remove all previously set categories boolean clearedCategories = false ; // iterate over all values checking for the category widget CmsXmlContentWidgetVisitor widgetCollector = new CmsXmlContentWidgetVisitor ( locale ) ; content . visitAllValuesWith ( widgetCollector ) ; Iterator < Map . Entry < String , I_CmsXmlContentValue > > itWidgets = widgetCollector . getValues ( ) . entrySet ( ) . iterator ( ) ; while ( itWidgets . hasNext ( ) ) { Map . Entry < String , I_CmsXmlContentValue > entry = itWidgets . next ( ) ; String xpath = entry . getKey ( ) ; I_CmsWidget widget = widgetCollector . getWidgets ( ) . get ( xpath ) ; I_CmsXmlContentValue value = entry . getValue ( ) ; if ( ! ( widget instanceof CmsCategoryWidget ) || value . getTypeName ( ) . equals ( CmsXmlDynamicCategoryValue . TYPE_NAME ) ) { // ignore other values than categories continue ; } if ( ! clearedCategories ) { CmsCategoryService . getInstance ( ) . clearCategoriesForResource ( tmpCms , resource . getRootPath ( ) ) ; clearedCategories = true ; } String stringValue = value . getStringValue ( tmpCms ) ; if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( stringValue ) ) { // skip empty values continue ; } try { // add the file to the selected category String [ ] catRootPathes = stringValue . split ( "," ) ; for ( String catRootPath : catRootPathes ) { CmsCategory cat = CmsCategoryService . getInstance ( ) . getCategory ( tmpCms , catRootPath ) ; CmsCategoryService . getInstance ( ) . addResourceToCategory ( tmpCms , resource . getRootPath ( ) , cat . getPath ( ) ) ; } } catch ( CmsVfsResourceNotFoundException e ) { // invalid category try { // try to remove invalid value content . removeValue ( value . getName ( ) , value . getLocale ( ) , value . getIndex ( ) ) ; modified = true ; } catch ( CmsRuntimeException ex ) { // in case minoccurs prevents removing the invalid value if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( ex . getLocalizedMessage ( ) , ex ) ; } } } } } } catch ( CmsException ex ) { if ( LOG . isErrorEnabled ( ) ) { LOG . error ( ex . getLocalizedMessage ( ) , ex ) ; } } if ( modified ) { // when an invalid category has been removed file = content . correctXmlStructure ( cms ) ; content . setFile ( file ) ; } return file ;
public class HtmlDocletWriter { /** * Get Package link , with target frame . * @ param pkg The link will be to the " package - summary . html " page for this package * @ param target name of the target frame * @ param label tag for the link * @ return a content for the target package link */ public Content getTargetPackageLink ( PackageElement pkg , String target , Content label ) { } }
return getHyperLink ( pathString ( pkg , DocPaths . PACKAGE_SUMMARY ) , label , "" , target ) ;
public class OIndexProxy { /** * { @ inheritDoc } */ public Collection < OIdentifiable > getValues ( Collection < ? > iKeys ) { } }
final Object result = lastIndex . getValues ( iKeys ) ; return ( Collection < OIdentifiable > ) applyTailIndexes ( result , - 1 ) ;
public class FilterResults { /** * Main visualizer setup . */ private void init ( ) { } }
this . setLayout ( new BorderLayout ( ) ) ; // MAIN PANEL JPanel mainPanel = new JPanel ( ) ; Border margin = new EmptyBorder ( 10 , 10 , 5 , 10 ) ; mainPanel . setBorder ( margin ) ; mainPanel . setLayout ( new BoxLayout ( mainPanel , BoxLayout . Y_AXIS ) ) ; mainPanel . add ( makeTitlePanel ( ) ) ;
public class LogMonitorSessionIO { /** * Saves current session to the persistent storage */ static void saveCurrentSession ( Context context , LogMonitorSession session ) { } }
if ( context == null ) { throw new IllegalArgumentException ( "Context is null" ) ; } if ( session == null ) { throw new IllegalArgumentException ( "Session is null" ) ; } SharedPreferences prefs = getPrefs ( context ) ; SharedPreferences . Editor editor = prefs . edit ( ) ; editor . putString ( PREFS_KEY_EMAIL_RECIPIENTS , StringUtils . join ( session . emailRecipients ) ) ; editor . apply ( ) ;
public class StoppedAnnotation { /** * { @ inheritDoc } */ public void writeDown ( Text text ) { } }
text . setStyle ( Styles . BACKGROUND_COLOR , Colors . RED ) ; text . setStatus ( Status . FAILLURE ) ; text . setContent ( message ( ) ) ;
public class cachepolicy_cachepolicylabel_binding { /** * Use this API to fetch cachepolicy _ cachepolicylabel _ binding resources of given name . */ public static cachepolicy_cachepolicylabel_binding [ ] get ( nitro_service service , String policyname ) throws Exception { } }
cachepolicy_cachepolicylabel_binding obj = new cachepolicy_cachepolicylabel_binding ( ) ; obj . set_policyname ( policyname ) ; cachepolicy_cachepolicylabel_binding response [ ] = ( cachepolicy_cachepolicylabel_binding [ ] ) obj . get_resources ( service ) ; return response ;
public class AbstractDomainObject { /** * Subclasses may override this method to include or exclude some properties * in toString . By default only " simple " types will be included in toString . * Relations to other domain objects can not be included since we don ' t know * if they are fetched and we don ' t wont toString to fetch them . * @ param field * the field to include in toString if this method returns true * @ return true to include the field in toString , or false to exclude it */ protected boolean acceptToString ( Field field ) { } }
return acceptedToStringTypes . contains ( field . getType ( ) ) || acceptedToStringTypes . contains ( field . getType ( ) . getName ( ) ) ;
public class AbstractWebAppMain { /** * Sets the root application object . */ protected void setApplicationObject ( ) { } }
try { Object app = createApplication ( ) ; context . setAttribute ( APP , app ) ; initializer . set ( app ) ; } catch ( Error e ) { LOGGER . log ( Level . SEVERE , "Failed to initialize " + getApplicationName ( ) , e ) ; initializer . setException ( e ) ; throw e ; } catch ( RuntimeException e ) { LOGGER . log ( Level . SEVERE , "Failed to initialize " + getApplicationName ( ) , e ) ; initializer . setException ( e ) ; throw e ; } catch ( Exception e ) { LOGGER . log ( Level . SEVERE , "Failed to initialize " + getApplicationName ( ) , e ) ; initializer . setException ( e ) ; throw new Error ( e ) ; } finally { // in case the above catch clauses miss this . if ( ! initializer . isDone ( ) ) initializer . cancel ( true ) ; }
public class CmsCloneModuleThread { /** * Deletes the temporarily copied classes files . < p > * @ param targetModulePath the target module path * @ param sourcePathPart the path part of the source module * @ param targetPathPart the target path part * @ throws CmsException if something goes wrong */ private void deleteSourceClassesFolder ( String targetModulePath , String sourcePathPart , String targetPathPart ) throws CmsException { } }
String sourceFirstFolder = sourcePathPart . substring ( 0 , sourcePathPart . indexOf ( '/' ) ) ; String targetFirstFolder = sourcePathPart . substring ( 0 , sourcePathPart . indexOf ( '/' ) ) ; if ( ! sourceFirstFolder . equals ( targetFirstFolder ) ) { getCms ( ) . deleteResource ( targetModulePath + PATH_CLASSES + sourceFirstFolder , CmsResource . DELETE_PRESERVE_SIBLINGS ) ; return ; } String [ ] targetPathParts = CmsStringUtil . splitAsArray ( targetPathPart , '/' ) ; String [ ] sourcePathParts = CmsStringUtil . splitAsArray ( sourcePathPart , '/' ) ; int sourceLength = sourcePathParts . length ; int diff = 0 ; for ( int i = 0 ; i < targetPathParts . length ; i ++ ) { if ( sourceLength >= i ) { if ( ! targetPathParts [ i ] . equals ( sourcePathParts [ i ] ) ) { diff = i + 1 ; } } } String topSourceClassesPath = targetModulePath + PATH_CLASSES + sourcePathPart . substring ( 0 , sourcePathPart . indexOf ( '/' ) ) + "/" ; if ( diff != 0 ) { topSourceClassesPath = targetModulePath + PATH_CLASSES ; for ( int i = 0 ; i < diff ; i ++ ) { topSourceClassesPath += sourcePathParts [ i ] + "/" ; } } getCms ( ) . deleteResource ( topSourceClassesPath , CmsResource . DELETE_PRESERVE_SIBLINGS ) ;
public class HystrixPropertiesManager { /** * Creates and sets Hystrix command properties . * @ param properties the collapser properties */ public static HystrixCommandProperties . Setter initializeCommandProperties ( List < HystrixProperty > properties ) throws IllegalArgumentException { } }
return initializeProperties ( HystrixCommandProperties . Setter ( ) , properties , CMD_PROP_MAP , "command" ) ;
public class Json { /** * Write to the supplied writer the modified JSON representation of the supplied in - memory { @ link Document } . The resulting * JSON will have no embedded line feeds or extra spaces . * This format is compact and easy for software to read , but usually very difficult for people to read anything but very small * documents . * @ param bson the BSON object or BSON value ; may not be null * @ param stream the output stream ; may not be null * @ throws IOException if there was a problem reading from the stream */ public static void write ( Document bson , OutputStream stream ) throws IOException { } }
getCompactJsonWriter ( ) . write ( bson , stream ) ;
public class AuthConfigFactoryWrapper { /** * Make sure we don ' t dump multiple messages to the logs by only * initializing once . */ synchronized static void setFactoryImplementation ( ) { } }
if ( initialized ) return ; initialized = true ; String authConfigProvider = Security . getProperty ( AuthConfigFactory . DEFAULT_FACTORY_SECURITY_PROPERTY ) ; if ( authConfigProvider == null || authConfigProvider . isEmpty ( ) ) { Tr . info ( tc , "JASPI_DEFAULT_AUTH_CONFIG_FACTORY" , new Object [ ] { JASPI_PROVIDER_REGISTRY } ) ; Security . setProperty ( AuthConfigFactory . DEFAULT_FACTORY_SECURITY_PROPERTY , JASPI_PROVIDER_REGISTRY ) ; } else if ( ! authConfigProvider . equals ( JASPI_PROVIDER_REGISTRY ) ) { Tr . info ( tc , "JASPI_AUTH_CONFIG_FACTORY" , new Object [ ] { authConfigProvider } ) ; }
public class DeleteWebhookRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DeleteWebhookRequest deleteWebhookRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( deleteWebhookRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteWebhookRequest . getProjectName ( ) , PROJECTNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }