signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class EsRequest { /** * Adds single property value . * @ param name property name . * @ param value property value . */ public void put ( String name , Object value ) { } }
if ( value instanceof EsRequest ) { document . setDocument ( name , ( ( EsRequest ) value ) . document ) ; } else { document . set ( name , value ) ; }
public class AbstractMBeanIntrospector { /** * Attempt for format an MBean attribute . Composite and Tabular data types will * be recursively formatted , arrays will be formatted with each entry on one line , * while all others will rely on the value returned by { @ code toString } . * @ param mbeanServer the mbean server hosting the mbean * @ param mbean the mbean associated with the attribute * @ param attr the mbean attribute to format * @ param indent the current indent level of the formatted report * @ return the formatted attribute */ @ FFDCIgnore ( Throwable . class ) String getFormattedAttribute ( MBeanServer mbeanServer , ObjectName mbean , MBeanAttributeInfo attr , String indent ) { } }
try { Object attribute = mbeanServer . getAttribute ( mbean , attr . getName ( ) ) ; if ( attribute == null ) { return "null" ; } else if ( CompositeData . class . isAssignableFrom ( attribute . getClass ( ) ) ) { return getFormattedCompositeData ( CompositeData . class . cast ( attribute ) , indent ) ; } else if ( TabularData . class . isAssignableFrom ( attribute . getClass ( ) ) ) { return getFormattedTabularData ( TabularData . class . cast ( attribute ) , indent ) ; } else if ( attribute . getClass ( ) . isArray ( ) ) { return getFormattedArray ( attribute , indent ) ; } else { return String . valueOf ( attribute ) ; } } catch ( Throwable t ) { Throwable rootCause = t ; while ( rootCause . getCause ( ) != null ) { rootCause = rootCause . getCause ( ) ; } StringBuilder sb = new StringBuilder ( ) ; sb . append ( "<<Unavailable: " ) ; sb . append ( rootCause . getMessage ( ) != null ? rootCause . getMessage ( ) : rootCause ) ; sb . append ( ">>" ) ; return sb . toString ( ) ; }
public class SqlAgentFactoryImpl { /** * { @ inheritDoc } * @ see jp . co . future . uroborosql . SqlAgentFactory # setDefaultInsertsType ( InsertsType ) */ @ Override public SqlAgentFactory setDefaultInsertsType ( InsertsType defaultInsertsType ) { } }
getDefaultProps ( ) . put ( PROPS_KEY_DEFAULT_INSERTS_TYPE , defaultInsertsType . toString ( ) ) ; return this ;
public class GalleryImagesInner { /** * List gallery images in a given lab account . * @ param resourceGroupName The name of the resource group . * @ param labAccountName The name of the lab Account . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; GalleryImageInner & gt ; object */ public Observable < Page < GalleryImageInner > > listAsync ( final String resourceGroupName , final String labAccountName ) { } }
return listWithServiceResponseAsync ( resourceGroupName , labAccountName ) . map ( new Func1 < ServiceResponse < Page < GalleryImageInner > > , Page < GalleryImageInner > > ( ) { @ Override public Page < GalleryImageInner > call ( ServiceResponse < Page < GalleryImageInner > > response ) { return response . body ( ) ; } } ) ;
public class Solo { /** * Returns a WebElement matching the specified By object and index . * @ param by the By object . Examples are : { @ code By . id ( " id " ) } and { @ code By . name ( " name " ) } * @ param index the index of the { @ link WebElement } . { @ code 0 } if only one is available * @ return a { @ link WebElement } matching the specified index */ public WebElement getWebElement ( By by , int index ) { } }
if ( config . commandLogging ) { Log . d ( config . commandLoggingTag , "getWebElement(" + by + ", " + index + ")" ) ; } int match = index + 1 ; WebElement webElement = waiter . waitForWebElement ( by , match , Timeout . getSmallTimeout ( ) , true ) ; if ( webElement == null ) { if ( match > 1 ) { Assert . fail ( match + " WebElements with " + webUtils . splitNameByUpperCase ( by . getClass ( ) . getSimpleName ( ) ) + ": '" + by . getValue ( ) + "' are not found!" ) ; } else { Assert . fail ( "WebElement with " + webUtils . splitNameByUpperCase ( by . getClass ( ) . getSimpleName ( ) ) + ": '" + by . getValue ( ) + "' is not found!" ) ; } } return webElement ;
public class FlowTypeCheck { /** * Type check a < code > whiley < / code > statement . * @ param stmt * Statement to type check * @ param environment * Determines the type of all variables immediately going into this * block * @ return * @ throws ResolveError * If a named type within this statement cannot be resolved within * the enclosing project . */ private Environment checkWhile ( Stmt . While stmt , Environment environment , EnclosingScope scope ) { } }
// Type loop invariant ( s ) . checkConditions ( stmt . getInvariant ( ) , true , environment ) ; // Type condition assuming its true to represent inside a loop // iteration . // Important if condition contains a type test , as we ' ll know it holds . Environment trueEnvironment = checkCondition ( stmt . getCondition ( ) , true , environment ) ; // Type condition assuming its false to represent the terminated loop . // Important if condition contains a type test , as we ' ll know it doesn ' t // hold . Environment falseEnvironment = checkCondition ( stmt . getCondition ( ) , false , environment ) ; // Type loop body using true environment checkBlock ( stmt . getBody ( ) , trueEnvironment , scope ) ; // Determine and update modified variables Tuple < Decl . Variable > modified = FlowTypeUtils . determineModifiedVariables ( stmt . getBody ( ) ) ; stmt . setModified ( stmt . getHeap ( ) . allocate ( modified ) ) ; // Return false environment to represent flow after loop . return falseEnvironment ;
public class Operations { /** * Creates an operation to read a resource . * @ param address the address to create the read for * @ param recursive whether to search recursively or not * @ return the operation */ public static ModelNode createReadResourceOperation ( final ModelNode address , final boolean recursive ) { } }
final ModelNode op = createOperation ( READ_RESOURCE_OPERATION , address ) ; op . get ( RECURSIVE ) . set ( recursive ) ; return op ;
public class AmazonAutoScalingClient { /** * Describes the notification types that are supported by Amazon EC2 Auto Scaling . * @ param describeAutoScalingNotificationTypesRequest * @ return Result of the DescribeAutoScalingNotificationTypes operation returned by the service . * @ throws ResourceContentionException * You already have a pending update to an Amazon EC2 Auto Scaling resource ( for example , an Auto Scaling * group , instance , or load balancer ) . * @ sample AmazonAutoScaling . DescribeAutoScalingNotificationTypes * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / autoscaling - 2011-01-01 / DescribeAutoScalingNotificationTypes " * target = " _ top " > AWS API Documentation < / a > */ @ Override public DescribeAutoScalingNotificationTypesResult describeAutoScalingNotificationTypes ( DescribeAutoScalingNotificationTypesRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDescribeAutoScalingNotificationTypes ( request ) ;
public class DefaultAttachmentProvider { /** * { @ inheritDoc } */ @ NonNull @ Override public List < Uri > getAttachments ( @ NonNull Context context , @ NonNull CoreConfiguration configuration ) { } }
final ArrayList < Uri > result = new ArrayList < > ( ) ; for ( String s : configuration . attachmentUris ( ) ) { try { result . add ( Uri . parse ( s ) ) ; } catch ( Exception e ) { ACRA . log . e ( LOG_TAG , "Failed to parse Uri " + s , e ) ; } } return result ;
public class CmsPrincipal { /** * Utility function to read a prefixed principal from the OpenCms database using the * provided OpenCms user context . < p > * The principal must be either prefixed with < code > { @ link I _ CmsPrincipal # PRINCIPAL _ GROUP } . < / code > or * < code > { @ link I _ CmsPrincipal # PRINCIPAL _ USER } . < / code > . < p > * @ param cms the OpenCms user context to use when reading the principal * @ param name the prefixed principal name * @ return the principal read from the OpenCms database * @ throws CmsException in case the principal could not be read */ public static I_CmsPrincipal readPrefixedPrincipal ( CmsObject cms , String name ) throws CmsException { } }
if ( CmsGroup . hasPrefix ( name ) ) { // this principal is a group return cms . readGroup ( CmsGroup . removePrefix ( name ) ) ; } else if ( CmsUser . hasPrefix ( name ) ) { // this principal is a user return cms . readUser ( CmsUser . removePrefix ( name ) ) ; } // invalid principal name was given throw new CmsDbEntryNotFoundException ( Messages . get ( ) . container ( Messages . ERR_INVALID_PRINCIPAL_1 , name ) ) ;
public class GetConnectivityInfoRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( GetConnectivityInfoRequest getConnectivityInfoRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( getConnectivityInfoRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getConnectivityInfoRequest . getThingName ( ) , THINGNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class URLNormalizer { /** * < p > Removes any trailing slash ( / ) from a URL , before fragment * ( # ) or query string ( ? ) . < / p > * < p > < b > Please Note : < / b > Removing trailing slashes form URLs * could potentially break their semantic equivalence . < / p > * < code > http : / / www . example . com / alice / & rarr ; * http : / / www . example . com / alice < / code > * @ return this instance * @ since 1.11.0 */ public URLNormalizer removeTrailingSlash ( ) { } }
String urlRoot = HttpURL . getRoot ( url ) ; String path = toURL ( ) . getPath ( ) ; String urlRootAndPath = urlRoot + path ; if ( path . endsWith ( "/" ) ) { String newPath = StringUtils . removeEnd ( path , "/" ) ; String newUrlRootAndPath = urlRoot + newPath ; url = StringUtils . replaceOnce ( url , urlRootAndPath , newUrlRootAndPath ) ; } return this ;
public class RPC { /** * Expert : Make multiple , parallel calls to a set of servers . */ public static Object [ ] call ( Method method , Object [ ] [ ] params , InetSocketAddress [ ] addrs , UserGroupInformation ticket , Configuration conf ) throws IOException { } }
Invocation [ ] invocations = new Invocation [ params . length ] ; for ( int i = 0 ; i < params . length ; i ++ ) invocations [ i ] = new Invocation ( method , null , params [ i ] ) ; Client client = CLIENTS . getClient ( conf ) ; try { Writable [ ] wrappedValues = client . call ( invocations , addrs , method . getDeclaringClass ( ) , ticket ) ; if ( method . getReturnType ( ) == Void . TYPE ) { return null ; } Object [ ] values = ( Object [ ] ) Array . newInstance ( method . getReturnType ( ) , wrappedValues . length ) ; for ( int i = 0 ; i < values . length ; i ++ ) if ( wrappedValues [ i ] != null ) values [ i ] = ( ( ObjectWritable ) wrappedValues [ i ] ) . get ( ) ; return values ; } finally { CLIENTS . stopClient ( client ) ; }
public class Strings { /** * subtractSeq . * @ param first * a { @ link java . lang . String } object . * @ param second * a { @ link java . lang . String } object . * @ return a { @ link java . lang . String } object . */ public static String subtractSeq ( final String first , final String second ) { } }
return subtractSeq ( first , second , DELIMITER ) ;
public class FindBugs2 { /** * Report an exception that occurred while analyzing a class with a * detector . * @ param classDescriptor * class being analyzed * @ param detector * detector doing the analysis * @ param e * the exception */ private void logRecoverableException ( ClassDescriptor classDescriptor , Detector2 detector , Throwable e ) { } }
bugReporter . logError ( "Exception analyzing " + classDescriptor . toDottedClassName ( ) + " using detector " + detector . getDetectorClassName ( ) , e ) ;
public class JKConversionUtil { /** * To boolean . * @ param value the value * @ param defaultValue the default value * @ return true , if successful */ public static boolean toBoolean ( Object value , boolean defaultValue ) { } }
boolean result ; // = defaultValue ; if ( value != null ) { if ( value instanceof Boolean ) { return ( ( Boolean ) value ) . booleanValue ( ) ; } if ( value . toString ( ) . trim ( ) . equals ( "1" ) || value . toString ( ) . trim ( ) . toLowerCase ( ) . equals ( "true" ) ) { result = true ; } else { result = false ; } } else { result = defaultValue ; } return result ;
public class WorldViewTransformer { /** * Transform a bounding box by a given < code > Matrix < / code > . * @ param bbox * The bounding box to transform . * @ param matrix * The transformation matrix . * @ return Returns a transformed bounding box , or null if one of the given parameters was null . */ public Bbox transform ( Bbox bbox , Matrix matrix ) { } }
if ( bbox != null ) { Coordinate c1 = transform ( bbox . getOrigin ( ) , matrix ) ; Coordinate c2 = transform ( bbox . getEndPoint ( ) , matrix ) ; double x = ( c1 . getX ( ) < c2 . getX ( ) ) ? c1 . getX ( ) : c2 . getX ( ) ; double y = ( c1 . getY ( ) < c2 . getY ( ) ) ? c1 . getY ( ) : c2 . getY ( ) ; return new Bbox ( x , y , Math . abs ( c1 . getX ( ) - c2 . getX ( ) ) , Math . abs ( c1 . getY ( ) - c2 . getY ( ) ) ) ; } return null ;
public class Context2 { /** * Declare a Namespace prefix for this context . * @ param prefix The prefix to declare . * @ param uri The associated Namespace URI . * @ see org . xml . sax . helpers . NamespaceSupport2 # declarePrefix */ void declarePrefix ( String prefix , String uri ) { } }
// Lazy processing . . . if ( ! tablesDirty ) { copyTables ( ) ; } if ( declarations == null ) { declarations = new Vector ( ) ; } prefix = prefix . intern ( ) ; uri = uri . intern ( ) ; if ( "" . equals ( prefix ) ) { if ( "" . equals ( uri ) ) { defaultNS = null ; } else { defaultNS = uri ; } } else { prefixTable . put ( prefix , uri ) ; uriTable . put ( uri , prefix ) ; // may wipe out another prefix } declarations . addElement ( prefix ) ;
public class JmsDurableSubscriberImpl { /** * This method overrides the createCoreConsumer method in JmsMsgConsumerImpl * to connect to a durable subscription rather than a regular consumer session . * Note : Care should be taken when altering this method signature to ensure * that it matches the method in JmsMsgConsumerImpl . */ protected ConsumerSession createCoreConsumer ( SICoreConnection _coreConn , ConsumerProperties _props ) throws JMSException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "createCoreConsumer" , new Object [ ] { _coreConn , _props } ) ; if ( DEVT_DEBUG ) System . out . println ( "Overidden create!" ) ; ConsumerSession dcs = null ; // Determine the correct subscription name to use ( concatenation // of clientID and subName . String clientID = _props . getClientID ( ) ; String subName = _props . getSubName ( ) ; String durableSubHome = _props . getDurableSubscriptionHome ( ) ; String coreSubscriptionName = JmsInternalsFactory . getSharedUtils ( ) . getCoreDurableSubName ( clientID , subName ) ; if ( DEVT_DEBUG ) System . out . println ( "SUBSCRIBE: " + coreSubscriptionName ) ; if ( DEVT_DEBUG ) System . out . println ( _props . debug ( ) ) ; // Retrieve the destination object for repeated use . JmsDestinationImpl cccDest = ( JmsDestinationImpl ) _props . getJmsDestination ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { // Trace out all the parameters to the create call . SibTr . debug ( this , tc , "subscriptionName: " + coreSubscriptionName + ", destName: " + cccDest . getDestName ( ) + ", discrim: " + cccDest . getDestDiscrim ( ) + ", selector: " + _props . getSelector ( ) ) ; SibTr . debug ( this , tc , "readAhead: " + _props . readAhead ( ) + ", supportsMultiple: " + _props . supportsMultipleConsumers ( ) + ", noLocal: " + _props . noLocal ( ) + ", durableSubHome: " + _props . getDurableSubscriptionHome ( ) ) ; // Check the values for supportsMultiple and readAhead to // see if they conflict . This may happen if the user has explicitly // set readAhead ON , then cloned their application server . This might // result in all the messages being streamed to a single consumer // rather than being shared equally across them . ( 192474 ) . // The concerning situations are where both supportsMultiple and // readAhead are set to the same thing . By using XOR ( ^ ) and // comparing for false we can see if they are set to the same thing . if ( ! ( _props . supportsMultipleConsumers ( ) ^ _props . readAhead ( ) ) ) { // They are both set to the same thing . if ( _props . supportsMultipleConsumers ( ) ) { // They are both set to true . This means all the messages might // be streamed to a single consumer . SibTr . debug ( this , tc , "WARNING: shareDurableSubs and readAhead are both ON." + " This could lead to all messages being streamed to a single consumer, which is inefficient." ) ; } else { // They are both set to false . This means that we are not // streaming messages to the consumer , even though we are // guaranteed that there is only one . This might not give // optimum performance . SibTr . debug ( this , tc , "WARNING: shareDurableSubs and readAhead are both OFF." + " This prevents the readAhead optimisation from taking place to pass messages pre-emptively to the single consumer." + " Performance would be improved if readAhead was DEFAULT or ON" ) ; } } } // end of stuff only done if Trace enabled /* * We are about to attempt to create or attach the durable subscription . * If the parameters we pass in do not match the ones that were used to * create the subscription then we will need to alter the subscription , * which is done by delete and re - create . * For an alter request we have the following behaviour ; * createDurableSubscription throws SIDestinationAlreadyExistsException * deleteDurableSubscription * createDurableSubscription * The following do - while loop handles the retry of the create . * d245910 - The original code would throw an exception to the application * if a create / connect sequence failed . This has been changed to retry . */ byte create_state = NOT_TRIED ; // Need to create a destination address object for this subscriber call . SIDestinationAddress sida = cccDest . getConsumerSIDestinationAddress ( ) ; // Need to create a selection criteria object for this subscriber call . SelectionCriteria selectionCriteria = null ; try { selectionCriteria = selectionCriteriaFactory . createSelectionCriteria ( cccDest . getDestDiscrim ( ) , // discriminator ( topic ) _props . getSelector ( ) , // selector string SelectorDomain . JMS // selector domain ) ; } catch ( SIErrorException sice ) { // No FFDC code needed // SIErrorException is described as a " should never happen " indicator . // No further detail is given in the javadoc for createSelectionCriteria , // so ExceptionReceived seems appropriate for this case . // d238447 FFDC Review . Generate FFDC for this case . throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "EXCEPTION_RECEIVED_CWSIA0221" , new Object [ ] { sice , "JmsDurableSubscriberImpl.createCoreConsumer (#10)" } , sice , "JmsDurableSubscriberImpl.createCoreConsumer#10" , this , tc ) ; } // This do - while loop handles the retry . do { try { // This block is used if we are going round the loop for a second time // to do the subscription altering . if ( create_state == REQUEST_ALTER ) { // We have been through the loop once already , and the create call // failed due to a DestAlreadyExists exception . if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Try to delete subscription: " + coreSubscriptionName ) ; // Delete the subscription _coreConn . deleteDurableSubscription ( coreSubscriptionName , durableSubHome ) ; // Now we need to create it again . create_state = TRY_CREATE ; } // This block is used when going round the loop for a second time // to do the durable sub create . if ( create_state == TRY_CREATE ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Try to create subscription: " + coreSubscriptionName ) ; _coreConn . createDurableSubscription ( coreSubscriptionName , durableSubHome , sida , selectionCriteria , _props . supportsMultipleConsumers ( ) , _props . noLocal ( ) , null // alternateUserID ) ; } // Attempt to connect to the durable subscription . Note that this // is separate to the act of creation . dcs = _coreConn . createConsumerSessionForDurableSubscription ( coreSubscriptionName , durableSubHome , sida , selectionCriteria , _props . supportsMultipleConsumers ( ) , _props . noLocal ( ) , null , _props . readAhead ( ) , Reliability . NONE , false , // bifurcatable null // alternateUserID ) ; // The operation succeeded as we expected . create_state = COMPLETE ; } catch ( SIDurableSubscriptionMismatchException daee ) { // No FFDC code needed // Name of this durable subscription clashes with an existing destination . // ( ie we just attempted to alter the subscription ) if ( create_state != REQUEST_ALTER ) { // This is the first time we have seen this exception type . // It most likely means that we need to alter the subscription . create_state = REQUEST_ALTER ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Exception received from createDurableSubscription: " , daee ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Now try to alter the subscription" ) ; } else { // d222942 review // I don ' t think we can ever get to this code block ( create _ state = = REQUEST _ ALTER ) // since create _ state is changed from REQUEST _ ALTER to TRY _ CREATE after the call to // deleteSubscription , which has to have succeeded before a call to // createConsumerSessionForDurableSubscription would be attempted . // d245910 Matt and JBK agree we can ' t get here with current code , but rather than // delete the block , we ' ll leave it here but with a stronger debug message . This // should protect us against future code changes that might bring this case into play . if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "SHOULDN'T HAVE GOT HERE, PLEASE REPORT/INVESTIGATE" ) ; // NB . Must throw exception here to avoid infinite looping ! // d238447 FFDC Review . Generate FFDC for this case . throw ( JMSException ) JmsErrorUtils . newThrowable ( InvalidDestinationException . class , "EXCEPTION_RECEIVED_CWSIA0221" , new Object [ ] { daee , "JmsDurableSubscriberImpl.createCoreConsumer (#1)" } , daee , "JmsDurableSubscriberImpl.createCoreConsumer#1" , this , tc ) ; } } catch ( SIConnectionUnavailableException oce ) { // No FFDC code needed // Method invoked on a closed connection // d222942 review // Looks like this could happen as part of ' normal ' operation if // the connection was closed from one thread whilst another was // calling createDurableSubscriber . // New message for connection closed during method . // NB . Must throw exception here to avoid infinite looping ! // d238447 FFDC review . Since this can happen during normal operation , we shouldn ' t generate an FFDC . throw ( JMSException ) JmsErrorUtils . newThrowable ( javax . jms . IllegalStateException . class , "CONN_CLOSED_CWSIA0222" , null , oce , null , // null probeId = no FFDC . this , tc ) ; } catch ( SIDestinationLockedException dle ) { // No FFDC code needed // Destination is not accepting consumers - probably means that there is // already an active subscriber for this durable subscription // NB . Must throw exception here to avoid infinite looping ! // d238447 FFDC review . App error , not internal , so no FFDC . throw ( JMSException ) JmsErrorUtils . newThrowable ( javax . jms . IllegalStateException . class , "DEST_LOCKED_CWSIA0223" , null , dle , null , // null probeId = no FFDC . this , tc ) ; } catch ( SIDurableSubscriptionNotFoundException dnfe ) { // No FFDC code needed // The destination cannot be found ( no durable subscription ) . // At this point we try to create it . if ( create_state != TRY_CREATE ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "The durable subscription could not be found - create it" ) ; create_state = TRY_CREATE ; } else { // d222942 review // To get here implies that createDurableSubscription succeeded , and then // createConsumerSessionForDurableSubscription failed with a notFoundException . // d245910 : This can happen when other threads are also calling unsubscribe , as in the testcase // written for d245910 . ThreadA does the create , then gets switched out , ThreadB does an // unsubscribe , ThreadA switches back in and finds the subscription gone , so ends up here . // Using the same logic as for SIDurableSubscriptionAlreadyExistsException , it makes // sense to reset to NOT _ TRIED and start over again . if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "The durable subscription was not found after create. Resetting to NOT_TRIED" ) ; create_state = NOT_TRIED ; } } catch ( SINotAuthorizedException nae ) { // No FFDC code needed // Not Authorized // d238447 FFDC Review . Not an internal error , no FFDC required . // NB . Must throw exception here to avoid infinite looping ! throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSSecurityException . class , "NOT_AUTH_CWSIA0224" , null , nae , null , // null probeId = no FFDC this , tc ) ; } catch ( SISelectorSyntaxException nae ) { // No FFDC code needed // Invalid selector // d238447 FFDC Review . Not an internal error , no FFDC required . // NB . Must throw exception here to avoid infinite looping ! throw ( JMSException ) JmsErrorUtils . newThrowable ( InvalidSelectorException . class , "BAD_SELECT_CWSIA0225" , null , nae , null , this , tc ) ; } catch ( SIDurableSubscriptionAlreadyExistsException saee ) { // No FFDC code needed if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( this , tc , "Subscription already exists - this may be a timing issue with multiple clients," + " since the first time we tried to connect to it, it didn't exist!" + " Resetting create_state to NOT_TRIED" ) ; } // d222942 review // Not sure I like the logic here - we are effectively throwing an exception // at the application that is the result of our implementation issues . Better // would be to reset this client to the beginning of the connect / create / alter // cycle , with the probable outcome that the app ' will get a ' subscription in use ' // exception which is more palatable . There exists the possibility that this client // will connect to a new subscription created by a different client , but only if // both subscriptions are identical , in which case it doesn ' t matter which // client created it . // Code used to be . . . . . // NB . Must throw exception here to avoid infinite looping ! // throw ( JMSException ) JmsErrorUtils . newThrowable ( // InvalidSelectorException . class , // " EXCEPTION _ RECEIVED _ CWSIA0221 " , // new Object [ ] { saee , " JmsDurableSubscriberImpl . createCoreConsumer ( # 8 ) " } , // saee , // " JmsDurableSubscriberImpl . createCoreConsumer # 8 " , // this , // tc // d245910 As discussed above , reset to not - tried and go around again . create_state = NOT_TRIED ; } catch ( SINotPossibleInCurrentConfigurationException npcc ) { // No FFDC code needed if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "The topicSpace is non-permanent or does not exist." ) ; // d238447 FFDC Review . Not an internal error , no FFDC required . // NB . Must throw exception here to avoid infinite looping ! throw ( JMSException ) JmsErrorUtils . newThrowable ( InvalidDestinationException . class , "BAD_TOPICSPACE_CWSIA0226" , null , npcc , null , // null probeId = no FFDC this , tc ) ; } catch ( SIException sice ) { // No FFDC code needed // Misc other exception ( Store , Comms , Core ) . // d238447 FFDC review . FFDC generation seems reasonable for this case . // NB . Must throw exception here to avoid infinite looping ! throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "EXCEPTION_RECEIVED_CWSIA0221" , new Object [ ] { sice , "JmsDurableSubscriberImpl.createCoreConsumer (#9)" } , sice , "JmsDurableSubscriberImpl.createCoreConsumer#9" , this , tc ) ; } // If the first createDurableSubscription call failed , then at this // point create _ state will be REQUEST _ ALTER , and we will loop round // again . ( Presumably it may alse be NOT _ TRIED ) . // If the operation succeeded for either reason ( direct success or // success after alter ) then the state will be COMPLETE . // Any other outcome will result in an exception being thrown so // we will not leave this loop in the regular fashion . } while ( create_state != COMPLETE ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "createCoreConsumer(SICoreConnection, ConsumerProperties)" , dcs ) ; return dcs ;
public class DefaultEndpointFactory { /** * Loads property file from classpath holding default endpoint annotation parser definitions in Citrus . */ private void loadEndpointParserProperties ( ) { } }
try { endpointParserProperties = PropertiesLoaderUtils . loadProperties ( new ClassPathResource ( "com/consol/citrus/endpoint/endpoint.parser" ) ) ; } catch ( IOException e ) { log . warn ( "Unable to laod default endpoint annotation parsers from resource '%s'" , e ) ; }
public class BeansDescriptorImpl { /** * Adds a new namespace * @ return the current instance of < code > BeansDescriptor < / code > */ public BeansDescriptor addNamespace ( String name , String value ) { } }
model . attribute ( name , value ) ; return this ;
public class CsvDataProvider { /** * { @ inheritDoc } */ @ Override protected void writeValue ( String column , int line , String value ) { } }
logger . debug ( "Writing: [{}] at line [{}] in column [{}]" , value , line , column ) ; final int colIndex = columns . indexOf ( column ) ; CSVReader reader ; try { reader = openOutputData ( ) ; final List < String [ ] > csvBody = reader . readAll ( ) ; csvBody . get ( line ) [ colIndex ] = value ; reader . close ( ) ; writeValue ( column , line , value , csvBody ) ; } catch ( final IOException e1 ) { logger . error ( Messages . getMessage ( CSV_DATA_PROVIDER_WRITING_IN_CSV_ERROR_MESSAGE ) , column , line , value , e1 ) ; }
public class BaseType { /** * Create a class - based type , where any parameters are filled with the * variables , not Object . */ public static BaseType createGenericClass ( Class < ? > type ) { } }
TypeVariable < ? > [ ] typeParam = type . getTypeParameters ( ) ; if ( typeParam == null || typeParam . length == 0 ) return ClassType . create ( type ) ; BaseType [ ] args = new BaseType [ typeParam . length ] ; HashMap < String , BaseType > newParamMap = new HashMap < String , BaseType > ( ) ; String paramDeclName = null ; for ( int i = 0 ; i < args . length ; i ++ ) { args [ i ] = create ( typeParam [ i ] , newParamMap , paramDeclName , ClassFill . TARGET ) ; if ( args [ i ] == null ) { throw new NullPointerException ( "unsupported BaseType: " + type ) ; } newParamMap . put ( typeParam [ i ] . getName ( ) , args [ i ] ) ; } // ioc / 07f2 return new GenericParamType ( type , args , newParamMap ) ;
public class BundledTileSetRepository { /** * documentation inherited from interface */ public TileSet getTileSet ( String setName ) throws NoSuchTileSetException , PersistenceException { } }
waitForBundles ( ) ; Integer tsid = _namemap . get ( setName ) ; if ( tsid != null ) { return getTileSet ( tsid . intValue ( ) ) ; } throw new NoSuchTileSetException ( setName ) ;
public class SessionListener { /** * Log the session counters for applications that maintain them . * @ param sess HttpSession for the session id * @ param start true for session start */ protected void logSessionCounts ( final HttpSession sess , final boolean start ) { } }
StringBuffer sb ; String appname = getAppName ( sess ) ; Counts ct = getCounts ( appname ) ; if ( start ) { sb = new StringBuffer ( "SESSION-START:" ) ; } else { sb = new StringBuffer ( "SESSION-END:" ) ; } sb . append ( getSessionId ( sess ) ) ; sb . append ( ":" ) ; sb . append ( appname ) ; sb . append ( ":" ) ; sb . append ( ct . activeSessions ) ; sb . append ( ":" ) ; sb . append ( ct . totalSessions ) ; sb . append ( ":" ) ; sb . append ( Runtime . getRuntime ( ) . freeMemory ( ) / ( 1024 * 1024 ) ) ; sb . append ( "M:" ) ; sb . append ( Runtime . getRuntime ( ) . totalMemory ( ) / ( 1024 * 1024 ) ) ; sb . append ( "M" ) ; info ( sb . toString ( ) ) ;
public class Client { /** * Get a batch of roles assigned to privilege . * @ param id Id of the privilege * @ param batchSize Size of the Batch * @ param afterCursor Reference to continue collecting items of next page * @ return OneLoginResponse of User ( Batch ) * @ throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection * @ throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled * @ throws URISyntaxException - if there is an error when generating the target URL at the getResource call * @ see < a target = " _ blank " href = " https : / / developers . onelogin . com / api - docs / 1 / privileges / get - roles " > Get Assigned Roles documentation < / a > */ public OneLoginResponse < Long > getRolesAssignedToPrivilegesBatch ( String id , int batchSize , String afterCursor ) throws OAuthSystemException , OAuthProblemException , URISyntaxException { } }
ExtractionContext context = extractResourceBatch ( ( Object ) id , batchSize , afterCursor , Constants . GET_ROLES_ASSIGNED_TO_PRIVILEGE_URL ) ; List < Long > roleIds = new ArrayList < Long > ( batchSize ) ; afterCursor = getRolesAssignedToPrivilegesBatch ( roleIds , context . url , context . bearerRequest , context . oAuth2Response ) ; return new OneLoginResponse < Long > ( roleIds , afterCursor ) ;
public class SipDigestAuthenticationMechanism { /** * Parse the specified authorization credentials , and return the associated Principal that these credentials authenticate * ( if any ) from the specified Realm . If there is no such Principal , return < code > null < / code > . * @ param request HTTP servlet request * @ param authorization Authorization credentials from this request * @ param realm Realm used to authenticate Principals * @ param sercurityDomain * @ param deployment * @ param servletInfo * @ param sipStack */ protected static SipPrincipal findPrincipal ( MobicentsSipServletRequest request , String authorization , String realmName , String securityDomain , Deployment deployment , ServletInfo servletInfo , SipStack sipStack ) { } }
// System . out . println ( " Authorization token : " + authorization ) ; // Validate the authorization credentials format if ( authorization == null ) { return ( null ) ; } if ( ! authorization . startsWith ( "Digest " ) ) { return ( null ) ; } String tmpAuthorization = authorization . substring ( 7 ) . trim ( ) ; // Bugzilla 37132 : http : / / issues . apache . org / bugzilla / show _ bug . cgi ? id = 37132 // The solution of 37132 doesn ' t work with : // response = " 2d05f1206becab904c1f311f205b405b " , cnonce = " 5644k1k670 " , username = " admin " , nc = 000001 , qop = auth , nonce = " b6c73ab509830b8c0897984f6b0526e8 " , realm = " sip - servlets - realm " , opaque = " 9ed6d115d11f505f9ee20f6a68654cc2 " , uri = " sip : 192.168.1.142 " , algorithm = MD5 // That ' s why I am going back to simple comma ( Vladimir ) . TODO : Review this . String [ ] tokens = tmpAuthorization . split ( "," ) ; String userName = null ; String nOnce = null ; String nc = null ; String cnonce = null ; String qop = null ; String uri = null ; String response = null ; String method = request . getMethod ( ) ; for ( int i = 0 ; i < tokens . length ; i ++ ) { String currentToken = tokens [ i ] ; if ( currentToken . length ( ) == 0 ) { continue ; } int equalSign = currentToken . indexOf ( '=' ) ; if ( equalSign < 0 ) { return null ; } String currentTokenName = currentToken . substring ( 0 , equalSign ) . trim ( ) ; String currentTokenValue = currentToken . substring ( equalSign + 1 ) . trim ( ) ; if ( "username" . equals ( currentTokenName ) ) { userName = removeQuotes ( currentTokenValue ) ; } if ( "realm" . equals ( currentTokenName ) ) { realmName = removeQuotes ( currentTokenValue , true ) ; } if ( "nonce" . equals ( currentTokenName ) ) { nOnce = removeQuotes ( currentTokenValue ) ; } if ( "nc" . equals ( currentTokenName ) ) { nc = removeQuotes ( currentTokenValue ) ; } if ( "cnonce" . equals ( currentTokenName ) ) { cnonce = removeQuotes ( currentTokenValue ) ; } if ( "qop" . equals ( currentTokenName ) ) { qop = removeQuotes ( currentTokenValue ) ; DigestQop qopObj = DigestQop . forName ( qop ) ; } if ( "uri" . equals ( currentTokenName ) ) { uri = removeQuotes ( currentTokenValue ) ; } if ( "response" . equals ( currentTokenName ) ) { response = removeQuotes ( currentTokenValue ) ; } } if ( ( userName == null ) || ( realmName == null ) || ( nOnce == null ) || ( uri == null ) || ( response == null ) ) { return null ; } // Second MD5 digest used to calculate the digest : // MD5 ( Method + " : " + uri ) String a2 = method + ":" + uri ; // System . out . println ( " A2 : " + a2 ) ; byte [ ] buffer = null ; synchronized ( md5Helper ) { buffer = md5Helper . digest ( a2 . getBytes ( ) ) ; } String md5a2 = MD5_ENCODER . encode ( buffer ) ; // taken from // https : / / github . com / jbossas / jboss - as / blob / 7.1.2 . Final / web / src / main / java / org / jboss / as / web / security / SecurityContextAssociationValve . java # L86 SecurityContext sc = SecurityActions . getSecurityContext ( ) ; if ( sc == null ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Security Domain " + securityDomain + " for Realm " + realmName ) ; } if ( securityDomain == null ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Security Domain is null using default security domain " + SIPSecurityConstants . DEFAULT_SIP_APPLICATION_POLICY + " for Realm " + realmName ) ; } securityDomain = SIPSecurityConstants . DEFAULT_SIP_APPLICATION_POLICY ; } sc = SecurityActions . createSecurityContext ( securityDomain ) ; SecurityActions . setSecurityContextOnAssociation ( sc ) ; } try { Properties users = new Properties ( ) ; String dir = System . getProperty ( "jboss.server.config.dir" ) ; String fileName = "sip-servlets-users.properties" ; boolean storedPasswordIsA1Hash = true ; if ( sipStack instanceof SipStackImpl ) { Properties stackProperties = ( ( SipStackImpl ) sipStack ) . getConfigurationProperties ( ) ; fileName = stackProperties . getProperty ( SipDigestAuthenticationMechanism . DIGEST_AUTH_USERS_PROPERTIES , "sip-servlets-users.properties" ) ; storedPasswordIsA1Hash = Boolean . parseBoolean ( stackProperties . getProperty ( SipDigestAuthenticationMechanism . DIGEST_AUTH_PASSWORD_IS_A1HASH , "true" ) ) ; } try { users = SipDigestAuthenticationMechanism . loadProperties ( dir + "/" + fileName , dir + "/" + fileName ) ; } catch ( IOException e ) { log . warn ( "Failed to load user properties file from location " + dir + "/" + fileName + ", please check digest security config in standalone and mss sip stack property files!" ) ; } String storedPassword = users . getProperty ( userName , "" ) ; Account account = SipDigestAuthenticationMechanism . authenticate ( userName , storedPassword , response , nOnce , nc , cnonce , method , uri , qop , realmName , md5a2 , deployment , storedPasswordIsA1Hash ) ; if ( account == null ) { return null ; } else { return ( new UndertowSipPrincipal ( account , deployment , servletInfo ) ) ; } } finally { SecurityActions . clearSecurityContext ( ) ; SecurityRolesAssociation . setSecurityRoles ( null ) ; }
public class Row { /** * Creates a new Row and assigns the given values to the Row ' s fields . * This is more convenient than using the constructor . * < p > For example : * < pre > * Row . of ( " hello " , true , 1L ) ; } * < / pre > * instead of * < pre > * Row row = new Row ( 3 ) ; * row . setField ( 0 , " hello " ) ; * row . setField ( 1 , true ) ; * row . setField ( 2 , 1L ) ; * < / pre > */ public static Row of ( Object ... values ) { } }
Row row = new Row ( values . length ) ; for ( int i = 0 ; i < values . length ; i ++ ) { row . setField ( i , values [ i ] ) ; } return row ;
public class OcAgentTraceServiceConfigRpcHandler { /** * Sends current config to Agent if the stream is still connected , otherwise do nothing . */ private synchronized void sendCurrentConfig ( CurrentLibraryConfig currentLibraryConfig ) { } }
if ( isCompleted ( ) || currentConfigObserver == null ) { return ; } try { currentConfigObserver . onNext ( currentLibraryConfig ) ; } catch ( Exception e ) { // Catch client side exceptions . onComplete ( e ) ; }
public class Text { /** * Set to contain the contents of a string . */ public void set ( String string ) { } }
try { ByteBuffer bb = encode ( string , true ) ; bytes = bb . array ( ) ; length = bb . limit ( ) ; } catch ( CharacterCodingException e ) { throw new RuntimeException ( "Should not have happened " + e . toString ( ) ) ; }
public class TransformationPerformer { /** * Gets the value of the field with the field name either from the source object or the target object , depending on * the parameters . Is also aware of temporary fields . */ private Object getObjectValue ( String fieldname , boolean fromSource ) throws Exception { } }
Object sourceObject = fromSource ? source : target ; Object result = null ; for ( String part : StringUtils . split ( fieldname , "." ) ) { if ( isTemporaryField ( part ) ) { result = loadObjectFromTemporary ( part , fieldname ) ; } else { result = loadObjectFromField ( part , result , sourceObject ) ; } } return result ;
public class InlineSimpleMethods { /** * Returns true if the provided node is a getprop for * which the left child is this or a valid property tree * and for which the right side is a string . */ private static boolean isPropertyTree ( Node expectedGetprop ) { } }
if ( ! expectedGetprop . isGetProp ( ) ) { return false ; } Node leftChild = expectedGetprop . getFirstChild ( ) ; if ( ! leftChild . isThis ( ) && ! isPropertyTree ( leftChild ) ) { return false ; } Node retVal = leftChild . getNext ( ) ; return NodeUtil . getStringValue ( retVal ) != null ;
public class YarnShuffleService { /** * Close the shuffle server to clean up any associated state . */ @ Override protected void serviceStop ( ) { } }
try { if ( shuffleServer != null ) { shuffleServer . close ( ) ; } if ( transportContext != null ) { transportContext . close ( ) ; } if ( blockHandler != null ) { blockHandler . close ( ) ; } if ( db != null ) { db . close ( ) ; } } catch ( Exception e ) { logger . error ( "Exception when stopping service" , e ) ; }
public class OpenPgpManager { /** * Determine , if we can sync secret keys using private PEP nodes as described in the XEP . * Requirements on the server side are support for PEP and support for the whitelist access model of PubSub . * @ see < a href = " https : / / xmpp . org / extensions / xep - 0373 . html # synchro - pep " > XEP - 0373 § 5 < / a > * @ param connection XMPP connection * @ return true , if the server supports secret key backups , otherwise false . * @ throws XMPPException . XMPPErrorException in case of an XMPP protocol error . * @ throws SmackException . NotConnectedException if we are not connected . * @ throws InterruptedException if the thread is interrupted . * @ throws SmackException . NoResponseException if the server doesn ' t respond . */ public static boolean serverSupportsSecretKeyBackups ( XMPPConnection connection ) throws XMPPException . XMPPErrorException , SmackException . NotConnectedException , InterruptedException , SmackException . NoResponseException { } }
return ServiceDiscoveryManager . getInstanceFor ( connection ) . serverSupportsFeature ( PubSubFeature . access_whitelist . toString ( ) ) ;
public class ReplyUtil { /** * dummy reply . please according to your own situation to build ReplyDetailWarpper , and remove those code in production . */ public static ReplyDetailWarpper getDummyTextReplyDetailWarpper ( ) { } }
ReplyDetail replyDetail = new ReplyDetail ( ) ; replyDetail . setDescription ( "欢迎订阅javatech,这是微信公众平台开发模式的一个尝试,更多详情请见 https://github.com/usc/wechat-mp-sdk \n" + "Welcome subscribe javatech, this is an attempt to development model of wechat management platform, please via https://github.com/usc/wechat-mp-sdk to see more details" ) ; return new ReplyDetailWarpper ( "text" , Arrays . asList ( replyDetail ) ) ;
public class ApplicationSecurityGroupsInner { /** * Gets all the application security groups in a resource group . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ 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 PagedList & lt ; ApplicationSecurityGroupInner & gt ; object if successful . */ public PagedList < ApplicationSecurityGroupInner > listByResourceGroupNext ( final String nextPageLink ) { } }
ServiceResponse < Page < ApplicationSecurityGroupInner > > response = listByResourceGroupNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) ; return new PagedList < ApplicationSecurityGroupInner > ( response . body ( ) ) { @ Override public Page < ApplicationSecurityGroupInner > nextPage ( String nextPageLink ) { return listByResourceGroupNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) . body ( ) ; } } ;
public class Metadata { /** * Returns a { @ code Metadata } object given the the metadata as a map . The total size of all keys * and values must be less than 512 KB . Keys must conform to the following regexp : { @ code * [ a - zA - Z0-9 - _ ] + } , and be less than 128 bytes in length . This is reflected as part of a URL in * the metadata server . Additionally , to avoid ambiguity , keys must not conflict with any other * metadata keys for the project . Values must be less than or equal to 32768 bytes . */ public static Metadata of ( Map < String , String > values ) { } }
return newBuilder ( ) . setValues ( values ) . build ( ) ;
public class TRNImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public void setTRNDATA ( byte [ ] newTRNDATA ) { } }
byte [ ] oldTRNDATA = trndata ; trndata = newTRNDATA ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . TRN__TRNDATA , oldTRNDATA , trndata ) ) ;
public class AbstractParser { /** * evaluates a XPath expression and loops over the nodeset result * @ param element * @ param xpath * @ return * @ throws XPathExpressionException */ protected static Iterable < Node > evaluate ( Node element , XPathExpression expression , boolean detatch ) throws XPathExpressionException { } }
final NodeList nodeList = ( NodeList ) expression . evaluate ( element , XPathConstants . NODESET ) ; return new Iterable < Node > ( ) { @ Override public Iterator < Node > iterator ( ) { return new Iterator < Node > ( ) { int index = 0 ; @ Override public boolean hasNext ( ) { return index < nodeList . getLength ( ) ; } @ Override public Node next ( ) { Node item = nodeList . item ( index ) ; if ( detatch ) { // detaching the node from its parent dramatically improves performance // for xpath ! item . getParentNode ( ) . removeChild ( item ) ; } index ++ ; return item ; } } ; } } ;
public class DescribeFleetAttributesRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DescribeFleetAttributesRequest describeFleetAttributesRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( describeFleetAttributesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeFleetAttributesRequest . getFleetIds ( ) , FLEETIDS_BINDING ) ; protocolMarshaller . marshall ( describeFleetAttributesRequest . getLimit ( ) , LIMIT_BINDING ) ; protocolMarshaller . marshall ( describeFleetAttributesRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class PolicyChecker { /** * Finds the policy nodes of depth ( certIndex - 1 ) where curPolicy * is in the expected policy set and creates a new child node * appropriately . If matchAny is true , then a value of ANY _ POLICY * in the expected policy set will match any curPolicy . If matchAny * is false , then the expected policy set must exactly contain the * curPolicy to be considered a match . This method returns a boolean * value indicating whether a match was found . * @ param certIndex the index of the certificate whose policy is * being processed * @ param policiesCritical a boolean indicating whether the certificate * policies extension is critical * @ param rejectPolicyQualifiers a boolean indicating whether the * user wants to reject policies that have qualifiers * @ param rootNode the root node of the valid policy tree * @ param curPolicy a String representing the policy being processed * @ param pQuals the policy qualifiers of the policy being processed or an * empty Set if there are no qualifiers * @ param matchAny a boolean indicating whether a value of ANY _ POLICY * in the expected policy set will be considered a match * @ return a boolean indicating whether a match was found * @ exception CertPathValidatorException Exception thrown if error occurs . */ private static boolean processParents ( int certIndex , boolean policiesCritical , boolean rejectPolicyQualifiers , PolicyNodeImpl rootNode , String curPolicy , Set < PolicyQualifierInfo > pQuals , boolean matchAny ) throws CertPathValidatorException { } }
boolean foundMatch = false ; if ( debug != null ) debug . println ( "PolicyChecker.processParents(): matchAny = " + matchAny ) ; // find matching parents Set < PolicyNodeImpl > parentNodes = rootNode . getPolicyNodesExpected ( certIndex - 1 , curPolicy , matchAny ) ; // for each matching parent , extend policy tree for ( PolicyNodeImpl curParent : parentNodes ) { if ( debug != null ) debug . println ( "PolicyChecker.processParents() " + "found parent:\n" + curParent . asString ( ) ) ; foundMatch = true ; String curParPolicy = curParent . getValidPolicy ( ) ; PolicyNodeImpl curNode = null ; Set < String > curExpPols = null ; if ( curPolicy . equals ( ANY_POLICY ) ) { // do step 2 Set < String > parExpPols = curParent . getExpectedPolicies ( ) ; parentExplicitPolicies : for ( String curParExpPol : parExpPols ) { Iterator < PolicyNodeImpl > childIter = curParent . getChildren ( ) ; while ( childIter . hasNext ( ) ) { PolicyNodeImpl childNode = childIter . next ( ) ; String childPolicy = childNode . getValidPolicy ( ) ; if ( curParExpPol . equals ( childPolicy ) ) { if ( debug != null ) debug . println ( childPolicy + " in parent's " + "expected policy set already appears in " + "child node" ) ; continue parentExplicitPolicies ; } } Set < String > expPols = new HashSet < > ( ) ; expPols . add ( curParExpPol ) ; curNode = new PolicyNodeImpl ( curParent , curParExpPol , pQuals , policiesCritical , expPols , false ) ; } } else { curExpPols = new HashSet < String > ( ) ; curExpPols . add ( curPolicy ) ; curNode = new PolicyNodeImpl ( curParent , curPolicy , pQuals , policiesCritical , curExpPols , false ) ; } } return foundMatch ;
public class UtilMath { /** * Get the rounded value with ceil . * @ param value The value . * @ param round The round factor ( must not be equal to 0 ) . * @ return The rounded value . * @ throws LionEngineException If invalid argument . */ public static int getRoundedC ( double value , int round ) { } }
Check . different ( round , 0 ) ; return ( int ) Math . ceil ( value / round ) * round ;
public class PluginResourceAction { /** * Registers / unregisters an action resource . * @ param shell The running shell . * @ param owner Owner of the resource . * @ param register If true , register the resource . If false , unregister it . */ @ Override public void register ( CareWebShell shell , ElementBase owner , boolean register ) { } }
if ( register ) { ActionRegistry . register ( false , getId ( ) , getLabel ( ) , getScript ( ) ) ; }
public class cachecontentgroup { /** * Use this API to save cachecontentgroup resources . */ public static base_responses save ( nitro_service client , cachecontentgroup resources [ ] ) throws Exception { } }
base_responses result = null ; if ( resources != null && resources . length > 0 ) { cachecontentgroup saveresources [ ] = new cachecontentgroup [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { saveresources [ i ] = new cachecontentgroup ( ) ; saveresources [ i ] . name = resources [ i ] . name ; } result = perform_operation_bulk_request ( client , saveresources , "save" ) ; } return result ;
public class UtcTimeSqlUtil { /** * Tries to retrieve UTC time from the given { @ link java . sql . ResultSet } . * Returns defaultTime if no the associated column has null value . * @ param rs Result set , must be in a state , where a value can be retrieved * @ param columnName Column name , associated with timestamp value , can hold null value * @ param defaultTime Default value , that should be used if returned timestamp is null * @ return UtcTime instance or null if returned timestamp and defaultTime are null * @ throws SQLException On SQL error */ @ Nullable public static UtcTime getNullableUtcTime ( @ Nonnull ResultSet rs , @ Nonnull String columnName , @ Nullable UtcTime defaultTime ) throws SQLException { } }
final Timestamp timestamp = rs . getTimestamp ( columnName , UtcTime . newUtcCalendar ( ) ) ; if ( timestamp == null ) { return defaultTime ; } return UtcTime . valueOf ( timestamp . getTime ( ) ) ;
public class CompareComply { /** * Get information about a specific batch - processing job . * Gets information about a batch - processing job with a specified ID . * @ param getBatchOptions the { @ link GetBatchOptions } containing the options for the call * @ return a { @ link ServiceCall } with a response type of { @ link BatchStatus } */ public ServiceCall < BatchStatus > getBatch ( GetBatchOptions getBatchOptions ) { } }
Validator . notNull ( getBatchOptions , "getBatchOptions cannot be null" ) ; String [ ] pathSegments = { "v1/batches" } ; String [ ] pathParameters = { getBatchOptions . batchId ( ) } ; RequestBuilder builder = RequestBuilder . get ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "compare-comply" , "v1" , "getBatch" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( BatchStatus . class ) ) ;
public class CommerceShipmentItemPersistenceImpl { /** * Returns a range of all the commerce shipment items where groupId = & # 63 ; . * Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link CommerceShipmentItemModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order . * @ param groupId the group ID * @ param start the lower bound of the range of commerce shipment items * @ param end the upper bound of the range of commerce shipment items ( not inclusive ) * @ return the range of matching commerce shipment items */ @ Override public List < CommerceShipmentItem > findByGroupId ( long groupId , int start , int end ) { } }
return findByGroupId ( groupId , start , end , null ) ;
public class Characters { /** * Creates a new Characters instance containing only the given chars . * @ param chars the chars * @ return a new Characters object */ public static Characters of ( char ... chars ) { } }
return chars . length == 0 ? Characters . NONE : new Characters ( false , chars . clone ( ) ) ;
public class EnumRandomizer { /** * Get a subset of enumeration . * @ return the enumeration values minus those excluded . */ private List < E > getFilteredList ( Class < E > enumeration , E ... excludedValues ) { } }
List < E > filteredValues = new ArrayList < > ( ) ; Collections . addAll ( filteredValues , enumeration . getEnumConstants ( ) ) ; if ( excludedValues != null ) { for ( E element : excludedValues ) { filteredValues . remove ( element ) ; } } return filteredValues ;
public class DefaultAnnotationService { /** * ~ Methods * * * * * */ @ Override public List < Annotation > getAnnotations ( String expression ) { } }
requireNotDisposed ( ) ; requireArgument ( AnnotationReader . isValid ( expression ) , "Invalid annotation expression: " + expression ) ; AnnotationReader < Annotation > reader = new AnnotationReader < Annotation > ( _tsdbService ) ; List < Annotation > annotations = new LinkedList < > ( ) ; try { _logger . debug ( "Retrieving annotations using {}." , expression ) ; annotations . addAll ( reader . parse ( expression , Annotation . class ) ) ; } catch ( ParseException ex ) { throw new SystemException ( "Failed to parse the given expression" , ex ) ; } _monitorService . modifyCounter ( Counter . ANNOTATION_READS , annotations . size ( ) , null ) ; return annotations ;
public class TrmFirstContactMessageImpl { /** * Get the value of the TrmFirstContactMessageType from the message . * Javadoc description supplied by TrmFirstContactMessage interface . */ public final TrmFirstContactMessageType getMessageType ( ) { } }
/* Get the int value and get the corresponding TrmFirstContactMessageType to return */ int mType = jmo . getIntField ( TrmFirstContactAccess . MESSAGETYPE ) ; return TrmFirstContactMessageType . getTrmFirstContactMessageType ( mType ) ;
public class AWSCognitoIdentityProviderClient { /** * Updates the device status as an administrator . * Requires developer credentials . * @ param adminUpdateDeviceStatusRequest * The request to update the device status , as an administrator . * @ return Result of the AdminUpdateDeviceStatus operation returned by the service . * @ throws InvalidParameterException * This exception is thrown when the Amazon Cognito service encounters an invalid parameter . * @ throws ResourceNotFoundException * This exception is thrown when the Amazon Cognito service cannot find the requested resource . * @ throws InvalidUserPoolConfigurationException * This exception is thrown when the user pool configuration is invalid . * @ throws TooManyRequestsException * This exception is thrown when the user has made too many requests for a given operation . * @ throws NotAuthorizedException * This exception is thrown when a user is not authorized . * @ throws UserNotFoundException * This exception is thrown when a user is not found . * @ throws InternalErrorException * This exception is thrown when Amazon Cognito encounters an internal error . * @ sample AWSCognitoIdentityProvider . AdminUpdateDeviceStatus * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / cognito - idp - 2016-04-18 / AdminUpdateDeviceStatus " * target = " _ top " > AWS API Documentation < / a > */ @ Override public AdminUpdateDeviceStatusResult adminUpdateDeviceStatus ( AdminUpdateDeviceStatusRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeAdminUpdateDeviceStatus ( request ) ;
public class PermissionFragmentHelper { /** * used only for { @ link Manifest . permission # SYSTEM _ ALERT _ WINDOW } */ @ Override public void onActivityForResult ( int requestCode ) { } }
if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . M ) { if ( requestCode == OVERLAY_PERMISSION_REQ_CODE ) { if ( isSystemAlertGranted ( ) ) { permissionCallback . onPermissionGranted ( new String [ ] { Manifest . permission . SYSTEM_ALERT_WINDOW } ) ; } else { permissionCallback . onPermissionDeclined ( new String [ ] { Manifest . permission . SYSTEM_ALERT_WINDOW } ) ; } } } else { permissionCallback . onPermissionPreGranted ( Manifest . permission . SYSTEM_ALERT_WINDOW ) ; }
public class LeaderAppender { /** * Registers a commit handler for the given commit index . * @ param index The index for which to register the handler . * @ return A completable future to be completed once the given log index has been committed . */ public CompletableFuture < Long > appendEntries ( long index ) { } }
if ( index == 0 ) return appendEntries ( ) ; if ( index <= context . getCommitIndex ( ) ) return CompletableFuture . completedFuture ( index ) ; // If there are no other stateful servers in the cluster , immediately commit the index . if ( context . getClusterState ( ) . getActiveMemberStates ( ) . isEmpty ( ) && context . getClusterState ( ) . getPassiveMemberStates ( ) . isEmpty ( ) ) { long previousCommitIndex = context . getCommitIndex ( ) ; context . setCommitIndex ( index ) ; context . setGlobalIndex ( index ) ; completeCommits ( previousCommitIndex , index ) ; return CompletableFuture . completedFuture ( index ) ; } // If there are no other active members in the cluster , update the commit index and complete the commit . // The updated commit index will be sent to passive / reserve members on heartbeats . else if ( context . getClusterState ( ) . getActiveMemberStates ( ) . isEmpty ( ) ) { long previousCommitIndex = context . getCommitIndex ( ) ; context . setCommitIndex ( index ) ; completeCommits ( previousCommitIndex , index ) ; return CompletableFuture . completedFuture ( index ) ; } // Only send entry - specific AppendRequests to active members of the cluster . return appendFutures . computeIfAbsent ( index , i -> { for ( MemberState member : context . getClusterState ( ) . getActiveMemberStates ( ) ) { appendEntries ( member ) ; } return new CompletableFuture < > ( ) ; } ) ;
public class IntArray { /** * Sets the length of the array , filling with zero if necessary . */ public void setLength ( int size ) { } }
expand ( size ) ; for ( int i = _size ; i < size ; i ++ ) _data [ i ] = 0 ; _size = size ;
public class PdfIndirectObject { /** * Writes efficiently to a stream * @ param os the stream to write to * @ throws IOException on write error */ void writeTo ( OutputStream os ) throws IOException { } }
os . write ( DocWriter . getISOBytes ( String . valueOf ( number ) ) ) ; os . write ( ' ' ) ; os . write ( DocWriter . getISOBytes ( String . valueOf ( generation ) ) ) ; os . write ( STARTOBJ ) ; object . toPdf ( writer , os ) ; os . write ( ENDOBJ ) ;
public class Utils { /** * Return the Java Unicode escape sequence for the given character . For example , the * null character ( 0x00 ) is converted to the string " \ u0000 " . This method is useful * for creating display - friendly strings that contain hidden non - printable characters . * @ param ch Character to be converted . * @ return String containing the Java Unicode escape sequence for the given * character . */ public static String charToEscape ( char ch ) { } }
String hexValue = Integer . toHexString ( ch ) ; if ( hexValue . length ( ) == 1 ) { return "\\u000" + hexValue ; } if ( hexValue . length ( ) == 2 ) { return "\\u00" + hexValue ; } if ( hexValue . length ( ) == 3 ) { return "\\u0" + hexValue ; } return "\\u" + hexValue ;
public class MuxServer { /** * Starts a client call . */ public boolean startCall ( int channel , MuxInputStream in , MuxOutputStream out ) throws IOException { } }
// XXX : Eventually need to check to see if the channel is used . // It ' s not clear whether this should cause a wait or an exception . in . init ( this , channel ) ; out . init ( this , channel ) ; return true ;
public class Classes { /** * Get class field with unchecked runtime exception . JRE throws checked { @ link NoSuchFieldException } if field is * missing , behavior that is not desirable for this library . This method uses runtime , unchecked * { @ link NoSuchBeingException } instead . Returned field has accessibility set to true . * @ param clazz Java class to return field from , * @ param fieldName field name . * @ return class reflective field . * @ throws NoSuchBeingException if field not found . */ public static Field getField ( Class < ? > clazz , String fieldName ) { } }
try { Field field = clazz . getDeclaredField ( fieldName ) ; field . setAccessible ( true ) ; return field ; } catch ( NoSuchFieldException e ) { throw new NoSuchBeingException ( e ) ; } catch ( SecurityException e ) { throw new BugError ( e ) ; }
public class AtomCache { /** * Returns the representation of a { @ link ScopDomain } as a BioJava { @ link Structure } object . * @ param scopId * a SCOP Id * @ param scopDatabase * A { @ link ScopDatabase } to use * @ return a Structure object * @ throws IOException * @ throws StructureException */ public Structure getStructureForDomain ( String scopId , ScopDatabase scopDatabase ) throws IOException , StructureException { } }
ScopDomain domain = scopDatabase . getDomainByScopID ( scopId ) ; return getStructureForDomain ( domain , scopDatabase ) ;
public class LCAGraphManager { /** * perform a dfs in graph to label nodes */ private void proceedFirstDFS ( ) { } }
for ( int i = 0 ; i < nbNodes ; i ++ ) { iterator [ i ] = successors [ i ] . iterator ( ) ; } int i = root ; int k = 0 ; father [ k ] = k ; dfsNumberOfNode [ root ] = k ; nodeOfDfsNumber [ k ] = root ; int j ; k ++ ; while ( true ) { if ( iterator [ i ] . hasNext ( ) ) { j = iterator [ i ] . next ( ) ; if ( dfsNumberOfNode [ j ] == - 1 ) { father [ k ] = dfsNumberOfNode [ i ] ; dfsNumberOfNode [ j ] = k ; nodeOfDfsNumber [ k ] = j ; i = j ; k ++ ; } } else { if ( i == root ) { break ; } else { i = nodeOfDfsNumber [ father [ dfsNumberOfNode [ i ] ] ] ; } } } if ( k != nbActives ) { throw new UnsupportedOperationException ( "LCApreprocess did not reach all nodes" ) ; } for ( ; k < nbNodes ; k ++ ) { father [ k ] = - 1 ; }
public class Logger { /** * Issue a formatted log message with a level of ERROR . * @ param t the throwable * @ param format the format string , as per { @ link String # format ( String , Object . . . ) } * @ param param1 the sole parameter */ public void errorf ( Throwable t , String format , Object param1 ) { } }
if ( isEnabled ( Level . ERROR ) ) { doLogf ( Level . ERROR , FQCN , format , new Object [ ] { param1 } , t ) ; }
public class FogOfWar { /** * In case of active fog of war , check if tile has been discovered . * @ param tx The horizontal tile . * @ param ty The vertical tile . * @ return < code > true < / code > if already discovered , < code > false < / code > else . */ public boolean isVisited ( int tx , int ty ) { } }
return mapHidden . getTile ( tx , ty ) . getNumber ( ) == MapTileFog . NO_FOG ;
public class GeographyValue { /** * Return the list of rings of a polygon . The list has the same * values as the list of rings used to construct the polygon , or * the sequence of WKT rings used to construct the polygon . * @ return A list of rings . */ public List < List < GeographyPointValue > > getRings ( ) { } }
/* * Gets the loops that make up the polygon , with the outer loop first . * Note that we need to convert from XYZPoint to GeographyPointValue . * Include the loop back to the first vertex . Also , since WKT wants * holes oriented Clockwise and S2 wants everything oriented CounterClockWise , * reverse the order of holes . We take care to leave the first vertex * the same . */ List < List < GeographyPointValue > > llLoops = new ArrayList < > ( ) ; boolean isShell = true ; for ( List < XYZPoint > xyzLoop : m_loops ) { List < GeographyPointValue > llLoop = new ArrayList < > ( ) ; // Add the first of xyzLoop first . llLoop . add ( xyzLoop . get ( 0 ) . toGeographyPointValue ( ) ) ; // Add shells left to right , and holes right to left . Make sure // not to add the first element we just added . int startIdx = ( isShell ? 1 : xyzLoop . size ( ) - 1 ) ; int endIdx = ( isShell ? xyzLoop . size ( ) : 0 ) ; int delta = ( isShell ? 1 : - 1 ) ; for ( int idx = startIdx ; idx != endIdx ; idx += delta ) { XYZPoint xyz = xyzLoop . get ( idx ) ; llLoop . add ( xyz . toGeographyPointValue ( ) ) ; } // Close the loop . llLoop . add ( xyzLoop . get ( 0 ) . toGeographyPointValue ( ) ) ; llLoops . add ( llLoop ) ; isShell = false ; } return llLoops ;
public class WebSphereSecurityPermission { /** * public WebSphereSecurityPermission ( String target , String actions ) { / / @ vj1 : Is Serialization affected by the removal of this constructor ? It was present for WAS5X . * super ( target , null ) ; * init ( getMax ( target ) ) ; */ @ Override public boolean implies ( Permission p ) { } }
if ( ! ( p instanceof WebSphereSecurityPermission ) ) return false ; WebSphereSecurityPermission that = ( WebSphereSecurityPermission ) p ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Permission " + this . max + "impliles " + that . max + " = " + ( this . max > that . max ) ) ; } return ( this . max >= that . max ) ;
public class Deferrers { /** * Defer closing of an closeable object . * @ param < T > type of closeable object * @ param closeable an object implements java . io . Closeable * @ return the same closeable object from arguments * @ since 1.0 */ @ Weight ( Weight . Unit . NORMAL ) public static < T extends Closeable > T defer ( @ Nullable final T closeable ) { } }
if ( closeable != null ) { defer ( new Deferred ( ) { private static final long serialVersionUID = 2265124256013043847L ; @ Override public void executeDeferred ( ) throws Exception { IOUtils . closeQuetly ( closeable ) ; } } ) ; } return closeable ;
import java . util . List ; import java . util . Arrays ; public class ComputeKthIndexProduct { /** * Function to calculate the product of elements present at kth index in each tuple from the provided list . * Args : * input _ list : List of arrays * k : Index whose product needs to be computed * Returns : * The product of elements at kth index in all the tuples * Examples : * > > > computeKthIndexProduct ( Arrays . asList ( new Integer [ ] [ ] { { 5 , 6 , 7 } , { 1 , 3 , 5 } , { 8 , 9 , 19 } } ) , 2) * 665 * > > > computeKthIndexProduct ( Arrays . asList ( new Integer [ ] [ ] { { 6 , 7 , 8 } , { 2 , 4 , 6 } , { 9 , 10 , 20 } } ) , 1) * 280 * > > > computeKthIndexProduct ( Arrays . asList ( new Integer [ ] [ ] { { 7 , 8 , 9 } , { 3 , 5 , 7 } , { 10 , 11 , 21 } } ) , 0) * 210 */ public static int computeKthIndexProduct ( List < Integer [ ] > input_list , int k ) { } }
int kth_index_product = input_list . stream ( ) . map ( x -> x [ k ] ) . reduce ( 1 , Math :: multiplyExact ) ; return kth_index_product ;
public class InternalTransaction { /** * < p > Reset the state of a transaction . Used During recovery processing of * TransactionOptimisticReplaceLogRecord to indicate that a transaction must commit or must backout . * Also use by TransactionCheckpointLogRecord to reinstate the transaction state . * @ param recoveredState the transaction state that was reciorded in the logRecord . */ protected void resetState ( int recoveredState ) throws ObjectManagerException { } }
if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "resetState" , "recoveredState=" + recoveredState + "(int) " + stateNames [ recoveredState ] + "(String)" ) ; switch ( recoveredState ) { case ( stateActivePersistent ) : setState ( nextStateForInvolvePersistentObject ) ; break ; case ( statePrePreparedPersistent ) : setState ( nextStateForPrePrepare ) ; break ; case ( statePreparedPersistent ) : setState ( nextStateForPrepare ) ; break ; case ( stateCommitingPersistent ) : setState ( nextStateForStartCommit ) ; break ; case ( stateBackingOutPersistent ) : setState ( nextStateForStartBackout ) ; break ; default : } // switch ( recoveredState ) if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "resetState" ) ;
public class N { /** * { @ link Arrays # binarySearch ( Object [ ] , Object , Comparator ) } * @ param a * @ param key * @ param cmp * @ return */ public static < T > int binarySearch ( final T [ ] a , final T key , final Comparator < ? super T > cmp ) { } }
return Array . binarySearch ( a , key , cmp ) ;
public class IndexHeapMemoryCostUtil { /** * Estimates the on - heap memory cost of the given value . * @ param value the value to estimate the cost of . * @ return the estimated value cost . */ @ SuppressWarnings ( { } }
"checkstyle:npathcomplexity" , "checkstyle:returncount" } ) public static long estimateValueCost ( Object value ) { if ( value == null ) { return 0 ; } Class < ? > clazz = value . getClass ( ) ; Integer cost = KNOWN_FINAL_CLASSES_COSTS . get ( clazz ) ; if ( cost != null ) { return cost ; } if ( value instanceof String ) { return BASE_STRING_COST + ( ( String ) value ) . length ( ) * 2L ; } if ( value instanceof Timestamp ) { return SQL_TIMESTAMP_COST ; } if ( value instanceof Date ) { return DATE_COST ; } if ( clazz . isEnum ( ) ) { // enum values are shared , so they don ' t cost anything return 0 ; } if ( value instanceof BigDecimal ) { return ROUGH_BIG_DECIMAL_COST ; } if ( value instanceof BigInteger ) { return ROUGH_BIG_INTEGER_COST ; } return ROUGH_UNKNOWN_CLASS_COST ;
public class BaseClient { /** * Retrieves source system queries based on the query name ( without the file * type ) and a specified change date parameter . * @ param changeDatePara * The change date specified from which to pull data with a given * query template . * @ param queryName * The source system query name ( without the file type ) . * @ return A given source system query , in String format . */ public String getQuery ( String changeDatePara , String queryName ) { } }
ST st = ( new STGroupDir ( featureSettings . getQueryFolder ( ) , '$' , '$' ) ) . getInstanceOf ( queryName ) ; st . add ( "changeDate" , changeDatePara ) ; return st . render ( ) ;
public class JournalHelper { /** * Format a date for the journal or the logger . */ public static String formatDate ( Date date ) { } }
SimpleDateFormat formatter = new SimpleDateFormat ( TIMESTAMP_FORMAT ) ; return formatter . format ( date ) ;
public class NodeWriteTrx { /** * { @ inheritDoc } */ @ Override public void setQName ( final QName paramName ) throws TTException { } }
checkState ( ! mDelegate . isClosed ( ) , "Transaction is already closed." ) ; checkState ( mDelegate . getCurrentNode ( ) instanceof ITreeNameData , "setQName is not allowed if current node is not an ITreeNameData implementation, but was %s" , mDelegate . getCurrentNode ( ) ) ; final long oldHash = mDelegate . getCurrentNode ( ) . hashCode ( ) ; final ITreeNameData node = ( ITreeNameData ) getPtx ( ) . getData ( mDelegate . getCurrentNode ( ) . getDataKey ( ) ) ; node . setNameKey ( insertName ( buildName ( paramName ) ) ) ; getPtx ( ) . setData ( node ) ; mDelegate . setCurrentNode ( ( ITreeData ) node ) ; adaptHashedWithUpdate ( oldHash ) ;
public class WigUtils { /** * Index the entire Wig file content in a SQLite database managed by the ChunkFrequencyManager . * @ param wigPath Wig file * @ return Path to the database * @ throws Exception */ public static Path index ( Path wigPath ) throws Exception { } }
Path dbPath = wigPath . getParent ( ) . resolve ( WIG_DB ) ; ChunkFrequencyManager chunkFrequencyManager = new ChunkFrequencyManager ( dbPath ) ; // get the chunk size int chunkSize = chunkFrequencyManager . getChunkSize ( ) ; String chromosome = null ; int step , span = 1 , start = 1 , end ; int startChunk , endChunk , partial ; boolean empty = true ; List < Integer > values = new ArrayList < > ( ) ; // reader BufferedReader bufferedReader = FileUtils . newBufferedReader ( wigPath ) ; // main loop String line = bufferedReader . readLine ( ) ; while ( line != null ) { // check for header lines if ( WigUtils . isHeaderLine ( line ) ) { if ( ! empty ) { // save values for the current chromosome into the database System . out . println ( "\tStoring " + values . size ( ) + " values for " + chromosome ) ; // if ( chromosome . equals ( " chr1 " ) ) { computeAndSaveMeanValues ( values , wigPath , chromosome , chunkSize , chunkFrequencyManager ) ; } System . out . println ( "Loading wig data:" + line ) ; if ( WigUtils . isVariableStep ( line ) ) { throw new UnsupportedOperationException ( "Wig coverage file with 'variableStep'" + " is not supported yet." ) ; } // update some values step = WigUtils . getStep ( line ) ; span = WigUtils . getSpan ( line ) ; start = WigUtils . getStart ( line ) ; chromosome = WigUtils . getChromosome ( line ) ; empty = true ; values = new ArrayList < > ( ) ; // sanity check if ( start <= 0 ) { throw new UnsupportedOperationException ( "Wig coverage file with" + " 'start' <= 0, it must be greater than 0." ) ; } if ( start != 1 ) { // we have to put zeros until the start position for ( int i = 0 ; i < start ; i ++ ) { values . add ( 0 ) ; } } if ( step != 1 ) { throw new UnsupportedOperationException ( "Wig coverage file with" + " 'step' != 1 is not supported yet." ) ; } // next line . . . line = bufferedReader . readLine ( ) ; } else { if ( values != null ) { end = start + span - 1 ; startChunk = start / chunkSize ; endChunk = end / chunkSize ; for ( int chunk = startChunk , pos = startChunk * chunkSize ; chunk <= endChunk ; chunk ++ , pos += chunkSize ) { // compute how many values are within the current chunk // and update the chunk partial = Math . min ( end , pos + chunkSize ) - Math . max ( start , pos ) ; values . add ( partial * Integer . parseInt ( line ) ) ; empty = false ; } start += span ; } // next line . . . line = bufferedReader . readLine ( ) ; } } if ( ! empty ) { // save values for the current chromosome into the database System . out . println ( "\tStoring " + values . size ( ) + " values for " + chromosome ) ; // if ( chromosome . equals ( " chr1 " ) ) { computeAndSaveMeanValues ( values , wigPath , chromosome , chunkSize , chunkFrequencyManager ) ; } return dbPath ;
public class ScanJob { /** * Returns true of scanning actually was started , false if it did not need to be */ private boolean startScanning ( ) { } }
BeaconManager beaconManager = BeaconManager . getInstanceForApplication ( getApplicationContext ( ) ) ; beaconManager . setScannerInSameProcess ( true ) ; if ( beaconManager . isMainProcess ( ) ) { LogManager . i ( TAG , "scanJob version %s is starting up on the main process" , BuildConfig . VERSION_NAME ) ; } else { LogManager . i ( TAG , "beaconScanJob library version %s is starting up on a separate process" , BuildConfig . VERSION_NAME ) ; ProcessUtils processUtils = new ProcessUtils ( ScanJob . this ) ; LogManager . i ( TAG , "beaconScanJob PID is " + processUtils . getPid ( ) + " with process name " + processUtils . getProcessName ( ) ) ; } ModelSpecificDistanceCalculator defaultDistanceCalculator = new ModelSpecificDistanceCalculator ( ScanJob . this , BeaconManager . getDistanceModelUpdateUrl ( ) ) ; Beacon . setDistanceCalculator ( defaultDistanceCalculator ) ; return restartScanning ( ) ;
public class DisableBehOnFieldHandler { /** * Constructor . * @ param field The basefield owner of this listener ( usually null and set on setOwner ( ) ) . */ public void init ( BaseField field , BaseListener listenerToDisable , String strDisableOnMatch , boolean bDisableIfMatch ) { } }
super . init ( field ) ; m_listenerToDisable = listenerToDisable ; m_strDisableOnMatch = strDisableOnMatch ; m_bDisableIfMatch = bDisableIfMatch ;
public class LinkedHashMap { /** * link at the end of list */ private void linkNodeLast ( LinkedHashMapEntry < K , V > p ) { } }
LinkedHashMapEntry < K , V > last = tail ; tail = p ; if ( last == null ) head = p ; else { p . before = last ; last . after = p ; }
public class DesignContextMenu { /** * Sets the disabled state of the specified component . * @ param comp The component . * @ param disabled The disabled state . */ private void disable ( IDisable comp , boolean disabled ) { } }
if ( comp != null ) { comp . setDisabled ( disabled ) ; if ( comp instanceof BaseUIComponent ) { ( ( BaseUIComponent ) comp ) . addStyle ( "opacity" , disabled ? ".2" : "1" ) ; } }
public class WriteExecutor { /** * Return a Concept for a given Variable . * This method is expected to be called from implementations of * VarProperty # insert ( Variable ) , provided they include the given Variable in * their PropertyExecutor # requiredVars ( ) . */ public Concept getConcept ( Variable var ) { } }
var = equivalentVars . componentOf ( var ) ; assert var != null ; @ Nullable Concept concept = concepts . get ( var ) ; if ( concept == null ) { @ Nullable ConceptBuilder builder = conceptBuilders . remove ( var ) ; if ( builder != null ) { concept = buildConcept ( var , builder ) ; } } if ( concept != null ) { return concept ; } LOG . debug ( "Could not build concept for {}\nconcepts = {}\nconceptBuilders = {}" , var , concepts , conceptBuilders ) ; throw GraqlQueryException . insertUndefinedVariable ( printableRepresentation ( var ) ) ;
public class SmartOpenIdController { /** * Gets the association response . Determines the mode first . * If mode is set to associate , will set the response . Then * builds the response parameters next and returns . * @ param request the request * @ return the association response */ public Map < String , String > getAssociationResponse ( final HttpServletRequest request ) { } }
val parameters = new ParameterList ( request . getParameterMap ( ) ) ; val mode = parameters . hasParameter ( OpenIdProtocolConstants . OPENID_MODE ) ? parameters . getParameterValue ( OpenIdProtocolConstants . OPENID_MODE ) : null ; val response = FunctionUtils . doIf ( StringUtils . equals ( mode , OpenIdProtocolConstants . ASSOCIATE ) , ( ) -> this . serverManager . associationResponse ( parameters ) , ( ) -> null ) . get ( ) ; val responseParams = new HashMap < String , String > ( ) ; if ( response != null ) { responseParams . putAll ( response . getParameterMap ( ) ) ; } return responseParams ;
public class StructrRelationshipTypeDefinition { /** * - - - - - private methods - - - - - */ private String getSourceMultiplicity ( final Cardinality cardinality ) { } }
switch ( cardinality ) { case OneToOne : case OneToMany : return "1" ; case ManyToOne : case ManyToMany : return "*" ; } return null ;
public class RespokeClient { /** * Connect to the Respoke infrastructure and authenticate in development mode using the specified endpoint ID and app ID . * Attempt to obtain an authentication token automatically from the Respoke infrastructure . * @ param endpointID The endpoint ID to use when connecting * @ param appID Your Application ID * @ param shouldReconnect Whether or not to automatically reconnect to the Respoke service when a disconnect occurs . * @ param initialPresence The optional initial presence value to set for this client * @ param context An application context with which to access system resources * @ param completionListener A listener to be called when an error occurs , passing a string describing the error */ public void connect ( String endpointID , String appID , boolean shouldReconnect , final Object initialPresence , Context context , final ConnectCompletionListener completionListener ) { } }
if ( ( endpointID != null ) && ( appID != null ) && ( endpointID . length ( ) > 0 ) && ( appID . length ( ) > 0 ) ) { connectionInProgress = true ; reconnect = shouldReconnect ; applicationID = appID ; appContext = context ; APIGetToken request = new APIGetToken ( context , baseURL ) { @ Override public void transactionComplete ( ) { super . transactionComplete ( ) ; if ( success ) { connect ( this . token , initialPresence , appContext , new ConnectCompletionListener ( ) { @ Override public void onError ( final String errorMessage ) { connectionInProgress = false ; postConnectError ( completionListener , errorMessage ) ; } } ) ; } else { connectionInProgress = false ; postConnectError ( completionListener , this . errorMessage ) ; } } } ; request . appID = appID ; request . endpointID = endpointID ; request . go ( ) ; } else { postConnectError ( completionListener , "AppID and endpointID must be specified" ) ; }
public class ReflectionUtil { /** * 循环向上转型 , 获取类对象的DeclaredField . */ public static Field getDeclaredField ( Class < ? > clz , final String fieldName ) { } }
for ( Class < ? > s = clz ; s != Object . class ; s = s . getSuperclass ( ) ) { try { return s . getDeclaredField ( fieldName ) ; } catch ( NoSuchFieldException ignored ) { } } return null ;
public class GenericIndexed { private static < T > GenericIndexed < T > createGenericIndexedVersionOne ( ByteBuffer byteBuffer , ObjectStrategy < T > strategy ) { } }
boolean allowReverseLookup = byteBuffer . get ( ) == REVERSE_LOOKUP_ALLOWED ; int size = byteBuffer . getInt ( ) ; ByteBuffer bufferToUse = byteBuffer . asReadOnlyBuffer ( ) ; bufferToUse . limit ( bufferToUse . position ( ) + size ) ; byteBuffer . position ( bufferToUse . limit ( ) ) ; return new GenericIndexed < > ( bufferToUse , strategy , allowReverseLookup ) ;
public class GetResponseUnmarshaller { /** * { @ inheritDoc } */ @ Override public Object unMarshall ( Response < GetResponse > response , Class < ? > entity ) { } }
this . entity = ClassUtil . newInstance ( entity ) ; try { consume ( response . getResult ( ) ) ; if ( found ) { return this . entity ; } else { return null ; } } catch ( Exception e ) { throw new MappingException ( e ) ; }
public class Mapper { /** * Return the results of mapping all objects with the mapper . * @ param mapper an Mapper * @ param en an Enumeration * @ param allowNull allow null values * @ return a Collection of the results . */ public static Collection map ( Mapper mapper , Enumeration en , boolean allowNull ) { } }
ArrayList l = new ArrayList ( ) ; while ( en . hasMoreElements ( ) ) { Object o = mapper . map ( en . nextElement ( ) ) ; if ( allowNull || o != null ) { l . add ( o ) ; } } return l ;
public class HBCIUtils { /** * Wandelt ein gegebenes Datums - Objekt in einen String um , der sowohl Datum * als auch Uhrzeit enthält . Das Format des erzeugten Strings ist abhängig von der gesetzten * < em > HBCI4Java < / em > - Locale ( siehe Kernel - Parameter < code > kernel . locale . * < / code > ) . * @ param date ein Datumsobjekt * @ return die lokalisierte Darstellung des Datums - Objektes */ public static String datetime2StringLocal ( Date date ) { } }
String ret ; try { ret = DateFormat . getDateTimeInstance ( DateFormat . SHORT , DateFormat . SHORT , Locale . getDefault ( ) ) . format ( date ) ; } catch ( Exception e ) { throw new InvalidArgumentException ( date . toString ( ) ) ; } return ret ;
public class DeleteFacesRequest { /** * An array of face IDs to delete . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setFaceIds ( java . util . Collection ) } or { @ link # withFaceIds ( java . util . Collection ) } if you want to override * the existing values . * @ param faceIds * An array of face IDs to delete . * @ return Returns a reference to this object so that method calls can be chained together . */ public DeleteFacesRequest withFaceIds ( String ... faceIds ) { } }
if ( this . faceIds == null ) { setFaceIds ( new java . util . ArrayList < String > ( faceIds . length ) ) ; } for ( String ele : faceIds ) { this . faceIds . add ( ele ) ; } return this ;
public class Pitch { /** * norm _ corr - Find the normalized correlation between the target vector and * the filtered past excitation . */ public static void norm_corr ( float exc [ ] , int excs , /* input : excitation buffer */ float xn [ ] , int xns , /* input : target vector */ float h [ ] , int hs , /* input : imp response of synth and weighting flt */ int l_subfr , /* input : Length of frame to compute pitch */ int t_min , /* input : minimum value of searched range */ int t_max , /* input : maximum value of search range */ float corr_norm [ ] , int cs /* output : normalized correlation ( correlation between target and filtered excitation divided by the square root of energy of filtered excitation ) */ ) { } }
int i , j , k ; float excf [ ] = new float [ LD8KConstants . L_SUBFR ] ; /* filtered past excitation */ float alp , s , norm ; k = - t_min ; /* compute the filtered excitation for the first delay t _ min */ Filter . convolve ( exc , excs + k , h , 0 , excf , 0 , l_subfr ) ; /* loop for every possible period */ for ( i = t_min ; i <= t_max ; i ++ ) { /* Compute 1 / sqrt ( energie of excf [ ] ) */ alp = ( float ) 0.01 ; for ( j = 0 ; j < l_subfr ; j ++ ) alp += excf [ j ] * excf [ j ] ; norm = inv_sqrt ( alp ) ; /* Compute correlation between xn [ ] and excf [ ] */ s = ( float ) 0.0 ; for ( j = 0 ; j < l_subfr ; j ++ ) s += xn [ xns + j ] * excf [ j ] ; /* Normalize correlation = correlation * ( 1 / sqrt ( energie ) ) */ corr_norm [ cs + i ] = s * norm ; /* modify the filtered excitation excf [ ] for the next iteration */ if ( i != t_max ) { k -- ; for ( j = l_subfr - 1 ; j > 0 ; j -- ) excf [ j ] = excf [ j - 1 ] + exc [ excs + k ] * h [ j ] ; excf [ 0 ] = exc [ excs + k ] ; } } return ;
public class AnnotationUtility { /** * Iterate over annotations of currentElement . Accept only annotation in * accepted set . * @ param currentElement the current element * @ param filter the filter * @ param listener the listener */ public static void forEachAnnotations ( Element currentElement , AnnotationFilter filter , AnnotationFoundListener listener ) { } }
final Elements elementUtils = BaseProcessor . elementUtils ; List < ? extends AnnotationMirror > annotationList = elementUtils . getAllAnnotationMirrors ( currentElement ) ; String annotationClassName ; // boolean valid = true ; for ( AnnotationMirror annotation : annotationList ) { Map < String , String > values = new HashMap < String , String > ( ) ; annotationClassName = annotation . getAnnotationType ( ) . asElement ( ) . toString ( ) ; if ( filter != null && ! filter . isAccepted ( annotationClassName ) ) { continue ; } values . clear ( ) ; for ( Entry < ? extends ExecutableElement , ? extends AnnotationValue > annotationItem : elementUtils . getElementValuesWithDefaults ( annotation ) . entrySet ( ) ) { String value = annotationItem . getValue ( ) . toString ( ) ; if ( value . startsWith ( "\"" ) && value . endsWith ( "\"" ) ) { value = value . substring ( 1 ) ; value = value . substring ( 0 , value . length ( ) - 1 ) ; } values . put ( annotationItem . getKey ( ) . getSimpleName ( ) . toString ( ) , value ) ; } if ( listener != null ) { listener . onAcceptAnnotation ( currentElement , annotationClassName , values ) ; } }
public class MutableURI { /** * Returns the values of the given parameter . * @ param name name of the parameter * @ return an unmodifable { @ link java . util . List } of values for the given parameter name */ public List /* < String > */ getParameters ( String name ) { } }
if ( _parameters == null || ! _parameters . hasParameters ( ) ) return Collections . EMPTY_LIST ; else { List parameters = _parameters . getParameterValues ( name ) ; if ( parameters == null ) return Collections . EMPTY_LIST ; else return Collections . unmodifiableList ( parameters ) ; }
public class JwtConsumerConfigImpl { /** * End OSGi - related fields and methods */ private void process ( Map < String , Object > props ) { } }
if ( props == null || props . isEmpty ( ) ) { return ; } id = JwtUtils . trimIt ( ( String ) props . get ( JwtUtils . CFG_KEY_ID ) ) ; issuer = JwtUtils . trimIt ( ( String ) props . get ( JwtUtils . CFG_KEY_ISSUER ) ) ; sharedKey = JwtConfigUtil . processProtectedString ( props , JwtUtils . CFG_KEY_SHARED_KEY ) ; audiences = JwtUtils . trimIt ( ( String [ ] ) props . get ( JwtUtils . CFG_KEY_AUDIENCES ) ) ; sigAlg = JwtUtils . trimIt ( ( String ) props . get ( JwtUtils . CFG_KEY_SIGNATURE_ALGORITHM ) ) ; trustStoreRef = JwtUtils . trimIt ( ( String ) props . get ( JwtUtils . CFG_KEY_TRUSTSTORE_REF ) ) ; trustedAlias = JwtUtils . trimIt ( ( String ) props . get ( JwtUtils . CFG_KEY_TRUSTED_ALIAS ) ) ; clockSkewMilliSeconds = ( Long ) props . get ( JwtUtils . CFG_KEY_CLOCK_SKEW ) ; validationRequired = ( Boolean ) props . get ( JwtUtils . CFG_KEY_VALIDATION_REQUIRED ) ; // internal jwkEnabled = ( Boolean ) props . get ( JwtUtils . CFG_KEY_JWK_ENABLED ) ; // internal jwkEndpointUrl = JwtUtils . trimIt ( ( String ) props . get ( JwtUtils . CFG_KEY_JWK_ENDPOINT_URL ) ) ; // internal sslRef = JwtUtils . trimIt ( ( String ) props . get ( JwtUtils . CFG_KEY_SSL_REF ) ) ; useSystemPropertiesForHttpClientConnections = ( Boolean ) props . get ( JwtUtils . CFG_KEY_USE_SYSPROPS_FOR_HTTPCLIENT_CONNECTONS ) ; consumerUtil = new ConsumerUtils ( keyStoreServiceRef ) ; jwkSet = null ; // the jwkEndpoint may have been changed during dynamic update
public class ManagedClustersInner { /** * Gets a list of managed clusters in the specified subscription . * Gets a list of managed clusters in the specified subscription . The operation returns properties of each managed cluster . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; ManagedClusterInner & gt ; object */ public Observable < Page < ManagedClusterInner > > listNextAsync ( final String nextPageLink ) { } }
return listNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < ManagedClusterInner > > , Page < ManagedClusterInner > > ( ) { @ Override public Page < ManagedClusterInner > call ( ServiceResponse < Page < ManagedClusterInner > > response ) { return response . body ( ) ; } } ) ;
public class JcElement { /** * < div color = ' red ' style = " font - size : 24px ; color : red " > < b > < i > < u > JCYPHER < / u > < / i > < / b > < / div > * < div color = ' red ' style = " font - size : 18px ; color : red " > < i > access a named property < / i > < / div > * < br / > */ public JcProperty property ( String name ) { } }
JcProperty ret = new JcProperty ( name , this , OPERATOR . PropertyContainer . PROPERTY_ACCESS ) ; QueryRecorder . recordInvocationConditional ( this , "property" , ret , QueryRecorder . literal ( name ) ) ; return ret ;
public class XMLAssert { /** * Assert that two XML documents are NOT similar * @ param control XML to be compared against * @ param test XML to be tested * @ throws SAXException * @ throws IOException */ public static void assertXMLNotEqual ( Reader control , Reader test ) throws SAXException , IOException { } }
assertXMLNotEqual ( null , control , test ) ;
public class RootDocImpl { /** * Return the path of the overview file and null if it does not exist . * @ return the path of the overview file and null if it does not exist . */ private JavaFileObject getOverviewPath ( ) { } }
for ( String [ ] opt : options ) { if ( opt [ 0 ] . equals ( "-overview" ) ) { if ( env . fileManager instanceof StandardJavaFileManager ) { StandardJavaFileManager fm = ( StandardJavaFileManager ) env . fileManager ; return fm . getJavaFileObjects ( opt [ 1 ] ) . iterator ( ) . next ( ) ; } } } return null ;
public class AbstractQueue { /** * Serialize a queue message to bytes . * @ param queueMsg * @ return * @ since 0.7.0 */ protected byte [ ] serialize ( IQueueMessage < ID , DATA > queueMsg ) { } }
return queueMsg != null ? SerializationUtils . toByteArray ( queueMsg ) : null ;
public class Cache { /** * Caches the specified object identified by the specified key . * @ param key a unique key for this object * @ param val the object to be cached */ public void cache ( Object key , T val ) { } }
cache . put ( key , new SoftReference < T > ( val ) ) ;
public class XBinaryOperationImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public NotificationChain basicSetLeftOperand ( XExpression newLeftOperand , NotificationChain msgs ) { } }
XExpression oldLeftOperand = leftOperand ; leftOperand = newLeftOperand ; if ( eNotificationRequired ( ) ) { ENotificationImpl notification = new ENotificationImpl ( this , Notification . SET , XbasePackage . XBINARY_OPERATION__LEFT_OPERAND , oldLeftOperand , newLeftOperand ) ; if ( msgs == null ) msgs = notification ; else msgs . add ( notification ) ; } return msgs ;
public class ContentTargeting { /** * Sets the excludedContentMetadata value for this ContentTargeting . * @ param excludedContentMetadata * A list of content metadata within hierarchies that are being * excluded by the { @ code LineItem } . */ public void setExcludedContentMetadata ( com . google . api . ads . admanager . axis . v201805 . ContentMetadataKeyHierarchyTargeting [ ] excludedContentMetadata ) { } }
this . excludedContentMetadata = excludedContentMetadata ;