idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
161,000
@ Trivial public static < U > CompletionStage < U > failedStage ( Throwable x ) { throw new UnsupportedOperationException ( Tr . formatMessage ( tc , "CWWKC1156.not.supported" , "ManagedExecutor.failedStage" ) ) ; }
Because CompletableFuture . failedStage is static this is not a true override . It will be difficult for the user to invoke this method because they would need to get the class of the CompletableFuture implementation and locate the static failedStage method on that .
62
53
161,001
public static < T > CompletableFuture < T > newIncompleteFuture ( Executor executor ) { if ( JAVA8 ) return new ManagedCompletableFuture < T > ( new CompletableFuture < T > ( ) , executor , null ) ; else return new ManagedCompletableFuture < T > ( executor , null ) ; }
Construct a new incomplete CompletableFuture that is backed by the specified executor .
79
17
161,002
@ Trivial public static CompletableFuture < Void > runAsync ( Runnable action ) { throw new UnsupportedOperationException ( Tr . formatMessage ( tc , "CWWKC1156.not.supported" , "ManagedExecutor.runAsync" ) ) ; }
Because CompletableFuture . runAsync is static this is not a true override . It will be difficult for the user to invoke this method because they would need to get the class of the CompletableFuture implementation and locate the static runAsync method on that .
61
53
161,003
@ Trivial public static < U > CompletableFuture < U > supplyAsync ( Supplier < U > action ) { throw new UnsupportedOperationException ( Tr . formatMessage ( tc , "CWWKC1156.not.supported" , "ManagedExecutor.supplyAsync" ) ) ; }
Because CompletableFuture . supplyAsync is static this is not a true override . It will be difficult for the user to invoke this method because they would need to get the class of the CompletableFuture implementation and locate the static supplyAsync method on that .
67
53
161,004
private ThreadContextDescriptor captureThreadContext ( Executor executor ) { WSManagedExecutorService managedExecutor = defaultExecutor instanceof WSManagedExecutorService // ? ( WSManagedExecutorService ) defaultExecutor // : executor != defaultExecutor && executor instanceof WSManagedExecutorService // ? ( WSManagedExecutorService ) executor // : null ; if ( managedExecutor == null ) return null ; @ SuppressWarnings ( "unchecked" ) ThreadContextDescriptor contextDescriptor = managedExecutor . getContextService ( ) . captureThreadContext ( XPROPS_SUSPEND_TRAN ) ; return contextDescriptor ; }
Captures thread context if possible first based on the default asynchronous execution facility otherwise based on the specified executor . If neither of these executors are a managed executor then thread context is not captured .
152
40
161,005
@ Trivial private final static FutureRefExecutor supportsAsync ( Executor executor ) { if ( executor instanceof ExecutorService ) return new FutureRefExecutor ( ( ExecutorService ) executor ) ; // valid if ( executor instanceof UnusableExecutor ) throw new UnsupportedOperationException ( ) ; // not valid for executing tasks return null ; // valid }
Convenience method to validate that an executor supports running asynchronously and to wrap the executor if an ExecutorService with FutureRefExecutor . This method is named supportsAsync to make failure stacks more meaningful to users .
80
47
161,006
static File validateDirectory ( final File directory ) { File newDirectory = null ; try { newDirectory = AccessController . doPrivileged ( new java . security . PrivilegedExceptionAction < File > ( ) { @ Override public File run ( ) throws Exception { boolean ok = true ; if ( ! directory . exists ( ) ) ok = directory . mkdirs ( ) || directory . exists ( ) ; //2nd exists check is necessary to close timing window if ( ! ok ) { Tr . error ( tc , "UNABLE_TO_DELETE_RESOURCE_NOEX" , new Object [ ] { directory . getAbsolutePath ( ) } ) ; return null ; } return directory ; } } ) ; } catch ( PrivilegedActionException e ) { Tr . error ( tc , "UNABLE_TO_DELETE_RESOURCE" , new Object [ ] { directory . getAbsolutePath ( ) , e } ) ; } return newDirectory ; }
This method will create the directory if it does not exist ensuring the specified location is writable .
207
19
161,007
static File createNewFile ( final FileLogSet fileLogSet ) { final File directory = fileLogSet . getDirectory ( ) ; final String fileName = fileLogSet . getFileName ( ) ; final String fileExtension = fileLogSet . getFileExtension ( ) ; File f = null ; try { f = AccessController . doPrivileged ( new java . security . PrivilegedExceptionAction < File > ( ) { @ Override public File run ( ) throws Exception { return fileLogSet . createNewFile ( ) ; } } ) ; } catch ( PrivilegedActionException e ) { File exf = new File ( directory , fileName + fileExtension ) ; Tr . error ( tc , "UNABLE_TO_DELETE_RESOURCE" , new Object [ ] { exf . getAbsolutePath ( ) , e } ) ; } return f ; }
This method will create a new file with the specified name and extension in the specified directory . If a unique file is required then it will add a timestamp to the file and if necessary a unqiue identifier to the file name .
189
46
161,008
public void releaseBuffers ( ) { // release buffers is desired if ( payloadBuffers != null ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "release payload buffers. number to release is: " + payloadCountOfBuffers ) ; } // if the payload buffers have been set into here, then release those for ( int i = 0 ; i < payloadCountOfBuffers ; i ++ ) { payloadBuffers [ i ] . release ( ) ; } // avoid double releasing by resetting these objects and variables payloadBuffers = null ; payloadCountOfBuffers = 0 ; } else { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "release buffers from frame list. number to release is: " + countOfIOFrames ) ; } // payload buffers haven't been set into here yet, so release buffers on each frame processor if ( countOfIOFrames > 0 ) { for ( int i = 0 ; i < countOfIOFrames ; i ++ ) { fpList [ i ] . releaseBuffers ( ) ; } } else { frameProcessor . releaseBuffers ( ) ; } } }
This is never called except in an exception case . frame buffers should be cleaned up when reset is called on the FrameReadProcessor
246
26
161,009
public static boolean methodParamsMatch ( List < String > typeNames , Class < ? > [ ] types ) { if ( typeNames . size ( ) != types . length ) { return false ; } for ( int i = 0 ; i < types . length ; i ++ ) { String typeName = typeNames . get ( i ) ; int typeNameEnd = typeName . length ( ) ; Class < ? > type = types [ i ] ; for ( ; type . isArray ( ) ; type = type . getComponentType ( ) ) { if ( typeNameEnd < 2 || typeName . charAt ( -- typeNameEnd ) != ' ' || typeName . charAt ( -- typeNameEnd ) != ' ' ) { return false ; } } if ( ! type . getName ( ) . regionMatches ( 0 , typeName , 0 , typeNameEnd ) ) { return false ; } } return true ; }
Checks if the specified method parameters object matches the specified method parameter types .
195
15
161,010
String evaluateExpression ( String expr ) throws ConfigEvaluatorException { ConfigExpressionScanner scanner = new ConfigExpressionScanner ( expr ) ; // Expression = Arithmetic | FilterCall // Arithmetic = Operand [( "+" | "-" | "*" | "/") Operand]* // Operand = VarName | Long | FunctionCall // VarName = <Java identifier plus "." after start> // Long = <[0-9]+ handled by Long.parseLong> // FunctionCall = FunctionName "(" VarName ")" // FunctionName = "count" // FilterCall = "servicePidOrFilter(" VarName ")" // Parse the first operand (or function name). if ( ! parseOperand ( expr , scanner , true ) ) { return null ; } if ( resultExpr != null ) { return scanner . end ( ) ? resultExpr : null ; } subtotal = value ; while ( ! scanner . end ( ) ) { // Parse operator. ConfigExpressionScanner . NumericOperator op = scanner . scanNumericOperator ( ) ; if ( op == null ) { return null ; } if ( ! parseOperand ( expr , scanner , false ) || ( resultExpr != null ) ) { return null ; } subtotal = op . evaluate ( subtotal , value ) ; } return String . valueOf ( subtotal ) ; }
Evaluate a variable expression .
296
7
161,011
private int evaluateCountExpression ( Object value ) { if ( value == null ) { return 0 ; } if ( value . getClass ( ) . isArray ( ) ) { return Array . getLength ( value ) ; } if ( value instanceof Vector < ? > ) { return ( ( Vector < ? > ) value ) . size ( ) ; } return 1 ; }
Evaluates the count expression function . If the value is null then 0 is returned . If the value is an array the length is returned . If the value is a vector the size is returned . Otherwise 1 is returned .
78
45
161,012
@ Override public Map < String , Object > getRequestCookieMap ( ) { if ( _requestCookieMap == null ) { checkHttpServletRequest ( ) ; _requestCookieMap = new CookieMap ( _httpServletRequest ) ; } return _requestCookieMap ; }
would be more elegant - = Simon Lessard = -
63
11
161,013
public LockingCursor getDefaultGetCursor ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getDefaultGetCursor" ) ; LockingCursor cursor = consumerKeyFilter [ 0 ] . getGetCursor ( ) ; if ( keyGroup != null ) cursor = keyGroup . getDefaultGetCursor ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getDefaultGetCursor" , cursor ) ; return cursor ; }
Return the getCursor for this consumer . This method is only called in the case where messages are not classified by XD .
135
25
161,014
private int chooseGetCursorIndex ( int classification ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "chooseGetCursorIndex" ) ; int classIndex = 0 ; if ( classifyingMessages ) classIndex = consumerSet . chooseGetCursorIndex ( classification ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "chooseGetCursorIndex" , classIndex ) ; return classIndex ; }
Determine the index of the getCursor to use based on the classifications defined for the ConsumerSet that a consumer belongs to . If SIB is not registered with XD and no classification is being performed then the default index is returned
126
48
161,015
public void detach ( ) throws SIResourceException , SINotPossibleInCurrentConfigurationException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "detach" ) ; // Make sure we are not ready notReady ( ) ; // Remove us from any group we are a member of if ( keyGroup != null ) keyGroup . removeMember ( this ) ; // Remove this consumer from the CD's knowledge consumerDispatcher . detachConsumerPoint ( this ) ; // Cleanly dispose of the getCursor if ( classifyingMessages ) { // Take the classifications read lock consumerSet . takeClassificationReadLock ( ) ; int numFilters = consumerKeyFilter . length ; for ( int i = 0 ; i < numFilters ; i ++ ) consumerKeyFilter [ i ] . detach ( ) ; // Free the classifications read lock consumerSet . freeClassificationReadLock ( ) ; } else consumerKeyFilter [ 0 ] . detach ( ) ; synchronized ( this ) { detached = true ; } // Remove the consumerPoint to the consumerSet if the latter has been specified if ( classifyingMessages ) consumerSet . removeConsumer ( consumerPoint ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "detach" ) ; }
Detach this consumer
299
4
161,016
public SIBUuid12 getConnectionUuid ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getConnectionUuid" ) ; SibTr . exit ( tc , "getConnectionUuid" , connectionUuid ) ; } return connectionUuid ; }
Return the consumer s connection Uuid
78
7
161,017
public boolean requiresRecovery ( SIMPMessage msg ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "requiresRecovery" , new Object [ ] { msg } ) ; boolean recoverable ; Reliability msgReliability = msg . getReliability ( ) ; recoverable = msgReliability . compareTo ( unrecoverability ) > 0 ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "requiresRecovery" , Boolean . valueOf ( recoverable ) ) ; return recoverable ; }
Determine if this consumer will require this message to be recoverable
141
14
161,018
public void markNotReady ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "markNotReady" ) ; ready = false ; if ( keyGroup != null ) keyGroup . markNotReady ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "markNotReady" ) ; }
Make this key not ready
101
5
161,019
public JSConsumerKey getParent ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getParent" ) ; JSConsumerKey key = this ; if ( keyGroup != null ) key = keyGroup ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getParent" , key ) ; return key ; }
Return this key s parent if it is a member of a keyGroup
108
14
161,020
public void start ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "start" ) ; if ( ! started ) { started = true ; if ( keyGroup != null ) keyGroup . startMember ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "start" ) ; }
The ConsumerKey doesn t actually care if the consumer is started but its ConsumerKey does
101
17
161,021
public void stop ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "stop" ) ; if ( started ) { started = false ; if ( keyGroup != null ) keyGroup . stopMember ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "stop" ) ; }
The ConsumerKey doesn t actually care if the consumer is stopped but its ConsumerKey does
100
17
161,022
private void createNewFiltersAndCursors ( ItemStream itemStream ) throws SIResourceException , MessageStoreException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "createNewFiltersAndCursors" , itemStream ) ; LockingCursor cursor = null ; // Instantiate a new array of Filters and associated cursors. If there is // no message classification, then we'll instantiate a single filter and // cursor pair. if ( classifyingMessages ) { // Classifying messages for XD. // this work should be done under the classifications readlock acquired higher // up in the stack JSConsumerClassifications classifications = consumerSet . getClassifications ( ) ; int numClasses = classifications . getNumberOfClasses ( ) ; consumerKeyFilter = new LocalQPConsumerKeyFilter [ numClasses + 1 ] ; for ( int i = 0 ; i < numClasses + 1 ; i ++ ) { String classificationName = null ; // The zeroth filter belongs to the default classification, which has a // null classification name if ( i > 0 ) classificationName = classifications . getClassification ( i ) ; consumerKeyFilter [ i ] = new LocalQPConsumerKeyFilter ( this , i , classificationName ) ; cursor = itemStream . newLockingItemCursor ( consumerKeyFilter [ i ] , ! forwardScanning ) ; consumerKeyFilter [ i ] . setLockingCursor ( cursor ) ; } } else { // No message classification consumerKeyFilter = new LocalQPConsumerKeyFilter [ 1 ] ; consumerKeyFilter [ 0 ] = new LocalQPConsumerKeyFilter ( this , 0 , null ) ; cursor = itemStream . newLockingItemCursor ( consumerKeyFilter [ 0 ] , ! forwardScanning ) ; consumerKeyFilter [ 0 ] . setLockingCursor ( cursor ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "createNewFiltersAndCursors" ) ; }
Create the filters and cursors for this Key . If XD has registered a MessageController we ll need a cursor - filter pair for each classification .
461
29
161,023
@ Override public JmsConnectionFactory createConnectionFactory ( ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "createConnectionFactory" ) ; JmsConnectionFactory jmscf = null ; // get a jca managed connection factory, which is used to construct // the jms connection factory. JmsJcaFactory jcaFact = JmsJcaFactory . getInstance ( ) ; if ( jcaFact == null ) { // This indicates that the jmsra.impl class could not be loaded by their // static initializer. Nothing we can do about that... // d238447 FFDC review. FFDC has already been generated by JmsJcaFactory, so // don't generate one here. throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "UNABLE_TO_CREATE_FACTORY_CWSIA0008" , new Object [ ] { "JmsJcaFactoryImpl" , "sib.api.jmsraOutboundImpl.jar" } , tc ) ; } JmsJcaManagedConnectionFactory jcamcf = jcaFact . createManagedConnectionFactory ( ) ; // invoke the construction of a jms connection factory - the jca managed // connection factory will call back into the jms api code by getting a // JmsRAFactoryFactory, and calling a create jms connection factory // method on it with jca connection factory and jca managed connection // factory objects as parameters (the jms cf will keep references to the // jca cf and jca mcf). try { jmscf = ( JmsConnectionFactory ) jcamcf . createConnectionFactory ( ) ; } catch ( ResourceException re ) { // No FFDC code needed // d222942 review - no documentation for when a RE will be thrown, so // default exception ok. (A quick look at the RA suggests the exception isn't // ever thrown). // d238447 FFDC review. From the above comment, generating an FFDC seems ok. throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "EXCEPTION_RECEIVED_CWSIA0007" , new Object [ ] { re , "JmsFactoryFactoryImpl.createConnectionFactory (#2)" } , re , "JmsFactoryFactoryImpl.createConnectionFactory#2" , this , tc ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "createConnectionFactory" , jmscf ) ; return jmscf ; }
This method is called by the application to retrieve its first ConnectionFactory object .
586
15
161,024
@ Override public JmsQueueConnectionFactory createQueueConnectionFactory ( ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "createQueueConnectionFactory" ) ; JmsQueueConnectionFactory jmsqcf = null ; // get a jca managed queue connection factory, which is used to construct // the jms queue connection factory. JmsJcaManagedQueueConnectionFactory jcamqcf = JmsJcaFactory . getInstance ( ) . createManagedQueueConnectionFactory ( ) ; // invoke the construction of a jms queue connection factory - the jca // managed queue connection factory will call back into the jms api code // by getting a JmsRAFactoryFactory, and calling a create jms queue // connection factory method on it with jca connection factory and jca // managed queue connection factory objects as parameters (the jms qcf // will keep references to the jca cf and jca mqcf). try { jmsqcf = ( JmsQueueConnectionFactory ) jcamqcf . createConnectionFactory ( ) ; } catch ( ResourceException re ) { // No FFDC code needed // d222942 review - no documentation for when a RE will be thrown, so // default exception ok. (A quick look at the RA suggests the exception isn't // ever thrown). // d238447 FFDC review. Comment above suggests an FFDC ok for this case. throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "EXCEPTION_RECEIVED_CWSIA0007" , new Object [ ] { re , "JmsFactoryFactoryImpl.createQueueConnectionFactory (#1)" } , re , "JmsFactoryFactoryImpl.createQueueConnectionFactory#1" , this , tc ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "createQueueConnectionFactory" , jmsqcf ) ; return jmsqcf ; }
This method is called by the application to retrieve its first QueueConnectionFactory object .
451
17
161,025
@ Override public JmsTopicConnectionFactory createTopicConnectionFactory ( ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "createTopicConnectionFactory" ) ; JmsTopicConnectionFactory jmstcf = null ; // get a jca managed topic connection factory, which is used to construct // the jms topic connection factory. JmsJcaManagedTopicConnectionFactory jcamtcf = JmsJcaFactory . getInstance ( ) . createManagedTopicConnectionFactory ( ) ; // invoke the construction of a jms topic connection factory - the jca // managed topic connection factory will call back into the jms api code // by getting a JmsRAFactoryFactory, and calling a create jms topic // connection factory method on it with jca connection factory and jca // managed topic connection factory objects as parameters (and the jms // tcf will keep references to the jca cf and jca mtcf). try { jmstcf = ( JmsTopicConnectionFactory ) jcamtcf . createConnectionFactory ( ) ; } catch ( ResourceException re ) { // No FFDC code needed // d222942 review - no documentation for when a RE will be thrown, so // default exception ok. (A quick look at the RA suggests the exception isn't // ever thrown). // d238447 FFDC review. Comment above suggests FFDC ok. throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "EXCEPTION_RECEIVED_CWSIA0007" , new Object [ ] { re , "JmsFactoryFactoryImpl.createTopicConnectionFactory (#1)" } , re , "JmsFactoryFactoryImpl.createTopicConnectionFactory#1" , this , tc ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "createTopicConnectionFactory" , jmstcf ) ; return jmstcf ; }
This method is called by the application to retrieve its first TopicConnectionFactory object .
447
16
161,026
@ Override public JmsQueue createQueue ( String name ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "createQueue" , name ) ; JmsQueue queue = null ; // if name string is null, empty or just "queue://", throw exception if ( ( name == null ) || ( "" . equals ( name ) ) || ( JmsQueueImpl . QUEUE_PREFIX . equals ( name ) ) ) { throw ( InvalidDestinationException ) JmsErrorUtils . newThrowable ( InvalidDestinationException . class , "INVALID_VALUE_CWSIA0003" , new Object [ ] { "Queue name" , name } , tc ) ; } // if name is "topic://" throw exception if ( name . startsWith ( JmsTopicImpl . TOPIC_PREFIX ) ) { throw ( InvalidDestinationException ) JmsErrorUtils . newThrowable ( InvalidDestinationException . class , "MALFORMED_DESCRIPTOR_CWSIA0047" , new Object [ ] { "Queue" , name } , tc ) ; } name = name . trim ( ) ; queue = ( JmsQueue ) destCreator . createDestinationFromString ( name , URIDestinationCreator . DestType . QUEUE ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "createQueue" , queue ) ; return queue ; }
This method is called by the application to create a jms administered queue object .
345
16
161,027
@ Override public JmsTopic createTopic ( String name ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "createTopic" , name ) ; JmsTopic topic = null ; // if name string is null throw exception if ( name == null ) { throw ( InvalidDestinationException ) JmsErrorUtils . newThrowable ( InvalidDestinationException . class , "INVALID_VALUE_CWSIA0003" , new Object [ ] { "Topic name" , null } , tc ) ; } // if name is "queue://" throw exception if ( name != null && name . startsWith ( JmsQueueImpl . QUEUE_PREFIX ) ) { throw ( InvalidDestinationException ) JmsErrorUtils . newThrowable ( InvalidDestinationException . class , "MALFORMED_DESCRIPTOR_CWSIA0047" , new Object [ ] { "Topic" , name } , tc ) ; } name = name . trim ( ) ; topic = ( JmsTopic ) destCreator . createDestinationFromString ( name , URIDestinationCreator . DestType . TOPIC ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "createTopic" , topic ) ; return topic ; }
This method is called by the application to create a jms administered topic object .
310
16
161,028
void handlePut ( SimpleTest test , Conjunction selector , MatchTarget object , InternTable subExpr ) throws MatchingException { if ( tc . isEntryEnabled ( ) ) tc . entry ( this , cclass , "handlePut" , new Object [ ] { test , selector , object , subExpr } ) ; Object value = test . getValue ( ) ; if ( value == null ) throw new IllegalStateException ( ) ; handleEqualityPut ( value , selector , object , subExpr ) ; if ( tc . isEntryEnabled ( ) ) tc . exit ( this , cclass , "handlePut" ) ; }
Implement handlePut .
134
5
161,029
void handleEqualityPut ( Object value , Conjunction selector , MatchTarget object , InternTable subExpr ) throws MatchingException { if ( tc . isEntryEnabled ( ) ) tc . entry ( this , cclass , "handleEqualityPut" , new Object [ ] { value , selector , object , subExpr } ) ; ContentMatcher next = ( ContentMatcher ) ( ( children == null ) ? null : children . get ( value ) ) ; ContentMatcher newNext = nextMatcher ( selector , next ) ; if ( newNext != next ) { if ( children == null ) children = new HashMap ( INITIAL_CHILDREN_CAPACITY ) ; children . put ( value , newNext ) ; } newNext . put ( selector , object , subExpr ) ; if ( tc . isEntryEnabled ( ) ) tc . exit ( this , cclass , "handleEqualityPut" ) ; }
Perform the handlePut function when the test is an equality test
200
13
161,030
void handleEqualityRemove ( Object value , Conjunction selector , MatchTarget object , InternTable subExpr , OrdinalPosition parentId ) throws MatchingException { if ( tc . isEntryEnabled ( ) ) tc . entry ( this , cclass , "handleEqualityRemove" , new Object [ ] { value , selector , object , subExpr } ) ; ContentMatcher next = ( ContentMatcher ) children . get ( value ) ; ContentMatcher newNext = ( ContentMatcher ) next . remove ( selector , object , subExpr , ordinalPosition ) ; if ( newNext == null ) children . remove ( value ) ; else if ( newNext != next ) children . put ( value , newNext ) ; if ( tc . isEntryEnabled ( ) ) tc . exit ( this , cclass , "handleEqualityRemove" ) ; }
Perform the handleRemove function when the test is an equality test
182
13
161,031
boolean isEmpty ( ) { if ( tc . isEntryEnabled ( ) ) tc . entry ( this , cclass , "isEmpty" ) ; boolean ans = super . isEmpty ( ) && ! haveEqualityMatches ( ) ; if ( tc . isEntryEnabled ( ) ) tc . exit ( this , cclass , "isEmpty" , new Boolean ( ans ) ) ; return ans ; }
Override isEmpty to check whether children is empty
86
9
161,032
ContentMatcher nextMatcher ( Conjunction selector , ContentMatcher oldMatcher ) { if ( tc . isEntryEnabled ( ) ) tc . entry ( this , cclass , "nextMatcher" , "selector: " + selector + ", oldMatcher: " + oldMatcher ) ; ContentMatcher ans ; if ( ! cacheing ) ans = super . nextMatcher ( selector , oldMatcher ) ; else if ( oldMatcher == null ) ans = new CacheingMatcher ( ordinalPosition , super . nextMatcher ( selector , null ) ) ; else ans = oldMatcher ; if ( tc . isEntryEnabled ( ) ) tc . exit ( this , cclass , "nextMatcher" , ans ) ; return ans ; }
Override nextMatcher to handle possibility of cacheing
162
10
161,033
public void setDestination ( DestinationHandler originalDestination ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "setDestination" , originalDestination ) ; _originalDestination = originalDestination ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "setDestination" ) ; }
Sets the destination that could not be delivered to .
99
11
161,034
@ Override public void setDestination ( SIDestinationAddress destinationAddr ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "setDestination" , destinationAddr ) ; if ( destinationAddr != null ) { try { _originalDestination = _messageProcessor . getDestinationManager ( ) . getDestination ( ( JsDestinationAddress ) destinationAddr , true ) ; } catch ( SIException e ) { // No FFDC code needed /* Generate warning but retry with default exception destination */ SibTr . warning ( tc , "EXCEPTION_DESTINATION_WARNING_CWSIP0291" , new Object [ ] { destinationAddr . getDestinationName ( ) , _messageProcessor . getMessagingEngineName ( ) , e } ) ; // Create a handler to the default if provided destination is inaccessible _originalDestination = null ; } } else _originalDestination = null ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "setDestination" , _originalDestination ) ; }
Sets the destination that could not be delivered to . Looks up the destination given its name .
262
19
161,035
public int checkCanExceptionMessage ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "checkCanExceptionMessage" ) ; // Return code int rc = DestinationHandler . OUTPUT_HANDLER_NOT_FOUND ; String newExceptionDestination = null ; boolean usingDefault = false ; if ( _originalDestination != null ) { newExceptionDestination = _originalDestination . getExceptionDestination ( ) ; if ( newExceptionDestination == null || newExceptionDestination . equals ( "" ) ) { // Simply return with OUTPUT_HANDLER_NOT_FOUND if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "checkCanExceptionMessage" , rc ) ; return rc ; } if ( newExceptionDestination . equals ( JsConstants . DEFAULT_EXCEPTION_DESTINATION ) ) { newExceptionDestination = _defaultExceptionDestinationName ; usingDefault = true ; } } else { newExceptionDestination = _defaultExceptionDestinationName ; usingDefault = true ; } try { DestinationHandler exceptionDestHandler = _messageProcessor . getDestinationManager ( ) . getDestination ( newExceptionDestination , true ) ; rc = exceptionDestHandler . checkCanAcceptMessage ( null , null ) ; } catch ( SIException e ) { // No FFDC code needed SibTr . exception ( tc , e ) ; } // If we havent checked the system default destination, then do that now if ( rc != DestinationHandler . OUTPUT_HANDLER_FOUND && ! usingDefault ) { try { DestinationHandler exceptionDestHandler = _messageProcessor . getDestinationManager ( ) . getDestination ( _defaultExceptionDestinationName , true ) ; rc = exceptionDestHandler . checkCanAcceptMessage ( null , null ) ; } catch ( SIException e ) { // No FFDC code needed SibTr . exception ( tc , e ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "checkCanExceptionMessage" , Integer . valueOf ( rc ) ) ; return rc ; }
Check whether it will be possible to place a message on the exception destination .
490
15
161,036
@ Override public UndeliverableReturnCode handleUndeliverableMessage ( SIBusMessage msg , String alternateUser , TransactionCommon tran , int exceptionReason , String [ ] exceptionStrings ) { // F001333-14610 // Delegate down onto the new method passing a null // subscription ID. return handleUndeliverableMessage ( msg , alternateUser , tran , exceptionReason , exceptionStrings , null ) ; }
Wrapper method for handleUndeliverableMessage . This version will be called from an external component via the com . ibm . ws . sib . processor . ExceptionDestinationHandler interface . E . g . we need to access this routine from the MQLink in the comms component .
94
62
161,037
private UndeliverableReturnCode checkMessage ( SIMPMessage message ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "checkMessage" , message ) ; UndeliverableReturnCode rc = UndeliverableReturnCode . OK ; // F001333:E3 // If the message's reliability equals or is less than the configured ExceptionDiscardReliability // then the message shouldn't be sent on to the exception destination, instead it should simply // be thrown away (the default setting is BestEffort). // We'll always chuck away BestEffort messages, but if we have the original destination we'll base // our decision on its configuration // (If the _originalDestination is null then we do not have the original destination's config to hand, // for example, in the case of cleaning up a deleted destination) Reliability discardReliabilityThreshold = Reliability . BEST_EFFORT_NONPERSISTENT ; if ( _originalDestination != null ) discardReliabilityThreshold = _originalDestination . getExceptionDiscardReliability ( ) ; if ( message . getReliability ( ) . compareTo ( discardReliabilityThreshold ) <= 0 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Message reliability (" + message . getReliability ( ) + ") <= Exception reliability (" + discardReliabilityThreshold + ")" ) ; rc = UndeliverableReturnCode . DISCARD ; } // Discard messages from temporary destinations. else if ( _originalDestination != null && _originalDestination . isTemporary ( ) ) rc = UndeliverableReturnCode . DISCARD ; // If the discardMessage option is set, then we discard the message rather // than send to the exception destination else if ( Boolean . TRUE . equals ( message . getMessage ( ) . getReportDiscardMsg ( ) ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Message discarded at sender's request" ) ; rc = UndeliverableReturnCode . DISCARD ; } // Decide whether we want to block the message or not. else if ( isBlockRequired ( message ) ) rc = UndeliverableReturnCode . BLOCK ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "checkMessage" , rc ) ; return rc ; }
Checks that a message is valid for delivery to an exception destination
560
13
161,038
private void handleAccessDenied ( AccessResult result , JsMessage msg , String alternateUser ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "handleAccessDenied" , new Object [ ] { result , msg , alternateUser } ) ; // Determine the username and operation for messaging String userName = null ; OperationType operationType = null ; if ( result . didIdentityAdoptionFail ( ) ) { userName = msg . getSecurityUserid ( ) ; operationType = OperationType . IDENTITY_ADOPTER ; } else { operationType = OperationType . SEND ; if ( alternateUser != null ) userName = alternateUser ; else userName = msg . getSecurityUserid ( ) ; } // Build the message for the Exception and the Notification String nlsMessage = nls . getFormattedMessage ( "USER_NOT_AUTH_EXCEPTION_DEST_ERROR_CWSIP0313" , new Object [ ] { userName , _exceptionDestinationName } , null ) ; // Fire a Notification if Eventing is enabled _messageProcessor . getAccessChecker ( ) . fireDestinationAccessNotAuthorizedEvent ( _exceptionDestinationName , userName , operationType , nlsMessage ) ; // Report the not authorized condition to the console SibTr . warning ( tc , "USER_NOT_AUTH_EXCEPTION_DEST_ERROR_CWSIP0313" , new Object [ ] { userName , _exceptionDestinationName } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "handleAccessDenied" ) ; }
Fire an event if eventing is enabled and write an audit record .
382
14
161,039
private void fireMessageExceptionedEvent ( String apiMsgId , SIMPMessage message , int exceptionReason ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "fireMessageExceptionedEvent" , new Object [ ] { apiMsgId , message , Integer . valueOf ( exceptionReason ) } ) ; JsMessagingEngine me = _messageProcessor . getMessagingEngine ( ) ; RuntimeEventListener listener = _messageProcessor . getRuntimeEventListener ( ) ; String systemMessageId = message . getMessage ( ) . getSystemMessageId ( ) ; // Check that we have a RuntimeEventListener if ( listener != null ) { // Build the message for the Notification String nlsMessage = nls_mt . getFormattedMessage ( "MESSAGE_EXCEPTION_DESTINATIONED_CWSJU0012" , new Object [ ] { apiMsgId , systemMessageId , _exceptionDestinationName , Integer . valueOf ( exceptionReason ) , message . getMessage ( ) . getExceptionMessage ( ) } , null ) ; // Build the properties for the Notification Properties props = new Properties ( ) ; // Set values for the intended destination String intendedDestinationName = "" ; String intendedDestinationUuid = SIBUuid12 . toZeroString ( ) ; if ( _originalDestination != null ) { intendedDestinationName = _originalDestination . getName ( ) ; intendedDestinationUuid = _originalDestination . getUuid ( ) . toString ( ) ; } props . put ( SibNotificationConstants . KEY_INTENDED_DESTINATION_NAME , intendedDestinationName ) ; props . put ( SibNotificationConstants . KEY_INTENDED_DESTINATION_UUID , intendedDestinationUuid ) ; // Set values for the exception destination props . put ( SibNotificationConstants . KEY_EXCEPTION_DESTINATION_NAME , _exceptionDestination . getName ( ) ) ; props . put ( SibNotificationConstants . KEY_EXCEPTION_DESTINATION_UUID , _exceptionDestination . getUuid ( ) . toString ( ) ) ; props . put ( SibNotificationConstants . KEY_SYSTEM_MESSAGE_IDENTIFIER , ( systemMessageId == null ) ? "" : systemMessageId ) ; props . put ( SibNotificationConstants . KEY_MESSAGE_EXCEPTION_REASON , String . valueOf ( exceptionReason ) ) ; // Fire the event listener . runtimeEventOccurred ( me , SibNotificationConstants . TYPE_SIB_MESSAGE_EXCEPTIONED , nlsMessage , props ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Null RuntimeEventListener, cannot fire event" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "fireMessageExceptionedEvent" ) ; }
Fire an event notification of type TYPE_SIB_MESSAGE_EXCEPTIONED
689
20
161,040
public static String decodeUri ( String url ) { int index1 = url . indexOf ( sessUrlRewritePrefix ) ; int index2 = url . indexOf ( qMark ) ; String tmp = null ; if ( index2 != - 1 && index2 > index1 ) { tmp = url . substring ( index2 ) ; } if ( index1 != - 1 ) { url = url . substring ( 0 , index1 ) ; if ( tmp != null ) { url = url + tmp ; } } return url ; }
Strips out the sessionId only form the URI
115
11
161,041
public static final void setInstance ( FaceletFactory factory ) { if ( factory == null ) { instance . remove ( ) ; } else { instance . set ( factory ) ; } }
Set the static instance
38
4
161,042
protected Object getSession ( String id , int version , boolean isSessionAccess , boolean forceSessionRetrieval , Object xdCorrelator ) { if ( isSessionAccess ) { if ( version == - 1 ) { _store . refreshSession ( id , xdCorrelator ) ; } else { _store . refreshSession ( id , version , xdCorrelator ) ; } } ISession iSession = getSessionFromStore ( id , version , isSessionAccess , forceSessionRetrieval , xdCorrelator ) ; if ( iSession != null ) { if ( isSessionAccess ) { boolean stillValid = _store . checkSessionStillValid ( iSession , iSession . getLastAccessedTime ( ) ) ; if ( stillValid ) { iSession . incrementRefCount ( ) ; _sessionEventDispatcher . sessionAccessed ( iSession ) ; } else { iSession = null ; } } } else { if ( isSessionAccess ) { _sessionEventDispatcher . sessionAccessUnknownKey ( id ) ; } } return iSession ; }
forceSessionRetrieval can only be true when using applicationSessions
228
14
161,043
public static byte [ ] copyCredToken ( byte [ ] credToken ) { if ( credToken == null ) { return null ; } final int LEN = credToken . length ; if ( LEN == 0 ) { return new byte [ LEN ] ; } byte [ ] newCredToken = new byte [ LEN ] ; System . arraycopy ( credToken , 0 , newCredToken , 0 , LEN ) ; return newCredToken ; }
Create a copy of the specified byte array .
99
9
161,044
public static X509Certificate [ ] copyCertChain ( X509Certificate [ ] certChain ) { if ( certChain == null ) { return null ; } final int LEN = certChain . length ; if ( LEN == 0 ) { return new X509Certificate [ LEN ] ; } X509Certificate [ ] newCertChain = new X509Certificate [ LEN ] ; System . arraycopy ( certChain , 0 , newCertChain , 0 , LEN ) ; return newCertChain ; }
Create a copy of the specified cert array .
110
9
161,045
public void waitOnChains ( long quiesceTimeout ) { ChannelFramework cf = ChannelFrameworkFactory . getChannelFramework ( ) ; int elapsedTime = 0 ; if ( waitingChainNames . size ( ) > 0 && elapsedTime < quiesceTimeout ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( this , tc , "Waiting on " + waitingChainNames . size ( ) + " chain(s) to stop" ) ; } Iterator < String > iter = waitingChainNames . iterator ( ) ; while ( iter . hasNext ( ) ) { if ( ! cf . isChainRunning ( iter . next ( ) ) ) iter . remove ( ) ; } try { Thread . sleep ( 1000 ) ; } catch ( InterruptedException ie ) { // ignore } elapsedTime += 1000 ; } }
Poll the list of chains until they re stopped or the quiesce timeout is hit
189
17
161,046
static void closeLink ( CommsConnection conn ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "closeLink" , conn ) ; conn . setSchemaSet ( null ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "closeLink" ) ; }
Called when a connection closes .
94
7
161,047
static byte [ ] receiveHandshake ( CommsConnection conn , byte [ ] data ) throws JMFException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "receiveHandshake" , conn ) ; Coder coder = new Coder ( data ) ; conn . setSchemaSet ( makeSchemaIdSet ( coder ) ) ; byte [ ] ids = makeSchemaIdList ( JMFRegistry . instance . retrieveAll ( ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "receiveHandshake" ) ; return ids ; }
Called when schema ids are received during an initial handshake
159
12
161,048
static void receiveSchemas ( CommsConnection conn , byte [ ] data ) throws JMFException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "receiveSchemas" , conn ) ; final SchemaSet ids ; try { ids = ( SchemaSet ) conn . getSchemaSet ( ) ; if ( ids == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "getSchemaSet() returned null for CommsConnection: " + conn ) ; throw new IllegalStateException ( "CommsConnection returned null SchemaSet" ) ; } } catch ( SIConnectionDroppedException e ) { // No FFDC code needed - this is not an unexpected condition when a connection fails during start of a new conversation on the connection throw new IllegalStateException ( "CommsConnection threw exception" , e ) ; } Coder coder = new Coder ( data ) ; addSchemaDefinitions ( ids , coder ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "receiveSchemas" ) ; }
Called when schema definitions are received on a connection
281
10
161,049
private static void addSchemaDefinitions ( SchemaSet ids , Coder coder ) throws JMFException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Decoding " + coder . count + "new schema definitions" ) ; // Decode the new schemas and add them to the registry and the list of known // schemas for this connection. for ( int i = 0 ; i < coder . count ; i ++ ) { int length = ArrayUtil . readInt ( coder . buffer , coder . offset ) ; coder . offset += ArrayUtil . INT_SIZE ; JMFSchema schema = JMFRegistry . instance . createJMFSchema ( coder . buffer , coder . offset , length ) ; JMFRegistry . instance . register ( schema ) ; ids . add ( schema . getLongID ( ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , " Added Schema " + debugSchema ( schema ) ) ; coder . offset += length ; } }
Add extra incoming schema definitions
258
5
161,050
public void cleanUpSubject ( ) { if ( temporarySubject != null ) { AccessController . doPrivileged ( new PrivilegedAction < Object > ( ) { @ Override public Object run ( ) { removeSubjectPrincipals ( ) ; removeSubjectPublicCredentials ( ) ; removeSubjectPrivateCredentials ( ) ; return null ; } } ) ; } temporarySubject = null ; }
Common Subject clean up .
82
5
161,051
protected void payloadWritten ( int payloadSize ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "payloadWritten" , new Object [ ] { this , new Integer ( payloadSize ) } ) ; // Track the unwritten payload decrease directly. We take no account for this classes header // values in this figure. The total payload remains unchanged since we are not removing the // corrisponding payload, just writing it to the underlying recovery log. _unwrittenDataSize -= payloadSize ; // When writing existing payload, if the resulting unwritten data size has gone back down to // zero then there will be no further need to account for the unwritten data header. // When we pass on this payload adjustment we must account for the header size. if ( _unwrittenDataSize == 0 ) { _recUnit . payloadWritten ( payloadSize + HEADER_SIZE ) ; } else { _recUnit . payloadWritten ( payloadSize ) ; } if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "unwrittenDataSize = " + _unwrittenDataSize + " totalDataSize = " + _totalDataSize ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "payloadWritten" ) ; }
Informs the recoverable unit section that previously unwritten data has been written to disk by one of its data items and no longer needs to be tracked in the unwritten data field . The recoverable unit must use the supplied information to track the amount of unwritten active data it holds . This information must be passed to its parent recovery log in order that it may track the amount of unwritten data in the entire recovery log .
268
86
161,052
protected void payloadDeleted ( int totalPayloadSize , int unwrittenPayloadSize ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "payloadDeleted" , new Object [ ] { this , new Integer ( totalPayloadSize ) , new Integer ( unwrittenPayloadSize ) } ) ; // Track the payload decreases directly. We take no account for this classes header values // in these figures. _totalDataSize -= totalPayloadSize ; _unwrittenDataSize -= unwrittenPayloadSize ; // When removing existing payload, if the resulting unwritten data size has gone back down to // zero then there will be no further need to account for the unwritten data header. // When we pass on this payload adjustment we must account for the header size. if ( _unwrittenDataSize == 0 && ( unwrittenPayloadSize != 0 ) ) { unwrittenPayloadSize += HEADER_SIZE ; } // When removing existing payload, if the resulting written data size has gone back down to // zero then there will be no further need to account for the written data header. // When we pass on this payload adjustment we must account for the header size. if ( _totalDataSize == 0 ) { totalPayloadSize += HEADER_SIZE ; } _recUnit . payloadDeleted ( totalPayloadSize , unwrittenPayloadSize ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "unwrittenDataSize = " + _unwrittenDataSize + " totalDataSize = " + _totalDataSize ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "payloadDeleted" ) ; }
Informs the recoverable unit section that data has been removed . At present this method is only used by the SingleDataItem class to remove the payload required for the its data before adding back additional payload back again for the replacement data data .
358
48
161,053
public BeanId getBeanId ( ) { if ( ivBeanId == null ) { ivBeanId = new BeanId ( ivBMD . j2eeName , null , false ) ; } return ivBeanId ; }
Gets the partially formed BeanId for this bean . The resulting BeanId will not have a home reference .
51
22
161,054
protected String promptForText ( com . ibm . ws . security . audit . reader . utils . ConsoleWrapper stdin , PrintStream stdout ) { return promptForText ( stdin , stdout , "encode.enterText" , "encode.reenterText" , "encode.readError" , "encode.entriesDidNotMatch" ) ; }
Prompt the user to enter text to encode . Prompts twice and compares to ensure it was entered correctly .
84
22
161,055
public static String getPropertyOrNull ( String name ) { try { return AccessController . doPrivileged ( new SystemPropertyAction ( name ) ) ; } catch ( SecurityException ex ) { LOG . log ( Level . FINE , "SecurityException raised getting property " + name , ex ) ; return null ; } }
Get the system property via the AccessController but if a SecurityException is raised just return null ;
66
19
161,056
public MatchTarget duplicate ( ) { try { return ( MatchTarget ) clone ( ) ; } catch ( CloneNotSupportedException e ) { // No FFDC Code Needed. // FFDC driven by wrapper class. FFDC . processException ( cclass , "com.ibm.ws.sib.matchspace.MatchTarget.duplicate" , e , "1:112:1.15" ) ; // should not happen throw new IllegalStateException ( ) ; } }
Creates a clone of this MatchTarget . Override only if the system clone support does not produce a correct result .
102
24
161,057
@ Override public EJBBinding createBindingObject ( HomeRecord hr , HomeWrapperSet homeSet , String interfaceName , int interfaceIndex , boolean local ) { return new EJBBinding ( hr , interfaceName , interfaceIndex , local ) ; }
Store the binding information for later use .
55
8
161,058
@ Override public EJBBinding createJavaBindingObject ( HomeRecord hr , HomeWrapperSet homeSet , String interfaceName , int interfaceIndex , boolean local , EJBBinding bindingObject ) { return bindingObject ; }
This method is provided for tWas and is not used for Liberty . Just return the bindingObject for now .
49
22
161,059
@ Override protected Class < ? > loadClass ( String className , boolean resolve ) throws ClassNotFoundException { Class < ? > loadedClass = null ; synchronized ( this ) { loadedClass = findLoadedClass ( className ) ; if ( loadedClass == null ) { int index = className . lastIndexOf ( ' ' ) ; String packageName = index > 0 ? className . substring ( 0 , index ) : "" ; if ( packageList . contains ( packageName ) ) { try { // first check our classpath loadedClass = findClass ( className ) ; } catch ( ClassNotFoundException cnfe ) { // ignore this since we'll try the parent next } } } } if ( null == loadedClass ) { // then the parent classpath loadedClass = super . loadClass ( className , resolve ) ; } // The resolve parameter is a legacy parameter that is effectively // never used as of JDK 1.1 (see footnote 1 of section 5.3.2 of the 2nd // edition of the JVM specification). The only caller of this method is // is java.lang.ClassLoader.loadClass(String), and that method always // passes false, so we ignore the parameter. return loadedClass ; }
load class from the local classpath first and the class was not found load from parent or system classload again .
262
23
161,060
public DERObject getConvertedValue ( DERObjectIdentifier oid , String value ) { if ( value . length ( ) != 0 && value . charAt ( 0 ) == ' ' ) { try { return convertHexEncoded ( value , 1 ) ; } catch ( IOException e ) { throw new RuntimeException ( "can't recode value for oid " + oid . getId ( ) , e ) ; } } else if ( oid . equals ( X509Name . EmailAddress ) ) { return new DERIA5String ( value ) ; } else if ( canBePrintable ( value ) ) { return new DERPrintableString ( value ) ; } else if ( canBeUTF8 ( value ) ) { return new DERUTF8String ( value ) ; } return new DERBMPString ( value ) ; }
Apply default coversion for the given value depending on the oid and the character range of the value .
183
21
161,061
@ Override public byte [ ] transform ( ClassLoader loader , String className , Class < ? > classBeingRedefined , ProtectionDomain protectionDomain , byte [ ] classfileBuffer ) throws IllegalClassFormatException { // Skip over anything on the bootstrap loader and some VM // internal classes (like those in support of reflection) if ( ( loader == null && ! includeBootstrap ) || probeManagerImpl . isExcludedClass ( className ) ) { return null ; } // If this is a probe candidate, hook the static initializer if ( probeManagerImpl . isProbeCandidate ( className ) ) { return transformCandidate ( classfileBuffer ) ; } return null ; }
Perform necessary transformation to hook static initializers of probe candidates .
143
13
161,062
public synchronized void setStoreFileSize ( long newMinimumStoreFileSize , long newMaximumStoreFileSize ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "setStoreFileSize" , new Object [ ] { new Long ( newMinimumStoreFileSize ) , new Long ( newMaximumStoreFileSize ) } ) ; // Synchronized so we have locked out flush(); if ( newMinimumStoreFileSize > newMaximumStoreFileSize ) { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "setStoreFileSize" ) ; throw new IllegalArgumentException ( newMinimumStoreFileSize + ">" + newMaximumStoreFileSize ) ; } // if (newStoreFileSize... // Check that the new MaximumStoreFileSize is still bigger than the existing // contents if the ObjectStore. if ( newMaximumStoreFileSize < storeFileSizeUsed ) { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "setStoreFileSize" , new Object [ ] { new Long ( newMaximumStoreFileSize ) , new Long ( storeFileSizeAllocated ) , new Long ( storeFileSizeUsed ) } ) ; throw new StoreFileSizeTooSmallException ( this , newMaximumStoreFileSize , storeFileSizeAllocated , storeFileSizeUsed ) ; } // if (newStoreFileSize... // If we are expanding the minimum file size grab the disk space now. // If we fail before storing the new administered values the space will be release next time // we open(). if ( newMinimumStoreFileSize > storeFileSizeAllocated ) { try { setStoreFileSizeInternalWithException ( newMinimumStoreFileSize ) ; } catch ( java . io . IOException exception ) { // No FFDC Code Needed. ObjectManager . ffdc . processException ( this , cclass , "setStoreFileSize" , exception , "1:349:1.57" ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "setStoreFileSize" ) ; throw new PermanentIOException ( this , exception ) ; } } // if ( newMinimumStoreFileSize > storeFileSizeAllocated). minimumStoreFileSize = newMinimumStoreFileSize ; maximumStoreFileSize = newMaximumStoreFileSize ; writeHeader ( ) ; force ( ) ; setAllocationAllowed ( ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "setStoreFileSize" ) ; }
Sets the size of the store file to the new values . At least the minimum space is reserved in the file system . No more than the maximum number of bytes will be used . Blocks until this has completed . The initial values used by the ObjecStore are 0 and Long . MAX_VAULE . The store will attempt to release space as ManagedObjects are deleted to reach the minimum size .
601
82
161,063
public synchronized void setCachedManagedObjectsSize ( int cachedManagedObjectsSize ) throws ObjectManagerException { this . cachedManagedObjectsSize = cachedManagedObjectsSize ; cachedManagedObjects = new java . lang . ref . SoftReference [ cachedManagedObjectsSize ] ; writeHeader ( ) ; force ( ) ; }
Causes all curently cached ManagedObjects to be dropped .
75
15
161,064
protected void setAllocationAllowed ( ) throws ObjectManagerException { final String methodName = "setAllocationAllowed" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName , new Object [ ] { new Long ( storeFileSizeAllocated ) , new Long ( storeFileSizeUsed ) } ) ; // Users of the store should have reserved space in the store for Objects that are allocated before // they finally add them to the store. We have already reserved enough space for a complete replacement // of the directory which also implies there is already enough space to delete any number of // ManagedObjects in the store. // Calculate how much file space we need to continue storing ManagedObjects. // We make the pessimistic assumption that the entire contents of the log might need to be written // to this ObjectStore. // We have to take into account any pending request to increase the size of the log file, because this // would allow applications to over commit the store if they used the extra log space when it did not // exist in the Object Store. long storeFileSizeRequired = storeFileSizeAllocated ; if ( simulateFullReservedSize > 0 ) { // We are simulating a a full filesystem. allocationAllowed = false ; reservationThreshold = 0 ; } else { // do we have enough space to accomdate the whole log in the store plus reserved space in the store long currentReservedSize = reservedSize . get ( ) ; long pesimisticSpaceRequired = Math . max ( objectManagerState . logOutput . getLogFileSize ( ) , objectManagerState . logOutput . getLogFileSizeRequested ( ) ) + directoryReservedSize + currentReservedSize ; long largestFreeSpace = 0 ; if ( freeSpaceByLength . size ( ) > 0 ) { largestFreeSpace = ( ( FreeSpace ) freeSpaceByLength . last ( ) ) . length ; } if ( pesimisticSpaceRequired <= largestFreeSpace ) { // we can at least fit the whole log plus reserved space in the largest free space entry // so we are ok allocationAllowed = true ; } else { storeFileSizeRequired = storeFileSizeUsed + pesimisticSpaceRequired ; // See if we need to change the size of the store file. if ( storeFileSizeRequired <= storeFileSizeAllocated ) { // we have allocated more than is required, its just not in the free space map yet allocationAllowed = true ; } else if ( storeFileSizeRequired <= maximumStoreFileSize ) { // we need more than we have allocated, and that is less than the maximum allowed, try grow to the required... allocationAllowed = setStoreFileSizeInternal ( storeFileSizeRequired ) ; } else { // We need greater than the maximum allowed, make sure we have all the space we are // allowed to have. if ( storeFileSizeAllocated < maximumStoreFileSize ) setStoreFileSizeInternal ( maximumStoreFileSize ) ; // TODO We could still allow allocation until we really are full when the reservation scheme will catch it! allocationAllowed = false ; // Request a checkpoint, see if we can clear some space. numberOfStoreFullCheckpointsTriggered ++ ; objectManagerState . requestCheckpoint ( persistent ) ; } // if ( storeFileSizeRequired... reservationThreshold = storeFileSizeAllocated - storeFileSizeUsed - directoryReservedSize ; reservationCheckpointThreshold = Math . min ( reservationThreshold , currentReservedSize + reservationCheckpointMaximum ) ; } } // Release at least one blocked reservation request. if ( reservationPacing ) { synchronized ( reservationPacingLock ) { reservationPacing = false ; reservationPacingLock . notify ( ) ; } // synchronized (reservationPacingLock). } if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , new Object [ ] { new Boolean ( allocationAllowed ) , new Long ( storeFileSizeRequired ) } ) ; }
Tests to see if allocation of new Objects should be allowed or not . Caller must be synchronized on this .
861
22
161,065
public void simulateFull ( boolean isFull ) throws ObjectManagerException { final String methodName = "simulateFull" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName , new Object [ ] { new Boolean ( isFull ) } ) ; if ( isFull ) { // Clear as much space as we can. objectManagerState . waitForCheckpoint ( true ) ; // Reserve all of the available space. synchronized ( this ) { long available = storeFileSizeAllocated - storeFileSizeUsed - directoryReservedSize - reservedSize . get ( ) ; long newReservedSize = reservedSize . addAndGet ( ( int ) available ) ; simulateFullReservedSize = simulateFullReservedSize + available ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isDebugEnabled ( ) ) trace . debug ( this , cclass , methodName , new Object [ ] { "isFull:834" , new Long ( available ) , new Long ( newReservedSize ) , new Long ( simulateFullReservedSize ) } ) ; } // synchronized (this). } else { synchronized ( this ) { reservedSize . addAndGet ( ( int ) - simulateFullReservedSize ) ; simulateFullReservedSize = 0 ; } // synchronized (this). objectManagerState . waitForCheckpoint ( true ) ; } // if (isFull). if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , new Object [ ] { new Long ( simulateFullReservedSize ) } ) ; }
When enabled reserve requests to this ObjectStore will throw ObjectStoreFullException .
360
15
161,066
public Map < String , ProvisioningFeatureDefinition > getFeatureDefinitions ( String productName ) { if ( productName . equals ( CORE_PRODUCT_NAME ) ) { return getCoreProductFeatureDefinitions ( ) ; } else if ( productName . equals ( USR_PRODUCT_EXT_NAME ) ) { return getUsrProductFeatureDefinitions ( ) ; } else { return getProductExtFeatureDefinitions ( productName ) ; } }
Retrieves a map of features definitions associated with the specified product name .
96
15
161,067
public Map < String , ProvisioningFeatureDefinition > getCoreFeatureDefinitionsExceptPlatform ( ) { Map < String , ProvisioningFeatureDefinition > features = new TreeMap < String , ProvisioningFeatureDefinition > ( ) ; File featureDir = getCoreFeatureDir ( ) ; //the feature directory may not exist if the packaged server had no features installed when minified if ( ! featureDir . isDirectory ( ) && ! featureDir . mkdir ( ) ) { throw new FeatureToolException ( "Unable to find or create feature directory: " + featureDir , MessageFormat . format ( NLS . messages . getString ( "tool.feature.dir.not.found" ) , featureDir ) , null , ReturnCode . MISSING_CONTENT ) ; } File [ ] manifestFiles = featureDir . listFiles ( MFFilter ) ; if ( manifestFiles != null ) { for ( File file : manifestFiles ) { try { ProvisioningFeatureDefinition fd = new SubsystemFeatureDefinitionImpl ( ExtensionConstants . CORE_EXTENSION , file ) ; if ( fd . isSupportedFeatureVersion ( ) ) { // using symbolic name because gets compared to FeatureResource symbolic name features . put ( fd . getSymbolicName ( ) , fd ) ; } } catch ( IOException e ) { // TODO: PROPER NLS MESSAGE throw new FeatureToolException ( "Unable to read core feature manifest: " + file , ( String ) null , e , ReturnCode . BAD_FEATURE_DEFINITION ) ; } } } return features ; }
This API for install used only .
335
7
161,068
private Map < String , ProvisioningFeatureDefinition > getCoreProductFeatureDefinitions ( ) { Map < String , ProvisioningFeatureDefinition > features = new TreeMap < String , ProvisioningFeatureDefinition > ( ) ; File featureDir = getCoreFeatureDir ( ) ; //the feature directory may not exist if the packaged server had no features installed when minified if ( ! featureDir . isDirectory ( ) && ! featureDir . mkdir ( ) ) { throw new FeatureToolException ( "Unable to find or create feature directory: " + featureDir , MessageFormat . format ( NLS . messages . getString ( "tool.feature.dir.not.found" ) , featureDir ) , null , ReturnCode . MISSING_CONTENT ) ; } File platformDir = getCorePlatformDir ( ) ; File [ ] manifestFiles = featureDir . listFiles ( MFFilter ) ; if ( manifestFiles != null ) { for ( File file : manifestFiles ) { try { ProvisioningFeatureDefinition fd = new SubsystemFeatureDefinitionImpl ( ExtensionConstants . CORE_EXTENSION , file ) ; if ( fd . isSupportedFeatureVersion ( ) ) { // using symbolic name because gets compared to FeatureResource symbolic name features . put ( fd . getSymbolicName ( ) , fd ) ; } } catch ( IOException e ) { // TODO: PROPER NLS MESSAGE throw new FeatureToolException ( "Unable to read core feature manifest: " + file , ( String ) null , e , ReturnCode . BAD_FEATURE_DEFINITION ) ; } } } manifestFiles = platformDir . listFiles ( MFFilter ) ; if ( manifestFiles != null ) { for ( File file : manifestFiles ) { try { ProvisioningFeatureDefinition fd = new KernelFeatureListDefinition ( file ) ; // using symbolic name because gets compared to FeatureResource symbolic name features . put ( fd . getSymbolicName ( ) , fd ) ; } catch ( IOException e ) { // TODO: PROPER NLS MESSAGE throw new FeatureToolException ( "Unable to read core manifest: " + file , ( String ) null , e , ReturnCode . BAD_FEATURE_DEFINITION ) ; } } } return features ; }
Retrieves a Map of Liberty core features .
487
10
161,069
private Map < String , ProvisioningFeatureDefinition > getUsrProductFeatureDefinitions ( ) { Map < String , ProvisioningFeatureDefinition > features = null ; File userDir = Utils . getUserDir ( ) ; if ( userDir != null && userDir . exists ( ) ) { File userFeatureDir = new File ( userDir , USER_FEATURE_DIR ) ; if ( userFeatureDir . exists ( ) ) { features = new TreeMap < String , ProvisioningFeatureDefinition > ( ) ; File [ ] userManifestFiles = userFeatureDir . listFiles ( MFFilter ) ; if ( userManifestFiles != null ) { for ( File file : userManifestFiles ) { try { ProvisioningFeatureDefinition fd = new SubsystemFeatureDefinitionImpl ( USR_PRODUCT_EXT_NAME , file ) ; features . put ( fd . getSymbolicName ( ) , fd ) ; } catch ( IOException e ) { // TODO: PROPER NLS MESSAGE throw new FeatureToolException ( "Unable to read feature manifest from user extension: " + file , ( String ) null , e , ReturnCode . BAD_FEATURE_DEFINITION ) ; } } } } } return features ; }
Retrieves a Map of feature definitions in default usr product extension location
268
15
161,070
public String getProdFeatureLocation ( String productName ) { String location = null ; if ( productName . equals ( CORE_PRODUCT_NAME ) ) { location = Utils . getInstallDir ( ) . getAbsolutePath ( ) ; } else if ( productName . equals ( USR_PRODUCT_EXT_NAME ) ) { location = Utils . getUserDir ( ) . getAbsolutePath ( ) ; } else { readProductExtFeatureLocations ( ) ; if ( productExtNameInfoMap . containsKey ( productName ) ) { location = productExtNameInfoMap . get ( productName ) . getLocation ( ) ; } } return location ; }
Retrieves the location of the specified product name .
145
11
161,071
public String getProdFeatureId ( String productName ) { String productId = null ; if ( ! productName . equals ( CORE_PRODUCT_NAME ) && ! productName . equals ( USR_PRODUCT_EXT_NAME ) ) { readProductExtFeatureLocations ( ) ; if ( productExtNameInfoMap . containsKey ( productName ) ) { productId = productExtNameInfoMap . get ( productName ) . getProductID ( ) ; } } return productId ; }
Retrieves the ID of the specified product name .
107
11
161,072
public File getCoreFeatureDir ( ) { File featureDir = null ; File installDir = Utils . getInstallDir ( ) ; if ( installDir != null ) { featureDir = new File ( installDir , FEATURE_DIR ) ; } if ( featureDir == null ) { throw new RuntimeException ( "Feature Directory not found" ) ; } return featureDir ; }
Retrieves the Liberty core features directory .
79
9
161,073
public File getCorePlatformDir ( ) { File platformDir = null ; File installDir = Utils . getInstallDir ( ) ; if ( installDir != null ) { platformDir = new File ( installDir , PLATFORM_DIR ) ; } if ( platformDir == null ) { throw new RuntimeException ( "Platform Directory not found" ) ; } return platformDir ; }
Retrieves the Liberty core platform directory .
80
9
161,074
public File getCoreAssetDir ( ) { File assetDir = null ; File installDir = Utils . getInstallDir ( ) ; if ( installDir != null ) { assetDir = new File ( installDir , ASSET_DIR ) ; } if ( assetDir == null ) { throw new RuntimeException ( "Asset Directory not found" ) ; } return assetDir ; }
Retrieves the Liberty core assets directory .
79
9
161,075
public ContentBasedLocalBundleRepository getBundleRepository ( String featureName , WsLocationAdmin locService ) { return BundleRepositoryRegistry . getRepositoryHolder ( featureName ) . getBundleRepository ( ) ; }
Get bundle repository
52
3
161,076
@ FFDCIgnore ( { IllegalCharsetNameException . class , UnsupportedCharsetException . class } ) public static String mapCharset ( String enc , String deflt ) { if ( enc == null ) { return deflt ; } //older versions of tomcat don't properly parse ContentType headers with stuff //after charset=StandardCharsets.UTF_8 int idx = enc . indexOf ( ";" ) ; if ( idx != - 1 ) { enc = enc . substring ( 0 , idx ) ; } // Charsets can be quoted. But it's quite certain that they can't have escaped quoted or // anything like that. enc = charsetPattern . matcher ( enc ) . replaceAll ( "" ) . trim ( ) ; if ( "" . equals ( enc ) ) { return deflt ; } String newenc = encodings . get ( enc ) ; if ( newenc == null ) { try { newenc = Charset . forName ( enc ) . name ( ) ; } catch ( IllegalCharsetNameException icne ) { return null ; } catch ( UnsupportedCharsetException uce ) { return null ; } String tmpenc = encodings . putIfAbsent ( enc , newenc ) ; if ( tmpenc != null ) { newenc = tmpenc ; } } return newenc ; }
into something that is actually supported by Java and the Stax parsers and such .
294
17
161,077
@ BeforeClass public static void setUp ( ) throws Exception { // Add LDAP variables to bootstrap properties file LDAPUtils . addLDAPVariables ( server ) ; Log . info ( c , "setUp" , "Starting the server... (will wait for userRegistry servlet to start)" ) ; server . copyFileToLibertyInstallRoot ( "lib/features" , "internalfeatures/securitylibertyinternals-1.0.mf" ) ; server . addInstalledAppForValidation ( "userRegistry" ) ; server . startServer ( c . getName ( ) + ".log" ) ; //Make sure the application has come up before proceeding assertNotNull ( "Application userRegistry does not appear to have started." , server . waitForStringInLog ( "CWWKZ0001I:.*userRegistry" ) ) ; assertNotNull ( "Security service did not report it was ready" , server . waitForStringInLog ( "CWWKS0008I" ) ) ; assertNotNull ( "Server did not came up" , server . waitForStringInLog ( "CWWKF0011I" ) ) ; Log . info ( c , "setUp" , "Creating servlet connection the server" ) ; servlet = new UserRegistryServletConnection ( server . getHostname ( ) , server . getHttpDefaultPort ( ) ) ; if ( servlet . getRealm ( ) == null ) { Thread . sleep ( 5000 ) ; servlet . getRealm ( ) ; } }
Updates the sample which is expected to be at the hard - coded path . If this test is failing check this path is correct .
336
27
161,078
@ Test public void getUserSecurityName ( ) throws Exception { String user = "vmmtestuser" ; String securityName = "cn=vmmtestuser,cn=users,dc=secfvt2,dc=austin,dc=ibm,dc=com" ; Log . info ( c , "getUserSecurityName" , "Checking with a valid user." ) ; LDAPFatUtils . assertDNsEqual ( "User security name didn't match expected value." , securityName , servlet . getUserSecurityName ( user ) ) ; }
Hit the test servlet to see if getUserSecurityName works when supplied with a valid user
124
19
161,079
public void initialRead ( ) { try { this . buffer = this . isc . getRequestBodyBuffer ( ) ; if ( null != this . buffer ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Buffer returned from getRequestBodyBuffer : " + this . buffer ) ; } // record the new amount of data read from the channel this . bytesRead += this . buffer . remaining ( ) ; } } catch ( IOException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Exception encountered during initialRead : " + e ) ; } } }
with the current set of data
155
6
161,080
private String encode ( PrintStream stderr , String plaintext , String encodingType , Map < String , String > properties ) throws InvalidPasswordEncodingException , UnsupportedCryptoAlgorithmException { String ret = null ; try { ret = PasswordUtil . encode ( plaintext , encodingType == null ? PasswordUtil . getDefaultEncoding ( ) : encodingType , properties ) ; } catch ( InvalidPasswordEncodingException e ) { e . printStackTrace ( stderr ) ; throw e ; } catch ( UnsupportedCryptoAlgorithmException e ) { e . printStackTrace ( stderr ) ; throw e ; } return ret ; }
Handle encoding of the plaintext provided . Capture any Exceptions and print the stack trace .
140
18
161,081
protected String getDescription ( JSONArray customInfoArray ) { StringBuffer sb = new StringBuffer ( ) ; sb . append ( getMessage ( "encode.option-custom.encryption" ) ) ; for ( int i = 0 ; i < customInfoArray . size ( ) ; i ++ ) { JSONObject customInfo = ( JSONObject ) customInfoArray . get ( i ) ; String name = ( String ) customInfo . get ( "name" ) ; sb . append ( getMessage ( "encode.option-desc.custom.feature" , name ) ) ; sb . append ( ( String ) customInfo . get ( "featurename" ) ) ; sb . append ( getMessage ( "encode.option-desc.custom.description" , name ) ) ; sb . append ( ( String ) customInfo . get ( "description" ) ) ; } return sb . toString ( ) ; }
Returns the message string of the custom encryption information .
200
10
161,082
private void extractFiles ( ArtifactMetadata artifactMetadata ) throws RepositoryArchiveIOException , RepositoryArchiveEntryNotFoundException , RepositoryArchiveException { _readmePayload = artifactMetadata . getFileWithExtension ( ".txt" ) ; if ( _readmePayload == null ) { throw new RepositoryArchiveEntryNotFoundException ( "Unable to find iFix readme .txt file in archive" + artifactMetadata . getArchive ( ) . getAbsolutePath ( ) , artifactMetadata . getArchive ( ) , "*.txt" ) ; } }
Extract the files from the zip
129
7
161,083
private String getFixId ( IFixInfo iFixInfo , ExtractedFileInformation xmlInfo ) throws RepositoryArchiveInvalidEntryException { // check for null input if ( null == iFixInfo ) { throw new RepositoryArchiveInvalidEntryException ( "Null XML object provided" , xmlInfo . getSourceArchive ( ) , xmlInfo . getSelectedPathFromArchive ( ) ) ; } // check the first child node is named fix return iFixInfo . getId ( ) ; }
Get the ID of the iFix from the Java representation of the iFix XML
105
16
161,084
private List < String > getProvides ( IFixInfo iFixInfo , ParserBase . ExtractedFileInformation xmlInfo ) throws RepositoryArchiveInvalidEntryException { // check for null input if ( null == iFixInfo ) { throw new RepositoryArchiveInvalidEntryException ( "Null document provided" , xmlInfo . getSourceArchive ( ) , xmlInfo . getSelectedPathFromArchive ( ) ) ; } Resolves resolves = iFixInfo . getResolves ( ) ; if ( null == resolves ) { throw new RepositoryArchiveInvalidEntryException ( "Document does not contain a \"resolves\" node" , xmlInfo . getSourceArchive ( ) , xmlInfo . getSelectedPathFromArchive ( ) ) ; } // Get child nodes and look for APAR ids List < String > retList = new ArrayList < String > ( ) ; List < Problem > problems = resolves . getProblems ( ) ; if ( problems != null ) { for ( Problem problem : problems ) { String displayId = problem . getDisplayId ( ) ; if ( null == displayId ) { throw new RepositoryArchiveInvalidEntryException ( "Unexpected null getting APAR id" , xmlInfo . getSourceArchive ( ) , xmlInfo . getSelectedPathFromArchive ( ) ) ; } retList . add ( displayId ) ; } } return retList ; }
Get a list of the APARs fixed by this iFix
297
13
161,085
private String parseManifestForAppliesTo ( File file ) throws RepositoryArchiveIOException { Manifest mf = null ; try ( JarFile jar = new JarFile ( file ) ) { try { mf = jar . getManifest ( ) ; } catch ( IOException ioe ) { throw new RepositoryArchiveIOException ( "Error getting manifest from jar " + jar . getName ( ) , new File ( jar . getName ( ) ) , ioe ) ; } } catch ( IOException ioe ) { throw new RepositoryArchiveIOException ( "Unable to create JarFile from path " + file , new File ( file . getName ( ) ) , ioe ) ; } String appliesTo = null ; Attributes mainattrs = mf . getMainAttributes ( ) ; // Iterate over the main attributes in the manifest and look for the ones we // are interested in. for ( Object at : mainattrs . keySet ( ) ) { String attribName = ( ( Attributes . Name ) at ) . toString ( ) ; String attribValue = ( String ) mainattrs . get ( at ) ; if ( APPLIES_TO . equals ( attribName ) ) { appliesTo = attribValue ; } } return appliesTo ; }
Looks at the manifest file extracting info and putting the info into the supplied asset
272
15
161,086
public static int bytesToInt ( byte [ ] bytes , int offset ) { return ( ( bytes [ offset + 3 ] & 0xFF ) << 0 ) + ( ( bytes [ offset + 2 ] & 0xFF ) << 8 ) + ( ( bytes [ offset + 1 ] & 0xFF ) << 16 ) + ( ( bytes [ offset + 0 ] & 0xFF ) << 24 ) ; }
A utility method to convert the int from the byte array to an int .
86
15
161,087
public static short bytesToShort ( byte [ ] bytes , int offset ) { short result = 0x0 ; for ( int i = offset ; i < offset + 2 ; ++ i ) { result = ( short ) ( ( result ) << 8 ) ; result |= ( bytes [ i ] & 0x00FF ) ; } return result ; }
A utility method to convert the short from the byte array to a short .
73
15
161,088
public static long bytesToLong ( byte [ ] bytes , int offset ) { long result = 0x0 ; for ( int i = offset ; i < offset + 8 ; ++ i ) { result = result << 8 ; result |= ( bytes [ i ] & 0x00000000000000FF l ) ; } return result ; }
A utility method to convert the long from the byte array to a long .
68
15
161,089
public static char bytesToChar ( byte [ ] bytes , int offset ) { char result = 0x0 ; for ( int i = offset ; i < offset + 2 ; ++ i ) { result = ( char ) ( ( result ) << 8 ) ; result |= ( bytes [ i ] & 0x00FF ) ; } return result ; }
A utility method to convert the char from the byte array to a char .
73
15
161,090
public static void intToBytes ( int value , byte [ ] bytes , int offset ) { bytes [ offset + 3 ] = ( byte ) ( value >>> 0 ) ; bytes [ offset + 2 ] = ( byte ) ( value >>> 8 ) ; bytes [ offset + 1 ] = ( byte ) ( value >>> 16 ) ; bytes [ offset + 0 ] = ( byte ) ( value >>> 24 ) ; }
A utility method to convert an int into bytes in an array .
84
13
161,091
public static void shortToBytes ( short value , byte [ ] bytes , int offset ) { for ( int i = offset + 1 ; i >= offset ; -- i ) { bytes [ i ] = ( byte ) value ; value = ( short ) ( ( value ) >> 8 ) ; } }
A utility method to convert a short into bytes in an array .
61
13
161,092
public static void longToBytes ( long value , byte [ ] bytes , int offset ) { for ( int i = offset + 7 ; i >= offset ; -- i ) { bytes [ i ] = ( byte ) value ; value = value >> 8 ; } }
A utility method to convert the long into bytes in an array .
54
13
161,093
public static long varIntBytesToLong ( byte [ ] bytes , int offset ) { int shift = 0 ; long result = 0 ; while ( shift < 64 ) { final byte b = bytes [ offset ++ ] ; result |= ( long ) ( b & 0x7F ) << shift ; if ( ( b & 0x80 ) == 0 ) { return result ; } shift += 7 ; } throw new IllegalStateException ( "Varint representation is invalid or exceeds 64-bit value" ) ; }
Reads a long from the byte array in the Varint format .
106
14
161,094
public static int varIntBytesToInt ( byte [ ] bytes , int offset ) { byte tmp = bytes [ offset ++ ] ; if ( tmp >= 0 ) { return tmp ; } int result = tmp & 0x7f ; if ( ( tmp = bytes [ offset ++ ] ) >= 0 ) { result |= tmp << 7 ; } else { result |= ( tmp & 0x7f ) << 7 ; if ( ( tmp = bytes [ offset ++ ] ) >= 0 ) { result |= tmp << 14 ; } else { result |= ( tmp & 0x7f ) << 14 ; if ( ( tmp = bytes [ offset ++ ] ) >= 0 ) { result |= tmp << 21 ; } else { result |= ( tmp & 0x7f ) << 21 ; result |= ( tmp = bytes [ offset ++ ] ) << 28 ; if ( tmp < 0 ) { // Discard upper 32 bits. for ( int i = 0 ; i < 5 ; i ++ ) { if ( bytes [ offset ++ ] >= 0 ) { return result ; } } //Should never happen since we wrote the varint value. If this occurs due to an internal bug //this exception is caught and wrapped further up the chain. throw new IllegalStateException ( "Varint representation is invalid or exceeds 32-bit value" ) ; } } } } return result ; }
Reads an int from the byte array in the Varint format .
286
14
161,095
public static int writeLongAsVarIntBytes ( long v , byte [ ] bytes , int offest ) { int pos = offest ; while ( true ) { if ( ( v & ~ 0x7F L ) == 0 ) { bytes [ pos ++ ] = ( ( byte ) v ) ; return pos ; } else { bytes [ pos ++ ] = ( byte ) ( ( v & 0x7F ) | 0x80 ) ; v >>>= 7 ; } } }
Writes a long to the byte array in the Varint format .
101
14
161,096
public static int writeIntAsVarIntBytes ( int intVal , byte [ ] bytes , int offset ) { int pos = offset ; int v = intVal ; if ( ( v & ~ 0x7F ) == 0 ) { bytes [ pos ++ ] = ( ( byte ) v ) ; return 1 + offset ; } while ( true ) { if ( ( v & ~ 0x7F ) == 0 ) { bytes [ pos ++ ] = ( ( byte ) v ) ; return pos ; } else { bytes [ pos ++ ] = ( byte ) ( ( v & 0x7F ) | 0x80 ) ; v >>>= 7 ; } } }
Writes an integer to the byte array in the Varint format .
139
14
161,097
public static String limitedBytesToString ( byte [ ] bytes ) { if ( bytes . length <= 1000 ) { return Arrays . toString ( bytes ) ; } else { byte [ ] firstBytes = new byte [ 1000 ] ; System . arraycopy ( bytes , 0 , firstBytes , 0 , 1000 ) ; return Arrays . toString ( firstBytes ) ; } }
If the byte array length is less than 1000 returns the result of calling Arrays . toString on the supplied byte array . Otherwise returns the result of calling Arrays . toString on a byte array containing the first 1000 bytes in the supplied byte array .
78
51
161,098
public static RESTHandlerJsonException createRESTHandlerJsonException ( Throwable e , JSONConverter converter , int status ) { try { //See if we need to fetch a converter if ( converter == null ) { converter = JSONConverter . getConverter ( ) ; } //Create a new OutputStream to avoid any corrupted data ByteArrayOutputStream os = new ByteArrayOutputStream ( ) ; //Write the exception inside the output stream converter . writeThrowable ( os , e ) ; //Get the message from the output stream String exceptionMessage = os . toString ( "UTF-8" ) ; //return a Web exception with the new response return new RESTHandlerJsonException ( exceptionMessage , status , true ) ; } catch ( IOException innerException ) { //Since we got an exception while converting the error just write the actual exception text with an internal error code. This should never //happen because our JSONErrorOutputStream shouldn't ever throw an IOException return new RESTHandlerJsonException ( e . getMessage ( ) , status , true ) ; } finally { JSONConverter . returnConverter ( converter ) ; } }
This method will recycle the given converter .
251
8
161,099
public static synchronized void notifyStarted ( HttpEndpointImpl endpoint , String resolvedHostName , int port , boolean isHttps ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Notify endpoint started: " + endpoint , resolvedHostName , port , isHttps , defaultHost . get ( ) , alternateHostSelector ) ; } if ( alternateHostSelector . get ( ) == null ) { if ( defaultHost . get ( ) != null ) { defaultHost . get ( ) . listenerStarted ( endpoint , resolvedHostName , port , isHttps ) ; } } else { alternateHostSelector . get ( ) . alternateNotifyStarted ( endpoint , resolvedHostName , port , isHttps ) ; } }
Add an endpoint that has started listening and notify associated virtual hosts
179
12