code
stringlengths
73
34.1k
label
stringclasses
1 value
public WsByteBuffer allocateBuffer(int size) { WsByteBufferPoolManager mgr = HttpDispatcher.getBufferManager(); WsByteBuffer wsbb = (this.useDirectBuffer) ? mgr.allocateDirect(size) : mgr.allocate(size); addToCreatedBuffer(wsbb); return wsbb; }
java
@Override public void setDebugContext(Object o) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "debugContext set to " + o + " for " + this); } if (null != o) { this.debugContext = o; } }
java
private void incrementHeaderCounter() { this.numberOfHeaders++; this.headerAddCount++; if (this.limitNumHeaders < this.numberOfHeaders) { String msg = "Too many headers in storage: " + this.numberOfHeaders; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, msg); } throw new IllegalArgumentException(msg); } }
java
private void checkHeaderValue(byte[] data, int offset, int length) { // if the last character is a CR or LF, then this fails int index = (offset + length) - 1; if (index < 0) { // empty data, quit now with success return; } String error = null; if (BNFHeaders.LF == data[index] || BNFHeaders.CR == data[index]) { error = "Illegal trailing EOL"; } // scan through the data now for invalid CRLF presence. Note that CRLFs // may be followed by whitespace for valid multiline headers. for (int i = offset; null == error && i < index; i++) { if (BNFHeaders.CR == data[i]) { // next char must be an LF if (BNFHeaders.LF != data[i + 1]) { error = "Invalid CR not followed by LF"; } else if (getCharacterValidation()) { data[i] = BNFHeaders.SPACE; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Found a CR replacing it with a SP"); } } } else if (BNFHeaders.LF == data[i]) { // if it is not followed by whitespace then this value is bad if (BNFHeaders.TAB != data[i + 1] && BNFHeaders.SPACE != data[i + 1]) { error = "Invalid LF not followed by whitespace"; } else if (getCharacterValidation()) { data[i] = BNFHeaders.SPACE; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Found a LF replacing it with a SP"); } } } } // if we found an error, throw the exception now if (null != error) { IllegalArgumentException iae = new IllegalArgumentException(error); FFDCFilter.processException(iae, getClass().getName() + ".checkHeaderValue(byte[])", "1", this); throw iae; } }
java
private void checkHeaderValue(String data) { // if the last character is a CR or LF, then this fails int index = data.length() - 1; if (index < 0) { // empty string, quit now with success return; } String error = null; char c = data.charAt(index); if (BNFHeaders.LF == c || BNFHeaders.CR == c) { error = "Illegal trailing EOL"; } // scan through the data now for invalid CRLF presence. Note that CRLFs // may be followed by whitespace for valid multiline headers. for (int i = 0; null == error && i < index; i++) { c = data.charAt(i); if (BNFHeaders.CR == c) { // next char must be an LF if (BNFHeaders.LF != data.charAt(i + 1)) { error = "Invalid CR not followed by LF"; } } else if (BNFHeaders.LF == c) { c = data.charAt(++i); // if it is not followed by whitespace then this value is bad if (BNFHeaders.TAB != c && BNFHeaders.SPACE != c) { error = "Invalid LF not followed by whitespace"; } } } // if we found an error, throw the exception now if (null != error) { IllegalArgumentException iae = new IllegalArgumentException(error); FFDCFilter.processException(iae, getClass().getName() + ".checkHeaderValue(String)", "1", this); throw iae; } }
java
private int countInstances(HeaderElement root) { int count = 0; HeaderElement elem = root; while (null != elem) { if (!elem.wasRemoved()) { count++; } elem = elem.nextInstance; } return count; }
java
private boolean skipWhiteSpace(WsByteBuffer buff) { // keep reading until we hit the end of the buffer or a non-space char byte b; do { if (this.bytePosition >= this.byteLimit) { if (!fillByteCache(buff)) { // not filled return false; } } b = this.byteCache[this.bytePosition++]; } while (BNFHeaders.SPACE == b || BNFHeaders.TAB == b); // move byte position back one. this.bytePosition--; return true; }
java
private boolean addInstanceOfElement(HeaderElement root, HeaderElement elem) { // first add to the overall sequence list if (null == this.hdrSequence) { this.hdrSequence = elem; this.lastHdrInSequence = elem; } else { // find the end of the list and append this new element this.lastHdrInSequence.nextSequence = elem; elem.prevSequence = this.lastHdrInSequence; this.lastHdrInSequence = elem; } if (null == root) { return true; } HeaderElement prev = root; while (null != prev.nextInstance) { prev = prev.nextInstance; } prev.nextInstance = elem; return false; }
java
protected WsByteBuffer[] putInt(int data, WsByteBuffer[] buffers) { return putBytes(GenericUtils.asBytes(data), buffers); }
java
protected WsByteBuffer[] flushCache(WsByteBuffer[] buffers) { // PK13351 - use the offset/length version to write only what we need // to and avoid the extra memory allocation int pos = this.bytePosition; if (0 == pos) { // nothing to write return buffers; } this.bytePosition = 0; return GenericUtils.putByteArray(buffers, this.byteCache, 0, pos, this); }
java
final protected void decrementBytePositionIgnoringLFs() { // PK15898 - added for just LF after first line this.bytePosition--; if (BNFHeaders.LF == this.byteCache[this.bytePosition]) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "decrementILF found an LF character"); } this.bytePosition++; } }
java
final protected void resetCacheToken(int len) { if (null == this.parsedToken || len != this.parsedToken.length) { this.parsedToken = new byte[len]; } this.parsedTokenLength = 0; }
java
final protected boolean fillCacheToken(WsByteBuffer buff) { // figure out how much we have left to copy out, append to any existing // parsed token (multiple passes through here). int curr_len = this.parsedTokenLength; int need_len = this.parsedToken.length - curr_len; int copy_len = need_len; // keep going until we have all we need or we run out of buffer data while (0 < need_len) { if (this.bytePosition >= this.byteLimit) { if (!fillByteCache(buff)) { // save a reference to how much we've pulled so far this.parsedTokenLength = curr_len; return false; } } // byte cache is now prepped int available = this.byteLimit - this.bytePosition; if (available < need_len) { // copy what we can from the current cache copy_len = available; } else { copy_len = need_len; } // copy new data into the existing space System.arraycopy(this.byteCache, this.bytePosition, this.parsedToken, curr_len, copy_len); need_len -= copy_len; curr_len += copy_len; this.bytePosition += copy_len; } return true; }
java
protected boolean fillByteCache(WsByteBuffer buff) { if (this.bytePosition < this.byteLimit) { return false; } int size = buff.remaining(); if (size > this.byteCacheSize) { // truncate to just fill up the cache size = this.byteCacheSize; } this.bytePosition = 0; this.byteLimit = size; if (0 == this.byteLimit) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "fillByteCache: no data"); } return false; } if (HeaderStorage.NOTSET != this.headerChangeLimit && -1 != this.parseIndex && -1 == this.parseBuffersStartPos[this.parseIndex]) { // first occurrance of this buffer and we're keeping track of changes this.parseBuffersStartPos[this.parseIndex] = buff.position(); } buff.get(this.byteCache, this.bytePosition, this.byteLimit); return true; }
java
protected TokenCodes findCRLFTokenLength(WsByteBuffer buff) throws MalformedMessageException { TokenCodes rc = TokenCodes.TOKEN_RC_MOREDATA; if (null == buff) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Null buffer provided"); } return rc; } // start with any pre-existing data int length = this.parsedTokenLength; byte b; while (true) { if (this.bytePosition >= this.byteLimit) { if (!fillByteCache(buff)) { // no more data break; } } b = this.byteCache[this.bytePosition++]; // check for a CRLF if (BNFHeaders.CR == b) { rc = TokenCodes.TOKEN_RC_DELIM; if (HeaderStorage.NOTSET != this.headerChangeLimit) { this.lastCRLFPosition = findCurrentBufferPosition(buff) - 1; this.lastCRLFBufferIndex = this.parseIndex; this.lastCRLFisCR = true; } break; // out of while } else if (BNFHeaders.LF == b) { // update counter if linefeed found rc = TokenCodes.TOKEN_RC_DELIM; this.numCRLFs = 1; if (HeaderStorage.NOTSET != this.headerChangeLimit) { this.lastCRLFPosition = findCurrentBufferPosition(buff) - 1; this.lastCRLFBufferIndex = this.parseIndex; this.lastCRLFisCR = false; } break; // out of while } length++; // check the limit on a token size if (length > this.limitTokenSize) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "findCRLFTokenLength: length is too big: " + length); } throw new MalformedMessageException("Token length: " + length); } } // end of the while this.parsedTokenLength = length; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "findCRLFTokenLength returning " + rc.getName() + "; len=" + length); } return rc; }
java
protected TokenCodes skipCRLFs(WsByteBuffer buffer) { int maxCRLFs = 33; // limit is the max number of CRLFs to skip if (this.bytePosition >= this.byteLimit) { if (!fillByteCache(buffer)) { // no more data return TokenCodes.TOKEN_RC_MOREDATA; } } byte b = this.byteCache[this.bytePosition++]; for (int i = 0; i < maxCRLFs; i++) { if (-1 == b) { // ran out of data return TokenCodes.TOKEN_RC_MOREDATA; } if (BNFHeaders.CR != b && BNFHeaders.LF != b) { // stopped on non-CRLF character, reset position this.bytePosition--; return TokenCodes.TOKEN_RC_DELIM; } // keep going otherwise if (this.bytePosition >= this.byteLimit) { return TokenCodes.TOKEN_RC_MOREDATA; } b = this.byteCache[this.bytePosition++]; } // found too many CRLFs... invalid if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Too many leading CRLFs found"); } return TokenCodes.TOKEN_RC_CRLF; }
java
protected TokenCodes findHeaderLength(WsByteBuffer buff) throws MalformedMessageException { TokenCodes rc = TokenCodes.TOKEN_RC_MOREDATA; if (null == buff) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "findHeaderLength: null buffer provided"); } return rc; } byte b; int numSpaces = 0; // start with any pre-existing data int length = this.parsedTokenLength; while (true) { if (this.bytePosition >= this.byteLimit) { if (!fillByteCache(buff)) { // no more data break; } } b = this.byteCache[this.bytePosition++]; // look for the colon marking the end if (BNFHeaders.COLON == b) { length -= numSpaces; // remove any "trailing" white space if (numSpaces > 0) { //PI13987 //found trailing whitespace this.foundTrailingWhitespace = true; } rc = TokenCodes.TOKEN_RC_DELIM; break; } // if we hit whitespace, then keep track of the number of spaces so // that we can easily trim that off at the end. This will end up // ignoring whitespace that is inside the header name if that does // happen if (BNFHeaders.SPACE == b || BNFHeaders.TAB == b) { numSpaces++; } else { // reset the counter on any non-space or colon numSpaces = 0; } // check for possible CRLF if (BNFHeaders.CR == b || BNFHeaders.LF == b) { // Note: would be nice to print the failing data but would need // to keep track of where we started inside here, then what about // data straddling bytecaches, etc? throw new MalformedMessageException("Invalid CRLF found in header name"); } length++; // check the limit on a token size if (length > this.limitTokenSize) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "findTokenLength: length is too big: " + length); } throw new MalformedMessageException("Token length: " + length); } } // end of the while this.parsedTokenLength = length; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "findHeaderLength: " + rc.getName() + "; len=" + length); } return rc; }
java
private boolean parseHeaderName(WsByteBuffer buff) throws MalformedMessageException { // if we're just starting, then skip leading white space characters // otherwise ignore them (i.e we might be in the middle of // "Mozilla/5.0 (Win" if (null == this.parsedToken) { if (!skipWhiteSpace(buff)) { return false; } } int start = findCurrentBufferPosition(buff); int cachestart = this.bytePosition; TokenCodes rc = findHeaderLength(buff); if (TokenCodes.TOKEN_RC_MOREDATA.equals(rc)) { // ran out of data saveParsedToken(buff, start, false, LOG_FULL); return false; } // could be in one single bytecache, otherwise we have to extract from // buffer byte[] data; int length = this.parsedTokenLength; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "length=" + length + " pos=" + this.bytePosition + ", cachestart=" + cachestart + ", start=" + start + ", trailingWhitespace=" + this.foundTrailingWhitespace); } //PI13987 - Added the first argument to the if statement if (!this.foundTrailingWhitespace && null == this.parsedToken && length < this.bytePosition) { // it's all in the bytecache if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { //PI13987 - Modified the message being printed as we now print the same thing above Tr.debug(tc, "Using bytecache"); } data = this.byteCache; start = cachestart; } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { //PI13987 Tr.debug(tc, "Using bytebuffer"); } saveParsedToken(buff, start, true, LOG_FULL); data = this.parsedToken; start = 0; length = data.length; } // otherwise we found the entire length of the name this.currentElem = getElement(findKey(data, start, length)); // Reset all the global variables once HeaderElement has been instantiated if (HeaderStorage.NOTSET != this.headerChangeLimit) { this.currentElem.updateLastCRLFInfo(this.lastCRLFBufferIndex, this.lastCRLFPosition, this.lastCRLFisCR); } this.stateOfParsing = PARSING_VALUE; this.parsedToken = null; this.parsedTokenLength = 0; this.foundTrailingWhitespace = false; //PI13987 return true; }
java
private boolean parseHeaderValueExtract(WsByteBuffer buff) throws MalformedMessageException { // 295178 - don't log sensitive information // log value contents based on the header key (if known) int log = LOG_FULL; HeaderKeys key = this.currentElem.getKey(); if (null != key && !key.shouldLogValue()) { // this header key wants to block the entire thing log = LOG_NONE; } TokenCodes tcRC = parseCRLFTokenExtract(buff, log); if (!tcRC.equals(TokenCodes.TOKEN_RC_MOREDATA)) { setHeaderValue(); this.parsedToken = null; this.currentElem = null; this.stateOfParsing = PARSING_CRLF; return true; } // otherwise we need more data in order to read the value return false; }
java
protected int parseTokenNonExtract(WsByteBuffer buff, byte bDelimiter, boolean bApproveCRLF) throws MalformedMessageException { TokenCodes rc = findTokenLength(buff, bDelimiter, bApproveCRLF); return (TokenCodes.TOKEN_RC_MOREDATA.equals(rc)) ? -1 : this.parsedTokenLength; }
java
private void saveParsedToken(WsByteBuffer buff, int start, boolean delim, int log) { final boolean bTrace = TraceComponent.isAnyTracingEnabled(); // local copy of the length int length = this.parsedTokenLength; this.parsedTokenLength = 0; if (0 > length) { throw new IllegalArgumentException("Negative token length: " + length); } if (bTrace && tc.isDebugEnabled()) { // 295178 - don't log sensitive information String value = GenericUtils.getEnglishString(this.parsedToken); if (null != value) { if (LOG_PARTIAL == log) { value = GenericUtils.nullOutPasswords(value, LF); } else if (LOG_NONE == log) { value = GenericUtils.blockContents(value); } } Tr.debug(tc, "Saving token: " + value + " len:" + length + " start:" + start + " pos:" + this.bytePosition + " delim:" + delim); } byte[] temp; int offset; if (null != this.parsedToken) { // concat to the existing value offset = this.parsedToken.length; temp = new byte[offset + length]; System.arraycopy(this.parsedToken, 0, temp, 0, offset); } else { offset = 0; temp = new byte[length]; } //PI13987 - Added the first argument if (!this.foundTrailingWhitespace && this.bytePosition > length) { // pull from the bytecache if (bTrace && tc.isDebugEnabled()) { //PI13987 - Print out this new trace message Tr.debug(tc, "savedParsedToken - using bytecache"); } int cacheStart = this.bytePosition - length; if (delim) { cacheStart--; } System.arraycopy(this.byteCache, cacheStart, temp, offset, length); } else { // must pull from the buffer if (bTrace && tc.isDebugEnabled()) { //PI13987 - Print this new trace message Tr.debug(tc, "savedParsedToken - pulling from buffer"); } int orig = buff.position(); buff.position(start); buff.get(temp, offset, length); buff.position(orig); } this.parsedToken = temp; if (bTrace && tc.isDebugEnabled()) { // 295178 - don't log sensitive information String value = GenericUtils.getEnglishString(this.parsedToken); if (LOG_PARTIAL == log) { value = GenericUtils.nullOutPasswords(value, LF); } else if (LOG_NONE == log) { value = GenericUtils.blockContents(value); } Tr.debug(tc, "Saved token [" + value + "]"); } }
java
public void parsedCompactHeader(boolean flag) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "parsedCompactHeader: " + flag); } this.compactHeaderFlag = flag; }
java
void finishAlarmThread() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "finishAlarmThread"); //wake up the thread so that it will exit it's main loop and end synchronized(wakeupLock) { //flag this alarm thread as finished finished = true; wakeupLock.notify(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "finishAlarmThread"); }
java
public void run() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "run"); try { //loop until finished while(!finished) { //what time is it now long now = System.currentTimeMillis(); boolean fire = false; //synchronize on the wake up lock synchronized(wakeupLock) { //if not suspended and we've reached or passed the target wakeup time if(running) { fire = (now >= nextWakeup); } } if(fire) { //call the internal alarm method which should return the //time for the next wakeup ... or SUSPEND if the thread should be suspended manager.fireInternalAlarm(); synchronized (wakeupLock) { setNextWakeup(manager.getNextWakeup()); } } synchronized(wakeupLock) { //if we are still not suspended (another thread could have got in before // the re-lock and changed things) if(running) { //if there is still time until the next wakeup if(wakeupDelta > 0) { try { if (!finished) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Thread wait : "+wakeupDelta); //wait until the next target wakeup time long start = System.currentTimeMillis(); wakeupLock.wait(wakeupDelta+10); long end = System.currentTimeMillis(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Thread slept for " + (end-start)); if(end < nextWakeup) setNextWakeup(nextWakeup); } } catch (InterruptedException e) { // No FFDC code needed // swallow InterruptedException ... we'll just loop round and try again } } } else { try { if (!finished) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Thread wait : Inifinite"); wakeupLock.wait(); } } catch (InterruptedException e) { // No FFDC code needed // swallow InterruptedException ... we'll just loop round and try again } } } // synchronized } } catch (RuntimeException e) { // FFDC FFDCFilter.processException(e, "com.ibm.ws.sib.processor.utils.am.MPAlarmThread.run", "1:284:1.8.1.7", this); SibTr.error(tc, nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.utils.am.MPAlarmThread", "1:290:1.8.1.7", e }, null)); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exception(tc, e); SibTr.exit(tc, "run", e); } throw e; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "run"); }
java
public boolean startInactivityTimer() { final boolean traceOn = TraceComponent.isAnyTracingEnabled(); if (traceOn && tc.isEntryEnabled()) Tr.entry(tc, "startInactivityTimer"); if (_inactivityTimeout > 0 && _status.getState() == TransactionState.STATE_ACTIVE && !_inactivityTimerActive) { EmbeddableTimeoutManager.setTimeout(this, EmbeddableTimeoutManager.INACTIVITY_TIMEOUT, _inactivityTimeout); _inactivityTimerActive = true; _mostRecentThread.pop(); } if (traceOn && tc.isEntryEnabled()) Tr.exit(tc, "startInactivityTimer", _inactivityTimerActive); return _inactivityTimerActive; }
java
public void rollbackResources() { final boolean traceOn = TraceComponent.isAnyTracingEnabled(); if (traceOn && tc.isEntryEnabled()) Tr.entry(tc, "rollbackResources"); try { final Transaction t = ((EmbeddableTranManagerSet) TransactionManagerFactory.getTransactionManager()).suspend(); getResources().rollbackResources(); if (t != null) ((EmbeddableTranManagerSet) TransactionManagerFactory.getTransactionManager()).resume(t); } catch (Exception ex) { FFDCFilter.processException(ex, "com.ibm.tx.jta.impl.EmbeddableTransactionImpl.rollbackResources", "104", this); if (traceOn && tc.isDebugEnabled()) Tr.debug(tc, "Exception caught from rollbackResources()", ex); } if (traceOn && tc.isEntryEnabled()) Tr.exit(tc, "rollbackResources"); }
java
public synchronized void stopInactivityTimer() { final boolean traceOn = TraceComponent.isAnyTracingEnabled(); if (traceOn && tc.isEntryEnabled()) Tr.entry(tc, "stopInactivityTimer"); if (_inactivityTimerActive) { _inactivityTimerActive = false; EmbeddableTimeoutManager.setTimeout(this, EmbeddableTimeoutManager.INACTIVITY_TIMEOUT, 0); } // The inactivity timer's being stopped so the transaction is // back on-server. Push the thread that it's running on onto // the stack. _mostRecentThread.push(Thread.currentThread()); if (traceOn && tc.isEntryEnabled()) Tr.exit(tc, "stopInactivityTimer"); }
java
@Override public void resumeAssociation() { final boolean traceOn = TraceComponent.isAnyTracingEnabled(); if (traceOn && tc.isEntryEnabled()) Tr.entry(tc, "resumeAssociation"); resumeAssociation(true); if (traceOn && tc.isEntryEnabled()) Tr.exit(tc, "resumeAssociation"); }
java
public synchronized void resumeAssociation(boolean allowSetRollback) throws TRANSACTION_ROLLEDBACK { final boolean traceOn = TraceComponent.isAnyTracingEnabled(); if (traceOn && tc.isEntryEnabled()) Tr.entry(tc, "resumeAssociation", allowSetRollback); // if another thread is active we have to wait // doSetRollback indicates if this method has marked the transaction for rollbackOnly // and if so TRANSACTION_ROLLEDBACK exception is thrown. boolean doSetRollback = false; while (_activeAssociations > _suspendedAssociations) { doSetRollback = allowSetRollback; try { if (doSetRollback && !_rollbackOnly) setRollbackOnly(); } catch (Exception ex) { FFDCFilter.processException(ex, "com.ibm.ws.Transaction.JTA.TransactionImpl.resumeAssociation", "1748", this); if (traceOn && tc.isDebugEnabled()) Tr.debug(tc, "setRollbackOnly threw exception", ex); // swallow this exception } try { wait(); } // woken up by removeAssociation catch (InterruptedException iex) { /* no ffdc */ } } // end while _suspendedAssociations--; if (doSetRollback) { if (traceOn && tc.isEntryEnabled()) Tr.exit(tc, "resumeAssociation throwing rolledback"); throw new TRANSACTION_ROLLEDBACK("Context already active"); } if (traceOn && tc.isEntryEnabled()) Tr.exit(tc, "resumeAssociation"); }
java
@Override public synchronized void addAssociation() { final boolean traceOn = TraceComponent.isAnyTracingEnabled(); if (traceOn && tc.isEntryEnabled()) Tr.entry(tc, "addAssociation"); if (_activeAssociations > _suspendedAssociations) { if (traceOn && tc.isDebugEnabled()) Tr.debug(tc, "addAssociation received incoming request for active context"); try { setRollbackOnly(); } catch (Exception ex) { FFDCFilter.processException(ex, "com.ibm.ws.Transaction.JTA.TransactionImpl.addAssociation", "1701", this); if (traceOn && tc.isDebugEnabled()) Tr.debug(tc, "setRollbackOnly threw exception", ex); // swallow this exception } if (traceOn && tc.isEntryEnabled()) Tr.exit(tc, "addAssociation throwing rolledback"); throw new TRANSACTION_ROLLEDBACK("Context already active"); } stopInactivityTimer(); _activeAssociations++; if (traceOn && tc.isEntryEnabled()) Tr.exit(tc, "addAssociation"); }
java
@Override public synchronized void removeAssociation() { final boolean traceOn = TraceComponent.isAnyTracingEnabled(); if (traceOn && tc.isEntryEnabled()) Tr.entry(tc, "removeAssociation"); _activeAssociations--; if (_activeAssociations <= 0) { startInactivityTimer(); } else { _mostRecentThread.pop(); } notifyAll(); //LIDB1673.23 if (traceOn && tc.isEntryEnabled()) Tr.exit(tc, "removeAssociation"); }
java
@Override public void enlistAsyncResource(String xaResFactoryFilter, Serializable xaResInfo, Xid xid) throws SystemException // @LIDB1922-5C { if (tc.isEntryEnabled()) Tr.entry(tc, "enlistAsyncResource (SPI): args: ", new Object[] { xaResFactoryFilter, xaResInfo, xid }); try { final WSATAsyncResource res = new WSATAsyncResource(xaResFactoryFilter, xaResInfo, xid); final WSATParticipantWrapper wrapper = new WSATParticipantWrapper(res); getResources().addAsyncResource(wrapper); } finally { if (tc.isEntryEnabled()) Tr.exit(tc, "enlistAsyncResource (SPI)"); } }
java
public synchronized void inactivityTimeout() { final boolean traceOn = TraceComponent.isAnyTracingEnabled(); if (traceOn && tc.isEntryEnabled()) Tr.entry(tc, "inactivityTimeout", this); _inactivityTimerActive = false; if (_inactivityTimer != null) { try { // important that this runs as part of synchronized block // to prevent context being re-imported while processing. _inactivityTimer.alarm(); } catch (Throwable exc) { FFDCFilter.processException(exc, "com.ibm.ws.tx.jta.TransactionImpl.inactivityTimeout", "2796", this); if (traceOn && tc.isEventEnabled()) Tr.event(tc, "exception caught in inactivityTimeout", exc); // swallow } finally { _inactivityTimer = null; } } else { if (_activeAssociations <= 0) // off server ... do the rollback { final EmbeddableTranManagerSet tranManager = (EmbeddableTranManagerSet) TransactionManagerFactory.getTransactionManager(); try { // resume this onto the current thread and roll it back tranManager.resume(this); // PK15024 // If there is a superior server involved in this transaction, make sure it is told about this inactivity timeout. try { tranManager.setRollbackOnly(); } catch (Exception e) { FFDCFilter.processException(e, "com.ibm.ws.Transaction.JTA.TransactionImpl.inactivityTimeout", "4353", this); if (traceOn && tc.isDebugEnabled()) Tr.debug(tc, "inactivityTimeout setRollbackOnly threw exception", e); } // Mark it so that a bean on the superior server can test its status on return. // PK15024 tranManager.rollback(); } catch (Exception ex) { if (traceOn && tc.isDebugEnabled()) Tr.debug(tc, "inactivityTimeout resume/rollback threw exception", ex); // swallow this exception // main timeout may have already rolled back! } } } if (traceOn && tc.isEntryEnabled()) Tr.exit(tc, "inactivityTimeout"); }
java
synchronized ConsumerSessionImpl get(long id) { if (tc.isEntryEnabled()) SibTr.entry(tc, "get", new Long(id)); ConsumerSessionImpl consumer = null ; if( _messageProcessor.isStarted() ) { consumer = (ConsumerSessionImpl) _consumers.get(new Long(id)); } if (tc.isEntryEnabled()) SibTr.exit(tc, "get", consumer); return consumer; }
java
synchronized void add(ConsumerSessionImpl consumer) { consumer.setId(_consumerCount); if (tc.isEntryEnabled()) SibTr.entry(tc, "add", new Long(consumer.getIdInternal()) ); _consumers.put(new Long(_consumerCount), consumer); _consumerCount++; if (tc.isEntryEnabled()) SibTr.exit(tc, "add"); }
java
private static Collection<String> getFromAppliesTo(final Asset asset, final AppliesToFilterGetter getter) { Collection<AppliesToFilterInfo> atfis = asset.getWlpInformation().getAppliesToFilterInfo(); Collection<String> ret = new ArrayList<String>(); if (atfis != null) { for (AppliesToFilterInfo at : atfis) { if (at != null) { String val = getter.getValue(at); if (val != null) { ret.add(val); } } } } return ret; }
java
@Activate protected void activate(ComponentContext ctx, Map<String, Object> properties) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(this, tc, "activate", properties); } if(isEnabled()) { loadMaps(properties); } else { Tr.error(tc, "SF_ERROR_NOT_ENABLED"); } }
java
private void updateCacheState(Map<String, Object> props) { getAuthenticationConfig(props); if (cacheEnabled) { authCacheServiceRef.activate(cc); } else { authCacheServiceRef.deactivate(cc); } }
java
private ReentrantLock optionallyObtainLockedLock(AuthenticationData authenticationData) { ReentrantLock currentLock = null; if (isAuthCacheServiceAvailable()) { currentLock = authenticationGuard.requestAccess(authenticationData); currentLock.lock(); } return currentLock; }
java
@Override public Subject delegate(String roleName, String appName) { Subject runAsSubject = getRunAsSubjectFromProvider(roleName, appName); return runAsSubject; }
java
static private StringBuilder determineType(String name, Object o) { String value = null; if (o instanceof String || o instanceof StringBuffer || o instanceof java.nio.CharBuffer || o instanceof Integer || o instanceof Long || o instanceof Byte || o instanceof Double || o instanceof Float || o instanceof Short || o instanceof BigInteger || o instanceof java.math.BigDecimal) { value = o.toString(); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Skipping class: " + o.getClass()); } return null; } // type="class" name="o" StringBuilder buffer = new StringBuilder(48); buffer.append(name); buffer.append("type=\""); // charbuffer is abstract so we might get HeapCharBuffer here, force it // to the generic layer in the XML output if (o instanceof java.nio.CharBuffer) { buffer.append("java.nio.CharBuffer"); } else { buffer.append(o.getClass().getName()); } buffer.append("\" "); buffer.append(name); buffer.append("=\""); buffer.append(value); buffer.append("\""); return buffer; }
java
static private StringBuilder serializeChannel(StringBuilder buffer, OutboundChannelDefinition ocd, int order) throws NotSerializableException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Serializing channel: " + order + " " + ocd.getOutboundFactory().getName()); } buffer.append(" <channel order=\""); buffer.append(order); buffer.append("\" factory=\""); buffer.append(ocd.getOutboundFactory().getName()); buffer.append("\">\n"); Map<Object, Object> props = ocd.getOutboundChannelProperties(); if (null != props) { for (Entry<Object, Object> entry : props.entrySet()) { if (null == entry.getValue()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Property value [" + entry.getKey() + "] is null, " + ocd.toString()); } throw new NotSerializableException("Property value for [" + entry.getKey() + "] is null"); } // TODO should pass around the one big stringbuffer instead // of creating all these intermediate ones StringBuilder kBuff = determineType("key", entry.getKey()); if (null != kBuff) { StringBuilder vBuff = determineType("value", entry.getValue()); if (null != vBuff) { buffer.append(" <property "); buffer.append(kBuff); buffer.append(" "); buffer.append(vBuff); buffer.append("/>\n"); } } } } buffer.append(" </channel>\n"); return buffer; }
java
static public String serialize(CFEndPoint point) throws NotSerializableException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "serialize"); } if (null == point) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Null CFEndPoint input for serialization"); } throw new NotSerializableException("Null input"); } // start the end point with name/host/port StringBuilder buffer = new StringBuilder(512); buffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Serializing endpoint: " + point.getName()); } buffer.append("<cfendpoint name=\""); buffer.append(point.getName()); buffer.append("\" host=\""); buffer.append(point.getAddress().getCanonicalHostName()); buffer.append("\" port=\""); buffer.append(point.getPort()); buffer.append("\" local=\""); buffer.append(point.isLocal()); buffer.append("\" ssl=\""); buffer.append(point.isSSLEnabled()); buffer.append("\">\n"); // loop through each channel in the list int i = 0; for (OutboundChannelDefinition def : point.getOutboundChannelDefs()) { buffer = serializeChannel(buffer, def, i++); } buffer.append("</cfendpoint>"); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Serialized string: \n" + buffer.toString()); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "serialize"); } return buffer.toString(); }
java
public MessageStore getOwningMessageStore() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(this, tc, "getOwningMessageStore"); SibTr.exit(this, tc, "getOwningMessageStore", "return="+_ms); } return _ms; }
java
protected void createRealizationAndState( MessageProcessor messageProcessor, TransactionCommon transaction) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "createRealizationAndState", new Object[] { messageProcessor, transaction }); /* * Create associated protocol suppor of appropriate type */ if (isPubSub()) { _pubSubRealization = new PubSubRealization(this, messageProcessor, getLocalisationManager(), transaction); _protoRealization = _pubSubRealization; } else { _ptoPRealization = new JSPtoPRealization(this, messageProcessor, getLocalisationManager()); _protoRealization = _ptoPRealization; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createRealizationAndState"); }
java
protected void reconstitute( MessageProcessor processor, HashMap<String, Object> durableSubscriptionsTable, int startMode) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "reconstitute", new Object[] { processor, durableSubscriptionsTable, Integer.valueOf(startMode) }); super.reconstitute(processor); // Links are 'BaseDestinationHandlers' but have no destination-like addressibility. if (!isLink()) { _name = getDefinition().getName(); _destinationAddr = SIMPUtils.createJsDestinationAddress(_name, null, getBus()); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug( tc, "Reconstituting " + (isPubSub() ? "pubsub" : "ptp") + " BaseDestinationHandler " + getName()); String name = getName(); if ((name.startsWith(SIMPConstants.TEMPORARY_QUEUE_DESTINATION_PREFIX) || name.startsWith(SIMPConstants.TEMPORARY_PUBSUB_DESTINATION_PREFIX))) { _isTemporary = true; _isSystem = false; } else { _isTemporary = false; _isSystem = name.startsWith(SIMPConstants.SYSTEM_DESTINATION_PREFIX); } /* * Any kind of failure while retrieving data from the message store (whether * problems with the MS itself or with the data retrieved) means this * destination should be marked as corrupt. The only time an exception * should be thrown back up to the DM is when the corruption of the * destination is fatal to starting the ME (such as a corrupt system * destination, currently). */ try { // Create appropriate state objects createRealizationAndState(messageProcessor); // Restore GD ProtocolItemStream before creating InputHandler _protoRealization. getRemoteSupport(). reconstituteGD(); // Reconstitute message ItemStreams if (isPubSub()) { // Indicate that the destinationHandler has not yet been reconciled _reconciled = false; createControlAdapter(); //Check if we are running in an ND environment. If not we can skip //some performance intensive WLM work _singleServer = messageProcessor.isSingleServer(); _pubSubRealization.reconstitute(startMode, durableSubscriptionsTable); } else { initializeNonPersistent(processor, durableSubscriptionsTable, null); // Indicate that the destinationHandler has not yet been reconciled _reconciled = false; _ptoPRealization.reconstitute(startMode, definition, isToBeDeleted(), isSystem()); } // Reconstitute GD target streams _protoRealization. reconstituteGDTargetStreams(); } catch (Exception e) { FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.BaseDestinationHandler.reconstitute", "1:945:1.700.3.45", this); SibTr.exception(tc, e); // At the moment, any exception we get while reconstituting means that we // want to mark the destination as corrupt. _isCorruptOrIndoubt = true; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "reconstitute", e); throw new SIResourceException(e); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug( tc, "Reconstituted " + (isPubSub() ? "pubsub" : "ptp") + " BaseDestinationHandler " + getName()); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "reconstitute"); }
java
public void deleteMsgsWithNoReferences() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "deleteMsgsWithNoReferences"); if (null != _pubSubRealization) //doing a sanity check with checking for not null _pubSubRealization.deleteMsgsWithNoReferences(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "deleteMsgsWithNoReferences"); }
java
public final synchronized AnycastOutputHandler getAnycastOutputHandler() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getAnycastOutputHandler"); AnycastOutputHandler aoh = null; if (_ptoPRealization != null) aoh = _ptoPRealization.getAnycastOutputHandler(definition, false); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getAnycastOutputHandler", aoh); return aoh; }
java
public Object[] getPostReconstitutePseudoIds() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getPostReconstitutePseudoIds"); Object[] result = _protoRealization. getRemoteSupport(). getPostReconstitutePseudoIds(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getPostReconstitutePseudoIds", result); return result; }
java
protected void addPubSubLocalisation( LocalizationDefinition destinationLocalizationDefinition) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "addPubSubLocalisation", new Object[] { destinationLocalizationDefinition }); _pubSubRealization.addPubSubLocalisation(destinationLocalizationDefinition); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addPubSubLocalisation"); }
java
public void setRemote(boolean hasRemote) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setRemote", Boolean.valueOf(hasRemote)); getLocalisationManager().setRemote(hasRemote); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setRemote"); }
java
public void setLocal() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setLocal"); getLocalisationManager().setLocal(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setLocal"); }
java
public boolean isToBeIgnored() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "isToBeIgnored"); SibTr.exit(tc, "isToBeIgnored", Boolean.valueOf(_toBeIgnored)); } return _toBeIgnored; }
java
PtoPXmitMsgsItemStream getXmitQueuePoint(SIBUuid8 meUuid) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getXmitQueuePoint", meUuid); PtoPXmitMsgsItemStream stream = getLocalisationManager().getXmitQueuePoint(meUuid); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getXmitQueuePoint", stream); return stream; }
java
private void eventMessageExpiryNotification( SIMPMessage msg, TransactionCommon tran) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "eventMessageExpiryNotification", new Object[] { msg, tran }); // If a ReportHandler object has not been created yet, then do so. if (_reportHandler == null) _reportHandler = new ReportHandler(messageProcessor); // Generate and send the report under the same transaction as the delete try { _reportHandler.handleMessage(msg, tran, SIApiConstants.REPORT_EXPIRY); } catch (SIException e) { FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.BaseDestinationHandler.eventMessageExpiryNotification", "1:3778:1.700.3.45", this); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "eventMessageExpiryNotification", "SIResourceException"); throw new SIResourceException( nls.getFormattedMessage( "REPORT_MESSAGE_ERROR_CWSIP0422", new Object[] { messageProcessor.getMessagingEngineName(), e }, null), e); } /** * 463584 * If this message has been restored from msgstore but this destination has been recreated * in admin thus a different destination uuid and diferent BDH instance the stats object will be null. * It only gets initialized during the create/updateLocalisations call. This call will never happen * on this BDH. * Therefore... If a destination has been recreated, the stats on expiry will no longer be valid. */ if (_protoRealization != null) _protoRealization.onExpiryReport(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "eventMessageExpiryNotification"); }
java
public String constructPseudoDurableDestName(String subName) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "constructPseudoDurableDestName", subName); String psuedoDestName = constructPseudoDurableDestName( messageProcessor.getMessagingEngineUuid().toString(), subName); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "constructPseudoDurableDestName", psuedoDestName); return psuedoDestName; }
java
public String constructPseudoDurableDestName(String meUUID, String durableName) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "constructPseudoDurableDestName", new Object[] { meUUID, durableName }); String returnString = meUUID + "##" + durableName; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "constructPseudoDurableDestName", returnString); return returnString; }
java
public AnycastOutputHandler getAnycastOHForPseudoDest(String destName) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getAnycastOHForPseudoDest", destName); AnycastOutputHandler returnAOH = _pubSubRealization. getRemotePubSubSupport(). getAnycastOHForPseudoDest(destName); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getAnycastOHForPseudoDest", returnAOH); return returnAOH; }
java
void sendCODMessage(SIMPMessage msg, TransactionCommon tran) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "sendCODMessage", new Object[] { msg, tran }); // If COD Report messages are required, this is when we need to create and // send them. if (msg.getReportCOD() != null) { // Create the ReportHandler object if not already created if (_reportHandler == null) _reportHandler = new ReportHandler(messageProcessor); try { _reportHandler.handleMessage(msg, tran, SIApiConstants.REPORT_COD); } catch (SIException e) { FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.BaseDestinationHandler.sendCODMessage", "1:3909:1.700.3.45", this); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "sendCODMessage", "SIResourceException"); throw new SIResourceException( nls.getFormattedMessage( "REPORT_MESSAGE_ERROR_CWSIP0423", new Object[] { messageProcessor.getMessagingEngineName(), e }, null), e); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "sendCODMessage"); }
java
@Override public void announceMPStopping() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "announceMPStopping"); if (isPubSub()) { if (null != _pubSubRealization) { //doing a sanity check with checking for not null //signal to _pubSubRealization to gracefully exit from deleteMsgsWithNoReferences() _pubSubRealization.stopDeletingMsgsWihoutReferencesTask(true); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "announceMPStopping"); }
java
@Override public void stop(int mode) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "stop", Integer.valueOf(mode)); // Deregister the destination deregisterDestination(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "stop"); }
java
public int createDurableFromRemote( String subName, SelectionCriteria criteria, String user, boolean isCloned, boolean isNoLocal, boolean isSIBServerSubject) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "createDurableFromRemote", new Object[] { subName, criteria, user, Boolean.valueOf(isSIBServerSubject) }); int status = DurableConstants.STATUS_OK; // Create a ConsumerDispatcherState for the local call ConsumerDispatcherState subState = new ConsumerDispatcherState( subName, definition.getUUID(), criteria, isNoLocal, messageProcessor.getMessagingEngineName(), definition.getName(), getBus()); // Set the security id into the CD state subState.setUser(user, isSIBServerSubject); //defect 259036 - we need to enable sharing of the durable subscription subState.setIsCloned(isCloned); try { _pubSubRealization.createLocalDurableSubscription(subState, null); } catch (SIDurableSubscriptionAlreadyExistsException e) { // No FFDC code needed status = DurableConstants.STATUS_SUB_ALREADY_EXISTS; } catch (Throwable e) { // FFDC FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.BaseDestinationHandler.createDurableFromRemote", "1:4436:1.700.3.45", this); // FFDC keeps the local broker happy, but we still need to return // a status to keep the remote ME live. status = DurableConstants.STATUS_SUB_GENERAL_ERROR; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createDurableFromRemote", Integer.valueOf(status)); return status; }
java
@Override public JsDestinationAddress getRoutingDestinationAddr(JsDestinationAddress inAddress, boolean fixedMessagePoint) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getRoutingDestinationAddr", new Object[] { this, inAddress, Boolean.valueOf(fixedMessagePoint) }); JsDestinationAddress routingAddress = null; // Pull out any encoded ME from a system or temporary queue SIBUuid8 encodedME = null; if (_isSystem || _isTemporary) encodedME = SIMPUtils.parseME(inAddress.getDestinationName()); // If this is a system or temporary queue that is located on a different ME to us // we need to set the actual address as the routing destination. if ((encodedME != null) && !(encodedME.equals(getMessageProcessor().getMessagingEngineUuid()))) { routingAddress = inAddress; } // The only other reason for setting a routing destination is if the sender is bound // (or will be bound) to a single message point. In which case we use the routing // address to transmit the chosen ME (added later by the caller) else if (fixedMessagePoint) { //TODO what if inAddres is isLocalOnly() or already has an ME? routingAddress = _destinationAddr; } else if ((inAddress != null) && (inAddress.getME() != null)) { routingAddress = _destinationAddr; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getRoutingDestinationAddr", routingAddress); return routingAddress; }
java
public void deleteRemoteDurableDME(String subName) throws SIRollbackException, SIConnectionLostException, SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "deleteRemoteDurableDME", new Object[] { subName }); _pubSubRealization. getRemotePubSubSupport(). deleteRemoteDurableDME(subName); // All done, return if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "deleteRemoteDurableDME"); }
java
public void requestReallocation() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "requestReallocation"); if (!isCorruptOrIndoubt()) { //PK73754 // Reset reallocation flag under lock on the BDH. synchronized (this) { _isToBeReallocated = true; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "requestReallocation", "Have set reallocation flag"); } // Set cleanup_pending state destinationManager.getDestinationIndex().cleanup(this); destinationManager.startAsynchDeletion(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "requestReallocation"); }
java
@Override public boolean isTopicAccessCheckRequired() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "isTopicAccessCheckRequired"); if (!isPubSub() || isTemporary()) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "isTopicAccessCheckRequired", Boolean.FALSE); return false; } boolean check = super.isTopicAccessCheckRequired(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "isTopicAccessCheckRequired", Boolean.valueOf(check)); return check; // Look to the underlying definition }
java
public boolean removeAnycastInputHandlerAndRCD(String key) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "removeAnycastInputHandlerAndRCD", key); boolean removed = _protoRealization. getRemoteSupport(). removeAnycastInputHandlerAndRCD(key); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "removeAnycastInputHandlerAndRCD", Boolean.valueOf(removed)); return removed; }
java
public void closeRemoteConsumer(SIBUuid8 dmeUuid) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "closeRemoteConsumer", dmeUuid); _protoRealization. getRemoteSupport(). closeRemoteConsumers(dmeUuid); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "closeRemoteConsumer"); return; }
java
public PubSubRealization getPubSubRealization() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getPubSubRealization"); SibTr.exit(tc, "getPubSubRealization", _pubSubRealization); } return _pubSubRealization; }
java
public PtoPRealization getPtoPRealization() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getPtoPRealization"); SibTr.exit(tc, "getPtoPRealization", _ptoPRealization); } return _ptoPRealization; }
java
public AbstractProtoRealization getProtocolRealization() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getProtocolRealization"); SibTr.exit(tc, "getProtocolRealization", _protoRealization); } return _protoRealization; }
java
public LocalisationManager getLocalisationManager() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getLocalisationManager", this); // Instantiate LocalisationManager to manage localisations and interface to WLM if (_localisationManager == null) { _localisationManager = new LocalisationManager(this); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getLocalisationManager", _localisationManager); return _localisationManager; }
java
protected void setByteArrayValue(byte[] input) { this.sValue = null; this.bValue = input; this.offset = 0; this.valueLength = input.length; if (ELEM_ADDED != this.status) { this.status = ELEM_CHANGED; } }
java
protected void setByteArrayValue(byte[] input, int offset, int length) { if ((offset + length) > input.length) { throw new IllegalArgumentException( "Invalid length: " + offset + "+" + length + " > " + input.length); } this.sValue = null; this.bValue = input; this.offset = offset; this.valueLength = length; if (ELEM_ADDED != this.status) { this.status = ELEM_CHANGED; } }
java
protected void setStringValue(String input) { this.bValue = null; this.sValue = input; this.offset = 0; this.valueLength = (null == input) ? 0 : input.length(); if (ELEM_ADDED != this.status) { this.status = ELEM_CHANGED; } }
java
protected void updateLastCRLFInfo(int index, int pos, boolean isCR) { this.lastCRLFBufferIndex = index; this.lastCRLFPosition = pos; this.lastCRLFisCR = isCR; }
java
protected void destroy() { this.nextSequence = null; this.prevSequence = null; this.bValue = null; this.sValue = null; this.buffIndex = -1; this.offset = 0; this.valueLength = 0; this.myHashCode = -1; this.lastCRLFBufferIndex = -1; this.lastCRLFisCR = false; this.lastCRLFPosition = -1; this.status = ELEM_ADDED; this.myOwner.freeElement(this); }
java
public Properties getHeader(RepositoryLogRecord record) { if (!headerMap.containsKey(record)) { throw new IllegalArgumentException("Record was not return by an iterator over this instance"); } return headerMap.get(record); }
java
@Trivial public static URL createWSJPAURL(URL url) throws MalformedURLException { if (url == null) { return null; } // Encode the URL to be embedded into the wsjpa URL's path final String encodedURLPathStr = encode(url.toExternalForm()); URL returnURL; try { returnURL = AccessController.doPrivileged(new PrivilegedExceptionAction<URL>() { @Override @Trivial public URL run() throws MalformedURLException { return new URL(WSJPA_PROTOCOL_NAME + ":" + encodedURLPathStr); } }); } catch (PrivilegedActionException e) { throw (MalformedURLException) e.getException(); } return returnURL; }
java
@Trivial public static URL extractEmbeddedURL(URL url) throws MalformedURLException { if (url == null) { return null; } if (!url.getProtocol().equalsIgnoreCase(WSJPA_PROTOCOL_NAME)) { throw new IllegalArgumentException("The specified URL \"" + url + "\" does not use the \"" + WSJPA_PROTOCOL_NAME + "\" protocol."); } String encodedPath = url.getPath(); if (encodedPath == null || encodedPath.trim().equals("")) { throw new IllegalArgumentException("The specified URL \"" + url + "\" is missing path information."); } final String decodedPath = decode(encodedPath); try { return AccessController.doPrivileged(new PrivilegedExceptionAction<URL>() { @Override @Trivial public URL run() throws MalformedURLException { return new URL(decodedPath); } }); } catch (PrivilegedActionException e) { throw (MalformedURLException) e.getException(); } }
java
@Trivial private static String encode(String s) { if (s == null) { return null; } // Throw an IllegalArgumentException if "%21" is already present in the String if (s.contains("%21")) { throw new IllegalArgumentException("WSJPAURLUtils.encode() cannot encode Strings containing \"%21\"."); } return s.replace("!", "%21"); }
java
@Trivial private static String decode(String s) { if (s == null) { return null; } return s.replace("%21", "!"); }
java
@Override public ValidationMode getValidationMode() { // Convert this ValidationMode from the class defined // in JAXB (com.ibm.ws.jpa.pxml20.PersistenceUnitValidationModeType) // to JPA (javax.persistence.ValidationMode). ValidationMode rtnMode = null; PersistenceUnitValidationModeType jaxbMode = null; jaxbMode = ivPUnit.getValidationMode(); if (jaxbMode == PersistenceUnitValidationModeType.AUTO) { rtnMode = ValidationMode.AUTO; } else if (jaxbMode == PersistenceUnitValidationModeType.CALLBACK) { rtnMode = ValidationMode.CALLBACK; } else if (jaxbMode == PersistenceUnitValidationModeType.NONE) { rtnMode = ValidationMode.NONE; } return rtnMode; }
java
public static void setServiceProviderFinder(ExternalContext ectx, ServiceProviderFinder slp) { ectx.getApplicationMap().put(SERVICE_PROVIDER_KEY, slp); }
java
private static ServiceProviderFinder _getServiceProviderFinderFromInitParam(ExternalContext context) { String initializerClassName = context.getInitParameter(SERVICE_PROVIDER_FINDER_PARAM); if (initializerClassName != null) { try { // get Class object Class<?> clazz = ClassUtils.classForName(initializerClassName); if (!ServiceProviderFinder.class.isAssignableFrom(clazz)) { throw new FacesException("Class " + clazz + " does not implement ServiceProviderFinder"); } // create instance and return it return (ServiceProviderFinder) ClassUtils.newInstance(clazz); } catch (ClassNotFoundException cnfe) { throw new FacesException("Could not find class of specified ServiceProviderFinder", cnfe); } } return null; }
java
public void psSetBytes(PreparedStatement pstmtImpl, int i, byte[] x) throws SQLException { pstmtImpl.setBytes(i, x); }
java
public void psSetString(PreparedStatement pstmtImpl, int i, String x) throws SQLException { pstmtImpl.setString(i, x); }
java
public void resetClientInformation(WSRdbManagedConnectionImpl mc) throws SQLException { if (mc.mcf.jdbcDriverSpecVersion >= 40 && (mc.clientInfoExplicitlySet || mc.clientInfoImplicitlySet)) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(this, tc, "resetClientInformation", mc); try { mc.sqlConn.setClientInfo(mc.mcf.defaultClientInfo); mc.clientInfoExplicitlySet = false; mc.clientInfoImplicitlySet = false; } catch (SQLException ex) { FFDCFilter.processException( ex, getClass().getName() + "resetClientInformation", "780", this); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(this, tc, "resetClientInformation", ex); throw AdapterUtil.mapSQLException(ex, mc); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(this, tc, "resetClientInformation"); } }
java
public ConnectionResults getPooledConnection(final CommonDataSource ds, String userName, String password, final boolean is2Phase, final WSConnectionRequestInfoImpl cri, boolean useKerberos, Object gssCredential) throws ResourceException { if (tc.isEntryEnabled()) Tr.entry(this, tc, "getPooledConnection", AdapterUtil.toString(ds), userName, "******", is2Phase ? "two-phase" : "one-phase", cri, useKerberos, gssCredential); // if kerberose is set then issue a warning that no special APIs are used instead, // a getConnection() without username/password will be used. // to get a connection. if (useKerberos) { Tr.warning(tc, "KERBEROS_NOT_SUPPORTED_WARNING"); } try { final String user = userName == null ? null : userName.trim(); final String pwd = password == null ? null : password.trim(); PooledConnection pConn = AccessController.doPrivileged(new PrivilegedExceptionAction<PooledConnection>() { public PooledConnection run() throws SQLException { boolean buildConnection = cri.ivShardingKey != null || cri.ivSuperShardingKey != null; if (is2Phase) if (buildConnection) return mcf.jdbcRuntime.buildXAConnection((XADataSource) ds, user, pwd, cri); else if (user == null) return ((XADataSource) ds).getXAConnection(); else return ((XADataSource) ds).getXAConnection(user, pwd); else if (buildConnection) return mcf.jdbcRuntime.buildPooledConnection((ConnectionPoolDataSource) ds, user, pwd, cri); else if (user == null) return ((ConnectionPoolDataSource) ds).getPooledConnection(); else return ((ConnectionPoolDataSource) ds).getPooledConnection(user, pwd); } }); if (tc.isEntryEnabled()) Tr.exit(this, tc, "getPooledConnection", AdapterUtil.toString(pConn)); return new ConnectionResults(pConn, null); } catch (PrivilegedActionException pae) { FFDCFilter.processException(pae.getException(), getClass().getName(), "1298"); ResourceException resX = new DataStoreAdapterException("JAVAX_CONN_ERR", pae.getException(), DatabaseHelper.class, is2Phase ? "XAConnection" : "PooledConnection"); if (tc.isEntryEnabled()) Tr.exit(this, tc, "getPooledConnection", "Exception"); throw resX; } catch (ClassCastException castX) { // There's a possibility this occurred because of an error in the JDBC driver // itself. The trace should allow us to determine this. FFDCFilter.processException(castX, getClass().getName(), "1312"); if (tc.isDebugEnabled()) Tr.debug(this, tc, "Caught ClassCastException", castX); ResourceException resX = new DataStoreAdapterException(castX.getMessage(), null, DatabaseHelper.class, is2Phase ? "NOT_A_2_PHASE_DS" : "NOT_A_1_PHASE_DS"); if (tc.isEntryEnabled()) Tr.exit(this, tc, "getPooledConnection", "Exception"); throw resX; } }
java
public void setClientRerouteData(Object dataSource, String cRJNDIName, String cRAlternateServer, String cRAlternatePort, String cRPrimeServer, String cRPrimePort, Context jndiContext, String driverType) throws Throwable // add driverType { if (tc.isDebugEnabled()) { Tr.debug(this, tc, "Client reroute is not supported on non-DB2 JCC driver."); } }
java
public boolean isAnAuthorizationException(SQLException x) { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(this, tc, "isAnAuthorizationException", x); boolean isAuthError = false; LinkedList<SQLException> stack = new LinkedList<SQLException>(); if (x != null) stack.push(x); // Limit the chain depth so that poorly written exceptions don't cause an infinite loop. for (int depth = 0; depth < 20 && !isAuthError && !stack.isEmpty(); depth++) { x = stack.pop(); isAuthError |= isAuthException(x); // Add the chained exceptions to the stack. if (x.getNextException() != null) stack.push(x.getNextException()); if (x.getCause() instanceof SQLException && x.getCause() != x.getNextException()) stack.push((SQLException) x.getCause()); } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(this, tc, "isAnAuthorizationException", isAuthError); return isAuthError; }
java
public void reuseKerbrosConnection(Connection sqlConn, GSSCredential gssCred, Properties props) throws SQLException { // an exception would have been thrown earlier than this point, so adding the trace just in case. if (tc.isDebugEnabled()) { Tr.debug(this, tc, "Kerberos reuse is not supported when using generic helper. No-op operation."); } }
java
public int branchCouplingSupported(int couplingType) { // Return -1 as we have no support for resref branch coupling if (couplingType == ResourceRefInfo.BRANCH_COUPLING_LOOSE || couplingType == ResourceRefInfo.BRANCH_COUPLING_TIGHT) { if (tc.isDebugEnabled()) { Tr.debug(this, tc, "Specified branch coupling type not supported"); } return -1; } // If resref branch coupling unset then return default xa_start flags return javax.transaction.xa.XAResource.TMNOFLAGS; }
java
public boolean loadClasses() { Boolean result = AccessController.doPrivileged(new PrivilegedAction<Boolean>() { @Override public Boolean run() { Policy policy = jaccProviderService.getService().getPolicy(); if (tc.isDebugEnabled()) Tr.debug(tc, "policy object" + policy); // in order to support the CTS provider, Policy object should be set prior to // instanciate PolicyConfigFactory class. if (policy == null) { Exception e = new Exception("Policy object is null."); Tr.error(tc, "JACC_POLICY_INSTANTIATION_FAILURE", new Object[] { policyName, e }); return Boolean.FALSE; } try { Policy.setPolicy(policy); policy.refresh(); } catch (ClassCastException cce) { Tr.error(tc, "JACC_POLICY_INSTANTIATION_FAILURE", new Object[] { policyName, cce }); return Boolean.FALSE; } pcf = jaccProviderService.getService().getPolicyConfigFactory(); if (pcf != null) { if (tc.isDebugEnabled()) Tr.debug(tc, "factory object : " + pcf); PolicyConfigurationManager.initialize(policy, pcf); } else { Tr.error(tc, "JACC_FACTORY_INSTANTIATION_FAILURE", new Object[] { factoryName }); return Boolean.FALSE; } return Boolean.TRUE; } }); return result.booleanValue(); }
java
private static String getResourceLookup(Resource resource) // F743-16274.1 { if (svResourceLookupMethod == null) { return ""; } try { return (String) svResourceLookupMethod.invoke(resource, (Object[]) null); } catch (Exception ex) { throw new IllegalStateException(ex); } }
java
private void setXMLType(String typeName, String element, String nameElement, String typeElement) // F743-32443 throws InjectionConfigurationException { if (ivNameSpaceConfig.getClassLoader() == null) { setInjectionClassTypeName(typeName); } else { Class<?> type = loadClass(typeName); //The type parameter is "optional" if (type != null) { ResourceImpl curAnnotation = (ResourceImpl) getAnnotation(); if (curAnnotation.ivIsSetType) { Class<?> curType = getInjectionClassType(); // check that value from xml is a subclasss, if not throw an error Class<?> mostSpecificClass = mostSpecificClass(type, curType); if (mostSpecificClass == null) { Tr.error(tc, "CONFLICTING_XML_VALUES_CWNEN0052E", ivComponent, ivModule, ivApplication, typeElement, element, nameElement, getJndiName(), curType, type); // d479669 String exMsg = "The " + ivComponent + " bean in the " + ivModule + " module of the " + ivApplication + " application has conflicting configuration data in the XML" + " deployment descriptor. Conflicting " + typeElement + " element values exist for multiple " + element + " elements with the same " + nameElement + " element value : " + getJndiName() + ". The conflicting " + typeElement + " element values are " + curType + " and " + type + "."; // d479669 throw new InjectionConfigurationException(exMsg); } curAnnotation.ivType = mostSpecificClass; } else { curAnnotation.ivType = type; curAnnotation.ivIsSetType = true; } } } }
java
private boolean isEnvEntryTypeCompatible(Object newType) // F743-32443 { Class<?> curType = getInjectionClassType(); if (curType == null) { return true; } return isClassesCompatible((Class<?>) newType, getInjectionClassType()); }
java
public void setEnvEntryType(ResourceImpl annotation, Object type) // F743-32443 throws InjectionException { if (type instanceof String) { setInjectionClassTypeName((String) type); } else { Class<?> classType = (Class<?>) type; annotation.ivType = classType; annotation.ivIsSetType = true; setInjectionClassType(classType); } }
java
private boolean isEnvEntryType(Class<?> resolverType) // F743-32443 { Class<?> injectType = getInjectionClassType(); return injectType == null ? resolverType.getName().equals(getInjectionClassTypeName()) : resolverType == injectType; }
java
@Override public List<Asset> getAllAssets() throws IOException, RequestFailureException { HttpURLConnection connection = createHttpURLConnectionToMassive("/assets"); connection.setRequestMethod("GET"); testResponseCode(connection); return JSONAssetConverter.readValues(connection.getInputStream()); }
java