code
stringlengths 73
34.1k
| label
stringclasses 1
value |
|---|---|
public void sendToMe(SIBUuid8 targetME, int priority, AbstractMessage aMessage)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "sendToMe", new Object[] { aMessage, Integer.valueOf(priority), targetME });
// find an appropriate MPConnection
MPConnection firstChoice = findMPConnection(targetME);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "sendToMe", firstChoice);
// Minimal comms trace of the message we're trying to send
if (TraceComponent.isAnyTracingEnabled()) {
MECommsTrc.traceMessage(tc,
_messageProcessor,
aMessage.getGuaranteedTargetMessagingEngineUUID(),
MECommsTrc.OP_SEND,
firstChoice,
aMessage);
}
if(firstChoice != null)
{
//send the message
firstChoice.send(aMessage, priority);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "sendToMe");
}
|
java
|
public void sendDownTree(SIBUuid8[] targets, int priority, AbstractMessage cMsg)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "sendDownTree", new Object[] { this, cMsg, Integer.valueOf(priority), targets});
// Select a set of connections, then annotate the message.
int length = targets.length;
//the unique list of connections
MPConnection[] send = new MPConnection[length];
int[] cCount = new int[length];
int numSendConnections = 0;
next:
for(int i=0; i<length; i++)
{
SIBUuid8 targetMEUuid = targets[i];
MPConnection firstChoice = findMPConnection(targetMEUuid);
// Minimal comms trace of the message we're trying to send
if (TraceComponent.isAnyTracingEnabled()) {
MECommsTrc.traceMessage(tc,
_messageProcessor,
cMsg.getGuaranteedTargetMessagingEngineUUID(),
MECommsTrc.OP_SEND,
firstChoice,
cMsg);
}
if(firstChoice != null)
{
// Keep track of the set of unique connections for sending below
int j = 0;
//loop through send until we find the next unused slot
for(j=0; (j<i) && (send[j]!=null); j++)
{
//if we have seen the selected connection before, start again
if (send[j].equals(firstChoice))
{
cCount[j]++;
continue next;
}
}
if(j+1 > numSendConnections) numSendConnections = (j+1);
//store the select connection in the chosen send slot
send[j] = firstChoice;
cCount[j]++;
}
}
for(int i=0; i<numSendConnections; i++)
{
if (send[i] != null) send[i].send(cMsg,priority);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "sendDownTree");
}
|
java
|
public boolean isMEReachable(SIBUuid8 meUuid)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "isMEReachable", new Object[] {this, meUuid});
boolean result = (findMPConnection(meUuid) != null);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "isMEReachable", Boolean.valueOf(result));
return result;
}
|
java
|
public boolean isCompatibleME(SIBUuid8 meUuid, ProtocolVersion version)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "isCompatibleME", new Object[] {meUuid});
boolean result = false;
MPConnection conn = findMPConnection(meUuid);
if (conn!=null)
{
// If the other ME is an older version then we are incompatible
ProtocolVersion otherVersion = conn.getVersion();
if (otherVersion != null && otherVersion.compareTo(version) >= 0)
result = true;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "isCompatibleME", Boolean.valueOf(result));
return result;
}
|
java
|
public void forceConnect(SIBUuid8 meUuid)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "forceConnect", meUuid);
if(_routingManager!=null)
_routingManager.connectToME(meUuid);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "forceConnect");
}
|
java
|
private List<SecurityConstraint> createSecurityConstraints(SecurityMetadata securityMetadataFromDD, ServletSecurityElement servletSecurity, Collection<String> urlPatterns) {
List<SecurityConstraint> securityConstraints = new ArrayList<SecurityConstraint>();
securityConstraints.add(getConstraintFromHttpElement(securityMetadataFromDD, urlPatterns, servletSecurity));
securityConstraints.addAll(getConstraintsFromHttpMethodElement(securityMetadataFromDD, urlPatterns, servletSecurity));
return securityConstraints;
}
|
java
|
private SecurityConstraint getConstraintFromHttpElement(SecurityMetadata securityMetadataFromDD, Collection<String> urlPatterns, ServletSecurityElement servletSecurity) {
List<String> omissionMethods = new ArrayList<String>();
if (!servletSecurity.getMethodNames().isEmpty()) {
omissionMethods.addAll(servletSecurity.getMethodNames()); //list of methods named by @HttpMethodConstraint
}
WebResourceCollection webResourceCollection = new WebResourceCollection((List<String>) urlPatterns, new ArrayList<String>(), omissionMethods, securityMetadataFromDD.isDenyUncoveredHttpMethods());
List<WebResourceCollection> webResourceCollections = new ArrayList<WebResourceCollection>();
webResourceCollections.add(webResourceCollection);
return createSecurityConstraint(securityMetadataFromDD, webResourceCollections, servletSecurity, true);
}
|
java
|
private List<SecurityConstraint> getConstraintsFromHttpMethodElement(SecurityMetadata securityMetadataFromDD, Collection<String> urlPatterns,
ServletSecurityElement servletSecurity) {
List<SecurityConstraint> securityConstraints = new ArrayList<SecurityConstraint>();
Collection<HttpMethodConstraintElement> httpMethodConstraints = servletSecurity.getHttpMethodConstraints();
for (HttpMethodConstraintElement httpMethodConstraint : httpMethodConstraints) {
String method = httpMethodConstraint.getMethodName();
List<String> methods = new ArrayList<String>();
methods.add(method);
WebResourceCollection webResourceCollection = new WebResourceCollection((List<String>) urlPatterns, methods, new ArrayList<String>(), securityMetadataFromDD.isDenyUncoveredHttpMethods());
List<WebResourceCollection> webResourceCollections = new ArrayList<WebResourceCollection>();
webResourceCollections.add(webResourceCollection);
securityConstraints.add(createSecurityConstraint(securityMetadataFromDD, webResourceCollections, httpMethodConstraint, false));
}
return securityConstraints;
}
|
java
|
private SecurityConstraint createSecurityConstraint(SecurityMetadata securityMetadataFromDD, List<WebResourceCollection> webResourceCollections,
HttpConstraintElement httpConstraint, boolean fromHttpConstraint) {
List<String> roles = createRoles(httpConstraint);
List<String> allRoles = securityMetadataFromDD.getRoles();
for (String role : roles) {
if (!allRoles.contains(role)) {
allRoles.add(role);
}
}
boolean sslRequired = isSSLRequired(httpConstraint);
boolean accessPrecluded = isAccessPrecluded(httpConstraint);
boolean accessUncovered = isAccessUncovered(httpConstraint);
return new SecurityConstraint(webResourceCollections, roles, sslRequired, accessPrecluded, fromHttpConstraint, accessUncovered);
}
|
java
|
private boolean isSSLRequired(HttpConstraintElement httpConstraint) {
boolean sslRequired = false;
TransportGuarantee transportGuarantee = httpConstraint.getTransportGuarantee();
if (transportGuarantee != TransportGuarantee.NONE) {
sslRequired = true;
}
return sslRequired;
}
|
java
|
private boolean isAccessPrecluded(HttpConstraintElement httpConstraint) {
boolean accessPrecluded = false;
String[] roles = httpConstraint.getRolesAllowed();
if (roles == null || roles.length == 0) {
if (EmptyRoleSemantic.DENY == httpConstraint.getEmptyRoleSemantic())
accessPrecluded = true;
}
return accessPrecluded;
}
|
java
|
private boolean isAccessUncovered(HttpConstraintElement httpConstraint) {
boolean accessUncovered = false;
String[] roles = httpConstraint.getRolesAllowed();
if (roles == null || roles.length == 0) {
if (EmptyRoleSemantic.PERMIT == httpConstraint.getEmptyRoleSemantic())
accessUncovered = true;
}
return accessUncovered;
}
|
java
|
private void setModuleSecurityMetaData(Container moduleContainer, SecurityMetadata securityMetadataFromDD) {
try {
WebModuleMetaData wmmd = moduleContainer.adapt(WebModuleMetaData.class);
wmmd.setSecurityMetaData(securityMetadataFromDD);
} catch (UnableToAdaptException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "There was a problem setting the security meta data.", e);
}
}
}
|
java
|
@Override
public void release()
{
_applicationFactory = null;
_currentFacesContext = null;
if (_defaultExternalContext != null)
{
_defaultExternalContext.release();
_defaultExternalContext = null;
}
_application = null;
_externalContext = null;
_viewRoot = null;
_renderKitFactory = null;
_elContext = null;
_exceptionHandler = null;
_cachedRenderKit = null;
_cachedRenderKitId = null;
_separatorChar = null;
// Spec JSF 2 section getAttributes when release is called the attributes map
// must!!! be cleared! (probably to trigger some clearance methods on possible
// added entries before nullifying everything)
if (_attributes != null)
{
_attributes.clear();
_attributes = null;
}
_released = true;
FacesContext.setCurrentInstance(null);
}
|
java
|
private void findMarkers(String url, String target) {
final char[] data = url.toCharArray();
// we only care about the last path segment so find that first
int i = 0;
int lastSlash = 0;
for (; i < data.length; i++) {
if ('/' == data[i]) {
lastSlash = i;
} else if ('?' == data[i]) {
this.queryMarker = i;
break; // out of loop since query data is after the path
}
}
// now check for the id marker and/or fragments for the last segment
for (i = lastSlash; i < data.length; i++) {
if (i == this.queryMarker) {
// no fragments or segment parameters were found
break;
} else if ('#' == data[i]) {
// found a "#fragment" at the end of the path segment
this.fragmentMarker = i;
break;
} else if (';' == data[i]) {
// found a segment parameter block (would appear before the
// optional fragment or query data)
this.paramMarker = i;
if (url.regionMatches(i, target, 0, target.length())) {
this.idMarker = i;
}
}
}
}
|
java
|
private void formLogout(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
try {
// if we have a valid custom logout page, set an attribute so SAML SLO knows about it.
String exitPage = getValidLogoutExitPage(req);
if (exitPage != null) {
req.setAttribute("FormLogoutExitPage", exitPage);
}
authenticateApi.logout(req, res, webAppSecurityConfig);
String str = null;
// if SAML SLO is in use, it will write the audit record and take care of the logoutExitPage redirection
if (req.getAttribute("SpSLOInProgress") == null) {
AuthenticationResult authResult = new AuthenticationResult(AuthResult.SUCCESS, str);
authResult.setAuditLogoutSubject(authenticateApi.returnSubjectOnLogout());
authResult.setAuditCredType("FORM");
authResult.setAuditOutcome(AuditEvent.OUTCOME_SUCCESS);
authResult.setTargetRealm(authResult.realm);
Audit.audit(Audit.EventID.SECURITY_AUTHN_TERMINATE_01, req, authResult, Integer.valueOf(res.getStatus()));
redirectLogoutExitPage(req, res);
}
} catch (ServletException se) {
String str = "ServletException: " + se.getMessage();
AuthenticationResult authResult = new AuthenticationResult(AuthResult.FAILURE, str);
authResult.setAuditCredType("FORM");
authResult.setAuditOutcome(AuditEvent.OUTCOME_FAILURE);
authResult.setTargetRealm(authResult.realm);
Audit.audit(Audit.EventID.SECURITY_AUTHN_TERMINATE_01, req, authResult, Integer.valueOf(res.getStatus()));
throw se;
} catch (IOException ie) {
String str = "IOException: " + ie.getMessage();
AuthenticationResult authResult = new AuthenticationResult(AuthResult.FAILURE, str);
authResult.setAuditCredType("FORM");
authResult.setAuditOutcome(AuditEvent.OUTCOME_FAILURE);
authResult.setTargetRealm(authResult.realm);
Audit.audit(Audit.EventID.SECURITY_AUTHN_TERMINATE_01, req, authResult, Integer.valueOf(res.getStatus()));
throw ie;
}
}
|
java
|
private String getValidLogoutExitPage(HttpServletRequest req) {
boolean valid = false;
String exitPage = req.getParameter("logoutExitPage");
if (exitPage != null && exitPage.length() != 0) {
boolean logoutExitURLaccepted = verifyLogoutURL(req, exitPage);
if (logoutExitURLaccepted) {
exitPage = removeFirstSlash(exitPage);
exitPage = compatibilityExitPage(req, exitPage);
valid = true;
}
}
return valid == true ? exitPage : null;
}
|
java
|
private void useDefaultLogoutMsg(HttpServletResponse res) {
try {
PrintWriter pw = res.getWriter();
pw.println(DEFAULT_LOGOUT_MSG);
} catch (IOException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, e.getMessage());
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "No logoutExitPage specified");
}
|
java
|
private boolean isRedirectHostTheSameAsLocalHost(String exitPage, String logoutURLhost, String hostFullName, String shortName, String ipAddress) {
String localHostIpAddress = "127.0.0.1";
boolean acceptURL = false;
if (logoutURLhost.equalsIgnoreCase("localhost") || logoutURLhost.equals(localHostIpAddress) ||
(hostFullName != null && logoutURLhost.equalsIgnoreCase(hostFullName)) ||
(shortName != null && logoutURLhost.equalsIgnoreCase(shortName)) ||
(ipAddress != null && logoutURLhost.equals(ipAddress))) {
acceptURL = true;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "exitPage points to this host: all ok");
}
return acceptURL;
}
|
java
|
private boolean isRequestURLEqualsExitPageHost(HttpServletRequest req, String logoutURLhost) {
boolean acceptURL = false;
try {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "about to attempt matching the logout exit url with the domain of the request.");
StringBuffer requestURLString = req.getRequestURL();
URL requestURL = new URL(new String(requestURLString));
String requestURLhost = requestURL.getHost();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, " host of the request url is: " + requestURLhost + " and the host of the logout URL is: " + logoutURLhost);
if (logoutURLhost != null && requestURLhost != null && logoutURLhost.equalsIgnoreCase(requestURLhost)) {
acceptURL = true;
}
} catch (MalformedURLException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "caught Exception trying to form request URL object: " + e.getMessage());
}
}
return acceptURL;
}
|
java
|
public synchronized boolean makeExclusiveDependency(int depStreamID, int exclusiveParentStreamID) {
Node depNode = root.findNode(depStreamID);
Node exclusiveParentNode = root.findNode(exclusiveParentStreamID);
return makeExclusiveDependency(depNode, exclusiveParentNode);
}
|
java
|
public synchronized boolean changeParent(int depStreamID, int newPriority, int newParentStreamID, boolean exclusive) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "changeParent entry: depStreamID: " + depStreamID + " newParentStreamID: " + newParentStreamID + " exclusive: " + exclusive);
}
// notice that the new dependent node and parent do not have to be directly related coming into this method.
// Therefore, find both nodes starting at the root.
Node depNode = root.findNode(depStreamID);
Node newParentNode = root.findNode(newParentStreamID);
if ((depNode == null) || (newParentNode == null)) {
return false;
}
// If the new parent can not be found in the tree under the dependent node, then changing parents is straight forward.
if (depNode.findNode(newParentStreamID) == null) {
// simple move, since the new parent is not a dependent of the stream that is changing parents
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "new parent is not a dependent of the stream that is changing parents");
}
Node oldParent = depNode.getParent();
// move the dependent node, reset write counters, and re-sort the affected set of siblings according to original priorities
depNode.setParent(newParentNode, true);
depNode.setPriority(newPriority);
newParentNode.clearDependentsWriteCount();
newParentNode.sortDependents();
// where it left from needs to be re-sorted also
oldParent.clearDependentsWriteCount();
oldParent.sortDependents();
// according to spec: after setting the new parent, if this node is to be exclusive, then invode the exclusive algorithm on it.
if (exclusive) {
makeExclusiveDependency(depNode, newParentNode);
}
} else {
// so much for simple. The parent is in the dependency tree underneath the node that we now want to be dependent on the new Parent.
// in the above example: A - depNode, D - newParentNode.
// The below steps are following how that spec says to handle this case (or at least it is suppose to).
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "new parent is a dependent of the stream that is changing parents");
}
// move the current newParentNode to be the dependent on the new dependent node's previous parent.
Node grandParent = depNode.getParent();
Node oldDepParent = newParentNode.getParent();
newParentNode.setParent(grandParent, true); // set Parent will also remove newParentNode as a dependent of its current/old parent
// now make the new dependent node depend on the newParentNode
depNode.setParent(newParentNode, true);
depNode.setPriority(newPriority);
// clear and re-sort the effective levels we touched
grandParent.clearDependentsWriteCount();
grandParent.sortDependents();
newParentNode.clearDependentsWriteCount();
newParentNode.sortDependents();
oldDepParent.clearDependentsWriteCount();
oldDepParent.sortDependents();
// and finally if the new dependency node is suppose to end up exclusive, make it so now.
if (exclusive) {
makeExclusiveDependency(depNode, newParentNode);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "changeParent exit: depNode on exit: " + depNode.toStringDetails());
}
return true;
}
|
java
|
private void populateTopics(String[] topics) {
for (String t : topics) {
// Clean up leading and trailing white space as appropriate
t = t.trim();
// Ignore topics that start or end with a '/'
if (t.startsWith("/") || t.endsWith("/") || t.contains("//") || t.isEmpty()) {
continue;
}
// Validate subscribe permission per section 113.10.2
checkTopicSubscribePermission(t);
if (t.equals("*")) {
wildcardTopics.add("");
} else if (t.endsWith("/*")) {
wildcardTopics.add(t.substring(0, t.length() - 1));
} else {
discreteTopics.add(t);
}
}
}
|
java
|
private void checkTopicSubscribePermission(String topic) {
SecurityManager sm = System.getSecurityManager();
if (sm == null)
return;
sm.checkPermission(new TopicPermission(topic, SUBSCRIBE));
}
|
java
|
void fireEvent() {
boolean useLock = !isReentrant();
if (useLock) {
lock.lock();
}
EventImpl event = eventQueue.poll();
try {
if (event != null) {
fireEvent(event);
}
} finally {
if (useLock) {
lock.unlock();
}
}
}
|
java
|
@Override
public Throwable getCause() {
if (exceptions != null && exceptions.size() > 0)
return (Throwable) exceptions.get(0);
else
return null;
}
|
java
|
public void addBootJars(List<URL> urlList) {
addBootJars(cache.getJarFiles(kernelMf), urlList);
addBootJars(cache.getJarFiles(logProviderMf), urlList);
if (osExtensionMf != null)
addBootJars(cache.getJarFiles(osExtensionMf), urlList);
}
|
java
|
private void addBootJars(List<File> jarFiles, List<URL> urlList) {
for (File jarFile : jarFiles) {
try {
urlList.add(jarFile.toURI().toURL());
} catch (MalformedURLException e) {
// Unlikely: we're making URLs for files we know exist
}
}
}
|
java
|
public SIMessageHandle getMessageHandle() {
// If the transient is not set, build the handle from the values in the message and cache it.
if (cachedMessageHandle == null) {
byte[] b = (byte[]) jmo.getField(JsHdrAccess.SYSTEMMESSAGESOURCEUUID);
if (b != null) {
cachedMessageHandle = new JsMessageHandleImpl(new SIBUuid8(b), (Long) jmo.getField(JsHdrAccess.SYSTEMMESSAGEVALUE));
}
else {
cachedMessageHandle = new JsMessageHandleImpl(null, (Long) jmo.getField(JsHdrAccess.SYSTEMMESSAGEVALUE));
}
}
// Return the (possibly newly) cached value
return cachedMessageHandle;
}
|
java
|
final void setProducerType(ProducerType value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setProducerType", value);
/* Get the int value of the ProducerType and set that into the field */
getHdr2().setField(JsHdr2Access.PRODUCERTYPE, value.toByte());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setProducerType");
}
|
java
|
final void setJsMessageType(MessageType value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setJsMessageType", value);
/* Get the int value of the MessageType and set that into the field */
jmo.setField(JsHdrAccess.MESSAGETYPE, value.toByte());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setJsMessageType");
}
|
java
|
public final void setGuaranteedRemoteGetPrevTick(long value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setGuaranteedRemoteGetPrevTick", Long.valueOf(value));
getHdr2().setLongField(JsHdr2Access.GUARANTEEDREMOTEGET_SET_PREVTICK, value);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setGuaranteedRemoteGetPrevTick");
}
|
java
|
final void setSubtype(Byte value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setSubtype", value);
jmo.setField(JsHdrAccess.SUBTYPE, value);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setSubtype");
}
|
java
|
void copyTransients(JsHdrsImpl copy) {
copy.cachedMessageWaitTime = cachedMessageWaitTime;
copy.cachedReliability = cachedReliability;
copy.cachedPriority = cachedPriority;
copy.cachedMessageHandle = cachedMessageHandle;
copy.flags = flags;
copy.gotFlags = gotFlags;
}
|
java
|
synchronized final JsMsgPart getHdr2() {
if (hdr2 == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "getHdr2 will call getPart");
hdr2 = jmo.getPart(JsHdrAccess.HDR2, JsHdr2Access.schema);
}
return hdr2;
}
|
java
|
synchronized final JsMsgPart getApi() {
if (api == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "getApi will call getPart");
api = jmo.getPart(JsHdrAccess.API_DATA, JsApiAccess.schema);
}
return api;
}
|
java
|
synchronized final JsMsgPart getPayload(JMFSchema schema) {
if (payload == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "getPayload will call getPart");
payload = jmo.getPayloadPart().getPart(JsPayloadAccess.PAYLOAD_DATA, schema);
}
return payload;
}
|
java
|
synchronized final JsMsgPart getPayloadIfFluffed() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
if (payload == null)
SibTr.debug(this, tc, "getPayloadIfFluffed returning null");
}
return payload;
}
|
java
|
@Override
synchronized final void clearPartCaches() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "clearPartCaches");
hdr2 = api = payload = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "clearPartCaches");
}
|
java
|
private final void setFlagValue(byte flagBit, boolean value) {
if (value) {
flags = (byte) (getFlags() | flagBit);
}
else {
flags = (byte) (getFlags() & (~flagBit));
}
}
|
java
|
public String getValue(FaceletContext ctx)
{
if ((this.capabilities & EL_LITERAL) != 0)
{
return this.value;
}
else
{
return (String) this.getObject(ctx, String.class);
}
}
|
java
|
public Object getObject(FaceletContext ctx, Class type)
{
if ((this.capabilities & EL_LITERAL) != 0)
{
if (String.class.equals(type))
{
return this.value;
}
else
{
try
{
return ctx.getExpressionFactory().coerceToType(this.value, type);
}
catch (Exception e)
{
throw new TagAttributeException(this, e);
}
}
}
else
{
ValueExpression ve = this.getValueExpression(ctx, type);
try
{
return ve.getValue(ctx);
}
catch (Exception e)
{
throw new TagAttributeException(this, e);
}
}
}
|
java
|
public ValueExpression getValueExpression(FaceletContext ctx, Class type)
{
AbstractFaceletContext actx = (AbstractFaceletContext) ctx;
//volatile reads are atomic, so take the tuple to later comparison.
Object[] localCachedExpression = cachedExpression;
if (actx.isAllowCacheELExpressions() && localCachedExpression != null && localCachedExpression.length == 2)
{
//If the expected type is the same return the cached one
if (localCachedExpression[0] == null && type == null)
{
// If #{cc} recalculate the composite component level
if ((this.capabilities & EL_CC) != 0)
{
return ((LocationValueExpression)localCachedExpression[1]).apply(
actx.getFaceletCompositionContext().getCompositeComponentLevel());
}
return (ValueExpression) localCachedExpression[1];
}
else if (localCachedExpression[0] != null && localCachedExpression[0].equals(type))
{
// If #{cc} recalculate the composite component level
if ((this.capabilities & EL_CC) != 0)
{
return ((LocationValueExpression)localCachedExpression[1]).apply(
actx.getFaceletCompositionContext().getCompositeComponentLevel());
}
return (ValueExpression) localCachedExpression[1];
}
}
actx.beforeConstructELExpression();
try
{
ExpressionFactory f = ctx.getExpressionFactory();
ValueExpression valueExpression = f.createValueExpression(ctx, this.value, type);
if (ExternalSpecifications.isUnifiedELAvailable())
{
if (actx.getFaceletCompositionContext().isWrapTagExceptionsAsContextAware())
{
valueExpression = new ContextAwareTagValueExpressionUEL(this, valueExpression);
}
else
{
valueExpression = new TagValueExpressionUEL(this, valueExpression);
}
}
else
{
if (actx.getFaceletCompositionContext().isWrapTagExceptionsAsContextAware())
{
valueExpression = new ContextAwareTagValueExpression(this, valueExpression);
}
else
{
valueExpression = new TagValueExpression(this, valueExpression);
}
}
// if the ValueExpression contains a reference to the current composite
// component, the Location also has to be stored in the ValueExpression
// to be able to resolve the right composite component (the one that was
// created from the file the Location is pointing to) later.
// (see MYFACES-2561 for details)
if ((this.capabilities & EL_CC) != 0)
{
if (ExternalSpecifications.isUnifiedELAvailable())
{
valueExpression = new LocationValueExpressionUEL(getLocation(), valueExpression,
actx.getFaceletCompositionContext().getCompositeComponentLevel());
}
else
{
valueExpression = new LocationValueExpression(getLocation(), valueExpression,
actx.getFaceletCompositionContext().getCompositeComponentLevel());
}
}
else if ((this.capabilities & EL_RESOURCE) != 0)
{
if (ExternalSpecifications.isUnifiedELAvailable())
{
valueExpression = new ResourceLocationValueExpressionUEL(getLocation(), valueExpression);
}
else
{
valueExpression = new ResourceLocationValueExpression(getLocation(), valueExpression);
}
}
if (actx.isAllowCacheELExpressions() && !actx.isAnyFaceletsVariableResolved())
{
cachedExpression = new Object[]{type, valueExpression};
}
return valueExpression;
}
catch (Exception e)
{
throw new TagAttributeException(this, e);
}
finally
{
actx.afterConstructELExpression();
}
}
|
java
|
protected String stripFileSeparateAtTheEnd(String path) {
return (path != null && (path.endsWith("/") || path.endsWith("\\") ) )
? path.substring(0, path.length()-1)
: path;
}
|
java
|
protected void renderId(
FacesContext context,
UIComponent component) throws IOException
{
if (shouldRenderId(context, component))
{
String clientId = getClientId(context, component);
context.getResponseWriter().writeAttribute(HTML.ID_ATTR, clientId, JSFAttr.ID_ATTR);
}
}
|
java
|
protected boolean shouldRenderId(
FacesContext context,
UIComponent component)
{
String id = component.getId();
// Otherwise, if ID isn't set, don't bother
if (id == null)
{
return false;
}
// ... or if the ID was generated, don't bother
if (id.startsWith(UIViewRoot.UNIQUE_ID_PREFIX))
{
return false;
}
return true;
}
|
java
|
static public String toUri(Object o)
{
if (o == null)
{
return null;
}
String uri = o.toString();
if (uri.startsWith("/"))
{
// Treat two slashes as server-relative
if (uri.startsWith("//"))
{
uri = uri.substring(1);
}
else
{
FacesContext fContext = FacesContext.getCurrentInstance();
uri = fContext.getExternalContext().getRequestContextPath() + uri;
}
}
return uri;
}
|
java
|
public ValueExpression resolveVariable(String variable)
{
ValueExpression ve = null;
try
{
if (_vars != null)
{
ve = (ValueExpression) _vars.get(variable);
// Is this code in a block that wants to cache
// the resulting expression(s) and variable has been resolved?
if (_trackResolveVariables && ve != null)
{
_variableResolved = true;
}
}
if (ve == null)
{
return _target.resolveVariable(variable);
}
return ve;
}
catch (StackOverflowError e)
{
throw new ELException("Could not Resolve Variable [Overflow]: " + variable, e);
}
}
|
java
|
@Override
public String[] introspectSelf() {
List<?> nameValuePairs = Arrays.asList(
BEGIN_TRAN_FOR_SCROLLING_APIS, beginTranForResultSetScrollingAPIs,
BEGIN_TRAN_FOR_VENDOR_APIS, beginTranForVendorAPIs,
COMMIT_OR_ROLLBACK_ON_CLEANUP, commitOrRollbackOnCleanup,
CONNECTION_SHARING, connectionSharing,
DataSourceDef.isolationLevel.name(), isolationLevel,
ResourceFactory.JNDI_NAME, jndiName,
ENABLE_CONNECTION_CASTING, enableConnectionCasting,
QUERY_TIMEOUT, queryTimeout,
STATEMENT_CACHE_SIZE, statementCacheSize,
SUPPLEMENTAL_JDBC_TRACE, supplementalJDBCTrace,
SYNC_QUERY_TIMEOUT_WITH_TRAN_TIMEOUT, syncQueryTimeoutWithTransactionTimeout,
DataSourceDef.transactional.name(), transactional
);
return new String[] {
toString(),
nameValuePairs.toString(),
PropertyService.hidePasswords(vendorProps).toString() };
}
|
java
|
public final static ControlMessageType getControlMessageType(Byte aValue) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc,"Value = " + aValue);
return set[aValue.intValue()];
}
|
java
|
public void updateDefinition(ForeignBusDefinition foreignBusDefinition)
throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "updateDefinition", foreignBusDefinition);
ForeignDestinationDefault newForeignDefault = null;
// If sendAllowed has changed on the BusDefinition, then
// update it.
updateSendAllowed(_foreignBusDefinition.getSendAllowed(),
foreignBusDefinition.getSendAllowed());
try
{
// Update the the VLD - including inbound and outbound userids if appropriate
VirtualLinkDefinition vld = foreignBusDefinition.getLinkForNextHop();
updateVirtualLinkDefinition(vld);
newForeignDefault = foreignBusDefinition.getDestinationDefault();
_foreignDestinationDefault = newForeignDefault;
_foreignBusDefinition = foreignBusDefinition;
}
catch (SIBExceptionObjectNotFound e)
{
// Shouldn't occur so FFDC.
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.BusHandler.updateDefinition",
"1:242:1.54",
this);
SibTr.exception(tc, e);
// Allow processing to continue
}
catch (SIBExceptionNoLinkExists e)
{
// Shouldn't occur so FFDC.
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.BusHandler.updateDefinition",
"1:254:1.54",
this);
SibTr.exception(tc, e);
// Allow processing to continue
}
catch (SIIncorrectCallException e)
{
// Shouldn't occur so FFDC.
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.BusHandler.updateDefinition",
"1:266:1.54",
this);
SibTr.exception(tc, e);
// Allow processing to continue
}
catch (SIBExceptionBusNotFound e)
{
// Shouldn't occur so FFDC.
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.BusHandler.updateDefinition",
"1:278:1.54",
this);
SibTr.exception(tc, e);
// Allow processing to continue
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "updateDefinition");
}
|
java
|
public void updateSendAllowed(boolean oldSendAllowed, boolean newSendAllowed)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc,
"updateSendAllowed",
new Object[] {Boolean.valueOf(oldSendAllowed), Boolean.valueOf(newSendAllowed)});
if(oldSendAllowed && !newSendAllowed)
setForeignBusSendAllowed(false);
else if(!oldSendAllowed && newSendAllowed)
setForeignBusSendAllowed(true);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "updateSendAllowed");
}
|
java
|
public void updateVirtualLinkDefinition(VirtualLinkDefinition newVirtualLinkDefinition)
throws SIIncorrectCallException, SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc,
"updateVirtualLinkDefinition",
new Object[] {newVirtualLinkDefinition});
// Get hold of the associated LinkHandler
LinkHandler lh = (LinkHandler)_targetDestinationHandler;
// We'll do this under a tranaction. This work is not coordinated with the Admin component.
//
// Create a local UOW
LocalTransaction transaction = txManager.createLocalTransaction(true);
try
{
lh.updateLinkDefinition(newVirtualLinkDefinition, transaction);
// If the update was successful then commit the unit of work
transaction.commit();
}
catch (SIResourceException e)
{
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "updateVirtualLinkDefinition", e);
try
{
transaction.rollback();
}
catch (Throwable et)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.BusHandler.updateVirtualLinkDefinition",
"1:359:1.54",
this);
SibTr.exception(tc, et);
}
throw e;
}
catch (RuntimeException e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.BusHandler.updateVirtualLinkDefinition",
"1:373:1.54",
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exception(tc, e);
SibTr.exit(tc, "updateVirtualLinkDefinition", e);
}
try
{
transaction.rollback();
}
catch (Throwable et)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.BusHandler.updateVirtualLinkDefinition",
"1:392:1.54",
this);
SibTr.exception(tc, et);
}
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "updateVirtualLinkDefinition");
}
|
java
|
public boolean checkDestinationAccess(
SecurityContext secContext,
OperationType operation)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"checkDestinationAccess",
new Object[] { secContext, operation });
boolean allow = false;
// This style of access check is against a bus only.
if(accessChecker.checkForeignBusAccess(secContext,
getName(),
operation))
{
allow = true;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkDestinationAccess", Boolean.valueOf(allow));
return allow;
}
|
java
|
@FFDCIgnore(NullPointerException.class)
private void addEventToRingBuffer(Object event) {
// Check again to see if the ringBuffer is null
if (ringBuffer != null) {
try {
ringBuffer.add(event);
} catch (NullPointerException npe) {
// Nothing to do! Perhaps a Trace?
}
}
}
|
java
|
public synchronized void addSyncHandler(SynchronousHandler syncHandler) {
// Send messages from EMQ to synchronous handler when it subscribes to
// receive messages
if (earlyMessageQueue != null && earlyMessageQueue.size() != 0
&& !synchronousHandlerSet.contains(syncHandler)) {
for (Object message : earlyMessageQueue.toArray()) {
if (message != null){
syncHandler.synchronousWrite(message);
}
}
}
Set<SynchronousHandler> synchronousHandlerSetCopy = new HashSet<SynchronousHandler>(synchronousHandlerSet);
synchronousHandlerSetCopy.add(syncHandler);
Tr.event(tc, "Added Synchronous Handler: " + syncHandler.getHandlerName());
synchronousHandlerSet = synchronousHandlerSetCopy;
}
|
java
|
public synchronized void removeSyncHandler(SynchronousHandler syncHandler) {
Set<SynchronousHandler> synchronousHandlerSetCopy = new HashSet<SynchronousHandler>(synchronousHandlerSet);
synchronousHandlerSetCopy.remove(syncHandler);
Tr.event(tc, "Removed Synchronous Handler: " + syncHandler.getHandlerName());
synchronousHandlerSet = synchronousHandlerSetCopy;
}
|
java
|
public synchronized void removeHandler(String handlerId) {
handlerEventMap.remove(handlerId);
Tr.event(tc, "Removed Asynchronous Handler: " + handlerId);
if (handlerEventMap.isEmpty()) {
ringBuffer = null;
Tr.event(tc, "ringBuffer for this BufferManagerImpl has now been set to null");
}
}
|
java
|
public static EJBSerializer instance()
{
EJBSerializer theInstance;
synchronized (CLASS_NAME)
{
if (cvInstance == null)
{
try
{
cvInstance = (EJBSerializer) Class.forName(IMPL_CLASS_NAME).newInstance();
} catch (Throwable t)
{
FFDCFilter.processException(t, CLASS_NAME + ".cvInstance", "46");
}
}
theInstance = cvInstance;
}
return theInstance;
}
|
java
|
public void initializeAppCounters(String appName) {
if (StatsFactory.isPMIEnabled()) {
synchronized(this) {
appPmi = new WebAppModule (appName, true); // @539186C
appPmiState = APP_PMI_WEB; // @539186A
}
}
}
|
java
|
protected List<AuthorizationValue> transform(List<AuthorizationValue> input) {
if (input == null) {
return null;
}
List<AuthorizationValue> output = new ArrayList<>();
for (AuthorizationValue value : input) {
AuthorizationValue v = new AuthorizationValue();
v.setKeyName(value.getKeyName());
v.setValue(value.getValue());
v.setType(value.getType());
output.add(v);
}
return output;
}
|
java
|
static <T> T ensureNotNull(String msg, T t) throws ClassLoadingConfigurationException {
ensure(msg, t != null);
return t;
}
|
java
|
static <T> String join(Iterable<T> elems, String delim) {
if (elems == null)
return "";
StringBuilder result = new StringBuilder();
for (T elem : elems)
result.append(elem).append(delim);
if (result.length() > 0)
result.setLength(result.length() - delim.length());
return result.toString();
}
|
java
|
static <T> Enumeration<T> compose(Enumeration<T> e1, Enumeration<T> e2) {
// return the composite of e1 and e2, or whichever is non-empty
return isEmpty(e1) ? e2
: isEmpty(e2) ? e1
: new CompositeEnumeration<T>(e1).add(e2);
}
|
java
|
public synchronized void add(int requestId, ReceiveListener rl, SendListener s)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "add", new Object[] {""+requestId, rl, s});
if (containsId(requestId))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) debugTraceTable("id ("+requestId+") already in table");
throw new SIErrorException(nls.getFormattedMessage("REQIDTABLE_INTERNAL_SICJ0058", null, "REQIDTABLE_INTERNAL_SICJ0058")); // D226223
}
RequestIdTableEntry newEntry = new RequestIdTableEntry(requestId, rl, s);
table.put(newEntry, newEntry);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "add");
}
|
java
|
public synchronized SendListener getSendListener(int requestId)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getSendListener", ""+requestId);
if (!containsId(requestId))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) debugTraceTable("id ("+requestId+") not in table");
throw new SIErrorException(nls.getFormattedMessage("REQIDTABLE_INTERNAL_SICJ0058", null, "REQIDTABLE_INTERNAL_SICJ0058")); // D226223
}
testReqIdTableEntry.requestId = requestId;
RequestIdTableEntry entry = table.get(testReqIdTableEntry);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getSendListener", entry.sendListener);
return entry.sendListener;
}
|
java
|
public synchronized ReceiveListener getListener(int requestId)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getListener", ""+requestId);
if (!containsId(requestId))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) debugTraceTable("id ("+requestId+") not in table");
throw new SIErrorException(nls.getFormattedMessage("REQIDTABLE_INTERNAL_SICJ0058", null, "REQIDTABLE_INTERNAL_SICJ0058")); // D226223
}
testReqIdTableEntry.requestId = requestId;
RequestIdTableEntry entry = table.get(testReqIdTableEntry);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getListener", entry.receiveListener);
return entry.receiveListener;
}
|
java
|
public synchronized boolean containsId(int requestId)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "containsId", ""+requestId);
testReqIdTableEntry.requestId = requestId;
boolean result = table.containsKey(testReqIdTableEntry);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "containsId", ""+result);
return result;
}
|
java
|
public synchronized Iterator receiveListenerIterator()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "receiveListenerIterator");
final LinkedList<ReceiveListener>linkedList = new LinkedList<ReceiveListener>();
final Iterator iterator = table.values().iterator();
while(iterator.hasNext())
{
final RequestIdTableEntry tableEntry = (RequestIdTableEntry)iterator.next();
if (tableEntry.receiveListener != null) linkedList.add(tableEntry.receiveListener);
}
final Iterator result = linkedList.iterator();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "receiveListenerIterator", result);
return result;
}
|
java
|
public synchronized Iterator sendListenerIterator()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "sendListenerIterator");
final LinkedList<SendListener> linkedList = new LinkedList<SendListener>();
final Iterator iterator = table.values().iterator();
while(iterator.hasNext())
{
final RequestIdTableEntry tableEntry = (RequestIdTableEntry)iterator.next();
if (tableEntry.sendListener != null)
linkedList.add(tableEntry.sendListener);
}
final Iterator result = linkedList.iterator();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "sendListenerIterator", result);
return result;
}
|
java
|
protected List<String> getFileLocationsFromSubsystemContent(String subsystemContent) {
String sc = subsystemContent + ",";
List<String> files = new ArrayList<String>();
boolean isFile = false;
String location = null;
int strLen = sc.length();
boolean quoted = false;
for (int i = 0, pos = 0; i < strLen; i++) {
char c = sc.charAt(i);
if (!quoted && (c == ';' || c == ',')) {
String str = sc.substring(pos, i);
pos = i + 1;
if (logger.isLoggable(Level.FINE)) {
logger.fine("element : " + str);
}
if (str.contains(":=")) {
if (getKey(str).equals(HDR_ATTR_LOCATION)) {
location = getValue(str);
}
} else if (str.contains("=")) {
if (getKey(str).equals(HDR_ATTR_TYPE) && getValue(str).equals(HDR_ATTR_VALUE_FILE)) {
isFile = true;
}
}
if (c == ',') { // the delimiter of each subsystem content.
if (isFile && location != null) {
if (logger.isLoggable(Level.FINE)) {
logger.fine("location : " + location);
}
files.add(location);
}
location = null;
isFile = false;
}
} else if (c == '\"') {
quoted = !quoted;
}
}
return files;
}
|
java
|
protected String getValue(String str) {
int index = str.indexOf('=');
String value = null;
if (index > 0) {
value = str.substring(index + 1).trim();
if (value.charAt(0) == '\"') {
value = value.substring(1, value.length() - 1);
}
}
return value;
}
|
java
|
protected String getFeatureSymbolicName(Attributes attrs) {
String output = null;
if (attrs != null) {
// get Subsystem-SymbolicName
String value = attrs.getValue(HDR_SUB_SYM_NAME);
if (value != null) {
String[] parts = value.split(";");
if (parts.length > 0) {
output = parts[0].trim();
}
}
}
return output;
}
|
java
|
protected String getFeatureName(Attributes attrs) {
String output = null;
if (attrs != null) {
// get IBM-ShortName first,
String value = attrs.getValue(HDR_SUB_SHORT_NAME);
if (value != null) {
output = value.trim();
} else {
// get Subsystem-SymbolicName
output = getFeatureSymbolicName(attrs);
}
}
return output;
}
|
java
|
protected String getLocalizedString(File featureManifest, String value) {
if (value != null && value.startsWith("%")) {
ResourceBundle res = CustomUtils.getResourceBundle(new File(featureManifest.getParentFile(), "l10n"), featureSymbolicName, Locale.getDefault());
if (res != null) {
String loc = res.getString(value.substring(1));
if (loc != null) {
value = loc;
}
}
}
return value;
}
|
java
|
public ManagedObject injectAndPostConstruct(final Object target) throws InjectionException
{
final String METHOD_NAME="injectAndPostConstruct";
if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.entering(CLASS_NAME, METHOD_NAME, target);
}
// PI30335: split inject logic from injectAndPostConstruct
ManagedObject r = inject(target);
// after injection then PostConstruct annotated methods on the host object needs to be invoked.
Throwable t = this.invokeAnnotTypeOnObjectAndHierarchy(target, ANNOT_TYPE.POST_CONSTRUCT);
if (null != t){
// log exception - and process InjectionExceptions so the error will be returned to the client as an error.
if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, METHOD_NAME, "Exception caught during post construct processing: " + t);
}
if ( t instanceof InjectionException) {
InjectionException ie = (InjectionException) t;
throw ie;
} else {
// According to spec, can't proceed if invoking PostContruct(s) threw exceptions
RuntimeException re = new RuntimeException(t);
throw re;
}
}
if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.exiting(CLASS_NAME, METHOD_NAME, r);
}
return r;
}
|
java
|
@FFDCIgnore(IOException.class)
public static Map<String, Object> parseExtensions(Extension[] extensions) {
final Map<String, Object> map = new HashMap<String, Object>();
for (Extension extension : extensions) {
final String name = extension.name();
final String key = name.length() > 0 ? StringUtils.prependIfMissing(name, "x-") : name;
Object value = null;
try {
value = Json.mapper().readTree(extension.value());
} catch (IOException e) {
value = extension.value();
}
map.put(key, value);
}
return map;
}
|
java
|
protected String add_escapes(String str) {
StringBuffer retval = new StringBuffer();
char ch;
for (int i = 0; i < str.length(); i++) {
switch (str.charAt(i))
{
case 0 :
continue;
case '\b':
retval.append("\\b");
continue;
case '\t':
retval.append("\\t");
continue;
case '\n':
retval.append("\\n");
continue;
case '\f':
retval.append("\\f");
continue;
case '\r':
retval.append("\\r");
continue;
case '\"':
retval.append("\\\"");
continue;
case '\'':
retval.append("\\\'");
continue;
case '\\':
retval.append("\\\\");
continue;
default:
if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
String s = "0000" + Integer.toString(ch, 16);
retval.append("\\u" + s.substring(s.length() - 4, s.length()));
} else {
retval.append(ch);
}
continue;
}
}
return retval.toString();
}
|
java
|
public void checkWritePermission(TimedDirContext ctx) throws OperationNotSupportedException {
if (!iWriteToSecondary) {
String providerURL = getProviderURL(ctx);
if (!getPrimaryURL().equalsIgnoreCase(providerURL)) {
String msg = Tr.formatMessage(tc, WIMMessageKey.WRITE_TO_SECONDARY_SERVERS_NOT_ALLOWED, WIMMessageHelper.generateMsgParms(providerURL));
throw new OperationNotSupportedException(WIMMessageKey.WRITE_TO_SECONDARY_SERVERS_NOT_ALLOWED, msg);
}
}
}
|
java
|
@FFDCIgnore(NamingException.class)
private void closeContextPool(List<TimedDirContext> contexts) {
final String METHODNAME = "closeContextPool";
if (contexts != null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Context pool being closed by " + Thread.currentThread() + ", Context pool size=" + contexts.size());
}
for (int i = 0; i < contexts.size(); i++) {
TimedDirContext context = contexts.get(i);
try {
context.close();
iLiveContexts--;
} catch (NamingException e) {
if (tc.isDebugEnabled())
Tr.debug(tc, METHODNAME + " Can not close LDAP connection: " + e.toString(true));
}
}
}
}
|
java
|
private void createContextPool(Integer poolSize, String providerURL) throws NamingException {
final String METHODNAME = "createContextPool";
/*
* Validate provider URL
*/
if (providerURL == null) {
providerURL = getPrimaryURL();
}
/*
* Default the pool size if one was not provided.
*/
if (poolSize == null) {
poolSize = DEFAULT_INIT_POOL_SIZE;
}
/*
* Enable the context pool
*/
if (iContextPoolEnabled) {
long currentTimeMillisec = System.currentTimeMillis();
long currentTimeSeconds = roundToSeconds(currentTimeMillisec);
// Don't purge the pool more than once per second
// This prevents multiple threads from purging the pool
if (currentTimeMillisec - iPoolCreateTimestampMillisec > 1000) {
List<TimedDirContext> contexts = new Vector<TimedDirContext>(poolSize);
Hashtable<String, Object> env = getEnvironment(URLTYPE_SEQUENCE, providerURL);
String currentURL = null;
try {
for (int i = 0; i < poolSize; i++) {
TimedDirContext ctx = createDirContext(env, currentTimeSeconds);
currentURL = getProviderURL(ctx);
if (!providerURL.equalsIgnoreCase(currentURL)) {
env = getEnvironment(URLTYPE_SEQUENCE, currentURL);
providerURL = currentURL;
}
contexts.add(ctx);
//iLiveContexts++;
}
} catch (NamingException e) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Context Pool creation FAILED for " + Thread.currentThread() + ", iLiveContext=" + iLiveContexts, e);
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Cleanup contexts in temp pool: " + contexts.size());
}
for (int j = 0; j < contexts.size(); j++) {
try {
TimedDirContext ctx = contexts.get(j);
ctx.close();
} catch (Exception ee) {
}
}
throw e;
}
iLiveContexts += poolSize;
// set active URL
setActiveURL(providerURL);
List<TimedDirContext> oldCtxs = iContexts;
iContexts = contexts;
iPoolCreateTimestampSeconds = currentTimeSeconds;
iPoolCreateTimestampMillisec = currentTimeMillisec;
closeContextPool(oldCtxs);
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Active Provider URL: " + getActiveURL());
Tr.debug(tc, METHODNAME + " ContextPool: total=" + iLiveContexts + ", poolSize=" + iContexts.size(),
", iPoolCreateTimestampSeconds=" + iPoolCreateTimestampSeconds);
}
} else if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Pool has already been purged within past second... skipping purge");
}
} else {
setActiveURL(providerURL);
}
}
|
java
|
public DirContext createSubcontext(String name,
Attributes attrs) throws OperationNotSupportedException, WIMSystemException, EntityAlreadyExistsException, EntityNotFoundException {
final String METHODNAME = "createSubcontext";
DirContext dirContext = null;
TimedDirContext ctx = getDirContext();
checkWritePermission(ctx);
try {
try {
long startTime = System.currentTimeMillis();
dirContext = ctx.createSubcontext(new LdapName(name), attrs);
long endTime = System.currentTimeMillis();
if ((endTime - startTime) > LDAP_CONNECT_TIMEOUT_TRACE) {
if (tc.isDebugEnabled())
Tr.debug(tc, METHODNAME + " **LDAPConnect time: " + (endTime - startTime) + " ms, lock held " + Thread.holdsLock(iLock)
+ ", principal=" + name);
} else {
handleBindStat(endTime - startTime);
}
} catch (NamingException e) {
if (!isConnectionException(e)) {
throw e;
}
ctx = reCreateDirContext(ctx, e.toString());
long startTime = System.currentTimeMillis();
dirContext = ctx.createSubcontext(new LdapName(name), attrs);
long endTime = System.currentTimeMillis();
if ((endTime - startTime) > LDAP_CONNECT_TIMEOUT_TRACE) {
if (tc.isDebugEnabled())
Tr.debug(tc, METHODNAME + " **LDAPConnect time: " + (endTime - startTime) + " ms, lock held " + Thread.holdsLock(iLock)
+ ", principal=" + name);
} else {
handleBindStat(endTime - startTime);
}
}
} catch (NameAlreadyBoundException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.ENTITY_ALREADY_EXIST, WIMMessageHelper.generateMsgParms(name));
throw new EntityAlreadyExistsException(WIMMessageKey.ENTITY_ALREADY_EXIST, msg, e);
} catch (NameNotFoundException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.PARENT_NOT_FOUND, WIMMessageHelper.generateMsgParms(e.toString(true)));
throw new EntityNotFoundException(WIMMessageKey.PARENT_NOT_FOUND, msg, e);
} catch (NamingException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)));
throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
} finally {
releaseDirContext(ctx);
}
return dirContext;
}
|
java
|
public void destroySubcontext(String name) throws EntityHasDescendantsException, EntityNotFoundException, WIMSystemException {
TimedDirContext ctx = getDirContext();
// checkWritePermission(ctx); // TODO Why are we not checking permissions here?
try {
try {
ctx.destroySubcontext(new LdapName(name));
} catch (NamingException e) {
if (!isConnectionException(e)) {
throw e;
}
ctx = reCreateDirContext(ctx, e.toString());
ctx.destroySubcontext(new LdapName(name));
}
} catch (ContextNotEmptyException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.ENTITY_HAS_DESCENDENTS, WIMMessageHelper.generateMsgParms(name));
throw new EntityHasDescendantsException(WIMMessageKey.ENTITY_HAS_DESCENDENTS, msg, e);
} catch (NameNotFoundException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.LDAP_ENTRY_NOT_FOUND, WIMMessageHelper.generateMsgParms(name, e.toString(true)));
throw new EntityNotFoundException(WIMMessageKey.LDAP_ENTRY_NOT_FOUND, msg, e);
} catch (NamingException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)));
throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
} finally {
releaseDirContext(ctx);
}
}
|
java
|
private static String formatIPv6Addr(String host) {
if (host == null) {
return null;
} else {
return (new StringBuilder()).append("[").append(host).append("]").toString();
}
}
|
java
|
@SuppressWarnings("unchecked")
private Hashtable<String, Object> getEnvironment(int type, String startingURL) {
Hashtable<String, Object> env = new Hashtable<String, Object>(iEnvironment);
List<String> urlList = (List<String>) env.remove(ENVKEY_URL_LIST);
int numURLs = urlList.size();
// get active URL index
int startingURLIndex = getURLIndex(startingURL, urlList);
// generate the sequence
String ldapUrl = null;
for (int i = startingURLIndex; i < startingURLIndex + numURLs; i++) {
if (i > startingURLIndex)
ldapUrl = ldapUrl + " " + urlList.get(i % numURLs);
else
ldapUrl = urlList.get(i % numURLs);
if (type == URLTYPE_SINGLE)
break;
}
env.put(Context.PROVIDER_URL, ldapUrl);
env.remove(ENVKEY_ACTIVE_URL);
return env;
}
|
java
|
@SuppressWarnings("unchecked")
@Trivial
private List<String> getEnvURLList() {
return (List<String>) iEnvironment.get(ENVKEY_URL_LIST);
}
|
java
|
@Trivial
private String getNextURL(String currentURL) {
List<String> urlList = getEnvURLList();
int urlIndex = getURLIndex(currentURL, urlList);
return urlList.get((urlIndex + 1) % urlList.size());
}
|
java
|
@Trivial
@FFDCIgnore(NamingException.class)
private String getProviderURL(TimedDirContext ctx) {
try {
return (String) ctx.getEnvironment().get(Context.PROVIDER_URL);
} catch (NamingException e) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "getProviderURL", e.toString(true));
}
return "(null)";
}
}
|
java
|
private int getURLIndex(String url, List<String> urlList) {
int urlIndex = 0;
int numURLs = urlList.size();
// get URL index
if (url != null)
for (int i = 0; i < numURLs; i++)
if ((urlList.get(i)).equalsIgnoreCase(url)) {
urlIndex = i;
break;
}
return urlIndex;
}
|
java
|
private void handleBindStat(long elapsedTime) {
String METHODNAME = "handleBindStat(long)";
if (elapsedTime < LDAP_CONNECT_TIMEOUT_TRACE) {
QUICK_LDAP_BIND.getAndIncrement();
}
long now = System.currentTimeMillis();
/*
* Print out at most every 30 minutes the latest number of "quick" binds
*/
if (now - LDAP_STATS_TIMER.get() > 1800000) {
//Update the last update time, then make certain no one beat us to it
long lastUpdated = LDAP_STATS_TIMER.getAndSet(now);
if (now - lastUpdated > 1800000) {
if (tc.isDebugEnabled())
Tr.debug(tc, METHODNAME + " **LDAPBindStat: " + QUICK_LDAP_BIND.get() + " binds took less then " + LDAP_CONNECT_TIMEOUT_TRACE + " ms");
}
}
}
|
java
|
private static boolean isIPv6Addr(String host) {
if (host != null) {
if (host.contains("[") && host.contains("]"))
host = host.substring(host.indexOf("[") + 1, host.indexOf("]"));
host = host.toLowerCase();
Pattern p1 = Pattern.compile("^(?:(?:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9](?::|$)){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))$");
Pattern p2 = Pattern.compile("^(\\d{1,3}\\.){3}\\d{1,3}$");
Matcher m1 = p1.matcher(host);
boolean b1 = m1.matches();
Matcher m2 = p2.matcher(host);
boolean b2 = !m2.matches();
return b1 && b2;
} else {
return false;
}
}
|
java
|
public TimedDirContext reCreateDirContext(TimedDirContext oldCtx, String errorMessage) throws WIMSystemException {
final String METHODNAME = "DirContext reCreateDirContext(String errorMessage)";
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Communication exception occurs: " + errorMessage + " Creating a new connection.");
}
try {
Long oldCreateTimeStampSeconds = oldCtx.getCreateTimestamp();
TimedDirContext ctx;
/*
* If the old context was created before the context pool was created, then
* we can just request a context from the pool.
*
* If the pool is older than the context, then we should create a new context
* and also create a new context pool if context pooling is enabled.
*/
if (oldCreateTimeStampSeconds < iPoolCreateTimestampSeconds) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Pool refreshed, skip to getDirContext. oldCreateTimeStamp: " + oldCreateTimeStampSeconds + " iPoolCreateTimestampSeconds:"
+ iPoolCreateTimestampSeconds);
}
ctx = getDirContext();
} else {
String oldURL = getProviderURL(oldCtx);
ctx = createDirContext(getEnvironment(URLTYPE_SEQUENCE, getNextURL(oldURL)));
String newURL = getProviderURL(ctx);
synchronized (iLock) {
// Refresh context pool if another thread hasn't already done so
if (oldCtx.getCreateTimestamp() >= iPoolCreateTimestampSeconds) {
createContextPool(iLiveContexts - 1, newURL);
ctx.setCreateTimestamp(iPoolCreateTimestampSeconds);
}
}
}
oldCtx.close();
if (tc.isDebugEnabled())
Tr.debug(tc, WIMMessageKey.CURRENT_LDAP_SERVER, WIMMessageHelper.generateMsgParms(getActiveURL()));
return ctx;
} catch (NamingException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)));
throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
}
}
|
java
|
@FFDCIgnore(NamingException.class)
public void releaseDirContext(TimedDirContext ctx) throws WIMSystemException {
final String METHODNAME = "releaseDirContext";
if (iContextPoolEnabled) {
//Get the lock for the current domain
synchronized (iLock) {
// If the DirContextTTL is 0, no need to put it back to pool
// If the size of the pool is larger than minimum size or total dirContexts larger than max size
// If context URL no longer matches active URL, then discard
if (iContexts.size() >= iPrefPoolSize || (iMaxPoolSize != 0 && iLiveContexts > iMaxPoolSize)
|| ctx.getCreateTimestamp() < iPoolCreateTimestampSeconds
|| !getProviderURL(ctx).equalsIgnoreCase(getActiveURL())) {
try {
iLiveContexts--; //PM95697
ctx.close();
} catch (NamingException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)));
throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Context is discarded.");
}
} else {
if (iContexts != null && iContexts.size() > 0 && iContexts.contains(ctx)) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Context already present in Context pool. No need to add it again to context pool. ContextPool: total=" + iLiveContexts
+ ", poolSize=" + iContexts.size());
}
} else {
if (iContexts != null)
iContexts.add(ctx);
if (iPoolTimeOut > 0) {
ctx.setPoolTimeStamp(roundToSeconds(System.currentTimeMillis()));
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Before Notifying the waiting threads and Context is back to pool. ContextPool: total=" + iLiveContexts
+ ", poolSize=" + iContexts.size());
}
}
iLock.notifyAll();
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " Context is back to pool.");
}
}
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " ContextPool: total=" + iLiveContexts + ", poolSize=" + iContexts.size());
}
} else {
try {
ctx.close();
} catch (NamingException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)));
throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
}
}
}
|
java
|
public void getTraceSummaryLine(StringBuilder buff) {
// Need to trim the control message name, as many contain space padding
buff.append(getControlMessageType().toString().trim());
// Display the bit flags in hex form
buff.append(":flags=0x");
buff.append(Integer.toHexString(getFlags() & 0xff));
}
|
java
|
protected static void appendArray(StringBuilder buff, String name, String[] values) {
buff.append(',');
buff.append(name);
buff.append("=[");
if (values != null) {
for (int i = 0; i < values.length; i++) {
if (i != 0) buff.append(',');
buff.append(values[i]);
}
}
buff.append(']');
}
|
java
|
public void init(InputStream in) throws IOException
{
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"init", "init");
}
this.in = in;
next();
obs=null;
}
|
java
|
public void next()
{
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"next", "next");
}
length = -1;
limit = Long.MAX_VALUE; // PM03146
total = 0;
count = 0;
pos = 0;
}
|
java
|
public void finish() throws IOException
{
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"finish", "finish");
}
// PM18453 start
WebContainerRequestState requestState = WebContainerRequestState.getInstance(false);
if (requestState != null && (Boolean.valueOf((String)requestState.getAttribute("InputStreamEarlyReadCompleted"))).booleanValue()) {
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"finish", "Skip read because data has already been read and destroyed.");
}
total=limit;
}
// PM18453 End
else if (!SRTServletResponse.isSkipInputStreamRead() && length != -1 ) {
// if content length set then skip remaining bytes in message body
long remaining = limit - total; // PK79219
while ( remaining > 0 )
{
long n = skip(remaining); // PM03146
if ( n == 0 )
{
// begin 280584.3 6021: Cleanup of defect 280584.2 WAS.webcontainer
//logger.logp(Level.SEVERE, CLASS_NAME,"finish", nls.getString("Invalid.Content.Length"));
// end 280584.3 6021: Cleanup of defect 280584.2 WAS.webcontainer
throw new IOException(nls.getString("Invalid.Content.Length","Invalid content length"));
}
remaining -= n;
}
}
}
|
java
|
public void resets()
{
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"resets", "resets");
}
this.in = null;
}
|
java
|
public void setContentLength(long len)
{
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"setContentLength", "setContentLength --> "+len);
}
if ( len < 0 )
{
logger.logp(Level.SEVERE, CLASS_NAME,"setContentLength", "Illegal.Argument.Invalid.Content.Length");
throw new IllegalArgumentException(nls.getString("Illegal.Argument.Invalid.Content.Length","Illegal Argument: Invalid Content Length"));
}
length = len;
if ( Long.MAX_VALUE - total > len ) // PK79219
{
limit = total + len;
}
}
|
java
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.