idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
37,500
private void getHeadersFromFrame ( ) { byte [ ] hbf = null ; if ( currentFrame . getFrameType ( ) == FrameTypes . HEADERS || currentFrame . getFrameType ( ) == FrameTypes . PUSHPROMISEHEADERS ) { hbf = ( ( FrameHeaders ) currentFrame ) . getHeaderBlockFragment ( ) ; } else if ( currentFrame . getFrameType ( ) == FrameTypes . CONTINUATION ) { hbf = ( ( FrameContinuation ) currentFrame ) . getHeaderBlockFragment ( ) ; } if ( hbf != null ) { if ( headerBlock == null ) { headerBlock = new ArrayList < byte [ ] > ( ) ; } headerBlock . add ( hbf ) ; } }
Appends the header block fragment in the current header frame to this stream s incomplete header block
37,501
private void getBodyFromFrame ( ) { if ( dataPayload == null ) { dataPayload = new ArrayList < byte [ ] > ( ) ; } if ( currentFrame . getFrameType ( ) == FrameTypes . DATA ) { dataPayload . add ( ( ( FrameData ) currentFrame ) . getData ( ) ) ; } }
Grab the data from the current frame
37,502
private void processCompleteData ( ) throws ProtocolException { WsByteBufferPoolManager bufManager = HttpDispatcher . getBufferManager ( ) ; WsByteBuffer buf = bufManager . allocate ( getByteCount ( dataPayload ) ) ; for ( byte [ ] bytes : dataPayload ) { buf . put ( bytes ) ; } buf . flip ( ) ; if ( expectedContentLength != - 1 && buf . limit ( ) != expectedContentLength ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "processCompleteData release buffer and throw ProtocolException" ) ; } buf . release ( ) ; ProtocolException pe = new ProtocolException ( "content-length header did not match the expected amount of data received" ) ; pe . setConnectionError ( false ) ; throw pe ; } moveDataIntoReadBufferArray ( buf ) ; }
Put the data payload for this stream into the read buffer that will be passed to the webcontainer . This should only be called when this stream has received an end of stream flag .
37,503
private void setReadyForRead ( ) throws ProtocolException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "setReadyForRead entry: stream id:" + myID ) ; } muxLink . updateHighestStreamId ( myID ) ; if ( headersCompleted ) { ExecutorService executorService = CHFWBundle . getExecutorService ( ) ; Http2Ready readyThread = new Http2Ready ( h2HttpInboundLinkWrap ) ; executorService . execute ( readyThread ) ; } }
Tell the HTTP inbound link that we have data ready for it to read
37,504
private void moveDataIntoReadBufferArray ( WsByteBuffer newReadBuffer ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "moveDataIntoReadBufferArray entry: stream " + myID + " buffer: " + newReadBuffer ) ; } if ( newReadBuffer != null ) { int size = newReadBuffer . remaining ( ) ; if ( size > 0 ) { streamReadReady . add ( newReadBuffer ) ; streamReadSize += size ; this . readLatch . countDown ( ) ; } } }
Add a buffer to the list of buffers that will be sent to the WebContainer when a read is requested
37,505
@ SuppressWarnings ( "unchecked" ) public VirtualConnection read ( long numBytes , WsByteBuffer [ ] requestBuffers ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "read entry: stream " + myID + " request: " + requestBuffers + " num bytes requested: " + numBytes ) ; } long streamByteCount = streamReadSize ; long requestByteCount = bytesRemaining ( requestBuffers ) ; int reqArrayIndex = 0 ; if ( numBytes > streamReadSize || requestBuffers == null ) { if ( this . headersCompleted ) { return h2HttpInboundLinkWrap . getVirtualConnection ( ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "read exit: stream " + myID + " more bytes requested than available for read: " + numBytes + " > " + streamReadSize ) ; } return null ; } } if ( streamByteCount < requestByteCount ) { actualReadCount = streamByteCount ; } else { actualReadCount = requestByteCount ; } for ( int bytesRead = 0 ; bytesRead < actualReadCount ; bytesRead ++ ) { while ( ( requestBuffers [ reqArrayIndex ] . position ( ) == requestBuffers [ reqArrayIndex ] . limit ( ) ) ) { reqArrayIndex ++ ; } while ( ! streamReadReady . isEmpty ( ) && ! streamReadReady . get ( 0 ) . hasRemaining ( ) ) { streamReadReady . get ( 0 ) . release ( ) ; streamReadReady . remove ( 0 ) ; } requestBuffers [ reqArrayIndex ] . put ( streamReadReady . get ( 0 ) . get ( ) ) ; } streamReadSize = 0 ; readLatch = new CountDownLatch ( 1 ) ; for ( WsByteBuffer buffer : ( ( ArrayList < WsByteBuffer > ) streamReadReady . clone ( ) ) ) { streamReadReady . clear ( ) ; if ( buffer . hasRemaining ( ) ) { moveDataIntoReadBufferArray ( buffer . slice ( ) ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "read exit: " + streamId ( ) ) ; } return h2HttpInboundLinkWrap . getVirtualConnection ( ) ; }
Read the HTTP header and data bytes for this stream
37,506
public boolean isStreamClosed ( ) { if ( this . myID == 0 && ! endStream ) { return false ; } if ( state == StreamState . CLOSED ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "isStreamClosed stream closed; " + streamId ( ) ) ; } return true ; } boolean rc = muxLink . checkIfGoAwaySendingOrClosing ( ) ; if ( rc == true ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "isStreamClosed stream closed via muxLink check; " + streamId ( ) ) ; } } return rc ; }
Check if the current stream should be closed
37,507
private int getByteCount ( ArrayList < byte [ ] > listOfByteArrays ) { int count = 0 ; for ( byte [ ] byteArray : listOfByteArrays ) { if ( byteArray != null ) { count += byteArray . length ; } } return count ; }
Get the number of bytes in this list of byte arrays
37,508
public static String generateIncUuid ( Object caller ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "generateIncUuid" , "Caller=" + caller ) ; java . util . Date time = new java . util . Date ( ) ; int hash = caller . hashCode ( ) ; long millis = time . getTime ( ) ; byte [ ] data = new byte [ ] { ( byte ) ( hash >> 24 ) , ( byte ) ( hash >> 16 ) , ( byte ) ( hash >> 8 ) , ( byte ) ( hash ) , ( byte ) ( millis >> 24 ) , ( byte ) ( millis >> 16 ) , ( byte ) ( millis >> 8 ) , ( byte ) ( millis ) } ; String digits = "0123456789ABCDEF" ; StringBuffer retval = new StringBuffer ( data . length * 2 ) ; for ( int i = 0 ; i < data . length ; i ++ ) { retval . append ( digits . charAt ( ( data [ i ] >> 4 ) & 0xf ) ) ; retval . append ( digits . charAt ( data [ i ] & 0xf ) ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "generateIncUuid" , "return=" + retval ) ; return retval . toString ( ) ; }
The UUID for this incarnation of ME is generated using the hashcode of this object and the least significant four bytes of the current time in milliseconds .
37,509
public static String getMEName ( Object o ) { String meName ; if ( ! threadLocalStack . isEmpty ( ) ) { meName = threadLocalStack . peek ( ) ; } else { meName = DEFAULT_ME_NAME ; } String str = "" ; if ( o != null ) { str = "/" + Integer . toHexString ( System . identityHashCode ( o ) ) ; } return "" ; }
Get Jetstream ME name to be printed in trace message
37,510
void setSICoreConnection ( final SICoreConnection connection ) { if ( TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , "setSICoreConnection" , connection ) ; } _coreConnection = connection ; if ( TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , "setSICoreConnection" ) ; } }
Sets the connection that was created as a result of this request .
37,511
public ZipFile open ( ) throws IOException { String methodName = "open" ; synchronized ( zipFileLock ) { if ( zipFile == null ) { debug ( methodName , "Opening" ) ; if ( zipFileReaper == null ) { zipFile = ZipFileUtils . openZipFile ( file ) ; } else { zipFile = zipFileReaper . open ( path ) ; } } openCount ++ ; debug ( methodName , "Opened" ) ; return zipFile ; } }
Open the zip file . Create and assign the zip file if this is the first open . Increase the open count by one .
37,512
public InputStream getInputStream ( ZipFile useZipFile , ZipEntry zipEntry ) throws IOException { String methodName = "getInputStream" ; String entryName = zipEntry . getName ( ) ; if ( zipEntry . isDirectory ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { debug ( methodName , "Entry [ " + entryName + " ] [ null ] (Not using cache: Directory entry)" ) ; } return null ; } long entrySize = zipEntry . getSize ( ) ; if ( entrySize == 0 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { debug ( methodName , "Entry [ " + entryName + " ] [ empty stream ] (Not using cache: Empty entry)" ) ; } return EMPTY_STREAM ; } boolean doNotCache ; String doNotCacheReason ; if ( zipEntries == null ) { doNotCache = true ; doNotCacheReason = "Do not cache: Entry cache disabled" ; } else if ( entrySize > ZipCachingProperties . ZIP_CACHE_ENTRY_LIMIT ) { doNotCache = true ; doNotCacheReason = "Do not cache: Too big" ; } else if ( entryName . equals ( "META-INF/MANIFEST.MF" ) ) { doNotCache = false ; doNotCacheReason = "Cache META-INF/MANIFEST.MF" ; } else if ( entryName . endsWith ( ".class" ) ) { doNotCache = false ; doNotCacheReason = "Cache .class resources" ; } else { doNotCache = true ; doNotCacheReason = "Do not cache: Not manifest or class resource" ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { debug ( methodName , "Entry [ " + entryName + " ] [ non-null ] [ " + doNotCacheReason + " ]" ) ; } if ( doNotCache ) { return useZipFile . getInputStream ( zipEntry ) ; } String entryCacheKey = entryName + ":::" + Long . toString ( zipEntry . getCrc ( ) ) + ":::" + Long . toString ( getLastModified ( ) ) ; byte [ ] entryBytes ; synchronized ( zipEntriesLock ) { entryBytes = zipEntries . get ( entryCacheKey ) ; } if ( entryBytes == null ) { InputStream inputStream = useZipFile . getInputStream ( zipEntry ) ; try { entryBytes = read ( inputStream , ( int ) entrySize , entryName ) ; } finally { inputStream . close ( ) ; } synchronized ( zipEntriesLock ) { zipEntries . put ( entryCacheKey , entryBytes ) ; } } return new ByteArrayInputStream ( entryBytes ) ; }
Answer an input stream for an entry of a zip file . When the entry is a class entry which has 8K or fewer bytes read all of the entry bytes immediately and cache the bytes in this handle . Subsequent input stream requests which locate cached bytes will answer a stream on those bytes .
37,513
private static byte [ ] read ( InputStream inputStream , int expectedRead , String name ) throws IOException { byte [ ] bytes = new byte [ expectedRead ] ; int remainingRead = expectedRead ; int totalRead = 0 ; while ( remainingRead > 0 ) { int nextRead = inputStream . read ( bytes , totalRead , remainingRead ) ; if ( nextRead <= 0 ) { throw new IOException ( "Read only [ " + Integer . valueOf ( totalRead ) + " ]" + " of expected [ " + Integer . valueOf ( expectedRead ) + " ] bytes" + " from [ " + name + " ]" ) ; } else { remainingRead -= nextRead ; totalRead += nextRead ; } } return bytes ; }
Read an exact count of bytes from an input stream .
37,514
private String findVersion ( ) { WlpInformation wlp = _asset . getWlpInformation ( ) ; if ( wlp == null ) { return null ; } Collection < AppliesToFilterInfo > filterInfo = wlp . getAppliesToFilterInfo ( ) ; if ( filterInfo == null ) { return null ; } for ( AppliesToFilterInfo filter : filterInfo ) { if ( filter . getMinVersion ( ) != null ) { return filter . getMinVersion ( ) . getValue ( ) ; } } return null ; }
Uses the filter information to return the first version number
37,515
private void addVersionDisplayString ( ) { WlpInformation wlp = _asset . getWlpInformation ( ) ; JavaSEVersionRequirements reqs = wlp . getJavaSEVersionRequirements ( ) ; if ( reqs == null ) { return ; } String minVersion = reqs . getMinVersion ( ) ; if ( minVersion == null ) { return ; } String minJava11 = "Java SE 11" ; String minJava8 = "Java SE 8, Java SE 11" ; String minJava7 = "Java SE 7, Java SE 8, Java SE 11" ; String minJava6 = "Java SE 6, Java SE 7, Java SE 8, Java SE 11" ; if ( "jdbc-4.3" . equals ( wlp . getLowerCaseShortName ( ) ) ) { reqs . setVersionDisplayString ( minJava11 ) ; return ; } if ( minVersion . equals ( "1.6.0" ) ) { reqs . setVersionDisplayString ( minJava6 ) ; return ; } if ( minVersion . equals ( "1.7.0" ) ) { reqs . setVersionDisplayString ( minJava7 ) ; return ; } if ( minVersion . equals ( "1.8.0" ) ) { reqs . setVersionDisplayString ( minJava8 ) ; return ; } if ( minVersion . startsWith ( "9." ) || minVersion . startsWith ( "10." ) || minVersion . startsWith ( "11." ) ) { reqs . setVersionDisplayString ( minJava11 ) ; return ; } throw new AssertionError ( "Unrecognized java version: " + minVersion ) ; }
This generates the string that should be displayed on the website to indicate the supported Java versions . The requirements come from the bundle manifests . The mapping between the two is non - obvious as it is the intersection between the Java EE requirement and the versions of Java that Liberty supports .
37,516
private void removeRequireFeatureWithToleratesIfExists ( String feature ) { Collection < RequireFeatureWithTolerates > rfwt = _asset . getWlpInformation ( ) . getRequireFeatureWithTolerates ( ) ; if ( rfwt != null ) { for ( RequireFeatureWithTolerates toCheck : rfwt ) { if ( toCheck . getFeature ( ) . equals ( feature ) ) { rfwt . remove ( toCheck ) ; return ; } } } }
Looks in the underlying asset to see if there is a requireFeatureWithTolerates entry for the supplied feature and if there is removes it .
37,517
private void copyRequireFeatureToRequireFeatureWithTolerates ( ) { Collection < RequireFeatureWithTolerates > rfwt = _asset . getWlpInformation ( ) . getRequireFeatureWithTolerates ( ) ; if ( rfwt != null ) { return ; } Collection < String > requireFeature = _asset . getWlpInformation ( ) . getRequireFeature ( ) ; if ( requireFeature == null ) { return ; } Collection < RequireFeatureWithTolerates > newOne = new HashSet < RequireFeatureWithTolerates > ( ) ; for ( String feature : requireFeature ) { RequireFeatureWithTolerates newFeature = new RequireFeatureWithTolerates ( ) ; newFeature . setFeature ( feature ) ; newFeature . setTolerates ( Collections . < String > emptyList ( ) ) ; newOne . add ( newFeature ) ; } _asset . getWlpInformation ( ) . setRequireFeatureWithTolerates ( newOne ) ; }
requireFeature was the old field in the asset which didn t contain tolerates information . The new field is requireFeatureWithTolerates and for the moment both fields are being maintained as older assets in the repository will only have the older field . When older assets are being written to the data from the older field needs to be copied to the new field to ensure both are consistent . The write will then write to both fields
37,518
public static boolean isClassVetoed ( Class < ? > type ) { if ( type . isAnnotationPresent ( Vetoed . class ) ) { return true ; } return isPackageVetoed ( type . getPackage ( ) ) ; }
Return true if the class is vetoed or the package is vetoed
37,519
private Map < String , String > populateCommonAuthzHeaderParams ( ) { Map < String , String > parameters = new HashMap < String , String > ( ) ; parameters . put ( TwitterConstants . PARAM_OAUTH_CONSUMER_KEY , consumerKey ) ; parameters . put ( TwitterConstants . PARAM_OAUTH_NONCE , Utils . generateNonce ( ) ) ; parameters . put ( TwitterConstants . PARAM_OAUTH_SIGNATURE_METHOD , DEFAULT_SIGNATURE_ALGORITHM ) ; parameters . put ( TwitterConstants . PARAM_OAUTH_TIMESTAMP , Utils . getCurrentTimestamp ( ) ) ; parameters . put ( TwitterConstants . PARAM_OAUTH_VERSION , DEFAULT_OAUTH_VERSION ) ; return parameters ; }
Creates a map of parameters and values that are common to all requests that require an Authorization header .
37,520
private String signAndCreateAuthzHeader ( String endpointUrl , Map < String , String > parameters ) { String signature = computeSignature ( requestMethod , endpointUrl , parameters ) ; parameters . put ( TwitterConstants . PARAM_OAUTH_SIGNATURE , signature ) ; String authzHeaderString = createAuthorizationHeaderString ( parameters ) ; return authzHeaderString ; }
Generates the Authorization header with all the requisite content for the specified endpoint request by computing the signature adding it to the parameters and generating the Authorization header string .
37,521
public Map < String , Object > populateJsonResponse ( String responseBody ) throws JoseException { if ( responseBody == null || responseBody . isEmpty ( ) ) { return null ; } return JsonUtil . parseJson ( responseBody ) ; }
Populates a Map from the response body . This method expects the responseBody value to be in JSON format .
37,522
@ FFDCIgnore ( SocialLoginException . class ) public Map < String , Object > executeRequest ( SocialLoginConfig config , String requestMethod , String authzHeaderString , String url , String endpointType , String verifierValue ) { if ( endpointType == null ) { endpointType = TwitterConstants . TWITTER_ENDPOINT_REQUEST_TOKEN ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "A Twitter endpoint path was not found; defaulting to using " + endpointType + " as the Twitter endpoint path." ) ; } } try { SocialUtil . validateEndpointWithQuery ( url ) ; } catch ( SocialLoginException e ) { return createErrorResponse ( e ) ; } StringBuilder uri = new StringBuilder ( url ) ; if ( endpointType . equals ( TwitterConstants . TWITTER_ENDPOINT_VERIFY_CREDENTIALS ) ) { uri . append ( "?" ) . append ( TwitterConstants . PARAM_INCLUDE_EMAIL ) . append ( "=" ) . append ( TwitterConstants . INCLUDE_EMAIL ) . append ( "&" ) . append ( TwitterConstants . PARAM_SKIP_STATUS ) . append ( "=" ) . append ( TwitterConstants . SKIP_STATUS ) ; } try { Map < String , Object > result = getEndpointResponse ( config , uri . toString ( ) , requestMethod , authzHeaderString , endpointType , verifierValue ) ; String responseContent = httpUtil . extractTokensFromResponse ( result ) ; return evaluateRequestResponse ( responseContent , endpointType ) ; } catch ( SocialLoginException e ) { return createErrorResponse ( "TWITTER_EXCEPTION_EXECUTING_REQUEST" , new Object [ ] { url , e . getLocalizedMessage ( ) } ) ; } }
Sends a request to the specified Twitter endpoint and returns a Map object containing the evaluated response .
37,523
@ FFDCIgnore ( IllegalStateException . class ) private void updateMonitorService ( ) { if ( ! coveringPaths . isEmpty ( ) ) { if ( service == null ) { try { BundleContext bundleContext = getContainerFactoryHolder ( ) . getBundleContext ( ) ; setServiceProperties ( ) ; service = bundleContext . registerService ( FileMonitor . class , this , serviceProperties ) ; loadZipEntries ( ) ; } catch ( IllegalStateException e ) { } } else { } } else { if ( service != null ) { try { service . unregister ( ) ; } catch ( IllegalStateException e ) { } service = null ; } else { } } }
Update the monitor service according to whether any listeners are registered . That is if any covering paths are present .
37,524
private void updateEnclosingMonitor ( ) { if ( ! coveringPaths . isEmpty ( ) ) { if ( ! listenerRegistered ) { ArtifactContainer enclosingRootContainer = entryInEnclosingContainer . getRoot ( ) ; ArtifactNotification enclosingNotification = new DefaultArtifactNotification ( enclosingRootContainer , Collections . singleton ( entryInEnclosingContainer . getPath ( ) ) ) ; ArtifactNotifier enclosingRootNotifier = enclosingRootContainer . getArtifactNotifier ( ) ; listenerRegistered = enclosingRootNotifier . registerForNotifications ( enclosingNotification , this ) ; loadZipEntries ( ) ; } else { } } else { if ( listenerRegistered ) { ArtifactContainer enclosingRootContainer = entryInEnclosingContainer . getRoot ( ) ; ArtifactNotifier enclosingNotifier = enclosingRootContainer . getArtifactNotifier ( ) ; enclosingNotifier . removeListener ( this ) ; } else { } } }
Update the enclosing monitor according to whether any listeners are registered . That is if any covering paths are present .
37,525
private boolean registerListener ( String newPath , ArtifactListenerSelector newListener ) { boolean updatedCoveringPaths = addCoveringPath ( newPath ) ; Collection < ArtifactListenerSelector > listenersForPath = listeners . get ( newPath ) ; if ( listenersForPath == null ) { listenersForPath = new LinkedList < ArtifactListenerSelector > ( ) ; listeners . put ( newPath , listenersForPath ) ; } listenersForPath . add ( newListener ) ; return ( updatedCoveringPaths ) ; }
Register a listener to a specified path .
37,526
private boolean addCoveringPath ( String newPath ) { int newLen = newPath . length ( ) ; Iterator < String > useCoveringPaths = coveringPaths . iterator ( ) ; boolean isCovered = false ; boolean isCovering = false ; while ( ! isCovered && useCoveringPaths . hasNext ( ) ) { String coveringPath = useCoveringPaths . next ( ) ; int coveringLen = coveringPath . length ( ) ; if ( coveringLen < newLen ) { if ( isCovering ) { continue ; } else { if ( newPath . regionMatches ( 0 , coveringPath , 0 , coveringLen ) ) { if ( newPath . charAt ( coveringLen ) == '/' ) { isCovered = true ; break ; } else { continue ; } } else { continue ; } } } else if ( coveringLen == newLen ) { if ( isCovering ) { continue ; } else { if ( newPath . regionMatches ( 0 , coveringPath , 0 , coveringLen ) ) { isCovered = true ; break ; } else { continue ; } } } else { if ( newPath . regionMatches ( 0 , coveringPath , 0 , newLen ) ) { if ( coveringPath . charAt ( newLen ) == '/' ) { isCovering = true ; useCoveringPaths . remove ( ) ; continue ; } else { continue ; } } else { continue ; } } } if ( ! isCovered ) { coveringPaths . add ( newPath ) ; } return ! isCovered ; }
Add a path to the covering paths collection .
37,527
private String validateNotification ( Collection < ? > added , Collection < ? > removed , Collection < ? > updated ) { boolean isAddition = ! added . isEmpty ( ) ; boolean isRemoval = ! removed . isEmpty ( ) ; boolean isUpdate = ! updated . isEmpty ( ) ; if ( ! isAddition && ! isRemoval && ! isUpdate ) { return "null" ; } else if ( isAddition ) { return "Addition of [ " + added . toString ( ) + " ]" ; } else if ( isUpdate && isRemoval ) { return "Update of [ " + updated . toString ( ) + " ]" + " with removal of [ " + removed . toString ( ) + " ]" ; } else { return null ; } }
Validate change data which is expected to be collections of files or collections of entry paths .
37,528
private void notifyAllListeners ( boolean isUpdate , String filter ) { List < QueuedNotification > notifications = null ; synchronized ( listenersLock ) { for ( Map . Entry < String , Collection < ArtifactListenerSelector > > listenersEntry : listeners . entrySet ( ) ) { List < String > a_registeredPaths = new ArrayList < String > ( ) ; collectRegisteredPaths ( listenersEntry . getKey ( ) , a_registeredPaths ) ; if ( a_registeredPaths . isEmpty ( ) ) { continue ; } ArtifactNotification registeredPaths = new DefaultArtifactNotification ( rootContainer , a_registeredPaths ) ; for ( ArtifactListenerSelector listener : listenersEntry . getValue ( ) ) { if ( notifications == null ) { notifications = new ArrayList < QueuedNotification > ( listenersEntry . getValue ( ) . size ( ) ) ; } QueuedNotification notification = new QueuedNotification ( isUpdate , registeredPaths , listener , filter ) ; notifications . add ( notification ) ; } } } if ( notifications != null ) { for ( QueuedNotification notification : notifications ) { notification . fire ( ) ; } } }
A notification which was either an update to the entire zip or was the removal of the entire zip file was received . For each listener that is registered collect the paths for that listener and forward the notification .
37,529
public AuthenticationService getAuthenticationService ( SecurityService securityService ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , CLASS_NAME + "getAuthenticationService" , securityService ) ; } if ( _authenticationService == null ) { if ( securityService != null ) _authenticationService = securityService . getAuthenticationService ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , CLASS_NAME + "getAuthenticationService" , _authenticationService ) ; } return _authenticationService ; }
Get Authentication Service from the Liberty Security component It will get the AuthenticationService only if the SecurityService is activated
37,530
protected Subject login ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , CLASS_NAME + "login" ) ; } Subject subject = null ; try { if ( _authenticationService != null ) { subject = _authenticationService . authenticate ( MESSAGING_JASS_ENTRY_NAME , _authenticationData , _partialSubject ) ; } } catch ( AuthenticationException ae ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( tc , "EXCEPTION_OCCURED_DURING_AUTHENTICATION_MSE1001" ) ; SibTr . exception ( tc , ae ) ; } } finally { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , CLASS_NAME + "login" ) ; } } return subject ; }
The method to authenticate a User
37,531
private void rejectHandshake ( Conversation conversation , int requestNumber , String rejectedField ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "rejectHandshake" , new Object [ ] { conversation , requestNumber , rejectedField } ) ; SIConnectionLostException exception = new SIConnectionLostException ( nls . getFormattedMessage ( "INVALID_PROP_SICO8012" , null , null ) ) ; FFDCFilter . processException ( exception , CLASS_NAME + ".rejectHandshake" , CommsConstants . COMMONSERVERRECEIVELISTENER_HSREJCT_01 , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Invalid handshake type received - rejecting field:" , rejectedField ) ; StaticCATHelper . sendExceptionToClient ( exception , CommsConstants . COMMONSERVERRECEIVELISTENER_HSREJCT_01 , conversation , requestNumber ) ; closeConnection ( conversation ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "rejectHandshake" ) ; }
This method is used to inform the client that we are rejecting their handshake . Typically this will never happen unless a third party client is written or an internal error occurs . However we should check for an inproperly formatted handshake and inform the client if such an error occurs .
37,532
void register ( CloudantService svc , ConcurrentMap < ClientKey , Object > clients ) { registrations . put ( svc , clients ) ; }
Lazily registers a CloudantService to have its client cache purged of entries related to a stopped application .
37,533
@ FFDCIgnore ( NoSuchMethodException . class ) private void setRRSTransactional ( ) { try { ivRRSTransactional = ( Boolean ) activationSpec . getClass ( ) . getMethod ( "getRRSTransactional" ) . invoke ( activationSpec ) ; } catch ( NoSuchMethodException x ) { ivRRSTransactional = false ; } catch ( Exception x ) { ivRRSTransactional = x == null ; } }
If an RA wants to enable RRS Transactions it should return true for the method getRRSTransactional .
37,534
public void setJCAVersion ( int majorJCAVer , int minorJCAVer ) { majorJCAVersion = majorJCAVer ; minorJCAVersion = minorJCAVer ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "MessageEndpointFactoryImpl.setJCAVersionJCA: Version " + majorJCAVersion + "." + minorJCAVersion + " is set" ) ; } }
Indicates what version of JCA specification the RA using this MessageEndpointFactory requires compliance with .
37,535
private void setup ( BeanMetaData bmd ) { if ( ! ivSetup ) { int slotSize = bmd . container . getEJBRuntime ( ) . getMetaDataSlotSize ( MethodMetaData . class ) ; for ( int i = 0 ; i < capacity ; ++ i ) { EJBMethodInfoImpl methodInfo = bmd . createEJBMethodInfoImpl ( slotSize ) ; methodInfo . initializeInstanceData ( null , null , null , null , null , false ) ; elements [ i ] = methodInfo ; } ivSetup = true ; } }
Construct capacity sized stack
37,536
public final void done ( EJBMethodInfoImpl mi ) { if ( orig || ( mi == null ) || ( topOfStack == 0 ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "In orig mode returning:" + " orig: " + orig + " top: " + topOfStack + " mi: " + mi ) ; orig = true ; elements = null ; } else { -- topOfStack ; if ( topOfStack < capacity ) { if ( mi != ( elements [ topOfStack ] ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "EJBMethodInfoStack::done called with wrong " + "TopOfStack value: " + mi + "!=" + ( elements [ topOfStack ] ) ) ; orig = true ; elements = null ; } else elements [ topOfStack ] . initializeInstanceData ( null , null , null , null , null , false ) ; } } }
Indicate that the caller is finished with the instance that was last obtained .
37,537
final public EJBMethodInfoImpl get ( String methodSignature , String methodNameOnly , EJSWrapperBase wrapper , MethodInterface methodInterface , TransactionAttribute txAttr ) { EJBMethodInfoImpl retVal = null ; BeanMetaData bmd = wrapper . bmd ; setup ( bmd ) ; if ( ( topOfStack < 0 ) || orig ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "EJBMethodInfoStack::get called with neg TopOfStack " + "or in orig mode:" + topOfStack + " orig: " + orig ) ; orig = true ; elements = null ; retVal = bmd . createEJBMethodInfoImpl ( bmd . container . getEJBRuntime ( ) . getMetaDataSlotSize ( MethodMetaData . class ) ) ; } else { if ( topOfStack < elements . length ) { retVal = elements [ topOfStack ++ ] ; } else { ++ topOfStack ; retVal = bmd . createEJBMethodInfoImpl ( bmd . container . getEJBRuntime ( ) . getMetaDataSlotSize ( MethodMetaData . class ) ) ; } } retVal . initializeInstanceData ( null , methodNameOnly , bmd , methodInterface , txAttr , false ) ; return retVal ; }
Get an instance of EJBMethodInfoImpl . Either return EJBMethod off the stack or new up a new instance after stack capacity is exhausted returns EJBMethodInfoImpl
37,538
Class < ? > loadClass ( String name ) throws ClassNotFoundException { ServiceReference < DeserializationClassProvider > provider = classProviders . getReference ( name ) ; if ( provider != null ) { return loadClass ( provider , name ) ; } int index = name . lastIndexOf ( '.' ) ; if ( index != - 1 ) { String pkg = name . substring ( 0 , index ) ; provider = packageProviders . getReference ( pkg ) ; if ( provider != null ) { return loadClass ( provider , name ) ; } } return null ; }
Attempts to resolve a class from registered class providers .
37,539
public void begin ( ) throws ResourceException { if ( tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "begin" , ivMC ) ; if ( ivMC . _mcStale ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "MC is stale" ) ; throw new DataStoreAdapterException ( "INVALID_CONNECTION" , AdapterUtil . staleX ( ) , WSRdbSpiLocalTransactionImpl . class ) ; } if ( dsConfig . get ( ) . enableMultithreadedAccessDetection ) ivMC . detectMultithreadedAccess ( ) ; if ( ! ivMC . isTransactional ( ) ) { if ( tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "begin" , "no-op. Enlistment disabled" ) ; return ; } if ( tc . isDebugEnabled ( ) ) { String cId = null ; try { cId = ivMC . mcf . getCorrelator ( ivMC ) ; } catch ( SQLException x ) { Tr . debug ( tc , "got an exception trying to get the correlator, exception is: " , x ) ; } if ( cId != null ) { StringBuffer stbuf = new StringBuffer ( 200 ) ; stbuf . append ( "Correlator: DB2, ID: " ) ; stbuf . append ( cId ) ; stbuf . append ( " Transaction : " ) ; stbuf . append ( this ) ; stbuf . append ( " BEGIN" ) ; Tr . debug ( this , tc , stbuf . toString ( ) ) ; } } ResourceException re ; re = ivStateManager . isValid ( WSStateManager . LT_BEGIN ) ; if ( re == null ) { try { if ( ivMC . getAutoCommit ( ) ) ivMC . setAutoCommit ( false ) ; } catch ( SQLException sqle ) { FFDCFilter . processException ( sqle , currClass . getName ( ) + ".begin" , "126" , this ) ; throw new DataStoreAdapterException ( "DSA_ERROR" , sqle , currClass ) ; } ivStateManager . transtate = WSStateManager . LOCAL_TRANSACTION_ACTIVE ; } else { LocalTransactionException local_tran_excep = new LocalTransactionException ( re . getMessage ( ) ) ; DataStoreAdapterException dsae = new DataStoreAdapterException ( "WS_INTERNAL_ERROR" , local_tran_excep , currClass , "Cannot start SPI local transaction." , "" , local_tran_excep . getMessage ( ) ) ; FFDCFilter . processException ( dsae , "com.ibm.ws.rsadapter.spi.WSRdbSpiLocalTransactionImpl.begin" , "127" , this , new Object [ ] { "Possible components: WebSphere J2C Implementation" } ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "begin" , "Exception" ) ; throw dsae ; } if ( tc . isEventEnabled ( ) ) Tr . event ( tc , "SpiLocalTransaction started. ManagedConnection state is " + ivMC . getTransactionStateAsString ( ) ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "begin" ) ; }
Begin a local transaction
37,540
public void commit ( ) throws ResourceException { if ( tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "commit" , ivMC ) ; if ( ivMC . _mcStale ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "MC is stale" ) ; throw new DataStoreAdapterException ( "INVALID_CONNECTION" , AdapterUtil . staleX ( ) , WSRdbSpiLocalTransactionImpl . class ) ; } if ( dsConfig . get ( ) . enableMultithreadedAccessDetection ) ivMC . detectMultithreadedAccess ( ) ; if ( ! ivMC . isTransactional ( ) ) { if ( tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "commit" , "no-op. Enlistment disabled" ) ; return ; } if ( tc . isDebugEnabled ( ) ) { String cId = null ; try { cId = ivMC . mcf . getCorrelator ( ivMC ) ; } catch ( SQLException x ) { Tr . debug ( tc , "got an exception trying to get the correlator, exception is: " , x ) ; } if ( cId != null ) { StringBuffer stbuf = new StringBuffer ( 200 ) ; stbuf . append ( "Correlator: DB2, ID: " ) ; stbuf . append ( cId ) ; stbuf . append ( " Transaction : " ) ; stbuf . append ( this ) ; stbuf . append ( " COMMIT" ) ; Tr . debug ( this , tc , stbuf . toString ( ) ) ; } } ResourceException re = ivStateManager . isValid ( WSStateManager . LT_COMMIT ) ; if ( re == null ) try { ivConnection . commit ( ) ; ivStateManager . transtate = WSStateManager . NO_TRANSACTION_ACTIVE ; } catch ( SQLException se ) { FFDCFilter . processException ( se , "com.ibm.ws.rsadapter.spi.WSRdbSpiLocalTransactionImpl.commit" , "139" , this ) ; ResourceException x = AdapterUtil . translateSQLException ( se , ivMC , true , currClass ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "commit" , "Exception" ) ; throw x ; } else { LocalTransactionException local_tran_excep = new LocalTransactionException ( re . getMessage ( ) ) ; DataStoreAdapterException ds = new DataStoreAdapterException ( "WS_INTERNAL_ERROR" , local_tran_excep , currClass , "Cannot commit SPI local transaction." , "" , local_tran_excep . getMessage ( ) ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "commit" , "Exception" ) ; throw ds ; } ivMC . wasLazilyEnlistedInGlobalTran = false ; if ( tc . isEventEnabled ( ) ) Tr . event ( tc , "SPILocalTransaction committed. ManagedConnection state is " + ivMC . getTransactionStateAsString ( ) ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "commit" ) ; }
Commit a local transaction
37,541
public void rollback ( ) throws ResourceException { if ( tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "rollback" , ivMC ) ; if ( ivMC . _mcStale ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "MC is stale" ) ; throw new DataStoreAdapterException ( "INVALID_CONNECTION" , AdapterUtil . staleX ( ) , WSRdbSpiLocalTransactionImpl . class ) ; } if ( ! ivMC . isTransactional ( ) ) { if ( tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "rollback" , "no-op. Enlistment disabled" ) ; return ; } ResourceException re ; if ( tc . isDebugEnabled ( ) ) { String cId = null ; try { cId = ivMC . mcf . getCorrelator ( ivMC ) ; } catch ( SQLException x ) { Tr . debug ( tc , "got an exception trying to get the correlator, exception is: " , x ) ; } if ( cId != null ) { StringBuffer stbuf = new StringBuffer ( 200 ) ; stbuf . append ( "Correlator: DB2, ID: " ) ; stbuf . append ( cId ) ; stbuf . append ( " Transaction : " ) ; stbuf . append ( this ) ; stbuf . append ( "ROLLBACK" ) ; Tr . debug ( this , tc , stbuf . toString ( ) ) ; } } re = ivStateManager . isValid ( WSStateManager . LT_ROLLBACK ) ; if ( re == null ) try { ivConnection . rollback ( ) ; ivStateManager . transtate = WSStateManager . NO_TRANSACTION_ACTIVE ; } catch ( SQLException se ) { if ( ! ivMC . isAborted ( ) ) FFDCFilter . processException ( se , getClass ( ) . getName ( ) , "192" , this ) ; ResourceException resX = AdapterUtil . translateSQLException ( se , ivMC , true , currClass ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "rollback" , "Exception" ) ; throw resX ; } else { LocalTransactionException local_tran_excep = new LocalTransactionException ( re . getMessage ( ) ) ; DataStoreAdapterException dsae = new DataStoreAdapterException ( "WS_INTERNAL_ERROR" , local_tran_excep , currClass , "Cannot rollback SPI local transaction." , "" , local_tran_excep . getMessage ( ) ) ; FFDCFilter . processException ( dsae , "com.ibm.ws.rsadapter.spi.WSRdbSpiLocalTransactionImpl.rollback" , "291" , this , new Object [ ] { " Possible components: WebSphere J2C Implementation" } ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "rollback" , "Exception" ) ; throw dsae ; } ivMC . wasLazilyEnlistedInGlobalTran = false ; if ( tc . isEventEnabled ( ) ) Tr . event ( tc , "SpiLocalTransaction rolled back. ManagedConnection state is " + ivMC . getTransactionStateAsString ( ) ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "rollback" ) ; }
Rollback a local transaction
37,542
private void serializeRealObject ( ) throws ObjectFailedToSerializeException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "serializeRealObject" ) ; if ( hasRealObject ) { if ( realObject != null ) { try { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; ObjectOutputStream oos = new ObjectOutputStream ( baos ) ; oos . writeObject ( realObject ) ; getPayload ( ) . setField ( JmsObjectBodyAccess . BODY_DATA_VALUE , baos . toByteArray ( ) ) ; hasSerializedRealObject = true ; softRefToRealObject = new SoftReference < Serializable > ( realObject ) ; realObject = null ; } catch ( IOException ioe ) { FFDCFilter . processException ( ioe , "com.ibm.ws.sib.mfp.impl.JsJmsObjectMessageImpl.serializeRealObject" , "296" ) ; String objectClassName = realObject . getClass ( ) . getName ( ) ; throw new ObjectFailedToSerializeException ( ioe , objectClassName ) ; } } else { getPayload ( ) . setField ( JmsObjectBodyAccess . BODY_DATA_VALUE , null ) ; hasSerializedRealObject = true ; } } clearCachedLengths ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "serializeRealObject" ) ; }
Private method to serialize the real object into the payload .
37,543
private Serializable deserializeToRealObject ( ) throws IOException , ClassNotFoundException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "deserializeToRealObject" ) ; Serializable obj = null ; ObjectInputStream ois = null ; byte [ ] bytes = getDataFromPayload ( ) ; if ( bytes != null ) { try { ByteArrayInputStream bais = new ByteArrayInputStream ( bytes ) ; ClassLoader cl = AccessController . doPrivileged ( new PrivilegedAction < ClassLoader > ( ) { public ClassLoader run ( ) { return Thread . currentThread ( ) . getContextClassLoader ( ) ; } } ) ; ois = new DeserializationObjectInputStream ( bais , cl ) ; obj = ( Serializable ) ois . readObject ( ) ; hasRealObject = true ; hasSerializedRealObject = true ; softRefToRealObject = new SoftReference < Serializable > ( obj ) ; } catch ( IOException ioe ) { FFDCFilter . processException ( ioe , "com.ibm.ws.sib.mfp.impl.JsJmsObjectMessageImpl.deserializeToRealObject" , "340" ) ; throw ioe ; } catch ( ClassNotFoundException cnfe ) { FFDCFilter . processException ( cnfe , "com.ibm.ws.sib.mfp.impl.JsJmsObjectMessageImpl.deserializeToRealObject" , "345" ) ; throw cnfe ; } finally { try { if ( ois != null ) { ois . close ( ) ; } } catch ( IOException ex ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Exception closing the ObjectInputStream" , ex ) ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "deserializeToRealObject" , ( obj == null ? "null" : obj . getClass ( ) ) ) ; return obj ; }
Private method to deserialize the real object from the payload .
37,544
public SICoreConnection getConnection ( ) throws SISessionUnavailableException { if ( TraceComponent . isAnyTracingEnabled ( ) && CoreSPIProducerSession . tc . isEntryEnabled ( ) ) { SibTr . entry ( CoreSPIProducerSession . tc , "getConnection" , this ) ; SibTr . exit ( CoreSPIProducerSession . tc , "getConnection" , _conn ) ; } checkNotClosed ( ) ; return _conn ; }
Returns this sessions connection
37,545
void disableDiscriminatorAccessCheckAtSend ( String discriminatorAtCreate ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "disableDiscriminatorAccessCheckAtSend" ) ; _checkDiscriminatorAccessAtSend = false ; this . _discriminatorAtCreate = discriminatorAtCreate ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "disableDiscriminatorAccessCheckAtSend" ) ; }
Disable discriminator access checks at send time
37,546
public void addEntry ( TimerWorkItem addItem , long curTime ) { this . mostRecentlyAccessedTime = curTime ; this . lastEntryIndex ++ ; this . entries [ lastEntryIndex ] = addItem ; }
Add a timer item .
37,547
@ Generated ( value = "com.ibm.jtc.jax.tools.xjc.Driver" , date = "2014-06-11T05:49:00-04:00" , comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-" ) public List < Flow > getFlows ( ) { if ( flows == null ) { flows = new ArrayList < Flow > ( ) ; } return this . flows ; }
Gets the value of the flows property .
37,548
public JMFMessage decode ( JSchema schema , byte [ ] contents , int offset , int length ) throws JMFMessageCorruptionException { return new JSMessageImpl ( schema , contents , offset , length , true ) ; }
Implementation of decode
37,549
protected String read ( SocketChannel sc ) throws IOException { sc . read ( buffer ) ; buffer . flip ( ) ; decoder . decode ( buffer , charBuffer , true ) ; charBuffer . flip ( ) ; String result = charBuffer . toString ( ) ; buffer . clear ( ) ; charBuffer . clear ( ) ; decoder . reset ( ) ; return result ; }
Reads a command or command response from a socket channel .
37,550
protected void write ( SocketChannel sc , String s ) throws IOException { sc . write ( encoder . encode ( CharBuffer . wrap ( s ) ) ) ; }
Writes a command or command response to a socket channel .
37,551
public void MPJwtBadMPConfigAsEnvVars_GoodMpJwtConfigSpecifiedInServerXml ( ) throws Exception { resourceServer . reconfigureServerUsingExpandedConfiguration ( _testName , "rs_server_AltConfigNotInApp_goodServerXmlConfig.xml" ) ; standardTestFlow ( resourceServer , MpJwtFatConstants . NO_MP_CONFIG_IN_APP_ROOT_CONTEXT , MpJwtFatConstants . NO_MP_CONFIG_IN_APP_APP , MpJwtFatConstants . MPJWT_APP_CLASS_NO_MP_CONFIG_IN_APP ) ; }
The server will be started with all mp - config properties set to bad values in environment variables . The server . xml has a valid mp_jwt config specified . The config settings should come from server . xml . The test should run successfully .
37,552
public void MPJwtBadMPConfigAsEnvVars_MpJwtConfigNotSpecifiedInServerXml ( ) throws Exception { standardTestFlow ( resourceServer , MpJwtFatConstants . NO_MP_CONFIG_IN_APP_ROOT_CONTEXT , MpJwtFatConstants . NO_MP_CONFIG_IN_APP_APP , MpJwtFatConstants . MPJWT_APP_CLASS_NO_MP_CONFIG_IN_APP , setBadIssuerExpectations ( resourceServer ) ) ; }
The server will be started with all mp - config properties set to bad values in environment variables . The server . xml has NO mp_jwt config specified . The config settings should come from the env vars . The test should fail
37,553
private boolean doRead ( int amountToRead ) throws IOException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "doRead, Current buffer, " + _buffer + ", reading from the TCP Channel, readLine : " + _isReadLine ) ; } try { if ( _tcpChannelCallback != null && ! _isReadLine ) { return immediateRead ( amountToRead ) ; } else { return syncRead ( amountToRead ) ; } } catch ( IOException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "doRead, we encountered an exception during the read : " + e ) ; } if ( _error != null ) { return false ; } _error = e ; throw e ; } }
This method will call the synchronous or asynchronous method depending on how everything is set up
37,554
private boolean syncRead ( int amountToRead ) throws IOException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "syncRead, Executing a synchronous read" ) ; } setAndAllocateBuffer ( amountToRead ) ; try { long bytesRead = _tcpContext . getReadInterface ( ) . read ( 1 , WCCustomProperties31 . UPGRADE_READ_TIMEOUT ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "syncRead, Completed the read, " + bytesRead ) ; } if ( bytesRead > 0 ) { _buffer = _tcpContext . getReadInterface ( ) . getBuffer ( ) ; configurePostReadBuffer ( ) ; _totalBytesRead += _buffer . remaining ( ) ; return true ; } return false ; } catch ( IOException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "syncRead, We encountered an exception during the read : " + e ) ; } _error = e ; throw e ; } }
Issues a synchronous read to the TCP Channel .
37,555
private boolean immediateRead ( int amountToRead ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "immediateRead, Executing a read" ) ; } if ( amountToRead > 1 ) { WsByteBuffer tempBuffer = allocateBuffer ( amountToRead ) ; tempBuffer . position ( 0 ) ; tempBuffer . limit ( amountToRead ) ; tempBuffer . put ( _buffer ) ; tempBuffer . position ( 1 ) ; _buffer . release ( ) ; _buffer = tempBuffer ; tempBuffer = null ; _tcpContext . getReadInterface ( ) . setBuffer ( _buffer ) ; long bytesRead = 0 ; try { bytesRead = _tcpContext . getReadInterface ( ) . read ( 0 , WCCustomProperties31 . UPGRADE_READ_TIMEOUT ) ; } catch ( IOException readException ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "immediateRead, The read encountered an exception. " + readException ) ; Tr . debug ( tc , "immediateRead, Return with our one byte" ) ; } configurePostReadBuffer ( ) ; return true ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "immediateRead, Complete, " + bytesRead ) ; } _buffer = _tcpContext . getReadInterface ( ) . getBuffer ( ) ; configurePostReadBuffer ( ) ; _totalBytesRead += _buffer . remaining ( ) ; } return true ; }
This method will execute an immediate read The immediate read will issue a read to the TCP Channel and immediately return with whatever can fit in the buffers This will only ever be called after we had read the 1 byte from the isReady or initialRead methods . As such we will allocate a buffer and add in the 1 byte . This method should always return at least 1 byte even if the read fails since we have already read that byte
37,556
public int read ( ) throws IOException { validate ( ) ; int rc = - 1 ; if ( doRead ( 1 ) ) { rc = _buffer . get ( ) & 0x000000FF ; } _buffer . release ( ) ; _buffer = null ; return rc ; }
Read the first available byte
37,557
public int read ( byte [ ] output , int offset , int length ) throws IOException { int size = - 1 ; validate ( ) ; if ( 0 == length ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "read(byte[],int,int), Target length was 0" ) ; } return length ; } if ( doRead ( length ) ) { size = _buffer . limit ( ) - _buffer . position ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "(byte[],int,int) Filling byte array, size + size ) ; } _buffer . get ( output , offset , size ) ; } _buffer . release ( ) ; _buffer = null ; return size ; }
Read into the provided byte array with the length and offset provided
37,558
private void setAndAllocateBuffer ( int sizeToAllocate ) { if ( _buffer == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "setAndAllocateBuffer, Buffer is null, size to allocate is : " + sizeToAllocate ) ; } _buffer = allocateBuffer ( sizeToAllocate ) ; } configurePreReadBuffer ( sizeToAllocate ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "setAndAllocateBuffer, Setting the buffer : " + _buffer ) ; } _tcpContext . getReadInterface ( ) . setBuffer ( _buffer ) ; }
Allocate the buffer size we need and then pre - configure the buffer to prepare it to be read into Once it has been prepared set the buffer to the TCP Channel
37,559
private void validate ( ) throws IOException { if ( null != _error ) { throw _error ; } if ( ! _isReadLine && ! _isReady ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isErrorEnabled ( ) ) Tr . error ( tc , "read.failed.isReady.false" ) ; throw new IllegalStateException ( Tr . formatMessage ( tc , "read.failed.isReady.false" ) ) ; } }
This checks if we have already had an exception thrown . If so it just rethrows that exception This check is done before any reads are done
37,560
public void setupReadListener ( ReadListener readListenerl , SRTUpgradeInputStream31 srtUpgradeStream ) { if ( readListenerl == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isErrorEnabled ( ) ) Tr . error ( tc , "readlistener.is.null" ) ; throw new NullPointerException ( Tr . formatMessage ( tc , "readlistener.is.null" ) ) ; } if ( _rl != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isErrorEnabled ( ) ) Tr . error ( tc , "readlistener.already.started" ) ; throw new IllegalStateException ( Tr . formatMessage ( tc , "readlistener.already.started" ) ) ; } ThreadContextManager tcm = new ThreadContextManager ( ) ; _tcpChannelCallback = new UpgradeReadCallback ( readListenerl , this , tcm , srtUpgradeStream ) ; _rl = readListenerl ; _isReady = false ; _upConn . getVirtualConnection ( ) . getStateMap ( ) . put ( TransportConstants . UPGRADED_LISTENER , "true" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "setupReadListener, Starting the initial read" ) ; } initialRead ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "setupReadListener, ReadListener set : " + _rl ) ; } }
Sets the ReadListener provided by the application to this stream Once the ReadListener is set we will kick off the initial read
37,561
public void initialRead ( ) { _isInitialRead = true ; if ( _buffer != null ) { _buffer . release ( ) ; _buffer = null ; } setAndAllocateBuffer ( 1 ) ; configurePreReadBuffer ( 1 ) ; _tcpContext . getReadInterface ( ) . setBuffer ( _buffer ) ; _tcpContext . getReadInterface ( ) . read ( 1 , _tcpChannelCallback , true , WCCustomProperties31 . UPGRADE_READ_TIMEOUT ) ; }
This method triggers the initial read on the connection or the read for after the ReadListener . onDataAvailable has run The read done in this method is a forced async read meaning it will always return on another thread The provided callback will be called when the read is completed and that callback will invoke the ReadListener logic .
37,562
public void configurePostInitialReadBuffer ( ) { _isInitialRead = false ; _isFirstRead = false ; _buffer = _tcpContext . getReadInterface ( ) . getBuffer ( ) ; configurePostReadBuffer ( ) ; }
Called after the initial read is completed . This will set the first read flag to false get the buffer from the TCP Channel and post configure the buffer . Without this method we would lose the first byte we are reading
37,563
public Boolean close ( ) { _isClosing = true ; boolean closeResult = true ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "close, Initial read outstanding : " + _isInitialRead ) ; } if ( _isInitialRead ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "close, Cancelling any outstanding read" ) ; } _tcpContext . getReadInterface ( ) . read ( 1 , _tcpChannelCallback , false , TCPReadRequestContext . IMMED_TIMEOUT ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "close, Call to cancel complete" ) ; } if ( _isInitialRead ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "close, Timeout has been called, waiting for it to complete" ) ; } closeResult = true ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "close, No read outstanding, no reason to call cancel" ) ; } closeResult = false ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "close, No read outstanding, no reason to call cancel" ) ; } closeResult = false ; } if ( _rl != null ) { if ( ! this . isAlldataReadCalled ( ) ) { try { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "close, We are now closed, calling the ReadListener onAllDataRead" ) ; } this . setAlldataReadCalled ( true ) ; _rl . onAllDataRead ( ) ; } catch ( IOException ioe ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "close, Encountered an exception while calling onAllDAtaRead : " + ioe ) ; } } } } return closeResult ; }
Close the connection down by immediately timing out any existing read
37,564
public synchronized int getDurableSubscriptions ( ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getDurableSubscriptions" ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getDurableSubscriptions" , new Integer ( durableSubscriptions ) ) ; return durableSubscriptions ; }
Get number of durable subscriptions .
37,565
public synchronized int getNonDurableSubscriptions ( ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getNonDurableSubscriptions" ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getNonDurableSubscriptions" , new Integer ( nonDurableSubscriptions ) ) ; return nonDurableSubscriptions ; }
Get number of non - durable subscriptions .
37,566
public synchronized int getTotalSubscriptions ( ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getTotalSubscriptions" ) ; int totalSubscriptions = durableSubscriptions + nonDurableSubscriptions ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getTotalSubscriptions" , new Integer ( totalSubscriptions ) ) ; return totalSubscriptions ; }
Get total number of subscriptions .
37,567
void balance ( NodeStack stack , GBSNode q ) { GBSNode p ; int bpidx = stack . balancePointIndex ( ) ; int x = bpidx ; GBSNode bpoint = stack . node ( x ) ; GBSNode bfather = stack . node ( x - 1 ) ; if ( bpoint . leftChild ( ) == stack . node ( x + 1 ) ) p = bpoint . leftChild ( ) ; else p = bpoint . rightChild ( ) ; x ++ ; while ( p != q ) { if ( p . leftChild ( ) == stack . node ( x + 1 ) ) { p . setBalance ( - 1 ) ; p = p . leftChild ( ) ; } else { p . setBalance ( 1 ) ; p = p . rightChild ( ) ; } x ++ ; } if ( bpoint . leftChild ( ) == stack . node ( bpidx + 1 ) ) { int bpb = bpoint . balance ( ) ; switch ( bpb ) { case 0 : bpoint . setBalance ( - 1 ) ; break ; case 1 : bpoint . clearBalance ( ) ; break ; case - 1 : rotateLeft ( bfather , bpoint ) ; break ; default : String zzz1 = "Help1 !, bpb = " + bpb ; throw new RuntimeException ( zzz1 ) ; } } else { int bpb = bpoint . balance ( ) ; switch ( bpb ) { case 0 : bpoint . setBalance ( 1 ) ; break ; case - 1 : bpoint . clearBalance ( ) ; break ; case 1 : rotateRight ( bfather , bpoint ) ; break ; default : String zzz2 = "Help2 !, bpb = " + bpb ; throw new RuntimeException ( zzz2 ) ; } } }
Restore the height balance of a tree following an insert .
37,568
private void rotateLeft ( GBSNode bfather , GBSNode bpoint ) { GBSNode bson = bpoint . leftChild ( ) ; if ( bson . balance ( ) == - 1 ) { bpoint . setLeftChild ( bson . rightChild ( ) ) ; bson . setRightChild ( bpoint ) ; if ( bfather . rightChild ( ) == bpoint ) bfather . setRightChild ( bson ) ; else bfather . setLeftChild ( bson ) ; bpoint . clearBalance ( ) ; bson . clearBalance ( ) ; } else { GBSNode blift = bson . rightChild ( ) ; bson . setRightChild ( blift . leftChild ( ) ) ; blift . setLeftChild ( bson ) ; bpoint . setLeftChild ( blift . rightChild ( ) ) ; blift . setRightChild ( bpoint ) ; if ( bfather . rightChild ( ) == bpoint ) bfather . setRightChild ( blift ) ; else bfather . setLeftChild ( blift ) ; bpoint . setBalance ( newBalance2 [ blift . balance ( ) + 1 ] ) ; bson . setBalance ( newBalance1 [ blift . balance ( ) + 1 ] ) ; blift . clearBalance ( ) ; } }
Do an LL or LR rotation .
37,569
public Entry getPrevious ( ) { checkEntryParent ( ) ; Entry entry = null ; if ( ! isFirst ( ) ) { entry = previous ; } return entry ; }
Unsynchronized . Get the previous entry in the list .
37,570
public boolean analyzeJar ( Analyzer analyzer ) throws Exception { try { if ( scanAgain ) { resetErrorMarker ( ) ; List < String > newlyAddedPackages = new ArrayList < String > ( ) ; System . out . println ( "ImportlessPackager plugin: iteration " + iteration ) ; setupFilters ( analyzer ) ; Set < PackageRef > importedPackages = collectDependencies ( analyzer ) ; Jar outputJar = analyzer . getJar ( ) ; for ( PackageRef ref : importedPackages ) { String packageName = ref . getFQN ( ) ; System . out . println ( "Seeking package " + packageName ) ; boolean foundPackage = false ; for ( Jar src : analyzer . getClasspath ( ) ) { if ( src . getPackages ( ) . contains ( packageName ) ) { foundPackage = true ; System . out . println ( "Found matching pkg " + packageName + " from " + src . getSource ( ) . getAbsolutePath ( ) ) ; outputJar . addAll ( src , new Instruction ( ref . getPath ( ) + "[/|/][^/]+" ) ) ; newlyAddedPackages . add ( packageName ) ; } } if ( ! foundPackage ) { String errorMsg = "Package " + packageName + " not found for inclusion in jar. Is the package available on the projects classpath?" ; error ( errorMsg ) ; } } if ( newlyAddedPackages . isEmpty ( ) ) { scanAgain = false ; } else { addedPackages . addAll ( newlyAddedPackages ) ; iteration ++ ; if ( iteration > LAST_ITERATION ) { error ( "Maximum number of plugin iterations reached, but there were still new packages to analyze. Consider adding more iterations." ) ; } } if ( scanAgain == true && errorMarker . exists ( ) ) scanAgain = false ; } } catch ( Exception ex ) { ex . printStackTrace ( ) ; System . out . println ( ex . getMessage ( ) ) ; } return scanAgain ; }
all class types that need to be exported
37,571
private void collectClassDependencies ( Clazz classInstance , Analyzer analyzer ) throws Exception { Set < TypeRef > importedClasses = classInstance . parseClassFile ( ) ; for ( TypeRef importedClass : importedClasses ) { if ( canBeSkipped ( importedClass ) ) continue ; Clazz classInstanceImported = analyzer . findClass ( importedClass ) ; if ( classInstanceImported == null ) error ( "Referenced class " + importedClass . getFQN ( ) + " not found for inclusion in jar. It is imported by " + classInstance . getAbsolutePath ( ) ) ; importedReferencedTypes . add ( importedClass ) ; allReferencedTypes . add ( importedClass ) ; collectClassDependencies ( classInstanceImported , analyzer ) ; } }
Collect the imports from a class and add the imported classes to the map of all known classes importedReferencedTypes is updated to contain newly added imports allReferencedTypes is updated to avoid the duplicated process
37,572
private boolean canBeSkipped ( TypeRef importedClass ) { if ( allReferencedTypes . contains ( importedClass ) || importedReferencedTypes . contains ( importedClass ) || importedClass . isJava ( ) ) return true ; String classPackage = importedClass . getPackageRef ( ) . getFQN ( ) ; for ( String excludePrefix : excludePrefixes ) { if ( classPackage . startsWith ( excludePrefix ) ) return true ; } if ( excludes . contains ( classPackage ) ) return true ; return classPackage . length ( ) < 2 ; }
check whether a imported class should be considered in further dependency check
37,573
private Set < PackageRef > collectPackageDependencies ( ) { Set < PackageRef > referencedPackages = new HashSet < PackageRef > ( ) ; for ( TypeRef newReferencedType : importedReferencedTypes ) { PackageRef packageRef = newReferencedType . getPackageRef ( ) ; if ( referencedPackages . contains ( packageRef ) ) continue ; referencedPackages . add ( packageRef ) ; System . out . println ( "Add package: " + packageRef . getFQN ( ) ) ; } return referencedPackages ; }
Collect the referenced packages information from the referenced classes information
37,574
public boolean addMetatypeAd ( MetatypeAd metatypeAd ) { if ( this . metatypeAds == null ) this . metatypeAds = new LinkedList < MetatypeAd > ( ) ; for ( MetatypeAd ad : metatypeAds ) if ( ad . getID ( ) . equals ( metatypeAd . getID ( ) ) ) return false ; this . metatypeAds . add ( metatypeAd ) ; return true ; }
Adds a metatype AD .
37,575
public synchronized void prepareSocket ( ) throws IOException { if ( ! prepared ) { final long fd = getFileDescriptor ( ) ; if ( fd == INVALID_SOCKET ) { throw new AsyncException ( AsyncProperties . aio_handle_unavailable ) ; } channelIdentifier = provider . prepare2 ( fd , asyncChannelGroup . getCompletionPort ( ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "prepareSocket - socket prepared, fd = " + fd + " channel id: " + channelIdentifier + " " + ", local: " + channel . socket ( ) . getLocalSocketAddress ( ) + ", remote: " + channel . socket ( ) . getRemoteSocketAddress ( ) ) ; } long callid = 0 ; readIOCB = ( CompletionKey ) AsyncLibrary . completionKeyPool . get ( ) ; if ( readIOCB != null ) { readIOCB . initializePoolEntry ( channelIdentifier , callid ) ; writeIOCB = ( CompletionKey ) AsyncLibrary . completionKeyPool . get ( ) ; if ( writeIOCB != null ) { writeIOCB . initializePoolEntry ( channelIdentifier , callid ) ; } else { writeIOCB = new CompletionKey ( channelIdentifier , callid , defaultBufferCount ) ; } } else { readIOCB = new CompletionKey ( channelIdentifier , callid , defaultBufferCount ) ; writeIOCB = new CompletionKey ( channelIdentifier , callid , defaultBufferCount ) ; } provider . initializeIOCB ( readIOCB ) ; provider . initializeIOCB ( writeIOCB ) ; prepared = true ; } }
Perform initialization steps for this new connection .
37,576
public String getParameterClassName ( String attributeName , JspCoreContext context ) throws JspCoreException { String parameterClassName = null ; if ( parameterClassNameMap == null ) { parameterClassNameMap = new HashMap ( ) ; } parameterClassName = ( String ) parameterClassNameMap . get ( attributeName ) ; if ( parameterClassName == null ) { TagAttributeInfo [ ] attributeInfos = ti . getAttributes ( ) ; for ( int i = 0 ; i < attributeInfos . length ; i ++ ) { if ( attributeInfos [ i ] . getName ( ) . equals ( attributeName ) ) { if ( attributeInfos [ i ] . isFragment ( ) ) { parameterClassName = "javax.servlet.jsp.tagext.JspFragment" ; } else { parameterClassName = attributeInfos [ i ] . getTypeName ( ) ; } parameterClassNameMap . put ( attributeName , parameterClassName ) ; break ; } } } return ( parameterClassName ) ; }
PK36246 && 417178 override method in TagClassInfo but since we aren t loading a class right now we don t have to worry about the classpath in the context
37,577
public ReturnCode rollback ( ) { while ( ! history . isEmpty ( ) ) { final Action action = ( Action ) history . pop ( ) ; final ReturnCode ret = action . execute ( ) ; if ( ret . getCode ( ) != 0 ) { return ret ; } } return ReturnCode . OK ; }
Attempts to undo changes in reverse order of actions taken ;
37,578
public void updateState ( SSLContext context , SSLEngine engine , SSLEngineResult result , WsByteBuffer decNetBuf , int position , int limit ) { this . sslContext = context ; this . sslEngine = engine ; this . sslEngineResult = result ; this . decryptedNetBuffer = decNetBuf ; this . netBufferPosition = position ; this . netBufferLimit = limit ; }
Update this state object with current information . This is called when a YES response comes from the discriminator . The position and limit must be saved here so the ready method can adjust them right away .
37,579
private void setXMLBeanInterface ( String homeInterfaceName , String interfaceName ) throws InjectionException { if ( homeInterfaceName != null && homeInterfaceName . length ( ) != 0 ) { ivHomeInterface = true ; setInjectionClassTypeName ( homeInterfaceName ) ; if ( isValidationLoggable ( ) ) { loadClass ( homeInterfaceName , isValidationFailable ( ) ) ; loadClass ( interfaceName , isValidationFailable ( ) ) ; } } else if ( interfaceName != null && interfaceName . length ( ) != 0 ) { ivBeanInterface = true ; setInjectionClassTypeName ( interfaceName ) ; if ( isValidationLoggable ( ) ) { loadClass ( interfaceName , isValidationFailable ( ) ) ; } } }
Sets the beanInterface as specified by XML .
37,580
private void setBindingName ( ) throws InjectionException { Map < String , String > ejbRefBindings = ivNameSpaceConfig . getEJBRefBindings ( ) ; if ( ejbRefBindings != null ) { ivBindingName = ejbRefBindings . get ( getJndiName ( ) ) ; if ( ivBindingName != null && ivBindingName . equals ( "" ) ) { ivBindingName = null ; Tr . warning ( tc , "EJB_BOUND_TO_EMPTY_STRING_CWNEN0025W" ) ; if ( isValidationFailable ( ) ) { InjectionConfigurationException icex = new InjectionConfigurationException ( "The " + getJndiName ( ) + " EJB reference in the " + ivModule + " module of the " + ivApplication + " application has been" + " bound to the empty string in the global Java Naming and Directory Interface (JNDI) namespace." ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "resolve : " + icex ) ; throw icex ; } } } }
Returns true if the user has configured a binding for this reference .
37,581
public void addInjectionTarget ( Member member ) throws InjectionException { if ( ivBeanName != null && ivBeanNameClass == null ) { ivBeanNameClass = member . getDeclaringClass ( ) ; } super . addInjectionTarget ( member ) ; }
d638111 . 1
37,582
public void visitInsn ( int opcode ) { if ( opcode == ATHROW && ! enabledListeners . isEmpty ( ) ) { String key = createKey ( ) ; ProbeImpl probe = getProbe ( key ) ; long probeId = probe . getIdentifier ( ) ; setProbeInProgress ( true ) ; visitInsn ( DUP ) ; visitLdcInsn ( Long . valueOf ( probeId ) ) ; visitInsn ( DUP2_X1 ) ; visitInsn ( POP2 ) ; if ( isStatic ( ) ) { visitInsn ( ACONST_NULL ) ; } else { visitVarInsn ( ALOAD , 0 ) ; } visitInsn ( SWAP ) ; visitInsn ( ACONST_NULL ) ; visitInsn ( SWAP ) ; visitFireProbeInvocation ( ) ; setProbeInProgress ( false ) ; setProbeListeners ( probe , enabledListeners ) ; } super . visitInsn ( opcode ) ; }
Inject code to fire a probe before any throw instruction .
37,583
public void addData ( int index , byte [ ] data ) throws InternalLogException { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "addData" , new java . lang . Object [ ] { new Integer ( index ) , RLSUtils . toHexString ( data , RLSUtils . MAX_DISPLAY_BYTES ) , this } ) ; if ( _recLog . failed ( ) ) { if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "addData" , this ) ; throw new InternalLogException ( null ) ; } if ( index > 0 ) index -- ; final int currentSize = _writtenData . size ( ) ; if ( index == currentSize ) _writtenData . add ( data ) ; else if ( index < currentSize ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "NMTEST: Replacing item (expect trace 'null') at index: " + index , _writtenData . get ( index ) ) ; _writtenData . set ( index , data ) ; } else { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "NMTEST: Adding null elements: " + ( index - currentSize ) ) ; while ( index -- > currentSize ) _writtenData . add ( null ) ; _writtenData . add ( data ) ; } _lastDataItem = ( byte [ ] ) _writtenData . get ( _writtenData . size ( ) - 1 ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "addData" ) ; }
recovery method to add data directly to _writtenData array
37,584
public int identity ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "identity" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "identity" , new Integer ( _identity ) ) ; return _identity ; }
Returns the identity of the recoverable unit section .
37,585
public static int decode ( WsByteBuffer headerBlock , int N ) { int I = HpackUtils . getLSB ( headerBlock . get ( ) , N ) ; if ( I < HpackUtils . ipow ( 2 , N ) - 1 ) { return I ; } else { int M = 0 ; boolean done = false ; byte b ; while ( done == false ) { b = headerBlock . get ( ) ; I = I + ( ( b ) & 127 ) * HpackUtils . ipow ( 2 , M ) ; M = M + 7 ; if ( ( ( b & 128 ) == 128 ) == false ) done = true ; } return I ; } }
Decodes a provided byte array that was encoded using an N - bit prefix .
37,586
static protected int getPadBits ( int bitString ) { int val = 0 ; for ( int i = 3 ; i >= 0 ; i -- ) { if ( i != 0 ) { if ( ( bitString >> ( i * 8 ) ) != 0 ) { val = ( bitString >> ( i * 8 ) ) & 0xFF ; break ; } } else { if ( bitString != 0 ) { val = bitString & 0xFF ; break ; } } } if ( val == 0 ) { return 7 ; } int bits = 1 ; while ( ( ( val <<= 1 ) & 0xFF ) != 0 ) { bits ++ ; } return 8 - bits ; }
return the correct number of pad bits for a bit string defined in a 32 bit constant
37,587
static protected byte [ ] getBytes ( int bitString ) { int bytes = 4 ; for ( int i = 3 ; i >= 1 ; i -- ) { if ( ( bitString & ( 0xFF << ( i * 8 ) ) ) != 0 ) { break ; } bytes -- ; } byte [ ] result = new byte [ bytes ] ; for ( int i = 0 ; i < bytes ; i ++ ) { result [ i ] = ( byte ) ( ( bitString >> ( i * 8 ) ) & 0xFF ) ; } return result ; }
return the correct number of bytes for a bit string defined in a 32 bit constant
37,588
public static DERBitString getInstance ( Object obj ) { if ( obj == null || obj instanceof DERBitString ) { return ( DERBitString ) obj ; } if ( obj instanceof ASN1OctetString ) { byte [ ] bytes = ( ( ASN1OctetString ) obj ) . getOctets ( ) ; int padBits = bytes [ 0 ] ; byte [ ] data = new byte [ bytes . length - 1 ] ; System . arraycopy ( bytes , 1 , data , 0 , bytes . length - 1 ) ; return new DERBitString ( data , padBits ) ; } if ( obj instanceof ASN1TaggedObject ) { return getInstance ( ( ( ASN1TaggedObject ) obj ) . getObject ( ) ) ; } throw new IllegalArgumentException ( "illegal object in getInstance: " + obj . getClass ( ) . getName ( ) ) ; }
return a Bit String from the passed in object
37,589
private AuthenticationResult handleBasicAuth ( String inRealm , HttpServletRequest req , HttpServletResponse res ) { AuthenticationResult result = null ; String hdrValue = req . getHeader ( BASIC_AUTH_HEADER_NAME ) ; if ( hdrValue == null || ! hdrValue . startsWith ( "Basic " ) ) { result = new AuthenticationResult ( AuthResult . SEND_401 , inRealm , AuditEvent . CRED_TYPE_BASIC , null , AuditEvent . OUTCOME_CHALLENGE ) ; return result ; } String encoding = req . getHeader ( "Authorization-Encoding" ) ; hdrValue = decodeBasicAuth ( hdrValue . substring ( 6 ) , encoding ) ; int idx = hdrValue . indexOf ( ':' ) ; if ( idx < 0 ) { result = new AuthenticationResult ( AuthResult . SEND_401 , inRealm , AuditEvent . CRED_TYPE_BASIC , null , AuditEvent . OUTCOME_CHALLENGE ) ; return result ; } String username = hdrValue . substring ( 0 , idx ) ; String password = hdrValue . substring ( idx + 1 ) ; return basicAuthenticate ( inRealm , username , password , req , res ) ; }
handleBasicAuth generates AuthenticationResult This routine invokes basicAuthenticate which also generates AuthenticationResult .
37,590
protected String getBasicAuthRealmName ( WebRequest webRequest ) { SecurityMetadata securityMetadata = webRequest . getSecurityMetadata ( ) ; if ( securityMetadata != null ) { LoginConfiguration loginConfig = securityMetadata . getLoginConfiguration ( ) ; if ( loginConfig != null && loginConfig . getRealmName ( ) != null ) { return loginConfig . getRealmName ( ) ; } if ( config . getDisplayAuthenticationRealm ( ) ) { return userRegistry . getRealm ( ) ; } } String realm = "defaultRealm" ; return realm ; }
Return a realm name if it s defined in the web . xml file . If it s not defined in the web . xml and displayAuthenticationRealm is set to true then return the userRegistry realm . Otherwise return the realm as Default Realm .
37,591
protected String decodeBasicAuth ( String data , String encoding ) { String output = "" ; byte decodedByte [ ] = null ; decodedByte = Base64Coder . base64DecodeString ( data ) ; if ( decodedByte != null && decodedByte . length > 0 ) { boolean decoded = false ; if ( encoding != null ) { try { output = new String ( decodedByte , encoding ) ; decoded = true ; } catch ( Exception e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "An exception is caught using the encoder: " + encoding + ". The exception is: " + e . getMessage ( ) ) ; } } } if ( ! decoded ) { output = new String ( decodedByte ) ; } } return output ; }
2 . This method intentionally returns empty string in case of error . With that a caller doesn t need to check null object prior to introspect it .
37,592
public static boolean isUninstallable ( Set < IFixInfo > installedFixes , IFixInfo fixToBeUninstalled ) { if ( Boolean . valueOf ( System . getenv ( S_DISABLE ) ) . booleanValue ( ) ) { return true ; } if ( fixToBeUninstalled != null ) { for ( IFixInfo fix : installedFixes ) { if ( ! ( fixToBeUninstalled . getId ( ) . equals ( fix . getId ( ) ) ) && ! confirmNoFileConflicts ( fixToBeUninstalled . getUpdates ( ) . getFiles ( ) , fix . getUpdates ( ) . getFiles ( ) ) ) { if ( ! isSupersededBy ( fix . getResolves ( ) . getProblems ( ) , fixToBeUninstalled . getResolves ( ) . getProblems ( ) ) ) { return false ; } } } return true ; } return false ; }
Return true if fixToBeUninstalled can be uninstalled . fixToBeUninstalled can only be uninstalled if there are no file conflicts with other fixes in the installedFixes Set that supersedes fixToBeUninstalled
37,593
public boolean isUninstallable ( UninstallAsset uninstallAsset , Set < IFixInfo > installedFixes , List < UninstallAsset > uninstallAssets ) { if ( Boolean . valueOf ( System . getenv ( S_DISABLE ) ) . booleanValue ( ) ) { return true ; } IFixInfo fixToBeUninstalled = uninstallAsset . getIFixInfo ( ) ; for ( IFixInfo fix : installedFixes ) { if ( ! ( fixToBeUninstalled . getId ( ) . equals ( fix . getId ( ) ) ) ) { if ( ( ! confirmNoFileConflicts ( fixToBeUninstalled . getUpdates ( ) . getFiles ( ) , fix . getUpdates ( ) . getFiles ( ) ) ) && ( ! isSupersededBy ( fix . getResolves ( ) . getProblems ( ) , fixToBeUninstalled . getResolves ( ) . getProblems ( ) ) ) ) if ( ! isToBeUninstalled ( fix . getId ( ) , uninstallAssets ) ) return false ; } } return true ; }
Verfiy whether the fix is uninstallable and there is no other installed fix still require this feature .
37,594
public static ArrayList < String > fixRequiredByFeature ( String fixApar , Map < String , ProvisioningFeatureDefinition > installedFeatures ) { ArrayList < String > dependencies = new ArrayList < String > ( ) ; for ( ProvisioningFeatureDefinition fd : installedFeatures . values ( ) ) { String requireFixes = fd . getHeader ( "IBM-Require-Fix" ) ; if ( requireFixes != null && requireFixes . length ( ) > 0 ) { String [ ] apars = requireFixes . split ( ";" ) ; for ( String apar : apars ) { if ( apar . trim ( ) . equals ( fixApar . trim ( ) ) ) { dependencies . add ( apar ) ; } } } } if ( dependencies . isEmpty ( ) ) return null ; return dependencies ; }
Determine the fix apar is required by one of the installed features
37,595
public List < UninstallAsset > determineOrder ( List < UninstallAsset > list ) { if ( list != null ) { List < FixDependencyComparator > fixCompareList = new ArrayList < FixDependencyComparator > ( ) ; for ( UninstallAsset asset : list ) { fixCompareList . add ( new FixDependencyComparator ( asset . getIFixInfo ( ) ) ) ; } Collections . sort ( fixCompareList , new FixDependencyComparator ( ) ) ; List < UninstallAsset > newList = new ArrayList < UninstallAsset > ( ) ; for ( FixDependencyComparator f : fixCompareList ) { newList . add ( new UninstallAsset ( f . getIfixInfo ( ) ) ) ; } return newList ; } return list ; }
Determine the order of the fixes according to their dependency
37,596
private static boolean isSupersededBy ( List < Problem > apars1 , List < Problem > apars2 ) { boolean result = true ; for ( Iterator < Problem > iter1 = apars1 . iterator ( ) ; iter1 . hasNext ( ) ; ) { boolean currAparMatch = false ; Problem currApar1 = iter1 . next ( ) ; for ( Iterator < Problem > iter2 = apars2 . iterator ( ) ; iter2 . hasNext ( ) ; ) { Problem currApar2 = iter2 . next ( ) ; if ( currApar1 . getDisplayId ( ) . equals ( currApar2 . getDisplayId ( ) ) ) { currAparMatch = true ; } } if ( ! currAparMatch ) result = false ; } return result ; }
Returns if the apars list apars1 is superseded by apars2 . Apars1 is superseded by apars2 if all the apars in apars1 is also included in apars2
37,597
private static boolean confirmNoFileConflicts ( Set < UpdatedFile > updatedFiles1 , Set < UpdatedFile > updatedFiles2 ) { for ( Iterator < UpdatedFile > iter1 = updatedFiles1 . iterator ( ) ; iter1 . hasNext ( ) ; ) { UpdatedFile currFile1 = iter1 . next ( ) ; for ( Iterator < UpdatedFile > iter2 = updatedFiles2 . iterator ( ) ; iter2 . hasNext ( ) ; ) { UpdatedFile currFile2 = iter2 . next ( ) ; if ( currFile1 . getId ( ) . equals ( currFile2 . getId ( ) ) ) { return false ; } } } return true ; }
Confirms that UpdatedFile lists does not contain any common files
37,598
public void close ( boolean deleteProgressFile ) { final String methodName = "close()" ; traceDebug ( methodName , "cacheName=" + this . cacheName + " deleteProgressFile=" + deleteProgressFile ) ; if ( deleteProgressFile ) { deleteInProgressFile ( ) ; } try { htod . close ( ) ; } catch ( Throwable t ) { com . ibm . ws . ffdc . FFDCFilter . processException ( t , "com.ibm.ws.cache.CacheOnDisk.close" , "574" , this ) ; traceDebug ( methodName , "cacheName=" + this . cacheName + "\nException: " + ExceptionUtility . getStackTrace ( t ) ) ; } }
Call this method to close the disk file manager and operation .
37,599
public int writeAuxiliaryDepTables ( ) { int returnCode = htod . writeAuxiliaryDepTables ( ) ; if ( returnCode == HTODDynacache . DISK_EXCEPTION ) { stopOnError ( this . htod . diskCacheException ) ; } else { updatePropertyFile ( ) ; } return returnCode ; }
Call this method to offload auxiliary dependency tables to the disk and update property file .