signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ScalarWithFallback { /** * Finds the best fallback for the given exception type and apply it to
* the exception or throw the original error if no fallback found .
* @ param exp The original exception
* @ return Result of the most suitable fallback
* @ throws Exception The original exception if no fallback found */
@ SuppressWarnings ( "PMD.AvoidThrowingRawExceptionTypes" ) private T fallback ( final Throwable exp ) throws Exception { } } | final Sorted < Map . Entry < FallbackFrom < T > , Integer > > candidates = new Sorted < > ( Comparator . comparing ( Map . Entry :: getValue ) , new Filtered < > ( entry -> new Not ( new Equals < > ( entry :: getValue , ( ) -> Integer . MIN_VALUE ) ) . value ( ) , new MapOf < > ( fbk -> fbk , fbk -> fbk . support ( exp . getClass ( ) ) , this . fallbacks ) . entrySet ( ) . iterator ( ) ) ) ; if ( candidates . hasNext ( ) ) { return candidates . next ( ) . getKey ( ) . apply ( exp ) ; } else { throw new Exception ( "No fallback found - throw the original exception" , exp ) ; } |
public class ExecMojo { /** * - - - - helpers - - - - - */
protected void execute ( CommandLine cmdLine ) throws MojoFailureException , MojoExecutionException { } } | try { DefaultExecutor executor = new DefaultExecutor ( ) ; executor . setWorkingDirectory ( workingDir ) ; executor . setStreamHandler ( new PumpStreamHandler ( System . out , System . err , System . in ) ) ; executor . execute ( cmdLine ) ; } catch ( ExecuteException e ) { throw new MojoFailureException ( "npm failure" , e ) ; } catch ( IOException e ) { throw new MojoExecutionException ( "Error executing NPM" , e ) ; } |
public class ExtensionScript { /** * Invokes the given { @ code script } , synchronously , as a { @ link ProxyScript } , handling any { @ code Exception } thrown during
* the invocation .
* The context class loader of caller thread is replaced with the class loader { @ code AddOnLoader } to allow the script to
* access classes of add - ons .
* @ param script the script to invoke .
* @ param msg the HTTP message being proxied .
* @ param request { @ code true } if processing the request , { @ code false } otherwise .
* @ return { @ code true } if the request should be forward to the server , { @ code false } otherwise .
* @ since 2.2.0
* @ see # getInterface ( ScriptWrapper , Class ) */
public boolean invokeProxyScript ( ScriptWrapper script , HttpMessage msg , boolean request ) { } } | validateScriptType ( script , TYPE_PROXY ) ; Writer writer = getWriters ( script ) ; try { // Dont need to check if enabled as it can only be invoked manually
ProxyScript s = this . getInterface ( script , ProxyScript . class ) ; if ( s != null ) { if ( request ) { return s . proxyRequest ( msg ) ; } else { return s . proxyResponse ( msg ) ; } } else { handleUnspecifiedScriptError ( script , writer , Constant . messages . getString ( "script.interface.proxy.error" ) ) ; } } catch ( Exception e ) { handleScriptException ( script , writer , e ) ; } // Return true so that the request is submitted - if we returned false all proxying would fail on script errors
return true ; |
public class DetachClassicLinkVpcRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional
* parameters to enable operation dry - run . */
@ Override public Request < DetachClassicLinkVpcRequest > getDryRunRequest ( ) { } } | Request < DetachClassicLinkVpcRequest > request = new DetachClassicLinkVpcRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ; |
public class JacksonTypeOracle { /** * < p > getClassFromJsonDeserializeAnnotation < / p >
* @ param logger a { @ link com . google . gwt . core . ext . TreeLogger } object .
* @ param annotation a { @ link java . lang . annotation . Annotation } object .
* @ param name a { @ link java . lang . String } object .
* @ return a { @ link com . google . gwt . thirdparty . guava . common . base . Optional } object . */
public Optional < JClassType > getClassFromJsonDeserializeAnnotation ( TreeLogger logger , Annotation annotation , String name ) { } } | try { Class asClass = ( Class ) annotation . getClass ( ) . getDeclaredMethod ( name ) . invoke ( annotation ) ; if ( asClass != Void . class ) { return Optional . fromNullable ( getType ( asClass . getCanonicalName ( ) ) ) ; } } catch ( Exception e ) { logger . log ( Type . ERROR , "Cannot find method " + name + " on JsonDeserialize annotation" , e ) ; } return Optional . absent ( ) ; |
public class WebvttDestinationSettingsMarshaller { /** * Marshall the given parameter object . */
public void marshall ( WebvttDestinationSettings webvttDestinationSettings , ProtocolMarshaller protocolMarshaller ) { } } | if ( webvttDestinationSettings == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class AsImpl { /** * Initialize FSM for SGW side */
private void initLocalFSM ( ) { } } | this . localFSM = new FSM ( this . name + "_LOCAL" ) ; // Define states
this . localFSM . createState ( AsState . DOWN . toString ( ) ) . setOnEnter ( new SEHLocalAsStateEnterDown ( this ) ) ; this . localFSM . createState ( AsState . ACTIVE . toString ( ) ) . setOnEnter ( new SEHLocalAsStateEnterActive ( this ) ) ; this . localFSM . createState ( AsState . INACTIVE . toString ( ) ) . setOnEnter ( new SEHLocalAsStateEnterInactive ( this ) ) ; this . localFSM . createState ( AsState . PENDING . toString ( ) ) . setOnTimeOut ( new RemAsStatePenTimeout ( this , this . localFSM ) , 2000 ) . setOnEnter ( new SEHLocalAsStateEnterPen ( this , this . localFSM ) ) ; this . localFSM . setStart ( AsState . DOWN . toString ( ) ) ; this . localFSM . setEnd ( AsState . DOWN . toString ( ) ) ; // Define Transitions
// STATE DOWN /
this . localFSM . createTransition ( TransitionState . ASP_UP , AsState . DOWN . toString ( ) , AsState . INACTIVE . toString ( ) ) . setHandler ( new THLocalAsDwnToInact ( this , this . localFSM ) ) ; this . localFSM . createTransition ( TransitionState . ASP_DOWN , AsState . DOWN . toString ( ) , AsState . DOWN . toString ( ) ) ; // STATE INACTIVE /
// TODO : Add Pluggable policy for AS ?
this . localFSM . createTransition ( TransitionState . ASP_ACTIVE , AsState . INACTIVE . toString ( ) , AsState . ACTIVE . toString ( ) ) . setHandler ( new THLocalAsInactToAct ( this , this . localFSM ) ) ; this . localFSM . createTransition ( TransitionState . ASP_DOWN , AsState . INACTIVE . toString ( ) , AsState . DOWN . toString ( ) ) . setHandler ( new THLocalAsInactToDwn ( this , this . localFSM ) ) ; this . localFSM . createTransition ( TransitionState . ASP_UP , AsState . INACTIVE . toString ( ) , AsState . INACTIVE . toString ( ) ) . setHandler ( new THLocalAsInactToInact ( this , this . localFSM ) ) ; // STATE ACTIVE /
this . localFSM . createTransition ( TransitionState . ASP_INACTIVE , AsState . ACTIVE . toString ( ) , AsState . PENDING . toString ( ) ) . setHandler ( new THLocalAsActToPendRemAspInac ( this , this . localFSM ) ) ; this . localFSM . createTransition ( TransitionState . ASP_DOWN , AsState . ACTIVE . toString ( ) , AsState . PENDING . toString ( ) ) . setHandler ( new THLocalAsActToPendRemAspDwn ( this , this . localFSM ) ) ; this . localFSM . createTransition ( TransitionState . ASP_ACTIVE , AsState . ACTIVE . toString ( ) , AsState . ACTIVE . toString ( ) ) . setHandler ( new THLocalAsActToActRemAspAct ( this , this . localFSM ) ) ; this . localFSM . createTransition ( TransitionState . ASP_UP , AsState . ACTIVE . toString ( ) , AsState . PENDING . toString ( ) ) . setHandler ( new THLocalAsActToPendRemAspInac ( this , this . localFSM ) ) ; // STATE PENDING /
this . localFSM . createTransition ( TransitionState . ASP_DOWN , AsState . PENDING . toString ( ) , AsState . DOWN . toString ( ) ) . setHandler ( new THNoTrans ( ) ) ; this . localFSM . createTransition ( TransitionState . ASP_UP , AsState . PENDING . toString ( ) , AsState . INACTIVE . toString ( ) ) . setHandler ( new THNoTrans ( ) ) ; this . localFSM . createTransition ( TransitionState . ASP_ACTIVE , AsState . PENDING . toString ( ) , AsState . ACTIVE . toString ( ) ) . setHandler ( new THLocalAsPendToAct ( this , this . localFSM ) ) ; this . localFSM . createTransition ( TransitionState . AS_DOWN , AsState . PENDING . toString ( ) , AsState . DOWN . toString ( ) ) ; this . localFSM . createTransition ( TransitionState . AS_INACTIVE , AsState . PENDING . toString ( ) , AsState . INACTIVE . toString ( ) ) ; |
public class ST_YMax { /** * Returns the maximal y - value of the given geometry .
* @ param geom Geometry
* @ return The maximal y - value of the given geometry , or null if the geometry is null . */
public static Double getMaxY ( Geometry geom ) { } } | if ( geom != null ) { return geom . getEnvelopeInternal ( ) . getMaxY ( ) ; } else { return null ; } |
public class ListUserPoolClientsResult { /** * The user pool clients in the response that lists user pool clients .
* @ param userPoolClients
* The user pool clients in the response that lists user pool clients . */
public void setUserPoolClients ( java . util . Collection < UserPoolClientDescription > userPoolClients ) { } } | if ( userPoolClients == null ) { this . userPoolClients = null ; return ; } this . userPoolClients = new java . util . ArrayList < UserPoolClientDescription > ( userPoolClients ) ; |
public class NotificationHubsInner { /** * test send a push notification .
* @ param resourceGroupName The name of the resource group .
* @ param namespaceName The namespace name .
* @ param notificationHubName The notification hub name .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the DebugSendResponseInner object */
public Observable < ServiceResponse < DebugSendResponseInner > > debugSendWithServiceResponseAsync ( String resourceGroupName , String namespaceName , String notificationHubName ) { } } | if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( namespaceName == null ) { throw new IllegalArgumentException ( "Parameter namespaceName is required and cannot be null." ) ; } if ( notificationHubName == null ) { throw new IllegalArgumentException ( "Parameter notificationHubName is required and cannot be null." ) ; } if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } final Object parameters = null ; return service . debugSend ( resourceGroupName , namespaceName , notificationHubName , this . client . subscriptionId ( ) , parameters , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < DebugSendResponseInner > > > ( ) { @ Override public Observable < ServiceResponse < DebugSendResponseInner > > call ( Response < ResponseBody > response ) { try { ServiceResponse < DebugSendResponseInner > clientResponse = debugSendDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class JmsManagedConnectionFactoryImpl { /** * This method is used to create a JMS Connection object . < p >
* This method is overriden by subclasses so that the appropriate connection
* type is returned whenever this method is called
* ( e . g . from within createConnection ( ) ) . */
JmsConnectionImpl instantiateConnection ( JmsJcaConnection jcaConnection , Map < String , String > _passThruProps ) throws JMSException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "instantiateConnection" , jcaConnection ) ; JmsConnectionImpl jmsConnection = new JmsConnectionImpl ( jcaConnection , isManaged ( ) , _passThruProps ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "instantiateConnection" , jmsConnection ) ; return jmsConnection ; |
public class DRL5Lexer { /** * $ ANTLR start " OctalEscape " */
public final void mOctalEscape ( ) throws RecognitionException { } } | try { // src / main / resources / org / drools / compiler / lang / DRL5Lexer . g : 136:5 : ( ' \ \ \ \ ' ( ' 0 ' . . ' 3 ' ) ( ' 0 ' . . ' 7 ' ) ( ' 0 ' . . ' 7 ' ) | ' \ \ \ \ ' ( ' 0 ' . . ' 7 ' ) ( ' 0 ' . . ' 7 ' ) | ' \ \ \ \ ' ( ' 0 ' . . ' 7 ' ) )
int alt55 = 3 ; int LA55_0 = input . LA ( 1 ) ; if ( ( LA55_0 == '\\' ) ) { int LA55_1 = input . LA ( 2 ) ; if ( ( ( LA55_1 >= '0' && LA55_1 <= '3' ) ) ) { int LA55_2 = input . LA ( 3 ) ; if ( ( ( LA55_2 >= '0' && LA55_2 <= '7' ) ) ) { int LA55_4 = input . LA ( 4 ) ; if ( ( ( LA55_4 >= '0' && LA55_4 <= '7' ) ) ) { alt55 = 1 ; } else { alt55 = 2 ; } } else { alt55 = 3 ; } } else if ( ( ( LA55_1 >= '4' && LA55_1 <= '7' ) ) ) { int LA55_3 = input . LA ( 3 ) ; if ( ( ( LA55_3 >= '0' && LA55_3 <= '7' ) ) ) { alt55 = 2 ; } else { alt55 = 3 ; } } else { if ( state . backtracking > 0 ) { state . failed = true ; return ; } int nvaeMark = input . mark ( ) ; try { input . consume ( ) ; NoViableAltException nvae = new NoViableAltException ( "" , 55 , 1 , input ) ; throw nvae ; } finally { input . rewind ( nvaeMark ) ; } } } else { if ( state . backtracking > 0 ) { state . failed = true ; return ; } NoViableAltException nvae = new NoViableAltException ( "" , 55 , 0 , input ) ; throw nvae ; } switch ( alt55 ) { case 1 : // src / main / resources / org / drools / compiler / lang / DRL5Lexer . g : 136:9 : ' \ \ \ \ ' ( ' 0 ' . . ' 3 ' ) ( ' 0 ' . . ' 7 ' ) ( ' 0 ' . . ' 7 ' )
{ match ( '\\' ) ; if ( state . failed ) return ; if ( ( input . LA ( 1 ) >= '0' && input . LA ( 1 ) <= '3' ) ) { input . consume ( ) ; state . failed = false ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return ; } MismatchedSetException mse = new MismatchedSetException ( null , input ) ; recover ( mse ) ; throw mse ; } if ( ( input . LA ( 1 ) >= '0' && input . LA ( 1 ) <= '7' ) ) { input . consume ( ) ; state . failed = false ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return ; } MismatchedSetException mse = new MismatchedSetException ( null , input ) ; recover ( mse ) ; throw mse ; } if ( ( input . LA ( 1 ) >= '0' && input . LA ( 1 ) <= '7' ) ) { input . consume ( ) ; state . failed = false ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return ; } MismatchedSetException mse = new MismatchedSetException ( null , input ) ; recover ( mse ) ; throw mse ; } } break ; case 2 : // src / main / resources / org / drools / compiler / lang / DRL5Lexer . g : 137:9 : ' \ \ \ \ ' ( ' 0 ' . . ' 7 ' ) ( ' 0 ' . . ' 7 ' )
{ match ( '\\' ) ; if ( state . failed ) return ; if ( ( input . LA ( 1 ) >= '0' && input . LA ( 1 ) <= '7' ) ) { input . consume ( ) ; state . failed = false ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return ; } MismatchedSetException mse = new MismatchedSetException ( null , input ) ; recover ( mse ) ; throw mse ; } if ( ( input . LA ( 1 ) >= '0' && input . LA ( 1 ) <= '7' ) ) { input . consume ( ) ; state . failed = false ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return ; } MismatchedSetException mse = new MismatchedSetException ( null , input ) ; recover ( mse ) ; throw mse ; } } break ; case 3 : // src / main / resources / org / drools / compiler / lang / DRL5Lexer . g : 138:9 : ' \ \ \ \ ' ( ' 0 ' . . ' 7 ' )
{ match ( '\\' ) ; if ( state . failed ) return ; if ( ( input . LA ( 1 ) >= '0' && input . LA ( 1 ) <= '7' ) ) { input . consume ( ) ; state . failed = false ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return ; } MismatchedSetException mse = new MismatchedSetException ( null , input ) ; recover ( mse ) ; throw mse ; } } break ; } } finally { // do for sure before leaving
} |
public class LogBuffer { /** * Return next 24 - bit unsigned int from buffer . ( big - endian )
* @ see mysql - 5.6.10 / include / myisampack . h - mi _ usint3korr */
public final int getBeUint24 ( ) { } } | if ( position + 2 >= origin + limit ) throw new IllegalArgumentException ( "limit excceed: " + ( position - origin + 2 ) ) ; byte [ ] buf = buffer ; return ( ( 0xff & buf [ position ++ ] ) << 16 ) | ( ( 0xff & buf [ position ++ ] ) << 8 ) | ( 0xff & buf [ position ++ ] ) ; |
public class BoardsApi { /** * Creates a new Issue Board list .
* < pre > < code > GitLab Endpoint : POST / projects / : id / boards / : board _ id / lists < / code > < / pre >
* @ param projectIdOrPath the project in the form of an Integer ( ID ) , String ( path ) , or Project instance
* @ param boardId the ID of the board
* @ param labelId the ID of the label
* @ return the created BoardList instance
* @ throws GitLabApiException if any exception occurs */
public BoardList createBoardList ( Object projectIdOrPath , Integer boardId , Integer labelId ) throws GitLabApiException { } } | GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "label_id" , labelId , true ) ; Response response = post ( Response . Status . CREATED , formData , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "boards" , boardId , "lists" ) ; return ( response . readEntity ( BoardList . class ) ) ; |
public class ControlNackImpl { /** * Get summary trace line for this message
* Javadoc description supplied by ControlMessage interface . */
public void getTraceSummaryLine ( StringBuilder buff ) { } } | // Get the common fields for control messages
super . getTraceSummaryLine ( buff ) ; buff . append ( ",startTick=" ) ; buff . append ( getStartTick ( ) ) ; buff . append ( ",endTick=" ) ; buff . append ( getEndTick ( ) ) ; buff . append ( ",force=" ) ; buff . append ( getForce ( ) ) ; |
public class SQLExpressions { /** * Create a new detached SQLQuery instance with the given projection
* @ param expr projection
* @ param < T >
* @ return select ( expr ) */
public static < T > SQLQuery < T > select ( Expression < T > expr ) { } } | return new SQLQuery < Void > ( ) . select ( expr ) ; |
public class br_enable { /** * < pre >
* Use this operation to enable Repeater Instances in bulk .
* < / pre > */
public static br_enable [ ] enable ( nitro_service client , br_enable [ ] resources ) throws Exception { } } | if ( resources == null ) throw new Exception ( "Null resource array" ) ; if ( resources . length == 1 ) return ( ( br_enable [ ] ) resources [ 0 ] . perform_operation ( client , "enable" ) ) ; return ( ( br_enable [ ] ) perform_operation_bulk_request ( client , resources , "enable" ) ) ; |
public class AbstractSkeleton { /** * Mangles a classname . */
public static String mangleClass ( Class cl , boolean isFull ) { } } | String name = cl . getName ( ) ; if ( name . equals ( "boolean" ) || name . equals ( "java.lang.Boolean" ) ) return "boolean" ; else if ( name . equals ( "int" ) || name . equals ( "java.lang.Integer" ) || name . equals ( "short" ) || name . equals ( "java.lang.Short" ) || name . equals ( "byte" ) || name . equals ( "java.lang.Byte" ) ) return "int" ; else if ( name . equals ( "long" ) || name . equals ( "java.lang.Long" ) ) return "long" ; else if ( name . equals ( "float" ) || name . equals ( "java.lang.Float" ) || name . equals ( "double" ) || name . equals ( "java.lang.Double" ) ) return "double" ; else if ( name . equals ( "java.lang.String" ) || name . equals ( "com.caucho.util.CharBuffer" ) || name . equals ( "char" ) || name . equals ( "java.lang.Character" ) || name . equals ( "java.io.Reader" ) ) return "string" ; else if ( name . equals ( "java.util.Date" ) || name . equals ( "com.caucho.util.QDate" ) ) return "date" ; else if ( InputStream . class . isAssignableFrom ( cl ) || name . equals ( "[B" ) ) return "binary" ; else if ( cl . isArray ( ) ) { return "[" + mangleClass ( cl . getComponentType ( ) , isFull ) ; } else if ( name . equals ( "org.w3c.dom.Node" ) || name . equals ( "org.w3c.dom.Element" ) || name . equals ( "org.w3c.dom.Document" ) ) return "xml" ; else if ( isFull ) return name ; else { int p = name . lastIndexOf ( '.' ) ; if ( p > 0 ) return name . substring ( p + 1 ) ; else return name ; } |
public class AmazonComprehendClient { /** * Stops a dominant language detection job in progress .
* If the job state is < code > IN _ PROGRESS < / code > the job is marked for termination and put into the
* < code > STOP _ REQUESTED < / code > state . If the job completes before it can be stopped , it is put into the
* < code > COMPLETED < / code > state ; otherwise the job is stopped and put into the < code > STOPPED < / code > state .
* If the job is in the < code > COMPLETED < / code > or < code > FAILED < / code > state when you call the
* < code > StopDominantLanguageDetectionJob < / code > operation , the operation returns a 400 Internal Request Exception .
* When a job is stopped , any documents already processed are written to the output location .
* @ param stopDominantLanguageDetectionJobRequest
* @ return Result of the StopDominantLanguageDetectionJob operation returned by the service .
* @ throws InvalidRequestException
* The request is invalid .
* @ throws JobNotFoundException
* The specified job was not found . Check the job ID and try again .
* @ throws InternalServerException
* An internal server error occurred . Retry your request .
* @ sample AmazonComprehend . StopDominantLanguageDetectionJob
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / comprehend - 2017-11-27 / StopDominantLanguageDetectionJob "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public StopDominantLanguageDetectionJobResult stopDominantLanguageDetectionJob ( StopDominantLanguageDetectionJobRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeStopDominantLanguageDetectionJob ( request ) ; |
public class ClusteringFeature { /** * Merge an other clustering features .
* @ param other Other CF */
protected void addToStatistics ( ClusteringFeature other ) { } } | n += other . n ; VMath . plusEquals ( ls , other . ls ) ; ss += other . ss ; |
public class LDAP { public static SearchResult toSearchResult ( NamingEnumeration < ? > aNamingEnumeration ) throws NoDataFoundException { } } | if ( aNamingEnumeration == null || ! aNamingEnumeration . hasMoreElements ( ) ) throw new NoDataFoundException ( "no results " + aNamingEnumeration ) ; return ( SearchResult ) aNamingEnumeration . nextElement ( ) ; |
public class UuidType { /** * Constructor */
@ Override public UuidType copy ( ) { } } | UuidType ret = new UuidType ( getValue ( ) ) ; copyValues ( ret ) ; return ret ; |
public class LDAPService { /** * - - - - - private methods - - - - - */
private void updateWithGroupDn ( final LDAPGroup group , final LdapConnection connection , final String groupDn , final String scope ) throws IOException , LdapException , CursorException , FrameworkException { } } | final Map < String , String > possibleGroupNames = getGroupMapping ( ) ; final List < LDAPUser > members = new LinkedList < > ( ) ; final Set < String > memberDNs = new LinkedHashSet < > ( ) ; // fetch DNs of all group members
try ( final EntryCursor cursor = connection . search ( groupDn , "(objectclass=*)" , SearchScope . valueOf ( scope ) ) ) { while ( cursor . next ( ) ) { final Entry entry = cursor . get ( ) ; final Attribute objectClass = entry . get ( "objectclass" ) ; for ( final java . util . Map . Entry < String , String > groupEntry : possibleGroupNames . entrySet ( ) ) { final String possibleGroupName = groupEntry . getKey ( ) ; final String possibleMemberName = groupEntry . getValue ( ) ; if ( objectClass . contains ( possibleGroupName ) ) { // add group members
final Attribute groupMembers = entry . get ( possibleMemberName ) ; if ( groupMembers != null ) { for ( final Value value : groupMembers ) { memberDNs . add ( value . getString ( ) ) ; } } } } } } // resolve users
for ( final String memberDN : memberDNs ) { try ( final EntryCursor cursor = connection . search ( memberDN , "(objectclass=*)" , SearchScope . valueOf ( scope ) ) ) { while ( cursor . next ( ) ) { members . add ( getOrCreateUser ( cursor . get ( ) ) ) ; } } } logger . info ( "{} users updated" , members . size ( ) ) ; // update members of group to new state ( will remove all members that are not part of the group , as expected )
group . setProperty ( StructrApp . key ( Group . class , "members" ) , members ) ; |
public class ArrayMath { /** * Returns the log of the sum of an array of numbers , which are
* themselves input in log form . This is all natural logarithms .
* Reasonable care is taken to do this as efficiently as possible
* ( under the assumption that the numbers might differ greatly in
* magnitude ) , with high accuracy , and without numerical overflow .
* @ param logInputs An array of numbers [ log ( x1 ) , . . . , log ( xn ) ]
* @ return log ( x1 + . . . + xn ) */
public static float logSum ( float [ ] logInputs ) { } } | int leng = logInputs . length ; if ( leng == 0 ) { throw new IllegalArgumentException ( ) ; } int maxIdx = 0 ; float max = logInputs [ 0 ] ; for ( int i = 1 ; i < leng ; i ++ ) { if ( logInputs [ i ] > max ) { maxIdx = i ; max = logInputs [ i ] ; } } boolean haveTerms = false ; double intermediate = 0.0f ; float cutoff = max - SloppyMath . LOGTOLERANCE_F ; // we avoid rearranging the array and so test indices each time !
for ( int i = 0 ; i < leng ; i ++ ) { if ( i != maxIdx && logInputs [ i ] > cutoff ) { haveTerms = true ; intermediate += Math . exp ( logInputs [ i ] - max ) ; } } if ( haveTerms ) { return max + ( float ) Math . log ( 1.0 + intermediate ) ; } else { return max ; } |
public class Vector3d { /** * Divide the components of this Vector3d by the given scalar values and store the result in < code > this < / code > .
* @ param x
* the x component to divide this vector by
* @ param y
* the y component to divide this vector by
* @ param z
* the z component to divide this vector by
* @ return a vector holding the result */
public Vector3d div ( double x , double y , double z ) { } } | return div ( x , y , z , thisOrNew ( ) ) ; |
public class CommerceAddressPersistenceImpl { /** * Returns a range of all the commerce addresses .
* 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 CommerceAddressModelImpl } . 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 start the lower bound of the range of commerce addresses
* @ param end the upper bound of the range of commerce addresses ( not inclusive )
* @ return the range of commerce addresses */
@ Override public List < CommerceAddress > findAll ( int start , int end ) { } } | return findAll ( start , end , null ) ; |
public class ContextFactory { /** * Returns the names of all the factory ' s attributes .
* @ return the attribute names */
public String [ ] getAttributeNames ( ) { } } | String [ ] result = new String [ attributeMap . size ( ) ] ; int i = 0 ; // for ( String attributeName : attributeMap . keySet ( ) ) {
Iterator it = attributeMap . keySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { result [ i ++ ] = ( String ) it . next ( ) ; } return result ; |
public class JsonWriter { /** * End document .
* @ throws IOException Something went wrong writing */
public void endDocument ( ) throws IOException { } } | checkAndPop ( JsonTokenType . BEGIN_DOCUMENT ) ; if ( isArray ) { writer . endArray ( ) ; } else { writer . endObject ( ) ; } |
public class ElmBaseVisitor { /** * Visit a ParameterDef . This method will be called for
* every node in the tree that is a ParameterDef .
* @ param elm the ELM tree
* @ param context the context passed to the visitor
* @ return the visitor result */
public T visitParameterDef ( ParameterDef elm , C context ) { } } | if ( elm . getParameterTypeSpecifier ( ) != null ) { visitElement ( elm . getParameterTypeSpecifier ( ) , context ) ; } if ( elm . getDefault ( ) != null ) { visitElement ( elm . getDefault ( ) , context ) ; } return null ; |
public class SimpleFormatter { /** * Formats the given values , replacing the contents of the result builder .
* May optimize by actually appending to the result if it is the same object
* as the value corresponding to the initial argument in the pattern .
* @ param result Gets its contents replaced by the formatted pattern and values .
* @ param offsets offsets [ i ] receives the offset of where
* values [ i ] replaced pattern argument { i } .
* Can be null , or can be shorter or longer than values .
* If there is no { i } in the pattern , then offsets [ i ] is set to - 1.
* @ param values The argument values .
* An argument value may be the same object as result .
* values . length must be at least getArgumentLimit ( ) .
* @ return result
* @ hide draft / provisional / internal are hidden on Android */
public StringBuilder formatAndReplace ( StringBuilder result , int [ ] offsets , CharSequence ... values ) { } } | return SimpleFormatterImpl . formatAndReplace ( compiledPattern , result , offsets , values ) ; |
public class DefaultGroovyMethods { /** * Power of a BigInteger to an integer certain exponent . If the
* exponent is positive , call the BigInteger . pow ( int ) method to
* maintain precision . Called by the ' * * ' operator .
* @ param self a BigInteger
* @ param exponent an Integer exponent
* @ return a Number to the power of a the exponent */
public static Number power ( BigInteger self , Integer exponent ) { } } | if ( exponent >= 0 ) { return self . pow ( exponent ) ; } else { return power ( self , ( double ) exponent ) ; } |
public class SQLExecutor { /** * Remember to close the returned < code > Stream < / code > list to close the underlying < code > ResultSet < / code > list .
* { @ code stream } operation won ' t be part of transaction or use the connection created by { @ code Transaction } even it ' s in transaction block / range .
* @ param sql
* @ param statementSetter
* @ param jdbcSettings
* @ param parameters
* @ return */
@ SafeVarargs public final < T > Stream < T > streamAll ( final String sql , final StatementSetter statementSetter , final JdbcUtil . BiRecordGetter < T , RuntimeException > recordGetter , final JdbcSettings jdbcSettings , final Object ... parameters ) { } } | checkJdbcSettingsForAllQuery ( jdbcSettings ) ; if ( jdbcSettings == null || N . isNullOrEmpty ( jdbcSettings . getQueryWithDataSources ( ) ) ) { return stream ( sql , statementSetter , recordGetter , jdbcSettings , parameters ) ; } final Collection < String > dss = jdbcSettings . getQueryWithDataSources ( ) ; return Stream . of ( dss ) . map ( new Function < String , JdbcSettings > ( ) { @ Override public JdbcSettings apply ( String ds ) { return jdbcSettings . copy ( ) . setQueryWithDataSources ( null ) . setQueryWithDataSource ( ds ) ; } } ) . __ ( new Function < Stream < JdbcSettings > , Stream < JdbcSettings > > ( ) { @ Override public Stream < JdbcSettings > apply ( Stream < JdbcSettings > s ) { return jdbcSettings . isQueryInParallel ( ) ? s . parallel ( dss . size ( ) ) : s ; } } ) . flatMap ( new Function < JdbcSettings , Stream < T > > ( ) { @ Override public Stream < T > apply ( JdbcSettings newJdbcSettings ) { return stream ( sql , statementSetter , recordGetter , newJdbcSettings , parameters ) ; } } ) ; |
public class UResourceBundle { /** * < strong > [ icu ] < / strong > Creates a resource bundle using the specified base name and locale .
* ICU _ DATA _ CLASS is used as the default root .
* @ param baseName string containing the name of the data package .
* If null the default ICU package name is used .
* @ param localeName the locale for which a resource bundle is desired
* @ throws MissingResourceException If no resource bundle for the specified base name
* can be found
* @ return a resource bundle for the given base name and locale */
public static UResourceBundle getBundleInstance ( String baseName , String localeName ) { } } | return getBundleInstance ( baseName , localeName , ICUResourceBundle . ICU_DATA_CLASS_LOADER , false ) ; |
public class TagLinkPanel { /** * { @ inheritDoc } */
@ Override protected void onBeforeRender ( ) { } } | if ( ! hasBeenRendered ( ) ) { final AbstractLink link = tagRenderData . getLink ( TAG_LINK_COMPONENT_ID ) ; link . add ( new Label ( TAG_NAME_LABEL_COMPONENT_ID , tagRenderData . getTagName ( ) ) ) ; link . add ( AttributeModifier . replace ( "style" , "font-size: " + tagRenderData . getFontSizeInPixels ( ) + "px;" ) ) ; // link . add ( new SimpleAttributeModifier ( " style " , " font - size : " + tagRenderData . getFontSizeInPixels ( ) + " px ; " ) ) ;
add ( link ) ; } super . onBeforeRender ( ) ; |
public class LogRecord { /** * Fills a buffer with bytes in the next part serialized LogRecord .
* @ param buffer we are to put the next part of this logRecord into .
* @ param offset into the buffer where we are to put the next part of this LogRecord .
* @ param length of the logBuffer we may fill this time round . If it is not sufficient
* to contain the whole logRecord .
* @ return int the new offset once the buffer has been filled .
* @ throws ObjectManagerException */
protected int fillBuffer ( byte [ ] buffer , int offset , int length ) throws ObjectManagerException { } } | if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "fillBuffer" , new Object [ ] { buffer , new Integer ( offset ) , new Integer ( length ) } ) ; // TODO Could do better by collecting the bytes from the log record directly into the logBuffer , or the log file
// TODO for large logRecords .
while ( length > 0 ) { int lengthToCopy = Math . min ( buffers [ bufferCursor ] . getCount ( ) - bufferByteCursor , length ) ; System . arraycopy ( buffers [ bufferCursor ] . getBuffer ( ) , bufferByteCursor , buffer , offset , lengthToCopy ) ; offset = offset + lengthToCopy ; length = length - lengthToCopy ; bufferByteCursor = bufferByteCursor + lengthToCopy ; if ( length > 0 ) { // Room for some more ?
bufferCursor ++ ; bufferByteCursor = 0 ; } } // while ( length > 0 ) .
if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "fillBuffer" , "returns offset=" + offset + "(int)" ) ; return offset ; |
public class StringUtil { /** * check if the specified string is Latin letter
* @ param str
* @ param beginIndex
* @ param endIndex
* @ return boolean */
public static boolean isLetter ( String str , int beginIndex , int endIndex ) { } } | for ( int i = beginIndex ; i < endIndex ; i ++ ) { char chr = str . charAt ( i ) ; if ( ! StringUtil . isEnLetter ( chr ) ) { return false ; } } return true ; |
public class GlParticlesView { /** * { @ inheritDoc } */
@ Override public void setFrameDelay ( @ IntRange ( from = 0 ) final int delay ) { } } | queueEvent ( new Runnable ( ) { @ Override public void run ( ) { scene . setFrameDelay ( delay ) ; } } ) ; |
public class ModuleUploads { /** * Delete a given upload again .
* @ param upload upload
* @ return response code , 204 on success .
* @ throws IllegalArgumentException if spaceId is null .
* @ throws IllegalArgumentException if uploadId is null . */
public int delete ( CMAUpload upload ) { } } | final String uploadId = getResourceIdOrThrow ( upload , "upload" ) ; final String spaceId = getSpaceIdOrThrow ( upload , "upload" ) ; final Response < Void > response = service . delete ( spaceId , uploadId ) . blockingFirst ( ) ; return response . code ( ) ; |
public class MapUtil { /** * 过滤Map保留指定键值对 , 如果键不存在跳过
* @ param < K > Key类型
* @ param < V > Value类型
* @ param map 原始Map
* @ param keys 键列表
* @ return Map 结果 , 结果的Map类型与原Map保持一致
* @ since 4.0.10 */
@ SuppressWarnings ( "unchecked" ) public static < K , V > Map < K , V > filter ( Map < K , V > map , K ... keys ) { } } | final Map < K , V > map2 = ObjectUtil . clone ( map ) ; if ( isEmpty ( map2 ) ) { return map2 ; } map2 . clear ( ) ; for ( K key : keys ) { if ( map . containsKey ( key ) ) { map2 . put ( key , map . get ( key ) ) ; } } return map2 ; |
public class LogMailBean { /** * 获取异常信息 */
private String getExceptionInfo ( Throwable e , String systemDate , String newLineToken , String tabToken ) { } } | StringBuffer info = new StringBuffer ( ) ; info . append ( systemDate ) ; info . append ( tabToken ) ; info . append ( "cause by: " ) ; info . append ( e . getClass ( ) . getName ( ) + "--" ) ; info . append ( e . getMessage ( ) ) ; info . append ( newLineToken ) ; for ( StackTraceElement stackTraceElement : e . getStackTrace ( ) ) { info . append ( systemDate ) ; info . append ( tabToken ) ; info . append ( stackTraceElement ) ; info . append ( newLineToken ) ; } if ( null != e . getCause ( ) && e . getCause ( ) instanceof Exception ) { info . append ( getExceptionInfo ( ( Exception ) e . getCause ( ) , systemDate , newLineToken , tabToken ) ) ; } return info . toString ( ) ; |
public class TldTaglibTypeImpl { /** * If not already created , a new < code > function < / code > element will be created and returned .
* Otherwise , the first existing < code > function < / code > element will be returned .
* @ return the instance defined for the element < code > function < / code > */
public FunctionType < TldTaglibType < T > > getOrCreateFunction ( ) { } } | List < Node > nodeList = childNode . get ( "function" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new FunctionTypeImpl < TldTaglibType < T > > ( this , "function" , childNode , nodeList . get ( 0 ) ) ; } return createFunction ( ) ; |
public class ChangeImageTransform { /** * Creates an Animator for ImageViews moving , changing dimensions , and / or changing
* { @ link android . widget . ImageView . ScaleType } .
* @ param sceneRoot The root of the transition hierarchy .
* @ param startValues The values for a specific target in the start scene .
* @ param endValues The values for the target in the end scene .
* @ return An Animator to move an ImageView or null if the View is not an ImageView ,
* the Drawable changed , the View is not VISIBLE , or there was no change . */
@ Nullable @ Override public Animator createAnimator ( @ NonNull ViewGroup sceneRoot , @ Nullable TransitionValues startValues , @ Nullable TransitionValues endValues ) { } } | if ( startValues == null || endValues == null ) { return null ; } Rect startBounds = ( Rect ) startValues . values . get ( PROPNAME_BOUNDS ) ; Rect endBounds = ( Rect ) endValues . values . get ( PROPNAME_BOUNDS ) ; if ( startBounds == null || endBounds == null ) { return null ; } Matrix startMatrix = ( Matrix ) startValues . values . get ( PROPNAME_MATRIX ) ; Matrix endMatrix = ( Matrix ) endValues . values . get ( PROPNAME_MATRIX ) ; boolean matricesEqual = ( startMatrix == null && endMatrix == null ) || ( startMatrix != null && startMatrix . equals ( endMatrix ) ) ; if ( startBounds . equals ( endBounds ) && matricesEqual ) { return null ; } ImageView imageView = ( ImageView ) endValues . view ; Drawable drawable = imageView . getDrawable ( ) ; int drawableWidth = drawable . getIntrinsicWidth ( ) ; int drawableHeight = drawable . getIntrinsicHeight ( ) ; ObjectAnimator animator ; if ( drawableWidth == 0 || drawableHeight == 0 ) { animator = createMatrixAnimator ( imageView , new MatrixUtils . NullMatrixEvaluator ( ) , MatrixUtils . IDENTITY_MATRIX , MatrixUtils . IDENTITY_MATRIX ) ; } else { if ( startMatrix == null ) { startMatrix = MatrixUtils . IDENTITY_MATRIX ; } if ( endMatrix == null ) { endMatrix = MatrixUtils . IDENTITY_MATRIX ; } MatrixUtils . animateTransform ( imageView , startMatrix ) ; animator = createMatrixAnimator ( imageView , new MatrixUtils . MatrixEvaluator ( ) , startMatrix , endMatrix ) ; } return animator ; |
public class SignatureConverter { /** * Convenience method for generating a method signature in human readable
* form .
* @ param xmethod
* an XMethod
* @ return the formatted version of that signature */
public static String convertMethodSignature ( XMethod xmethod ) { } } | @ DottedClassName String className = xmethod . getClassName ( ) ; assert className . indexOf ( '/' ) == - 1 ; return convertMethodSignature ( className , xmethod . getName ( ) , xmethod . getSignature ( ) ) ; |
public class TieredBlockStore { /** * Commits a temp block .
* @ param sessionId the id of session
* @ param blockId the id of block
* @ return destination location to move the block
* @ throws BlockDoesNotExistException if block id can not be found in temporary blocks
* @ throws BlockAlreadyExistsException if block id already exists in committed blocks
* @ throws InvalidWorkerStateException if block id is not owned by session id */
private BlockStoreLocation commitBlockInternal ( long sessionId , long blockId ) throws BlockAlreadyExistsException , InvalidWorkerStateException , BlockDoesNotExistException , IOException { } } | long lockId = mLockManager . lockBlock ( sessionId , blockId , BlockLockType . WRITE ) ; try { // When committing TempBlockMeta , the final BlockMeta calculates the block size according to
// the actual file size of this TempBlockMeta . Therefore , commitTempBlockMeta must happen
// after moving actual block file to its committed path .
BlockStoreLocation loc ; String srcPath ; String dstPath ; TempBlockMeta tempBlockMeta ; try ( LockResource r = new LockResource ( mMetadataReadLock ) ) { checkTempBlockOwnedBySession ( sessionId , blockId ) ; tempBlockMeta = mMetaManager . getTempBlockMeta ( blockId ) ; srcPath = tempBlockMeta . getPath ( ) ; dstPath = tempBlockMeta . getCommitPath ( ) ; loc = tempBlockMeta . getBlockLocation ( ) ; } // Heavy IO is guarded by block lock but not metadata lock . This may throw IOException .
FileUtils . move ( srcPath , dstPath ) ; try ( LockResource r = new LockResource ( mMetadataWriteLock ) ) { mMetaManager . commitTempBlockMeta ( tempBlockMeta ) ; } catch ( BlockAlreadyExistsException | BlockDoesNotExistException | WorkerOutOfSpaceException e ) { throw Throwables . propagate ( e ) ; // we shall never reach here
} return loc ; } finally { mLockManager . unlockBlock ( lockId ) ; } |
public class JedisRedisClient { /** * { @ inheritDoc } */
@ Override public void set ( String key , String value , int ttlSeconds ) { } } | if ( ttlSeconds > 0 ) { redisClient . setex ( key , ttlSeconds , value ) ; } else { redisClient . set ( key , value ) ; } |
public class MemoryMappedFile { /** * May want to have offset & length within data as well , for both of these */
public void getBytes ( long pos , byte [ ] data , long offset , long length ) { } } | unsafe . copyMemory ( null , pos + addr , data , BYTE_ARRAY_OFFSET + offset , length ) ; |
public class TaskFailure { /** * Deserialize task information .
* @ param in The stream from which this object is read .
* @ throws IOException
* @ throws ClassNotFoundException */
@ Trivial private void readObject ( ObjectInputStream in ) throws IOException , ClassNotFoundException { } } | GetField fields = in . readFields ( ) ; failure = ( Throwable ) fields . get ( FAILURE , null ) ; params = ( String [ ] ) fields . get ( PARAMS , new String [ ] { } ) ; reason = fields . get ( REASON , ( short ) 0 ) ; |
public class OAuth2PlatformClient { /** * Method to validate IDToken
* @ param idToken
* @ param clientId
* @ return
* @ throws OpenIdException */
public boolean validateIDToken ( String idToken ) throws OpenIdException { } } | logger . debug ( "Enter OAuth2PlatformClient::validateIDToken" ) ; String [ ] idTokenParts = idToken . split ( "\\." ) ; if ( idTokenParts . length < 3 ) { logger . debug ( "invalid idTokenParts length" ) ; return false ; } String idTokenHeader = base64UrlDecode ( idTokenParts [ 0 ] ) ; String idTokenPayload = base64UrlDecode ( idTokenParts [ 1 ] ) ; byte [ ] idTokenSignature = base64UrlDecodeToBytes ( idTokenParts [ 2 ] ) ; JSONObject idTokenHeaderJson = new JSONObject ( idTokenHeader ) ; JSONObject idTokenHeaderPayload = new JSONObject ( idTokenPayload ) ; // Step 1 : First check if the issuer is as mentioned in " issuer " in the discovery doc
String issuer = idTokenHeaderPayload . getString ( "iss" ) ; if ( ! issuer . equalsIgnoreCase ( oauth2Config . getIntuitIdTokenIssuer ( ) ) ) { logger . debug ( "issuer value mismtach" ) ; return false ; } // Step 2 : check if the aud field in idToken is same as application ' s clientId
JSONArray jsonaud = idTokenHeaderPayload . getJSONArray ( "aud" ) ; String aud = jsonaud . getString ( 0 ) ; if ( ! aud . equalsIgnoreCase ( oauth2Config . getClientId ( ) ) ) { logger . debug ( "incorrect client id" ) ; return false ; } // Step 3 : ensure the timestamp has not elapsed
Long expirationTimestamp = idTokenHeaderPayload . getLong ( "exp" ) ; Long currentTime = System . currentTimeMillis ( ) / 1000 ; if ( ( expirationTimestamp - currentTime ) <= 0 ) { logger . debug ( "expirationTimestamp has elapsed" ) ; return false ; } // Step 4 : Verify that the ID token is properly signed by the issuer
HashMap < String , JSONObject > keyMap = getKeyMapFromJWKSUri ( ) ; if ( keyMap == null || keyMap . isEmpty ( ) ) { logger . debug ( "unable to retrive keyMap from JWKS url" ) ; return false ; } // first get the kid from the header .
String keyId = idTokenHeaderJson . getString ( "kid" ) ; JSONObject keyDetails = keyMap . get ( keyId ) ; // now get the exponent ( e ) and modulo ( n ) to form the PublicKey
String exponent = keyDetails . getString ( "e" ) ; String modulo = keyDetails . getString ( "n" ) ; // build the public key
PublicKey publicKey = getPublicKey ( modulo , exponent ) ; byte [ ] data = ( idTokenParts [ 0 ] + "." + idTokenParts [ 1 ] ) . getBytes ( StandardCharsets . UTF_8 ) ; try { // verify token using public key
boolean isSignatureValid = verifyUsingPublicKey ( data , idTokenSignature , publicKey ) ; logger . debug ( "isSignatureValid: " + isSignatureValid ) ; return isSignatureValid ; } catch ( GeneralSecurityException e ) { logger . error ( "Exception while validating ID token " , e ) ; throw new OpenIdException ( e . getMessage ( ) , e ) ; } |
public class TransferThreadManager { /** * use only in mode E */
public void activeClose ( TransferContext context , int connections ) { } } | try { // this could be improved ; for symmetry and performance ,
// make it a separate task class and pass to the taskThread
for ( int i = 0 ; i < connections ; i ++ ) { SocketBox sbox = socketPool . checkOut ( ) ; try { GridFTPDataChannel dc = new GridFTPDataChannel ( gSession , sbox ) ; EBlockImageDCWriter writer = ( EBlockImageDCWriter ) dc . getDataChannelSink ( context ) ; writer . setDataStream ( sbox . getSocket ( ) . getOutputStream ( ) ) ; // close the socket
writer . close ( ) ; } finally { // do not reuse the socket
socketPool . remove ( sbox ) ; sbox . setSocket ( null ) ; } } } catch ( Exception e ) { FTPServerFacade . exceptionToControlChannel ( e , "closing of a reused connection failed" , localControlChannel ) ; } |
public class CommerceRegionLocalServiceUtil { /** * Creates a new commerce region with the primary key . Does not add the commerce region to the database .
* @ param commerceRegionId the primary key for the new commerce region
* @ return the new commerce region */
public static com . liferay . commerce . model . CommerceRegion createCommerceRegion ( long commerceRegionId ) { } } | return getService ( ) . createCommerceRegion ( commerceRegionId ) ; |
public class SurfDescribeOps { /** * Computes the width of a square containment region that contains a rotated rectangle .
* @ param width Size of the original rectangle .
* @ param c Cosine ( theta )
* @ param s Sine ( theta )
* @ return Side length of the containment square . */
public static double rotatedWidth ( double width , double c , double s ) { } } | return Math . abs ( c ) * width + Math . abs ( s ) * width ; |
public class AmazonEC2Client { /** * Attaches a virtual private gateway to a VPC . You can attach one virtual private gateway to one VPC at a time .
* For more information , see < a href = " https : / / docs . aws . amazon . com / vpn / latest / s2svpn / VPC _ VPN . html " > AWS Site - to - Site
* VPN < / a > in the < i > AWS Site - to - Site VPN User Guide < / i > .
* @ param attachVpnGatewayRequest
* Contains the parameters for AttachVpnGateway .
* @ return Result of the AttachVpnGateway operation returned by the service .
* @ sample AmazonEC2 . AttachVpnGateway
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / AttachVpnGateway " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public AttachVpnGatewayResult attachVpnGateway ( AttachVpnGatewayRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeAttachVpnGateway ( request ) ; |
public class ChaiUtility { /** * Convert to an LDIF format . Useful for debugging or other purposes
* @ param theEntry A valid { @ code ChaiEntry }
* @ return A string containing a properly formatted LDIF view of the entry .
* @ throws ChaiOperationException If there is an error during the operation
* @ throws ChaiUnavailableException If the directory server ( s ) are unavailable */
public static String entryToLDIF ( final ChaiEntry theEntry ) throws ChaiUnavailableException , ChaiOperationException { } } | final StringBuilder sb = new StringBuilder ( ) ; sb . append ( "dn: " ) . append ( theEntry . getEntryDN ( ) ) . append ( "\n" ) ; final Map < String , Map < String , List < String > > > results = theEntry . getChaiProvider ( ) . searchMultiValues ( theEntry . getEntryDN ( ) , "(objectClass=*)" , null , SearchScope . BASE ) ; final Map < String , List < String > > props = results . get ( theEntry . getEntryDN ( ) ) ; for ( final Map . Entry < String , List < String > > entry : props . entrySet ( ) ) { final String attrName = entry . getKey ( ) ; final List < String > values = entry . getValue ( ) ; for ( final String value : values ) { sb . append ( attrName ) . append ( ": " ) . append ( value ) . append ( '\n' ) ; } } return sb . toString ( ) ; |
public class ComposableFutures { /** * retries a given operation N times for each computed Failed future .
* @ param retries max amount of retries
* @ param action the eager future provider
* @ param < T > the future type
* @ return the composed result . */
public static < T > ComposableFuture < T > retry ( final int retries , final FutureAction < T > action ) { } } | return retry ( retries , __ -> action . execute ( ) ) ; |
public class CommerceWarehousePersistenceImpl { /** * Returns the last commerce warehouse in the ordered set where groupId = & # 63 ; .
* @ param groupId the group ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching commerce warehouse
* @ throws NoSuchWarehouseException if a matching commerce warehouse could not be found */
@ Override public CommerceWarehouse findByGroupId_Last ( long groupId , OrderByComparator < CommerceWarehouse > orderByComparator ) throws NoSuchWarehouseException { } } | CommerceWarehouse commerceWarehouse = fetchByGroupId_Last ( groupId , orderByComparator ) ; if ( commerceWarehouse != null ) { return commerceWarehouse ; } StringBundler msg = new StringBundler ( 4 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "groupId=" ) ; msg . append ( groupId ) ; msg . append ( "}" ) ; throw new NoSuchWarehouseException ( msg . toString ( ) ) ; |
public class AstUtil { /** * Return true only if the MethodCallExpression represents a method call for the specified method object ( receiver ) ,
* method name , and with the specified number of arguments .
* @ param methodCall - the AST MethodCallExpression
* @ param methodObjectPattern - the name of the method object ( receiver )
* @ param methodPattern - the name of the method being called
* @ param numArguments - the number of arguments passed into the method
* @ return true only if the method call matches the specified criteria */
public static boolean isMethodCall ( MethodCallExpression methodCall , String methodObjectPattern , String methodPattern , int numArguments ) { } } | return ( isMethodCall ( methodCall , methodObjectPattern , methodPattern ) && AstUtil . getMethodArguments ( methodCall ) . size ( ) == numArguments ) ; |
public class AsyncActivityImpl { /** * ( non - Javadoc )
* @ see
* AsyncActivity # deleteIfNoneMatch
* ( java . net . URI , java . lang . String ,
* Header [ ] ,
* Credentials ) */
public void deleteIfNoneMatch ( URI uri , String eTag , Header [ ] additionalRequestHeaders , Credentials credentials ) { } } | ra . getExecutorService ( ) . execute ( new AsyncDeleteIfNoneMatchHandler ( ra , handle , uri , eTag , additionalRequestHeaders , credentials ) ) ; |
public class Base64VLQ { /** * Returns the base 64 VLQ encoded value . */
static final String encode ( int aValue ) { } } | String encoded = "" ; int digit ; int vlq = toVLQSigned ( aValue ) ; do { digit = vlq & VLQ_BASE_MASK ; vlq >>>= VLQ_BASE_SHIFT ; if ( vlq > 0 ) { // There are still more digits in this value , so we must make sure the
// continuation bit is marked .
digit |= VLQ_CONTINUATION_BIT ; } encoded += Base64 . encode ( digit ) ; } while ( vlq > 0 ) ; return encoded ; |
public class RowSpec { /** * Parses the encoded row specifications and returns a RowSpec object that represents the
* string . Variables are expanded using the given LayoutMap .
* @ param encodedRowSpec the encoded column specification
* @ param layoutMap expands layout row variables
* @ return a RowSpec instance for the given specification
* @ throws NullPointerException if { @ code encodedRowSpec } or { @ code layoutMap } is { @ code null }
* @ see # decodeSpecs ( String , LayoutMap )
* @ since 1.2 */
public static RowSpec decode ( String encodedRowSpec , LayoutMap layoutMap ) { } } | checkNotBlank ( encodedRowSpec , "The encoded row specification must not be null, empty or whitespace." ) ; checkNotNull ( layoutMap , "The LayoutMap must not be null." ) ; String trimmed = encodedRowSpec . trim ( ) ; String lower = trimmed . toLowerCase ( Locale . ENGLISH ) ; return decodeExpanded ( layoutMap . expand ( lower , false ) ) ; |
public class ArchiveHelper { /** * Adds a file or files to a jar file , replacing the original one
* @ param jarFile
* File the jar file
* @ param basePathWithinJar
* String the base path to put the files within the Jar
* @ param files
* File [ ] The files . The files will be placed in basePathWithinJar
* @ throws Exception
* @ since 2007-06-07 uses createTempFile instead of Java ' s createTempFile , increased buffer from 1k to 4k */
public static boolean addFilesToExistingJar ( File jarFile , String basePathWithinJar , Map < String , File > files , ActionOnConflict action ) throws IOException { } } | // get a temp file
File tempFile = FileHelper . createTempFile ( jarFile . getName ( ) , null ) ; boolean renamed = jarFile . renameTo ( tempFile ) ; if ( ! renamed ) { throw new RuntimeException ( "[ArchiveHelper] {addFilesToExistingJar} " + "Could not rename the file " + jarFile . getAbsolutePath ( ) + " to " + tempFile . getAbsolutePath ( ) ) ; } ZipInputStream jarInput = new ZipInputStream ( new FileInputStream ( tempFile ) ) ; ZipOutputStream jarOutput = new ZipOutputStream ( new FileOutputStream ( jarFile ) ) ; try { switch ( action ) { case OVERWRITE : overwriteFiles ( jarInput , jarOutput , basePathWithinJar , files ) ; break ; case CONFLICT : conflictFiles ( jarInput , jarOutput , basePathWithinJar , files ) ; break ; default : // This should never happen with validation of action taking place in WarDriver class
throw new IOException ( "An invalid ActionOnConflict action was received" ) ; } } finally { if ( ! tempFile . delete ( ) ) log . warn ( "Could not delete temp file " + tempFile ) ; } return true ; |
public class UpdateMatchmakingConfigurationRequest { /** * Amazon Resource Name ( < a href = " https : / / docs . aws . amazon . com / AmazonS3 / latest / dev / s3 - arn - format . html " > ARN < / a > ) that
* is assigned to a game session queue and uniquely identifies it . Format is
* < code > arn : aws : gamelift : & lt ; region & gt ; : : fleet / fleet - a1234567 - b8c9-0d1e - 2fa3 - b45c6d7e8912 < / code > . These queues are
* used when placing game sessions for matches that are created with this matchmaking configuration . Queues can be
* located in any region .
* @ param gameSessionQueueArns
* Amazon Resource Name ( < a
* href = " https : / / docs . aws . amazon . com / AmazonS3 / latest / dev / s3 - arn - format . html " > ARN < / a > ) that is assigned to a
* game session queue and uniquely identifies it . Format is
* < code > arn : aws : gamelift : & lt ; region & gt ; : : fleet / fleet - a1234567 - b8c9-0d1e - 2fa3 - b45c6d7e8912 < / code > . These
* queues are used when placing game sessions for matches that are created with this matchmaking
* configuration . Queues can be located in any region . */
public void setGameSessionQueueArns ( java . util . Collection < String > gameSessionQueueArns ) { } } | if ( gameSessionQueueArns == null ) { this . gameSessionQueueArns = null ; return ; } this . gameSessionQueueArns = new java . util . ArrayList < String > ( gameSessionQueueArns ) ; |
public class ContentSpec { /** * Set the version of the product that the Content Specification documents .
* @ param version The product version . */
public void setVersion ( final String version ) { } } | if ( version == null && this . version == null ) { return ; } else if ( version == null ) { removeChild ( this . version ) ; this . version = null ; } else if ( this . version == null ) { this . version = new KeyValueNode < String > ( CommonConstants . CS_VERSION_TITLE , version ) ; appendChild ( this . version , false ) ; } else { this . version . setValue ( version ) ; } |
public class FSNamesystem { /** * Move a file that is being written to be immutable .
* @ param src The filename
* @ param lease The lease for the client creating the file */
void internalReleaseLeaseOne ( Lease lease , String src ) throws IOException { } } | internalReleaseLeaseOne ( lease , src , false ) ; |
public class Webcam { /** * Return webcam driver . Perform search if necessary . < br >
* < br >
* < b > This method is not thread - safe ! < / b >
* @ return Webcam driver */
public static synchronized WebcamDriver getDriver ( ) { } } | if ( driver != null ) { return driver ; } if ( driver == null ) { driver = WebcamDriverUtils . findDriver ( DRIVERS_LIST , DRIVERS_CLASS_LIST ) ; } if ( driver == null ) { driver = new WebcamDefaultDriver ( ) ; } LOG . info ( "{} capture driver will be used" , driver . getClass ( ) . getSimpleName ( ) ) ; return driver ; |
public class PatternUtils { /** * Create an IllegalArgumentException with a message including context based
* on the position . */
static IllegalArgumentException error ( String message , String str , int pos ) { } } | return new IllegalArgumentException ( message + "\n" + context ( str , pos ) ) ; |
public class IdOperator { /** * Execute ID operator . Uses property path to extract content value , convert it to string and set < em > id < / em > attribute .
* @ param element context element , unused ,
* @ param scope scope object ,
* @ param propertyPath property path ,
* @ param arguments optional arguments , unused .
* @ return always returns null for void .
* @ throws TemplateException if requested content value is undefined . */
@ Override protected Object doExec ( Element element , Object scope , String propertyPath , Object ... arguments ) throws TemplateException { } } | if ( ! propertyPath . equals ( "." ) && ConverterRegistry . hasType ( scope . getClass ( ) ) ) { throw new TemplateException ( "Operand is property path but scope is not an object." ) ; } Object value = content . getObject ( scope , propertyPath ) ; if ( value == null ) { return null ; } if ( Types . isNumber ( value ) ) { value = value . toString ( ) ; } if ( Types . isEnum ( value ) ) { value = ( ( Enum < ? > ) value ) . name ( ) ; } if ( ! ( value instanceof String ) ) { throw new TemplateException ( "Invalid element |%s|. ID operand should be string, enumeration or numeric." , element ) ; } return new AttrImpl ( "id" , ( String ) value ) ; |
public class JMElasticsearchClient { /** * Gets settings builder .
* @ param nodeName the node name
* @ param clientTransportSniff the client transport sniff
* @ param clusterName the cluster name
* @ return the settings builder */
public static Builder getSettingsBuilder ( String nodeName , boolean clientTransportSniff , String clusterName ) { } } | boolean isNullClusterName = Objects . isNull ( clusterName ) ; Builder builder = Settings . builder ( ) . put ( NODE_NAME , nodeName ) . put ( CLIENT_TRANSPORT_SNIFF , clientTransportSniff ) . put ( CLIENT_TRANSPORT_IGNORE_CLUSTER_NAME , isNullClusterName ) ; if ( ! isNullClusterName ) builder . put ( CLUSTER_NAME , clusterName ) ; return builder ; |
public class RemoteConsumerDispatcher { /** * The timeperiod after which a message that was added to the itemStream , and is still in unlocked state ,
* should be rejected . This is important to not starve other remote MEs */
public long getRejectTimeout ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getRejectTimeout" ) ; boolean localCardinalityOne ; synchronized ( consumerPoints ) { localCardinalityOne = _cardinalityOne ; } if ( localCardinalityOne ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getRejectTimeout" , new Long ( AbstractItem . NEVER_EXPIRES ) ) ; // there is no one else to starve
return AbstractItem . NEVER_EXPIRES ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getRejectTimeout" , new Long ( _messageProcessor . getCustomProperties ( ) . get_unlocked_reject_interval ( ) ) ) ; return _messageProcessor . getCustomProperties ( ) . get_unlocked_reject_interval ( ) ; |
public class CoronaSerializer { /** * This is a helper method that reads a JSON token using a JsonParser
* instance , and throws an exception if the next token is not the same as
* the token we expect .
* @ param parentFieldName The name of the field
* @ param expectedToken The expected token
* @ throws IOException */
public void readToken ( String parentFieldName , JsonToken expectedToken ) throws IOException { } } | JsonToken currentToken = jsonParser . nextToken ( ) ; if ( currentToken != expectedToken ) { throw new IOException ( "Expected a " + expectedToken . toString ( ) + " token when reading the value of the field: " + parentFieldName + " but found a " + currentToken . toString ( ) + " token" ) ; } |
public class AlipayService { /** * 退款申请 */
public Boolean refund ( RefundDetail detail ) { } } | detail . setNotifyUrl ( refundNotifyUrl ) ; return alipay . refund ( ) . refund ( detail ) ; |
public class DisambiguatedAlchemyEntity { /** * Set the geographic coordinates associated with this concept tag .
* latitude longitude
* @ param geo latitude longitude
* @ see # setLatitude ( String )
* @ see # setLongitude ( String ) */
public void setGeo ( String geo ) { } } | if ( geo != null ) { geo = geo . trim ( ) ; } if ( StringUtils . isBlank ( geo ) ) { this . geo = geo ; setLatitude ( Constants . DEFAULT_LATITUDE ) ; setLongitude ( Constants . DEFAULT_LONGITUDE ) ; return ; } String [ ] split = geo . split ( "\\s+" ) ; if ( split != null && split . length == 2 ) { this . geo = split [ 0 ] . trim ( ) + " " + split [ 1 ] ; setLatitude ( split [ 0 ] ) ; setLongitude ( split [ 1 ] ) ; } |
public class ST_RemovePoints { /** * Remove all vertices that are located within a polygon
* @ param geometry
* @ param polygon
* @ return
* @ throws SQLException */
public static Geometry removePoint ( Geometry geometry , Polygon polygon ) throws SQLException { } } | if ( geometry == null ) { return null ; } GeometryEditor localGeometryEditor = new GeometryEditor ( ) ; PolygonDeleteVertexOperation localBoxDeleteVertexOperation = new PolygonDeleteVertexOperation ( geometry . getFactory ( ) , new PreparedPolygon ( polygon ) ) ; Geometry localGeometry = localGeometryEditor . edit ( geometry , localBoxDeleteVertexOperation ) ; if ( localGeometry . isEmpty ( ) ) { return null ; } return localGeometry ; |
public class ProposalLineItem { /** * Sets the roadblockingType value for this ProposalLineItem .
* @ param roadblockingType * The strategy for serving roadblocked creatives , i . e . instances
* where
* multiple creatives must be served together on a single
* web page . This attribute
* is optional during creation and defaults to the
* { @ link Product # roadblockingType product ' s roadblocking
* type } ,
* or { @ link RoadblockingType # ONE _ OR _ MORE } if not specified
* by the product . */
public void setRoadblockingType ( com . google . api . ads . admanager . axis . v201805 . RoadblockingType roadblockingType ) { } } | this . roadblockingType = roadblockingType ; |
public class NodeSet { /** * Add the node into a vector of nodes where it should occur in
* document order .
* @ param node The node to be added .
* @ param test true if we should test for doc order
* @ param support The XPath runtime context .
* @ return insertIndex .
* @ throws RuntimeException thrown if this NodeSet is not of
* a mutable type . */
public int addNodeInDocOrder ( Node node , boolean test , XPathContext support ) { } } | if ( ! m_mutable ) throw new RuntimeException ( XSLMessages . createXPATHMessage ( XPATHErrorResources . ER_NODESET_NOT_MUTABLE , null ) ) ; // XSLMessages . createXPATHMessage ( XPATHErrorResources . ER _ NODESET _ NOT _ MUTABLE , null ) ) ; / / " This NodeSet is not mutable ! " ) ;
int insertIndex = - 1 ; if ( test ) { // This needs to do a binary search , but a binary search
// is somewhat tough because the sequence test involves
// two nodes .
int size = size ( ) , i ; for ( i = size - 1 ; i >= 0 ; i -- ) { Node child = ( Node ) elementAt ( i ) ; if ( child == node ) { i = - 2 ; // Duplicate , suppress insert
break ; } if ( ! DOM2Helper . isNodeAfter ( node , child ) ) { break ; } } if ( i != - 2 ) { insertIndex = i + 1 ; insertElementAt ( node , insertIndex ) ; } } else { insertIndex = this . size ( ) ; boolean foundit = false ; for ( int i = 0 ; i < insertIndex ; i ++ ) { if ( this . item ( i ) . equals ( node ) ) { foundit = true ; break ; } } if ( ! foundit ) addElement ( node ) ; } // checkDups ( ) ;
return insertIndex ; |
public class GradientSobel_UnrolledOuter { /** * Can only process images which are NOT sub - images . */
public static void process_I8 ( GrayU8 orig , GrayS16 derivX , GrayS16 derivY ) { } } | final byte [ ] data = orig . data ; final short [ ] imgX = derivX . data ; final short [ ] imgY = derivY . data ; final int width = orig . getWidth ( ) ; final int height = orig . getHeight ( ) - 1 ; final int adjWidth = width - 2 ; // CONCURRENT _ BELOW BoofConcurrency . loopFor ( 1 , height , y - > {
for ( int y = 1 ; y < height ; y ++ ) { int endX_alt = width * y + ( width - adjWidth % 3 ) - 1 ; int endX = endX_alt + adjWidth % 3 ; int a11 , a12 , a13 ; int a21 , a22 , a23 ; int a31 , a32 , a33 ; int index = width * y + 1 ; a11 = data [ index - width - 1 ] & 0xFF ; a12 = data [ index - width ] & 0xFF ; a21 = data [ index - 1 ] & 0xFF ; a22 = data [ index ] & 0xFF ; a31 = data [ index + width - 1 ] & 0xFF ; a32 = data [ index + width ] & 0xFF ; for ( ; index < endX_alt ; ) { a13 = data [ index - width + 1 ] & 0xFF ; a23 = data [ index + 1 ] & 0xFF ; a33 = data [ index + width + 1 ] & 0xFF ; int v = ( a33 - a11 ) ; int w = ( a31 - a13 ) ; imgY [ index ] = ( short ) ( ( a32 - a12 ) * 2 + v + w ) ; imgX [ index ] = ( short ) ( ( a23 - a21 ) * 2 + v - w ) ; index ++ ; a11 = data [ index - width + 1 ] & 0xFF ; a21 = data [ index + 1 ] & 0xFF ; a31 = data [ index + width + 1 ] & 0xFF ; v = ( a31 - a12 ) ; w = ( a32 - a11 ) ; imgY [ index ] = ( short ) ( ( a33 - a13 ) * 2 + v + w ) ; imgX [ index ] = ( short ) ( ( a21 - a22 ) * 2 + v - w ) ; index ++ ; a12 = data [ index - width + 1 ] & 0xFF ; a22 = data [ index + 1 ] & 0xFF ; a32 = data [ index + width + 1 ] & 0xFF ; v = ( a32 - a13 ) ; w = ( a33 - a12 ) ; imgY [ index ] = ( short ) ( ( a31 - a11 ) * 2 + v + w ) ; imgX [ index ] = ( short ) ( ( a22 - a23 ) * 2 + v - w ) ; index ++ ; } for ( ; index < endX ; index ++ ) { int v = ( data [ index + width + 1 ] & 0xFF ) - ( data [ index - width - 1 ] & 0xFF ) ; int w = ( data [ index + width - 1 ] & 0xFF ) - ( data [ index - width + 1 ] & 0xFF ) ; imgY [ index ] = ( short ) ( ( ( data [ index + width ] & 0xFF ) - ( data [ index - width ] & 0xFF ) ) * 2 + v + w ) ; imgX [ index ] = ( short ) ( ( ( data [ index + 1 ] & 0xFF ) - ( data [ index - 1 ] & 0xFF ) ) * 2 + v - w ) ; } } // CONCURRENT _ ABOVE } ) ; |
public class RtfParagraphStyle { /** * Handles the inheritance of paragraph style settings . All settings that
* have not been modified will be inherited from the base RtfParagraphStyle .
* If this RtfParagraphStyle is not based on another one , then nothing happens . */
public void handleInheritance ( ) { } } | if ( this . basedOnName != null && this . document . getDocumentHeader ( ) . getRtfParagraphStyle ( this . basedOnName ) != null ) { this . baseStyle = this . document . getDocumentHeader ( ) . getRtfParagraphStyle ( this . basedOnName ) ; this . baseStyle . handleInheritance ( ) ; if ( ! ( ( this . modified & MODIFIED_ALIGNMENT ) == MODIFIED_ALIGNMENT ) ) { this . alignment = this . baseStyle . getAlignment ( ) ; } if ( ! ( ( this . modified & MODIFIED_INDENT_LEFT ) == MODIFIED_INDENT_LEFT ) ) { this . indentLeft = this . baseStyle . getIndentLeft ( ) ; } if ( ! ( ( this . modified & MODIFIED_INDENT_RIGHT ) == MODIFIED_INDENT_RIGHT ) ) { this . indentRight = this . baseStyle . getIndentRight ( ) ; } if ( ! ( ( this . modified & MODIFIED_SPACING_BEFORE ) == MODIFIED_SPACING_BEFORE ) ) { this . spacingBefore = this . baseStyle . getSpacingBefore ( ) ; } if ( ! ( ( this . modified & MODIFIED_SPACING_AFTER ) == MODIFIED_SPACING_AFTER ) ) { this . spacingAfter = this . baseStyle . getSpacingAfter ( ) ; } if ( ! ( ( this . modified & MODIFIED_FONT_NAME ) == MODIFIED_FONT_NAME ) ) { setFontName ( this . baseStyle . getFontName ( ) ) ; } if ( ! ( ( this . modified & MODIFIED_FONT_SIZE ) == MODIFIED_FONT_SIZE ) ) { setSize ( this . baseStyle . getFontSize ( ) ) ; } if ( ! ( ( this . modified & MODIFIED_FONT_STYLE ) == MODIFIED_FONT_STYLE ) ) { setStyle ( this . baseStyle . getFontStyle ( ) ) ; } if ( ! ( ( this . modified & MODIFIED_FONT_COLOR ) == MODIFIED_FONT_COLOR ) ) { setColor ( this . baseStyle . getColor ( ) ) ; } if ( ! ( ( this . modified & MODIFIED_LINE_LEADING ) == MODIFIED_LINE_LEADING ) ) { setLineLeading ( this . baseStyle . getLineLeading ( ) ) ; } if ( ! ( ( this . modified & MODIFIED_KEEP_TOGETHER ) == MODIFIED_KEEP_TOGETHER ) ) { setKeepTogether ( this . baseStyle . getKeepTogether ( ) ) ; } if ( ! ( ( this . modified & MODIFIED_KEEP_TOGETHER_WITH_NEXT ) == MODIFIED_KEEP_TOGETHER_WITH_NEXT ) ) { setKeepTogetherWithNext ( this . baseStyle . getKeepTogetherWithNext ( ) ) ; } } |
public class Sftp { /** * 遍历某个目录下所有目录 , 不会递归遍历
* @ param path 遍历某个目录下所有目录
* @ return 目录名列表
* @ since 4.0.5 */
public List < String > lsDirs ( String path ) { } } | return ls ( path , new Filter < LsEntry > ( ) { @ Override public boolean accept ( LsEntry t ) { return t . getAttrs ( ) . isDir ( ) ; } } ) ; |
public class EnumParameterTypeImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public void eSet ( int featureID , Object newValue ) { } } | switch ( featureID ) { case BpsimPackage . ENUM_PARAMETER_TYPE__GROUP : ( ( FeatureMap . Internal ) getGroup ( ) ) . set ( newValue ) ; return ; case BpsimPackage . ENUM_PARAMETER_TYPE__PARAMETER_VALUE_GROUP : ( ( FeatureMap . Internal ) getParameterValueGroup ( ) ) . set ( newValue ) ; return ; case BpsimPackage . ENUM_PARAMETER_TYPE__PARAMETER_VALUE : getParameterValue ( ) . clear ( ) ; getParameterValue ( ) . addAll ( ( Collection < ? extends ParameterValue > ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ; |
public class ApiOvhSms { /** * Delete the sms user given
* REST : DELETE / sms / { serviceName } / users / { login }
* @ param serviceName [ required ] The internal name of your SMS offer
* @ param login [ required ] The sms user login */
public void serviceName_users_login_DELETE ( String serviceName , String login ) throws IOException { } } | String qPath = "/sms/{serviceName}/users/{login}" ; StringBuilder sb = path ( qPath , serviceName , login ) ; exec ( qPath , "DELETE" , sb . toString ( ) , null ) ; |
public class VAlarmScribe { /** * Creates a new { @ link VCalAlarmProperty } based on the given { @ link VAlarm }
* component , setting fields that are common to all
* { @ link VCalAlarmProperty } classes .
* @ param valarm the source component
* @ return the property or null if it cannot be created */
private static VCalAlarmProperty create ( VAlarm valarm ) { } } | Action action = valarm . getAction ( ) ; if ( action == null ) { return null ; } if ( action . isAudio ( ) ) { AudioAlarm aalarm = new AudioAlarm ( ) ; List < Attachment > attaches = valarm . getAttachments ( ) ; if ( ! attaches . isEmpty ( ) ) { Attachment attach = attaches . get ( 0 ) ; String formatType = attach . getFormatType ( ) ; aalarm . setParameter ( "TYPE" , formatType ) ; byte [ ] data = attach . getData ( ) ; if ( data != null ) { aalarm . setData ( data ) ; } String uri = attach . getUri ( ) ; if ( uri != null ) { String contentId = StringUtils . afterPrefixIgnoreCase ( uri , "cid:" ) ; if ( contentId == null ) { aalarm . setUri ( uri ) ; } else { aalarm . setContentId ( contentId ) ; } } } return aalarm ; } if ( action . isDisplay ( ) ) { Description description = valarm . getDescription ( ) ; String text = ValuedProperty . getValue ( description ) ; return new DisplayAlarm ( text ) ; } if ( action . isEmail ( ) ) { List < Attendee > attendees = valarm . getAttendees ( ) ; String email = attendees . isEmpty ( ) ? null : attendees . get ( 0 ) . getEmail ( ) ; EmailAlarm malarm = new EmailAlarm ( email ) ; Description description = valarm . getDescription ( ) ; String note = ValuedProperty . getValue ( description ) ; malarm . setNote ( note ) ; return malarm ; } if ( action . isProcedure ( ) ) { Description description = valarm . getDescription ( ) ; String path = ValuedProperty . getValue ( description ) ; return new ProcedureAlarm ( path ) ; } return null ; |
public class GridLayoutHelper { /** * { @ inheritDoc }
* Set SpanCount for grid
* @ param spanCount grid column number , must be greater than 0 . { @ link IllegalArgumentException }
* will be thrown otherwise */
public void setSpanCount ( int spanCount ) { } } | if ( spanCount == mSpanCount ) { return ; } if ( spanCount < 1 ) { throw new IllegalArgumentException ( "Span count should be at least 1. Provided " + spanCount ) ; } mSpanCount = spanCount ; mSpanSizeLookup . invalidateSpanIndexCache ( ) ; ensureSpanCount ( ) ; |
public class UCharacter { /** * Determines if the specified code point is a Unicode specified space
* character , i . e . if code point is in the category Zs , Zl and Zp .
* Up - to - date Unicode implementation of java . lang . Character . isSpaceChar ( ) .
* @ param ch code point to determine if it is a space
* @ return true if the specified code point is a space character */
public static boolean isSpaceChar ( int ch ) { } } | // if props = = 0 , it will just fall through and return false
return ( ( 1 << getType ( ch ) ) & ( ( 1 << UCharacterCategory . SPACE_SEPARATOR ) | ( 1 << UCharacterCategory . LINE_SEPARATOR ) | ( 1 << UCharacterCategory . PARAGRAPH_SEPARATOR ) ) ) != 0 ; |
public class StatementManager { /** * return a prepared Select Statement for the given ClassDescriptor */
public PreparedStatement getSelectByPKStatement ( ClassDescriptor cds ) throws PersistenceBrokerSQLException , PersistenceBrokerException { } } | try { return cds . getStatementsForClass ( m_conMan ) . getSelectByPKStmt ( m_conMan . getConnection ( ) ) ; } catch ( SQLException e ) { throw new PersistenceBrokerSQLException ( "Could not build statement ask for" , e ) ; } catch ( LookupException e ) { throw new PersistenceBrokerException ( "Used ConnectionManager instance could not obtain a connection" , e ) ; } |
public class FirewallClient { /** * Returns the specified firewall .
* < p > Sample code :
* < pre > < code >
* try ( FirewallClient firewallClient = FirewallClient . create ( ) ) {
* ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName . of ( " [ PROJECT ] " , " [ FIREWALL ] " ) ;
* Firewall response = firewallClient . getFirewall ( firewall . toString ( ) ) ;
* < / code > < / pre >
* @ param firewall Name of the firewall rule to return .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final Firewall getFirewall ( String firewall ) { } } | GetFirewallHttpRequest request = GetFirewallHttpRequest . newBuilder ( ) . setFirewall ( firewall ) . build ( ) ; return getFirewall ( request ) ; |
public class LogManager { /** * we return the given default value . */
boolean getBooleanProperty ( String name , boolean defaultValue ) { } } | String val = getProperty ( name ) ; if ( val == null ) { return defaultValue ; } val = val . toLowerCase ( ) ; if ( val . equals ( "true" ) || val . equals ( "1" ) ) { return true ; } else if ( val . equals ( "false" ) || val . equals ( "0" ) ) { return false ; } return defaultValue ; |
public class LowLevelAbstractionDefinition { /** * Adds a primitive parameter from which this abstraction is inferred .
* @ param paramId
* a primitive parameter id < code > String < / code > .
* @ return < code > true < / code > if adding the parameter id was successful ,
* < code > false < / code > otherwise ( e . g . , < code > paramId < / code > was
* < code > null < / code > ) . */
public boolean addPrimitiveParameterId ( String paramId ) { } } | boolean result = this . paramIds . add ( paramId ) ; if ( result ) { recalculateChildren ( ) ; } return result ; |
public class RESTDocBuilder { /** * param which will not be displayed in doc . */
protected boolean isInIgnoreParamList ( Parameter param ) { } } | return "javax.servlet.http.HttpServletRequest" . equals ( param . type ( ) . qualifiedTypeName ( ) ) || "javax.servlet.http.HttpServletResponse" . equals ( param . type ( ) . qualifiedTypeName ( ) ) || "javax.servlet.http.HttpSession" . equals ( param . type ( ) . qualifiedTypeName ( ) ) || "org.springframework.web.context.request.WebRequest" . equals ( param . type ( ) . qualifiedTypeName ( ) ) || "java.io.OutputStream" . equals ( param . type ( ) . qualifiedTypeName ( ) ) || "org.springframework.http.HttpEntity<java.lang.String>" . equals ( param . type ( ) . qualifiedTypeName ( ) ) ; |
public class SARLPackageExplorerPart { /** * Replies the label provider .
* @ return the label provider . */
protected PackageExplorerLabelProvider getLabelProvider ( ) { } } | try { return ( PackageExplorerLabelProvider ) this . reflect . get ( this , "fLabelProvider" ) ; // $ NON - NLS - 1 $
} catch ( SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException e ) { throw new Error ( e ) ; } |
public class OWLEquivalentObjectPropertiesAxiomImpl_CustomFieldSerializer { /** * Serializes the content of the object into the
* { @ link com . google . gwt . user . client . rpc . SerializationStreamWriter } .
* @ param streamWriter the { @ link com . google . gwt . user . client . rpc . SerializationStreamWriter } to write the
* object ' s content to
* @ param instance the object instance to serialize
* @ throws com . google . gwt . user . client . rpc . SerializationException
* if the serialization operation is not
* successful */
@ Override public void serializeInstance ( SerializationStreamWriter streamWriter , OWLEquivalentObjectPropertiesAxiomImpl instance ) throws SerializationException { } } | serialize ( streamWriter , instance ) ; |
public class WebCrawler { /** * This function is called when a unhandled exception was encountered during fetching
* @ param webUrl URL where a unhandled exception occured */
protected void onUnhandledException ( WebURL webUrl , Throwable e ) { } } | if ( myController . getConfig ( ) . isHaltOnError ( ) && ! ( e instanceof IOException ) ) { throw new RuntimeException ( "unhandled exception" , e ) ; } else { String urlStr = ( webUrl == null ? "NULL" : webUrl . getURL ( ) ) ; logger . warn ( "Unhandled exception while fetching {}: {}" , urlStr , e . getMessage ( ) ) ; logger . info ( "Stacktrace: " , e ) ; // Do nothing by default ( except basic logging )
// Sub - classed can override this to add their custom functionality
} |
public class AxisHandler { /** * Invoke a SOAP call .
* @ param soapCall the call to make to a SOAP web service
* @ return information about the SOAP response */
@ Override public RemoteCallReturn invokeSoapCall ( SoapCall < Stub > soapCall ) { } } | Stub stub = soapCall . getSoapClient ( ) ; RemoteCallReturn . Builder builder = new RemoteCallReturn . Builder ( ) ; synchronized ( stub ) { Object result = null ; try { result = invoke ( soapCall ) ; } catch ( InvocationTargetException e ) { builder . withException ( e . getTargetException ( ) ) ; } catch ( Exception e ) { builder . withException ( e ) ; } finally { MessageContext messageContext = stub . _getCall ( ) . getMessageContext ( ) ; RequestInfo . Builder requestInfoBuilder = new RequestInfo . Builder ( ) . withMethodName ( stub . _getCall ( ) . getOperationName ( ) . getLocalPart ( ) ) . withServiceName ( stub . _getService ( ) . getServiceName ( ) . getLocalPart ( ) ) . withUrl ( stub . _getCall ( ) . getTargetEndpointAddress ( ) ) ; requestInfoXPathSet . parseMessage ( requestInfoBuilder , messageContext . getRequestMessage ( ) ) ; builder . withRequestInfo ( requestInfoBuilder . build ( ) ) ; ResponseInfo . Builder responseInfoBuilder = new ResponseInfo . Builder ( ) ; responseInfoXPathSet . parseMessage ( responseInfoBuilder , messageContext . getResponseMessage ( ) ) ; builder . withResponseInfo ( responseInfoBuilder . build ( ) ) ; } return builder . withReturnValue ( result ) . build ( ) ; } |
public class Database { public void registerService ( String serviceName , String instanceName , String devname ) throws DevFailed { } } | databaseDAO . registerService ( this , serviceName , instanceName , devname ) ; |
public class AbstractGenericHandler { /** * Helper method to perform certain side effects when the channel is connected . */
private void channelActiveSideEffects ( final ChannelHandlerContext ctx ) { } } | long interval = env ( ) . keepAliveInterval ( ) ; if ( env ( ) . continuousKeepAliveEnabled ( ) ) { continuousKeepAliveFuture = ctx . executor ( ) . scheduleAtFixedRate ( new Runnable ( ) { @ Override public void run ( ) { if ( shouldSendKeepAlive ( ) ) { createAndWriteKeepAlive ( ctx ) ; } } } , interval , interval , TimeUnit . MILLISECONDS ) ; } |
public class MtasBasicParser { /** * Check for variables .
* @ param values the values
* @ return true , if successful */
private boolean checkForVariables ( List < Map < String , String > > values ) { } } | if ( values == null || values . isEmpty ( ) ) { return false ; } else { for ( Map < String , String > list : values ) { if ( list . containsKey ( "type" ) && list . get ( "type" ) . equals ( MtasParserMapping . PARSER_TYPE_VARIABLE ) ) { return true ; } } } return false ; |
public class PowerMock { /** * Suppress multiple methods for a class .
* @ param clazz The class whose methods will be suppressed .
* @ param methodName The first method to be suppress in class { @ code clazz } .
* @ param additionalMethodNames Additional methods to suppress in class { @ code clazz } .
* @ deprecated Use { @ link # suppress ( Method [ ] ) } instead . */
@ Deprecated public static synchronized void suppressMethod ( Class < ? > clazz , String methodName , String ... additionalMethodNames ) { } } | SuppressCode . suppressMethod ( clazz , methodName , additionalMethodNames ) ; |
public class Token { /** * setter for tokenId - sets
* @ generated
* @ param v value to set into the feature */
public void setTokenId ( int v ) { } } | if ( Token_Type . featOkTst && ( ( Token_Type ) jcasType ) . casFeat_tokenId == null ) jcasType . jcas . throwFeatMissing ( "tokenId" , "de.unihd.dbs.uima.types.heideltime.Token" ) ; jcasType . ll_cas . ll_setIntValue ( addr , ( ( Token_Type ) jcasType ) . casFeatCode_tokenId , v ) ; |
import java . util . List ; public class Main { /** * This is a Java function to identify the initial odd number in a provided list of numbers .
* Examples :
* get _ first _ odd ( [ 1 , 3 , 5 ] ) - > 1
* get _ first _ odd ( [ 2 , 4 , 1 , 3 ] ) - > 1
* get _ first _ odd ( [ 8 , 9 , 1 ] ) - > 9
* Parameters :
* num _ list : A list containing integers .
* Returns :
* The first odd integer found in the list . If there is no odd number , it returns - 1. */
public static int getFirstOdd ( List < Integer > num_list ) { } public static void main ( String [ ] args ) { } } | for ( int num : num_list ) { if ( num % 2 != 0 ) { return num ; } } return - 1 ; |
public class Bits { /** * Reads a variable - length encoded long from an input stream . Note that currently variable - length encoding is < em > not < / em >
* used ( a similar mechanism is used ) ; this will be implemented later .
* @ param in the input stream
* @ return the long read from the input stream
* @ throws IOException */
public static long readLong ( DataInput in ) throws IOException { } } | byte len = in . readByte ( ) ; if ( len == 0 ) return 0 ; return makeLong ( in , len ) ; |
public class LayerReducerUtil { /** * TODO replace this function by the DOME
* @ param key
* @ return */
public static String defaultValue ( String key ) { } } | String value ; HashMap < String , String > defaultValues ; defaultValues = new HashMap < String , String > ( ) ; defaultValues . put ( "slcly" , "12.6" ) ; defaultValues . put ( "salb" , "0.25" ) ; defaultValues . put ( "slphw" , "6.2" ) ; defaultValues . put ( "sksat" , "0.0" ) ; defaultValues . put ( "caco3" , "0.0" ) ; defaultValues . put ( "sloc" , "0.1" ) ; defaultValues . put ( "slll" , "0.0" ) ; defaultValues . put ( "icnh4" , "0.0" ) ; defaultValues . put ( "icno3" , "0.0" ) ; defaultValues . put ( "ich2o" , "0.0" ) ; if ( defaultValues . containsKey ( key ) ) { value = defaultValues . get ( key ) ; } else { value = UNKNOWN_DEFAULT_VALUE ; } return value ; |
public class Jar { /** * Adds a directory ( with all its subdirectories ) or the contents of a zip / JAR to this JAR .
* @ param path the path within the JAR where the root of the directory will be placed , or { @ code null } for the JAR ' s root
* @ param dirOrZip the directory to add as an entry or a zip / JAR file whose contents will be extracted and added as entries
* @ param filter a filter to select particular classes
* @ return { @ code this } */
public Jar addEntries ( Path path , Path dirOrZip , Filter filter ) throws IOException { } } | if ( Files . isDirectory ( dirOrZip ) ) addDir ( path , dirOrZip , filter , true ) ; else { try ( JarInputStream jis1 = newJarInputStream ( Files . newInputStream ( dirOrZip ) ) ) { addEntries ( path , jis1 , filter ) ; } } return this ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.