repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
sequence | docstring
stringlengths 3
16k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 105
339
| partition
stringclasses 1
value |
---|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/client/injection/InjectionHelper.java | InjectionHelper.getTypeFromMember | static Class<?> getTypeFromMember(Member member) throws InjectionException {
Class<?> memberType = null;
if (member instanceof Field) {
memberType = ((Field) member).getType();
} else if (member instanceof Method) {
Method method = (Method) member;
if (method.getParameterTypes() == null || method.getParameterTypes().length != 1) {
String msg = Tr.formatMessage(tc, "error.service.ref.member.level.annotation.wrong.method.name",
method.getName(), method.getDeclaringClass().getName());
throw new InjectionException(msg);
}
memberType = method.getParameterTypes()[0];
}
return memberType;
} | java | static Class<?> getTypeFromMember(Member member) throws InjectionException {
Class<?> memberType = null;
if (member instanceof Field) {
memberType = ((Field) member).getType();
} else if (member instanceof Method) {
Method method = (Method) member;
if (method.getParameterTypes() == null || method.getParameterTypes().length != 1) {
String msg = Tr.formatMessage(tc, "error.service.ref.member.level.annotation.wrong.method.name",
method.getName(), method.getDeclaringClass().getName());
throw new InjectionException(msg);
}
memberType = method.getParameterTypes()[0];
}
return memberType;
} | [
"static",
"Class",
"<",
"?",
">",
"getTypeFromMember",
"(",
"Member",
"member",
")",
"throws",
"InjectionException",
"{",
"Class",
"<",
"?",
">",
"memberType",
"=",
"null",
";",
"if",
"(",
"member",
"instanceof",
"Field",
")",
"{",
"memberType",
"=",
"(",
"(",
"Field",
")",
"member",
")",
".",
"getType",
"(",
")",
";",
"}",
"else",
"if",
"(",
"member",
"instanceof",
"Method",
")",
"{",
"Method",
"method",
"=",
"(",
"Method",
")",
"member",
";",
"if",
"(",
"method",
".",
"getParameterTypes",
"(",
")",
"==",
"null",
"||",
"method",
".",
"getParameterTypes",
"(",
")",
".",
"length",
"!=",
"1",
")",
"{",
"String",
"msg",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"error.service.ref.member.level.annotation.wrong.method.name\"",
",",
"method",
".",
"getName",
"(",
")",
",",
"method",
".",
"getDeclaringClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"throw",
"new",
"InjectionException",
"(",
"msg",
")",
";",
"}",
"memberType",
"=",
"method",
".",
"getParameterTypes",
"(",
")",
"[",
"0",
"]",
";",
"}",
"return",
"memberType",
";",
"}"
] | This returns the type of the injection being requested based on either the
annotated field or annotated method. | [
"This",
"returns",
"the",
"type",
"of",
"the",
"injection",
"being",
"requested",
"based",
"on",
"either",
"the",
"annotated",
"field",
"or",
"annotated",
"method",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/client/injection/InjectionHelper.java#L42-L56 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/StaticCATHelper.java | StaticCATHelper.sendExceptionToClient | public static void sendExceptionToClient(Throwable throwable, String probeId,
Conversation conversation, int requestNumber) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "sendExceptionToClient",
new Object[]
{
throwable,
probeId,
conversation,
requestNumber
});
CommsByteBuffer buffer = poolManager.allocate();
buffer.putException(throwable, probeId, conversation);
// defect 99984 checking whether jmsServer feature is intact or its removed
if (CommsServerServiceFacade.getJsAdminService() != null)
{
try {
conversation.send(buffer,
JFapChannelConstants.SEG_EXCEPTION,
requestNumber,
JFapChannelConstants.PRIORITY_MEDIUM,
true,
ThrottlingPolicy.BLOCK_THREAD,
null);
} catch (SIException c) {
FFDCFilter.processException(c, CLASS_NAME + ".sendExceptionToClient",
CommsConstants.STATICCATHELPER_SEND_EXCEP_01);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2023", c);
}
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "conversation send is not being called as jmsadminService is null");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "sendExceptionToClient");
} | java | public static void sendExceptionToClient(Throwable throwable, String probeId,
Conversation conversation, int requestNumber) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "sendExceptionToClient",
new Object[]
{
throwable,
probeId,
conversation,
requestNumber
});
CommsByteBuffer buffer = poolManager.allocate();
buffer.putException(throwable, probeId, conversation);
// defect 99984 checking whether jmsServer feature is intact or its removed
if (CommsServerServiceFacade.getJsAdminService() != null)
{
try {
conversation.send(buffer,
JFapChannelConstants.SEG_EXCEPTION,
requestNumber,
JFapChannelConstants.PRIORITY_MEDIUM,
true,
ThrottlingPolicy.BLOCK_THREAD,
null);
} catch (SIException c) {
FFDCFilter.processException(c, CLASS_NAME + ".sendExceptionToClient",
CommsConstants.STATICCATHELPER_SEND_EXCEP_01);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2023", c);
}
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "conversation send is not being called as jmsadminService is null");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "sendExceptionToClient");
} | [
"public",
"static",
"void",
"sendExceptionToClient",
"(",
"Throwable",
"throwable",
",",
"String",
"probeId",
",",
"Conversation",
"conversation",
",",
"int",
"requestNumber",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"sendExceptionToClient\"",
",",
"new",
"Object",
"[",
"]",
"{",
"throwable",
",",
"probeId",
",",
"conversation",
",",
"requestNumber",
"}",
")",
";",
"CommsByteBuffer",
"buffer",
"=",
"poolManager",
".",
"allocate",
"(",
")",
";",
"buffer",
".",
"putException",
"(",
"throwable",
",",
"probeId",
",",
"conversation",
")",
";",
"// defect 99984 checking whether jmsServer feature is intact or its removed ",
"if",
"(",
"CommsServerServiceFacade",
".",
"getJsAdminService",
"(",
")",
"!=",
"null",
")",
"{",
"try",
"{",
"conversation",
".",
"send",
"(",
"buffer",
",",
"JFapChannelConstants",
".",
"SEG_EXCEPTION",
",",
"requestNumber",
",",
"JFapChannelConstants",
".",
"PRIORITY_MEDIUM",
",",
"true",
",",
"ThrottlingPolicy",
".",
"BLOCK_THREAD",
",",
"null",
")",
";",
"}",
"catch",
"(",
"SIException",
"c",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"c",
",",
"CLASS_NAME",
"+",
"\".sendExceptionToClient\"",
",",
"CommsConstants",
".",
"STATICCATHELPER_SEND_EXCEP_01",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"COMMUNICATION_ERROR_SICO2023\"",
",",
"c",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"conversation send is not being called as jmsadminService is null\"",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"sendExceptionToClient\"",
")",
";",
"}"
] | Sends an exception response back to the client.
@param throwable The exception to send back
@param probeId The probe ID of any corresponding FFDC record.
@param conversation The conversaton to use.
@param requestNumber The request number to reply with. | [
"Sends",
"an",
"exception",
"response",
"back",
"to",
"the",
"client",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/StaticCATHelper.java#L76-L116 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/StaticCATHelper.java | StaticCATHelper.sendAsyncExceptionToClient | public static void sendAsyncExceptionToClient(Throwable throwable,
String probeId, short clientSessionId,
Conversation conversation, int requestNumber) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "sendAsyncExceptionToClient",
new Object[]
{
throwable,
probeId,
"" + clientSessionId,
conversation,
"" + requestNumber
});
// BIT16 ConnectionObjectId
// BIT16 Event Id
// BIT16 ConsumerSessionId
// Exception...
CommsByteBuffer buffer = poolManager.allocate();
buffer.putShort(0); // We do not need the connection object ID on the client
buffer.putShort(CommsConstants.EVENTID_ASYNC_EXCEPTION); // Async exception
buffer.putShort(clientSessionId);
buffer.putException(throwable, probeId, conversation);
try {
conversation.send(buffer,
JFapChannelConstants.SEG_EVENT_OCCURRED,
requestNumber,
JFapChannelConstants.PRIORITY_MEDIUM,
true,
ThrottlingPolicy.BLOCK_THREAD,
null);
} catch (SIException c) {
FFDCFilter.processException(c, CLASS_NAME + ".sendAsyncExceptionToClient",
CommsConstants.STATICCATHELPER_SEND_ASEXCEP_01);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2023", c);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "sendAsyncExceptionToClient");
} | java | public static void sendAsyncExceptionToClient(Throwable throwable,
String probeId, short clientSessionId,
Conversation conversation, int requestNumber) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "sendAsyncExceptionToClient",
new Object[]
{
throwable,
probeId,
"" + clientSessionId,
conversation,
"" + requestNumber
});
// BIT16 ConnectionObjectId
// BIT16 Event Id
// BIT16 ConsumerSessionId
// Exception...
CommsByteBuffer buffer = poolManager.allocate();
buffer.putShort(0); // We do not need the connection object ID on the client
buffer.putShort(CommsConstants.EVENTID_ASYNC_EXCEPTION); // Async exception
buffer.putShort(clientSessionId);
buffer.putException(throwable, probeId, conversation);
try {
conversation.send(buffer,
JFapChannelConstants.SEG_EVENT_OCCURRED,
requestNumber,
JFapChannelConstants.PRIORITY_MEDIUM,
true,
ThrottlingPolicy.BLOCK_THREAD,
null);
} catch (SIException c) {
FFDCFilter.processException(c, CLASS_NAME + ".sendAsyncExceptionToClient",
CommsConstants.STATICCATHELPER_SEND_ASEXCEP_01);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2023", c);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "sendAsyncExceptionToClient");
} | [
"public",
"static",
"void",
"sendAsyncExceptionToClient",
"(",
"Throwable",
"throwable",
",",
"String",
"probeId",
",",
"short",
"clientSessionId",
",",
"Conversation",
"conversation",
",",
"int",
"requestNumber",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"sendAsyncExceptionToClient\"",
",",
"new",
"Object",
"[",
"]",
"{",
"throwable",
",",
"probeId",
",",
"\"\"",
"+",
"clientSessionId",
",",
"conversation",
",",
"\"\"",
"+",
"requestNumber",
"}",
")",
";",
"// BIT16 ConnectionObjectId",
"// BIT16 Event Id",
"// BIT16 ConsumerSessionId",
"// Exception...",
"CommsByteBuffer",
"buffer",
"=",
"poolManager",
".",
"allocate",
"(",
")",
";",
"buffer",
".",
"putShort",
"(",
"0",
")",
";",
"// We do not need the connection object ID on the client",
"buffer",
".",
"putShort",
"(",
"CommsConstants",
".",
"EVENTID_ASYNC_EXCEPTION",
")",
";",
"// Async exception",
"buffer",
".",
"putShort",
"(",
"clientSessionId",
")",
";",
"buffer",
".",
"putException",
"(",
"throwable",
",",
"probeId",
",",
"conversation",
")",
";",
"try",
"{",
"conversation",
".",
"send",
"(",
"buffer",
",",
"JFapChannelConstants",
".",
"SEG_EVENT_OCCURRED",
",",
"requestNumber",
",",
"JFapChannelConstants",
".",
"PRIORITY_MEDIUM",
",",
"true",
",",
"ThrottlingPolicy",
".",
"BLOCK_THREAD",
",",
"null",
")",
";",
"}",
"catch",
"(",
"SIException",
"c",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"c",
",",
"CLASS_NAME",
"+",
"\".sendAsyncExceptionToClient\"",
",",
"CommsConstants",
".",
"STATICCATHELPER_SEND_ASEXCEP_01",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"COMMUNICATION_ERROR_SICO2023\"",
",",
"c",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"sendAsyncExceptionToClient\"",
")",
";",
"}"
] | This method is used to flow a message down to the client that will get picked up
and delivered to the asynchronousException method of any listeners that the client
has registered.
@param throwable
@param probeId
@param clientSessionId
@param conversation
@param requestNumber | [
"This",
"method",
"is",
"used",
"to",
"flow",
"a",
"message",
"down",
"to",
"the",
"client",
"that",
"will",
"get",
"picked",
"up",
"and",
"delivered",
"to",
"the",
"asynchronousException",
"method",
"of",
"any",
"listeners",
"that",
"the",
"client",
"has",
"registered",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/StaticCATHelper.java#L129-L170 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/StaticCATHelper.java | StaticCATHelper.sendSessionCreateResponse | public static void sendSessionCreateResponse(int segmentType, int requestNumber,
Conversation conversation, short sessionId,
DestinationSession session,
SIDestinationAddress originalDestinationAddr) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "sendSessionCreateResponse");
CommsByteBuffer buffer = poolManager.allocate();
// Add the Message processor session id if we are sending back a consumer response
if (segmentType == JFapChannelConstants.SEG_CREATE_CONS_FOR_DURABLE_SUB_R ||
segmentType == JFapChannelConstants.SEG_CREATE_CONSUMER_SESS_R) {
long id = 0;
try {
id = ((ConsumerSession) session).getId();
} catch (SIException e) {
//No FFDC code needed
//Only FFDC if we haven't received a meTerminated event.
if (!((ConversationState) conversation.getAttachment()).hasMETerminated()) {
FFDCFilter.processException(e, CLASS_NAME + ".sendSessionCreateResponse",
CommsConstants.STATICCATHELPER_SENDSESSRESPONSE_02);
}
// Not a lot we can do here - so just debug the error
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Unable to get session id", e);
}
buffer.putLong(id);
}
if (segmentType == JFapChannelConstants.SEG_CREATE_CONSUMER_SESS_R) {
buffer.putShort(CommsConstants.CF_UNICAST);
}
buffer.putShort(sessionId);
// Now get the destination address from the session so we can get sizes
JsDestinationAddress destAddress = (JsDestinationAddress) session.getDestinationAddress();
// We should only send back the destination address if it is different from the original.
// To do this, we can do a simple compare on their toString() methods.
if (originalDestinationAddr == null ||
(!originalDestinationAddr.toString().equals(destAddress.toString()))) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Destination address is different: Orig, New",
new Object[]
{
originalDestinationAddr,
destAddress
});
buffer.putSIDestinationAddress(destAddress, conversation.getHandshakeProperties().getFapLevel());
}
try {
// Send the response to the client.
conversation.send(buffer,
segmentType,
requestNumber,
JFapChannelConstants.PRIORITY_MEDIUM,
true,
ThrottlingPolicy.BLOCK_THREAD,
null);
} catch (SIException e) {
FFDCFilter.processException(e,
CLASS_NAME + ".sendSessionCreateResponse",
CommsConstants.STATICCATHELPER_SENDSESSRESPONSE_01);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, e.getMessage(), e);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2023", e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "sendSessionCreateResponse");
} | java | public static void sendSessionCreateResponse(int segmentType, int requestNumber,
Conversation conversation, short sessionId,
DestinationSession session,
SIDestinationAddress originalDestinationAddr) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "sendSessionCreateResponse");
CommsByteBuffer buffer = poolManager.allocate();
// Add the Message processor session id if we are sending back a consumer response
if (segmentType == JFapChannelConstants.SEG_CREATE_CONS_FOR_DURABLE_SUB_R ||
segmentType == JFapChannelConstants.SEG_CREATE_CONSUMER_SESS_R) {
long id = 0;
try {
id = ((ConsumerSession) session).getId();
} catch (SIException e) {
//No FFDC code needed
//Only FFDC if we haven't received a meTerminated event.
if (!((ConversationState) conversation.getAttachment()).hasMETerminated()) {
FFDCFilter.processException(e, CLASS_NAME + ".sendSessionCreateResponse",
CommsConstants.STATICCATHELPER_SENDSESSRESPONSE_02);
}
// Not a lot we can do here - so just debug the error
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Unable to get session id", e);
}
buffer.putLong(id);
}
if (segmentType == JFapChannelConstants.SEG_CREATE_CONSUMER_SESS_R) {
buffer.putShort(CommsConstants.CF_UNICAST);
}
buffer.putShort(sessionId);
// Now get the destination address from the session so we can get sizes
JsDestinationAddress destAddress = (JsDestinationAddress) session.getDestinationAddress();
// We should only send back the destination address if it is different from the original.
// To do this, we can do a simple compare on their toString() methods.
if (originalDestinationAddr == null ||
(!originalDestinationAddr.toString().equals(destAddress.toString()))) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Destination address is different: Orig, New",
new Object[]
{
originalDestinationAddr,
destAddress
});
buffer.putSIDestinationAddress(destAddress, conversation.getHandshakeProperties().getFapLevel());
}
try {
// Send the response to the client.
conversation.send(buffer,
segmentType,
requestNumber,
JFapChannelConstants.PRIORITY_MEDIUM,
true,
ThrottlingPolicy.BLOCK_THREAD,
null);
} catch (SIException e) {
FFDCFilter.processException(e,
CLASS_NAME + ".sendSessionCreateResponse",
CommsConstants.STATICCATHELPER_SENDSESSRESPONSE_01);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, e.getMessage(), e);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2023", e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "sendSessionCreateResponse");
} | [
"public",
"static",
"void",
"sendSessionCreateResponse",
"(",
"int",
"segmentType",
",",
"int",
"requestNumber",
",",
"Conversation",
"conversation",
",",
"short",
"sessionId",
",",
"DestinationSession",
"session",
",",
"SIDestinationAddress",
"originalDestinationAddr",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"sendSessionCreateResponse\"",
")",
";",
"CommsByteBuffer",
"buffer",
"=",
"poolManager",
".",
"allocate",
"(",
")",
";",
"// Add the Message processor session id if we are sending back a consumer response",
"if",
"(",
"segmentType",
"==",
"JFapChannelConstants",
".",
"SEG_CREATE_CONS_FOR_DURABLE_SUB_R",
"||",
"segmentType",
"==",
"JFapChannelConstants",
".",
"SEG_CREATE_CONSUMER_SESS_R",
")",
"{",
"long",
"id",
"=",
"0",
";",
"try",
"{",
"id",
"=",
"(",
"(",
"ConsumerSession",
")",
"session",
")",
".",
"getId",
"(",
")",
";",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"//No FFDC code needed",
"//Only FFDC if we haven't received a meTerminated event.",
"if",
"(",
"!",
"(",
"(",
"ConversationState",
")",
"conversation",
".",
"getAttachment",
"(",
")",
")",
".",
"hasMETerminated",
"(",
")",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".sendSessionCreateResponse\"",
",",
"CommsConstants",
".",
"STATICCATHELPER_SENDSESSRESPONSE_02",
")",
";",
"}",
"// Not a lot we can do here - so just debug the error",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Unable to get session id\"",
",",
"e",
")",
";",
"}",
"buffer",
".",
"putLong",
"(",
"id",
")",
";",
"}",
"if",
"(",
"segmentType",
"==",
"JFapChannelConstants",
".",
"SEG_CREATE_CONSUMER_SESS_R",
")",
"{",
"buffer",
".",
"putShort",
"(",
"CommsConstants",
".",
"CF_UNICAST",
")",
";",
"}",
"buffer",
".",
"putShort",
"(",
"sessionId",
")",
";",
"// Now get the destination address from the session so we can get sizes",
"JsDestinationAddress",
"destAddress",
"=",
"(",
"JsDestinationAddress",
")",
"session",
".",
"getDestinationAddress",
"(",
")",
";",
"// We should only send back the destination address if it is different from the original.",
"// To do this, we can do a simple compare on their toString() methods.",
"if",
"(",
"originalDestinationAddr",
"==",
"null",
"||",
"(",
"!",
"originalDestinationAddr",
".",
"toString",
"(",
")",
".",
"equals",
"(",
"destAddress",
".",
"toString",
"(",
")",
")",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Destination address is different: Orig, New\"",
",",
"new",
"Object",
"[",
"]",
"{",
"originalDestinationAddr",
",",
"destAddress",
"}",
")",
";",
"buffer",
".",
"putSIDestinationAddress",
"(",
"destAddress",
",",
"conversation",
".",
"getHandshakeProperties",
"(",
")",
".",
"getFapLevel",
"(",
")",
")",
";",
"}",
"try",
"{",
"// Send the response to the client.",
"conversation",
".",
"send",
"(",
"buffer",
",",
"segmentType",
",",
"requestNumber",
",",
"JFapChannelConstants",
".",
"PRIORITY_MEDIUM",
",",
"true",
",",
"ThrottlingPolicy",
".",
"BLOCK_THREAD",
",",
"null",
")",
";",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".sendSessionCreateResponse\"",
",",
"CommsConstants",
".",
"STATICCATHELPER_SENDSESSRESPONSE_01",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"COMMUNICATION_ERROR_SICO2023\"",
",",
"e",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"sendSessionCreateResponse\"",
")",
";",
"}"
] | Because of the larger amount of data needed to be sent back on the response to a session
create, I have split this into a seperate method so that we are not repeating code
all over the place.
@param segmentType The segment type to send the response with.
@param requestNumber The request number we are replying to.
@param conversation The conversation to send the reply on.
@param sessionId The session id of the session we just created.
@param session The session.
@param originalDestinationAddr The original address that was passed in. We will only send back
a destination address if the actual one is different. | [
"Because",
"of",
"the",
"larger",
"amount",
"of",
"data",
"needed",
"to",
"be",
"sent",
"back",
"on",
"the",
"response",
"to",
"a",
"session",
"create",
"I",
"have",
"split",
"this",
"into",
"a",
"seperate",
"method",
"so",
"that",
"we",
"are",
"not",
"repeating",
"code",
"all",
"over",
"the",
"place",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/StaticCATHelper.java#L189-L265 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/JavaDumper.java | JavaDumper.createInstance | private static JavaDumper createInstance() {
try {
// Try to find IBM Java dumper class.
Class<?> dumpClass = Class.forName("com.ibm.jvm.Dump");
try {
// Try to find the IBM Java 7.1 dump methods.
Class<?>[] paramTypes = new Class<?>[] { String.class };
Method javaDumpToFileMethod = dumpClass.getMethod("javaDumpToFile", paramTypes);
Method heapDumpToFileMethod = dumpClass.getMethod("heapDumpToFile", paramTypes);
Method systemDumpToFileMethod = dumpClass.getMethod("systemDumpToFile", paramTypes);
return new IBMJavaDumperImpl(javaDumpToFileMethod, heapDumpToFileMethod, systemDumpToFileMethod);
} catch (NoSuchMethodException e) {
return new IBMLegacyJavaDumperImpl(dumpClass);
}
} catch (ClassNotFoundException ex) {
// Try to find HotSpot MBeans.
ObjectName diagName;
ObjectName diagCommandName;
try {
diagName = new ObjectName("com.sun.management:type=HotSpotDiagnostic");
diagCommandName = new ObjectName("com.sun.management:type=DiagnosticCommand");
} catch (MalformedObjectNameException ex2) {
throw new IllegalStateException(ex2);
}
MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
if (!mbeanServer.isRegistered(diagName)) {
diagName = null;
}
if (!mbeanServer.isRegistered(diagCommandName)) {
diagCommandName = null;
}
return new HotSpotJavaDumperImpl(mbeanServer, diagName, diagCommandName);
}
} | java | private static JavaDumper createInstance() {
try {
// Try to find IBM Java dumper class.
Class<?> dumpClass = Class.forName("com.ibm.jvm.Dump");
try {
// Try to find the IBM Java 7.1 dump methods.
Class<?>[] paramTypes = new Class<?>[] { String.class };
Method javaDumpToFileMethod = dumpClass.getMethod("javaDumpToFile", paramTypes);
Method heapDumpToFileMethod = dumpClass.getMethod("heapDumpToFile", paramTypes);
Method systemDumpToFileMethod = dumpClass.getMethod("systemDumpToFile", paramTypes);
return new IBMJavaDumperImpl(javaDumpToFileMethod, heapDumpToFileMethod, systemDumpToFileMethod);
} catch (NoSuchMethodException e) {
return new IBMLegacyJavaDumperImpl(dumpClass);
}
} catch (ClassNotFoundException ex) {
// Try to find HotSpot MBeans.
ObjectName diagName;
ObjectName diagCommandName;
try {
diagName = new ObjectName("com.sun.management:type=HotSpotDiagnostic");
diagCommandName = new ObjectName("com.sun.management:type=DiagnosticCommand");
} catch (MalformedObjectNameException ex2) {
throw new IllegalStateException(ex2);
}
MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
if (!mbeanServer.isRegistered(diagName)) {
diagName = null;
}
if (!mbeanServer.isRegistered(diagCommandName)) {
diagCommandName = null;
}
return new HotSpotJavaDumperImpl(mbeanServer, diagName, diagCommandName);
}
} | [
"private",
"static",
"JavaDumper",
"createInstance",
"(",
")",
"{",
"try",
"{",
"// Try to find IBM Java dumper class.",
"Class",
"<",
"?",
">",
"dumpClass",
"=",
"Class",
".",
"forName",
"(",
"\"com.ibm.jvm.Dump\"",
")",
";",
"try",
"{",
"// Try to find the IBM Java 7.1 dump methods.",
"Class",
"<",
"?",
">",
"[",
"]",
"paramTypes",
"=",
"new",
"Class",
"<",
"?",
">",
"[",
"]",
"{",
"String",
".",
"class",
"}",
";",
"Method",
"javaDumpToFileMethod",
"=",
"dumpClass",
".",
"getMethod",
"(",
"\"javaDumpToFile\"",
",",
"paramTypes",
")",
";",
"Method",
"heapDumpToFileMethod",
"=",
"dumpClass",
".",
"getMethod",
"(",
"\"heapDumpToFile\"",
",",
"paramTypes",
")",
";",
"Method",
"systemDumpToFileMethod",
"=",
"dumpClass",
".",
"getMethod",
"(",
"\"systemDumpToFile\"",
",",
"paramTypes",
")",
";",
"return",
"new",
"IBMJavaDumperImpl",
"(",
"javaDumpToFileMethod",
",",
"heapDumpToFileMethod",
",",
"systemDumpToFileMethod",
")",
";",
"}",
"catch",
"(",
"NoSuchMethodException",
"e",
")",
"{",
"return",
"new",
"IBMLegacyJavaDumperImpl",
"(",
"dumpClass",
")",
";",
"}",
"}",
"catch",
"(",
"ClassNotFoundException",
"ex",
")",
"{",
"// Try to find HotSpot MBeans.",
"ObjectName",
"diagName",
";",
"ObjectName",
"diagCommandName",
";",
"try",
"{",
"diagName",
"=",
"new",
"ObjectName",
"(",
"\"com.sun.management:type=HotSpotDiagnostic\"",
")",
";",
"diagCommandName",
"=",
"new",
"ObjectName",
"(",
"\"com.sun.management:type=DiagnosticCommand\"",
")",
";",
"}",
"catch",
"(",
"MalformedObjectNameException",
"ex2",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"ex2",
")",
";",
"}",
"MBeanServer",
"mbeanServer",
"=",
"ManagementFactory",
".",
"getPlatformMBeanServer",
"(",
")",
";",
"if",
"(",
"!",
"mbeanServer",
".",
"isRegistered",
"(",
"diagName",
")",
")",
"{",
"diagName",
"=",
"null",
";",
"}",
"if",
"(",
"!",
"mbeanServer",
".",
"isRegistered",
"(",
"diagCommandName",
")",
")",
"{",
"diagCommandName",
"=",
"null",
";",
"}",
"return",
"new",
"HotSpotJavaDumperImpl",
"(",
"mbeanServer",
",",
"diagName",
",",
"diagCommandName",
")",
";",
"}",
"}"
] | Create a dumper for the current JVM. | [
"Create",
"a",
"dumper",
"for",
"the",
"current",
"JVM",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/JavaDumper.java#L27-L62 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxrs.2.1.common/src/com/ibm/ws/jaxrs20/clientconfig/JAXRSClientConfigImpl.java | JAXRSClientConfigImpl.filterProps | private Map<String, String> filterProps(Map<String, Object> props) {
HashMap<String, String> filteredProps = new HashMap<>();
Iterator<String> it = props.keySet().iterator();
boolean debug = tc.isDebugEnabled() && TraceComponent.isAnyTracingEnabled();
while (it.hasNext()) {
String key = it.next();
String newKey = null;
if (debug) {
Tr.debug(tc, "key: " + key + " value: " + props.get(key));
}
// skip stuff we don't care about
if (propertiesToRemove.contains(key)) {
continue;
}
// convert from shorthand key (timeout) to actual prop name (com.ibm.way.too.long.name.timeout)
// note that this swap is NOT case sensitive.
newKey = key;
if (propsToTranslate.containsKey(key.toLowerCase())) {
newKey = propsToTranslate.get(key.toLowerCase());
if (debug) {
Tr.debug(tc, " translated " + key + " to " + newKey);
}
}
filteredProps.put(newKey, props.get(key).toString());
// special case for authnToken
if (newKey.compareTo("authnToken") == 0) {
String replacementKey = validateAuthn(props.get(key).toString());
if (replacementKey != null) {
filteredProps.remove(newKey);
filteredProps.put(replacementKey, "true");
} else {
filteredProps.remove(newKey); // invalid token type, back it out.
}
}
}
return filteredProps;
} | java | private Map<String, String> filterProps(Map<String, Object> props) {
HashMap<String, String> filteredProps = new HashMap<>();
Iterator<String> it = props.keySet().iterator();
boolean debug = tc.isDebugEnabled() && TraceComponent.isAnyTracingEnabled();
while (it.hasNext()) {
String key = it.next();
String newKey = null;
if (debug) {
Tr.debug(tc, "key: " + key + " value: " + props.get(key));
}
// skip stuff we don't care about
if (propertiesToRemove.contains(key)) {
continue;
}
// convert from shorthand key (timeout) to actual prop name (com.ibm.way.too.long.name.timeout)
// note that this swap is NOT case sensitive.
newKey = key;
if (propsToTranslate.containsKey(key.toLowerCase())) {
newKey = propsToTranslate.get(key.toLowerCase());
if (debug) {
Tr.debug(tc, " translated " + key + " to " + newKey);
}
}
filteredProps.put(newKey, props.get(key).toString());
// special case for authnToken
if (newKey.compareTo("authnToken") == 0) {
String replacementKey = validateAuthn(props.get(key).toString());
if (replacementKey != null) {
filteredProps.remove(newKey);
filteredProps.put(replacementKey, "true");
} else {
filteredProps.remove(newKey); // invalid token type, back it out.
}
}
}
return filteredProps;
} | [
"private",
"Map",
"<",
"String",
",",
"String",
">",
"filterProps",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"props",
")",
"{",
"HashMap",
"<",
"String",
",",
"String",
">",
"filteredProps",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"Iterator",
"<",
"String",
">",
"it",
"=",
"props",
".",
"keySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"boolean",
"debug",
"=",
"tc",
".",
"isDebugEnabled",
"(",
")",
"&&",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"String",
"key",
"=",
"it",
".",
"next",
"(",
")",
";",
"String",
"newKey",
"=",
"null",
";",
"if",
"(",
"debug",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"key: \"",
"+",
"key",
"+",
"\" value: \"",
"+",
"props",
".",
"get",
"(",
"key",
")",
")",
";",
"}",
"// skip stuff we don't care about",
"if",
"(",
"propertiesToRemove",
".",
"contains",
"(",
"key",
")",
")",
"{",
"continue",
";",
"}",
"// convert from shorthand key (timeout) to actual prop name (com.ibm.way.too.long.name.timeout)",
"// note that this swap is NOT case sensitive.",
"newKey",
"=",
"key",
";",
"if",
"(",
"propsToTranslate",
".",
"containsKey",
"(",
"key",
".",
"toLowerCase",
"(",
")",
")",
")",
"{",
"newKey",
"=",
"propsToTranslate",
".",
"get",
"(",
"key",
".",
"toLowerCase",
"(",
")",
")",
";",
"if",
"(",
"debug",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\" translated \"",
"+",
"key",
"+",
"\" to \"",
"+",
"newKey",
")",
";",
"}",
"}",
"filteredProps",
".",
"put",
"(",
"newKey",
",",
"props",
".",
"get",
"(",
"key",
")",
".",
"toString",
"(",
")",
")",
";",
"// special case for authnToken",
"if",
"(",
"newKey",
".",
"compareTo",
"(",
"\"authnToken\"",
")",
"==",
"0",
")",
"{",
"String",
"replacementKey",
"=",
"validateAuthn",
"(",
"props",
".",
"get",
"(",
"key",
")",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"replacementKey",
"!=",
"null",
")",
"{",
"filteredProps",
".",
"remove",
"(",
"newKey",
")",
";",
"filteredProps",
".",
"put",
"(",
"replacementKey",
",",
"\"true\"",
")",
";",
"}",
"else",
"{",
"filteredProps",
".",
"remove",
"(",
"newKey",
")",
";",
"// invalid token type, back it out.",
"}",
"}",
"}",
"return",
"filteredProps",
";",
"}"
] | given the map of properties, remove ones we don't care about, and translate some others.
If it's not one we're familiar with, transfer it unaltered
@param props - input list of properties
@return - a new Map of the filtered properties. | [
"given",
"the",
"map",
"of",
"properties",
"remove",
"ones",
"we",
"don",
"t",
"care",
"about",
"and",
"translate",
"some",
"others",
".",
"If",
"it",
"s",
"not",
"one",
"we",
"re",
"familiar",
"with",
"transfer",
"it",
"unaltered"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.1.common/src/com/ibm/ws/jaxrs20/clientconfig/JAXRSClientConfigImpl.java#L73-L113 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxrs.2.1.common/src/com/ibm/ws/jaxrs20/clientconfig/JAXRSClientConfigImpl.java | JAXRSClientConfigImpl.validateAuthn | private String validateAuthn(String value) {
// for now, if we got here we're validating an authnToken
String result = null;
String valueLower = value.toLowerCase();
do {
if (valueLower.equals("saml")) {
result = JAXRSClientConstants.SAML_HANDLER;
break;
}
if (valueLower.equals("oauth")) {
result = JAXRSClientConstants.OAUTH_HANDLER;
break;
}
if (valueLower.equals("ltpa")) {
result = JAXRSClientConstants.LTPA_HANDLER;
}
} while (false);
if (result == null) {
Tr.warning(tc, "warn.invalid.authorization.token.type", value); // CWWKW0061W
}
return result;
} | java | private String validateAuthn(String value) {
// for now, if we got here we're validating an authnToken
String result = null;
String valueLower = value.toLowerCase();
do {
if (valueLower.equals("saml")) {
result = JAXRSClientConstants.SAML_HANDLER;
break;
}
if (valueLower.equals("oauth")) {
result = JAXRSClientConstants.OAUTH_HANDLER;
break;
}
if (valueLower.equals("ltpa")) {
result = JAXRSClientConstants.LTPA_HANDLER;
}
} while (false);
if (result == null) {
Tr.warning(tc, "warn.invalid.authorization.token.type", value); // CWWKW0061W
}
return result;
} | [
"private",
"String",
"validateAuthn",
"(",
"String",
"value",
")",
"{",
"// for now, if we got here we're validating an authnToken",
"String",
"result",
"=",
"null",
";",
"String",
"valueLower",
"=",
"value",
".",
"toLowerCase",
"(",
")",
";",
"do",
"{",
"if",
"(",
"valueLower",
".",
"equals",
"(",
"\"saml\"",
")",
")",
"{",
"result",
"=",
"JAXRSClientConstants",
".",
"SAML_HANDLER",
";",
"break",
";",
"}",
"if",
"(",
"valueLower",
".",
"equals",
"(",
"\"oauth\"",
")",
")",
"{",
"result",
"=",
"JAXRSClientConstants",
".",
"OAUTH_HANDLER",
";",
"break",
";",
"}",
"if",
"(",
"valueLower",
".",
"equals",
"(",
"\"ltpa\"",
")",
")",
"{",
"result",
"=",
"JAXRSClientConstants",
".",
"LTPA_HANDLER",
";",
"}",
"}",
"while",
"(",
"false",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"Tr",
".",
"warning",
"(",
"tc",
",",
"\"warn.invalid.authorization.token.type\"",
",",
"value",
")",
";",
"// CWWKW0061W",
"}",
"return",
"result",
";",
"}"
] | validate the value for authnToken key and select appropriate new key
Note that the check is not case sensitive.
@param value - shorthand key name
@return long property name | [
"validate",
"the",
"value",
"for",
"authnToken",
"key",
"and",
"select",
"appropriate",
"new",
"key",
"Note",
"that",
"the",
"check",
"is",
"not",
"case",
"sensitive",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.1.common/src/com/ibm/ws/jaxrs20/clientconfig/JAXRSClientConfigImpl.java#L122-L143 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxrs.2.1.common/src/com/ibm/ws/jaxrs20/clientconfig/JAXRSClientConfigImpl.java | JAXRSClientConfigImpl.getURI | private String getURI(Map<String, Object> props) {
if (props == null)
return null;
if (props.keySet().contains(URI)) {
return (props.get(URI).toString());
} else {
return null;
}
} | java | private String getURI(Map<String, Object> props) {
if (props == null)
return null;
if (props.keySet().contains(URI)) {
return (props.get(URI).toString());
} else {
return null;
}
} | [
"private",
"String",
"getURI",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"props",
")",
"{",
"if",
"(",
"props",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"props",
".",
"keySet",
"(",
")",
".",
"contains",
"(",
"URI",
")",
")",
"{",
"return",
"(",
"props",
".",
"get",
"(",
"URI",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] | find the uri parameter which we will key off of
@param props
@return value of uri param within props, or null if no uri param | [
"find",
"the",
"uri",
"parameter",
"which",
"we",
"will",
"key",
"off",
"of"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.1.common/src/com/ibm/ws/jaxrs20/clientconfig/JAXRSClientConfigImpl.java#L151-L159 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/staxutils/StaxUtils.java | StaxUtils.getXMLInputFactory | private static XMLInputFactory getXMLInputFactory() {
if (SAFE_INPUT_FACTORY != null) {
return SAFE_INPUT_FACTORY;
}
XMLInputFactory f = NS_AWARE_INPUT_FACTORY_POOL.poll();
if (f == null) {
f = createXMLInputFactory(true);
}
return f;
} | java | private static XMLInputFactory getXMLInputFactory() {
if (SAFE_INPUT_FACTORY != null) {
return SAFE_INPUT_FACTORY;
}
XMLInputFactory f = NS_AWARE_INPUT_FACTORY_POOL.poll();
if (f == null) {
f = createXMLInputFactory(true);
}
return f;
} | [
"private",
"static",
"XMLInputFactory",
"getXMLInputFactory",
"(",
")",
"{",
"if",
"(",
"SAFE_INPUT_FACTORY",
"!=",
"null",
")",
"{",
"return",
"SAFE_INPUT_FACTORY",
";",
"}",
"XMLInputFactory",
"f",
"=",
"NS_AWARE_INPUT_FACTORY_POOL",
".",
"poll",
"(",
")",
";",
"if",
"(",
"f",
"==",
"null",
")",
"{",
"f",
"=",
"createXMLInputFactory",
"(",
"true",
")",
";",
"}",
"return",
"f",
";",
"}"
] | Return a cached, namespace-aware, factory. | [
"Return",
"a",
"cached",
"namespace",
"-",
"aware",
"factory",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/staxutils/StaxUtils.java#L278-L287 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/staxutils/StaxUtils.java | StaxUtils.copy | public static void copy(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
copy(reader, writer, false, false);
} | java | public static void copy(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
copy(reader, writer, false, false);
} | [
"public",
"static",
"void",
"copy",
"(",
"XMLStreamReader",
"reader",
",",
"XMLStreamWriter",
"writer",
")",
"throws",
"XMLStreamException",
"{",
"copy",
"(",
"reader",
",",
"writer",
",",
"false",
",",
"false",
")",
";",
"}"
] | Copies the reader to the writer. The start and end document methods must
be handled on the writer manually.
@param reader
@param writer
@throws XMLStreamException | [
"Copies",
"the",
"reader",
"to",
"the",
"writer",
".",
"The",
"start",
"and",
"end",
"document",
"methods",
"must",
"be",
"handled",
"on",
"the",
"writer",
"manually",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/staxutils/StaxUtils.java#L729-L731 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/staxutils/StaxUtils.java | StaxUtils.readQName | public static QName readQName(XMLStreamReader reader) throws XMLStreamException {
String value = reader.getElementText();
if (value == null) {
return null;
}
value = value.trim();
int index = value.indexOf(":");
if (index == -1) {
return new QName(value);
}
String prefix = value.substring(0, index);
String localName = value.substring(index + 1);
String ns = reader.getNamespaceURI(prefix);
if ((!StringUtils.isEmpty(prefix) && ns == null) || localName == null) {
throw new RuntimeException("Invalid QName in mapping: " + value);
}
if (ns == null) {
return new QName(localName);
}
return new QName(ns, localName, prefix);
} | java | public static QName readQName(XMLStreamReader reader) throws XMLStreamException {
String value = reader.getElementText();
if (value == null) {
return null;
}
value = value.trim();
int index = value.indexOf(":");
if (index == -1) {
return new QName(value);
}
String prefix = value.substring(0, index);
String localName = value.substring(index + 1);
String ns = reader.getNamespaceURI(prefix);
if ((!StringUtils.isEmpty(prefix) && ns == null) || localName == null) {
throw new RuntimeException("Invalid QName in mapping: " + value);
}
if (ns == null) {
return new QName(localName);
}
return new QName(ns, localName, prefix);
} | [
"public",
"static",
"QName",
"readQName",
"(",
"XMLStreamReader",
"reader",
")",
"throws",
"XMLStreamException",
"{",
"String",
"value",
"=",
"reader",
".",
"getElementText",
"(",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"value",
"=",
"value",
".",
"trim",
"(",
")",
";",
"int",
"index",
"=",
"value",
".",
"indexOf",
"(",
"\":\"",
")",
";",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"{",
"return",
"new",
"QName",
"(",
"value",
")",
";",
"}",
"String",
"prefix",
"=",
"value",
".",
"substring",
"(",
"0",
",",
"index",
")",
";",
"String",
"localName",
"=",
"value",
".",
"substring",
"(",
"index",
"+",
"1",
")",
";",
"String",
"ns",
"=",
"reader",
".",
"getNamespaceURI",
"(",
"prefix",
")",
";",
"if",
"(",
"(",
"!",
"StringUtils",
".",
"isEmpty",
"(",
"prefix",
")",
"&&",
"ns",
"==",
"null",
")",
"||",
"localName",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Invalid QName in mapping: \"",
"+",
"value",
")",
";",
"}",
"if",
"(",
"ns",
"==",
"null",
")",
"{",
"return",
"new",
"QName",
"(",
"localName",
")",
";",
"}",
"return",
"new",
"QName",
"(",
"ns",
",",
"localName",
",",
"prefix",
")",
";",
"}"
] | Reads a QName from the element text. Reader must be positioned at the
start tag. | [
"Reads",
"a",
"QName",
"from",
"the",
"element",
"text",
".",
"Reader",
"must",
"be",
"positioned",
"at",
"the",
"start",
"tag",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/staxutils/StaxUtils.java#L1851-L1877 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/ConcurrentServiceReferenceSet.java | ConcurrentServiceReferenceSet.addReference | public boolean addReference(ServiceReference<T> reference) {
if (reference == null)
return false;
ConcurrentServiceReferenceElement<T> element = new ConcurrentServiceReferenceElement<T>(referenceName, reference);
synchronized (elementMap) {
ConcurrentServiceReferenceElement<T> oldElement = elementMap.put(reference, element);
if (oldElement != null) {
if (!element.getRanking().equals(oldElement.getRanking())) {
elementSetUnsorted = true;
}
return true;
}
elementSet.add(element);
}
return false;
} | java | public boolean addReference(ServiceReference<T> reference) {
if (reference == null)
return false;
ConcurrentServiceReferenceElement<T> element = new ConcurrentServiceReferenceElement<T>(referenceName, reference);
synchronized (elementMap) {
ConcurrentServiceReferenceElement<T> oldElement = elementMap.put(reference, element);
if (oldElement != null) {
if (!element.getRanking().equals(oldElement.getRanking())) {
elementSetUnsorted = true;
}
return true;
}
elementSet.add(element);
}
return false;
} | [
"public",
"boolean",
"addReference",
"(",
"ServiceReference",
"<",
"T",
">",
"reference",
")",
"{",
"if",
"(",
"reference",
"==",
"null",
")",
"return",
"false",
";",
"ConcurrentServiceReferenceElement",
"<",
"T",
">",
"element",
"=",
"new",
"ConcurrentServiceReferenceElement",
"<",
"T",
">",
"(",
"referenceName",
",",
"reference",
")",
";",
"synchronized",
"(",
"elementMap",
")",
"{",
"ConcurrentServiceReferenceElement",
"<",
"T",
">",
"oldElement",
"=",
"elementMap",
".",
"put",
"(",
"reference",
",",
"element",
")",
";",
"if",
"(",
"oldElement",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"element",
".",
"getRanking",
"(",
")",
".",
"equals",
"(",
"oldElement",
".",
"getRanking",
"(",
")",
")",
")",
"{",
"elementSetUnsorted",
"=",
"true",
";",
"}",
"return",
"true",
";",
"}",
"elementSet",
".",
"add",
"(",
"element",
")",
";",
"}",
"return",
"false",
";",
"}"
] | Adds the service reference to the set, or notifies the set that the
service ranking for the reference might have been updated.
@param reference ServiceReference for the target service
@return true if this set already contained the service reference | [
"Adds",
"the",
"service",
"reference",
"to",
"the",
"set",
"or",
"notifies",
"the",
"set",
"that",
"the",
"service",
"ranking",
"for",
"the",
"reference",
"might",
"have",
"been",
"updated",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/ConcurrentServiceReferenceSet.java#L139-L157 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/ConcurrentServiceReferenceSet.java | ConcurrentServiceReferenceSet.removeReference | public boolean removeReference(ServiceReference<T> reference) {
synchronized (elementMap) {
ConcurrentServiceReferenceElement<T> element = elementMap.remove(reference);
if (element == null) {
return false;
}
elementSet.remove(element);
return true;
}
} | java | public boolean removeReference(ServiceReference<T> reference) {
synchronized (elementMap) {
ConcurrentServiceReferenceElement<T> element = elementMap.remove(reference);
if (element == null) {
return false;
}
elementSet.remove(element);
return true;
}
} | [
"public",
"boolean",
"removeReference",
"(",
"ServiceReference",
"<",
"T",
">",
"reference",
")",
"{",
"synchronized",
"(",
"elementMap",
")",
"{",
"ConcurrentServiceReferenceElement",
"<",
"T",
">",
"element",
"=",
"elementMap",
".",
"remove",
"(",
"reference",
")",
";",
"if",
"(",
"element",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"elementSet",
".",
"remove",
"(",
"element",
")",
";",
"return",
"true",
";",
"}",
"}"
] | Removes the service reference from the set
@param reference ServiceReference associated with service to be unset
@return true if this set contained the service reference | [
"Removes",
"the",
"service",
"reference",
"from",
"the",
"set"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/ConcurrentServiceReferenceSet.java#L165-L175 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/ConcurrentServiceReferenceSet.java | ConcurrentServiceReferenceSet.elements | private Iterator<ConcurrentServiceReferenceElement<T>> elements() {
Collection<ConcurrentServiceReferenceElement<T>> set;
synchronized (elementMap) {
if (elementSetUnsorted) {
elementSet = new ConcurrentSkipListSet<ConcurrentServiceReferenceElement<T>>(elementMap.values());
elementSetUnsorted = false;
}
set = elementSet;
}
return set.iterator();
} | java | private Iterator<ConcurrentServiceReferenceElement<T>> elements() {
Collection<ConcurrentServiceReferenceElement<T>> set;
synchronized (elementMap) {
if (elementSetUnsorted) {
elementSet = new ConcurrentSkipListSet<ConcurrentServiceReferenceElement<T>>(elementMap.values());
elementSetUnsorted = false;
}
set = elementSet;
}
return set.iterator();
} | [
"private",
"Iterator",
"<",
"ConcurrentServiceReferenceElement",
"<",
"T",
">",
">",
"elements",
"(",
")",
"{",
"Collection",
"<",
"ConcurrentServiceReferenceElement",
"<",
"T",
">>",
"set",
";",
"synchronized",
"(",
"elementMap",
")",
"{",
"if",
"(",
"elementSetUnsorted",
")",
"{",
"elementSet",
"=",
"new",
"ConcurrentSkipListSet",
"<",
"ConcurrentServiceReferenceElement",
"<",
"T",
">",
">",
"(",
"elementMap",
".",
"values",
"(",
")",
")",
";",
"elementSetUnsorted",
"=",
"false",
";",
"}",
"set",
"=",
"elementSet",
";",
"}",
"return",
"set",
".",
"iterator",
"(",
")",
";",
"}"
] | Return an iterator for the elements in service ranking order. | [
"Return",
"an",
"iterator",
"for",
"the",
"elements",
"in",
"service",
"ranking",
"order",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/ConcurrentServiceReferenceSet.java#L243-L254 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/udpchannel/internal/UDPChannelConfiguration.java | UDPChannelConfiguration.setChannelData | public void setChannelData(ChannelData data) throws ChannelException {
this.channelData = data;
setValues(data.getPropertyBag());
if (tc.isDebugEnabled())
outputConfigToTrace();
} | java | public void setChannelData(ChannelData data) throws ChannelException {
this.channelData = data;
setValues(data.getPropertyBag());
if (tc.isDebugEnabled())
outputConfigToTrace();
} | [
"public",
"void",
"setChannelData",
"(",
"ChannelData",
"data",
")",
"throws",
"ChannelException",
"{",
"this",
".",
"channelData",
"=",
"data",
";",
"setValues",
"(",
"data",
".",
"getPropertyBag",
"(",
")",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"outputConfigToTrace",
"(",
")",
";",
"}"
] | Update the configuration with a new channel framework configuration object.
@param data
@throws ChannelException | [
"Update",
"the",
"configuration",
"with",
"a",
"new",
"channel",
"framework",
"configuration",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/udpchannel/internal/UDPChannelConfiguration.java#L256-L261 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/udpchannel/internal/UDPChannelConfiguration.java | UDPChannelConfiguration.setChannelReceiveBufferSize | public void setChannelReceiveBufferSize(int size) {
this.channelReceiveBufferSize = size;
if (size < 0 || size > UDPConfigConstants.MAX_UDP_PACKET_SIZE) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Channel Receive buffer size not within Limits: " + size + " setting to default: " + UDPConfigConstants.MAX_UDP_PACKET_SIZE);
}
this.channelReceiveBufferSize = UDPConfigConstants.MAX_UDP_PACKET_SIZE;
}
} | java | public void setChannelReceiveBufferSize(int size) {
this.channelReceiveBufferSize = size;
if (size < 0 || size > UDPConfigConstants.MAX_UDP_PACKET_SIZE) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Channel Receive buffer size not within Limits: " + size + " setting to default: " + UDPConfigConstants.MAX_UDP_PACKET_SIZE);
}
this.channelReceiveBufferSize = UDPConfigConstants.MAX_UDP_PACKET_SIZE;
}
} | [
"public",
"void",
"setChannelReceiveBufferSize",
"(",
"int",
"size",
")",
"{",
"this",
".",
"channelReceiveBufferSize",
"=",
"size",
";",
"if",
"(",
"size",
"<",
"0",
"||",
"size",
">",
"UDPConfigConstants",
".",
"MAX_UDP_PACKET_SIZE",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Channel Receive buffer size not within Limits: \"",
"+",
"size",
"+",
"\" setting to default: \"",
"+",
"UDPConfigConstants",
".",
"MAX_UDP_PACKET_SIZE",
")",
";",
"}",
"this",
".",
"channelReceiveBufferSize",
"=",
"UDPConfigConstants",
".",
"MAX_UDP_PACKET_SIZE",
";",
"}",
"}"
] | Set the size of the bytebuffer to allocate when receiving data.
@param size | [
"Set",
"the",
"size",
"of",
"the",
"bytebuffer",
"to",
"allocate",
"when",
"receiving",
"data",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/udpchannel/internal/UDPChannelConfiguration.java#L333-L341 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/ServerSICoreConnectionListener.java | ServerSICoreConnectionListener.addSICoreConnection | public void addSICoreConnection(SICoreConnection conn, Conversation conversation) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "addSICoreConnection");
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
SibTr.debug(tc, "Params: connection, conversation",
new Object[] { conn, conversation });
}
conversationTable.put(conn, conversation);
// At this point, if the me has previously been terminated, we know it is
// back up - so make sure we remove if from our quiesce and terminated table
// so that if it goes down again, we can notify the clients.
quiesceNotif.remove(conn.getMeUuid());
termNotif.remove(conn.getMeUuid());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "addSICoreConnection");
} | java | public void addSICoreConnection(SICoreConnection conn, Conversation conversation) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "addSICoreConnection");
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
SibTr.debug(tc, "Params: connection, conversation",
new Object[] { conn, conversation });
}
conversationTable.put(conn, conversation);
// At this point, if the me has previously been terminated, we know it is
// back up - so make sure we remove if from our quiesce and terminated table
// so that if it goes down again, we can notify the clients.
quiesceNotif.remove(conn.getMeUuid());
termNotif.remove(conn.getMeUuid());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "addSICoreConnection");
} | [
"public",
"void",
"addSICoreConnection",
"(",
"SICoreConnection",
"conn",
",",
"Conversation",
"conversation",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"addSICoreConnection\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Params: connection, conversation\"",
",",
"new",
"Object",
"[",
"]",
"{",
"conn",
",",
"conversation",
"}",
")",
";",
"}",
"conversationTable",
".",
"put",
"(",
"conn",
",",
"conversation",
")",
";",
"// At this point, if the me has previously been terminated, we know it is",
"// back up - so make sure we remove if from our quiesce and terminated table",
"// so that if it goes down again, we can notify the clients.",
"quiesceNotif",
".",
"remove",
"(",
"conn",
".",
"getMeUuid",
"(",
")",
")",
";",
"termNotif",
".",
"remove",
"(",
"conn",
".",
"getMeUuid",
"(",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"addSICoreConnection\"",
")",
";",
"}"
] | Creates a new SICoreConnection that this listener is listening
for events from.
@param conn The SICoreConnection.
@param conversation The associated conversation. | [
"Creates",
"a",
"new",
"SICoreConnection",
"that",
"this",
"listener",
"is",
"listening",
"for",
"events",
"from",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/ServerSICoreConnectionListener.java#L92-L111 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/ServerSICoreConnectionListener.java | ServerSICoreConnectionListener.asynchronousException | @Override
public void asynchronousException(ConsumerSession session, Throwable e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "asynchronousException",
new Object[]
{
session,
e
});
FFDCFilter.processException(e,
CLASS_NAME + ".asynchronousException",
CommsConstants.SERVERSICORECONNECTIONLISTENER_ASYNC_01,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Caught an async exception:", e);
try {
sendMeNotificationEvent(CommsConstants.EVENTID_ASYNC_EXCEPTION, null, session, e);
} catch (SIException e2) {
FFDCFilter.processException(e,
CLASS_NAME + ".asynchronousException",
CommsConstants.SERVERSICORECONNECTIONLISTENER_ASYNC_02,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, e.getMessage(), e);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2018", e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "asynchronousException");
} | java | @Override
public void asynchronousException(ConsumerSession session, Throwable e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "asynchronousException",
new Object[]
{
session,
e
});
FFDCFilter.processException(e,
CLASS_NAME + ".asynchronousException",
CommsConstants.SERVERSICORECONNECTIONLISTENER_ASYNC_01,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Caught an async exception:", e);
try {
sendMeNotificationEvent(CommsConstants.EVENTID_ASYNC_EXCEPTION, null, session, e);
} catch (SIException e2) {
FFDCFilter.processException(e,
CLASS_NAME + ".asynchronousException",
CommsConstants.SERVERSICORECONNECTIONLISTENER_ASYNC_02,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, e.getMessage(), e);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2018", e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "asynchronousException");
} | [
"@",
"Override",
"public",
"void",
"asynchronousException",
"(",
"ConsumerSession",
"session",
",",
"Throwable",
"e",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"asynchronousException\"",
",",
"new",
"Object",
"[",
"]",
"{",
"session",
",",
"e",
"}",
")",
";",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".asynchronousException\"",
",",
"CommsConstants",
".",
"SERVERSICORECONNECTIONLISTENER_ASYNC_01",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Caught an async exception:\"",
",",
"e",
")",
";",
"try",
"{",
"sendMeNotificationEvent",
"(",
"CommsConstants",
".",
"EVENTID_ASYNC_EXCEPTION",
",",
"null",
",",
"session",
",",
"e",
")",
";",
"}",
"catch",
"(",
"SIException",
"e2",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".asynchronousException\"",
",",
"CommsConstants",
".",
"SERVERSICORECONNECTIONLISTENER_ASYNC_02",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"COMMUNICATION_ERROR_SICO2018\"",
",",
"e",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"asynchronousException\"",
")",
";",
"}"
] | This event is generated if an exception is thrown during the processing of
an asynchronous callback. In practise this should never occur as we should
ensure that we catch all the errors in the place they occur as no state
is available here.
@param session
@param e | [
"This",
"event",
"is",
"generated",
"if",
"an",
"exception",
"is",
"thrown",
"during",
"the",
"processing",
"of",
"an",
"asynchronous",
"callback",
".",
"In",
"practise",
"this",
"should",
"never",
"occur",
"as",
"we",
"should",
"ensure",
"that",
"we",
"catch",
"all",
"the",
"errors",
"in",
"the",
"place",
"they",
"occur",
"as",
"no",
"state",
"is",
"available",
"here",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/ServerSICoreConnectionListener.java#L145-L179 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/ServerSICoreConnectionListener.java | ServerSICoreConnectionListener.meTerminated | @Override
public void meTerminated(SICoreConnection conn) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "meTerminated");
//Remember the fact that the ME has terminated so we don't issue spurious FFDCs
final Conversation conversation = conversationTable.get(conn);
//If conversation is null we do nothing.
if (conversation != null) {
final ConversationState convState = (ConversationState) conversation.getAttachment();
convState.setMETerminated();
}
// Right, so the ME that the core connection is connected to
// is dead. First of all get the ME Uuid that the connection
// refers to
String meUuid = conn.getMeUuid();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "ME Uuid: ", meUuid);
// Have we already sent a notification about this ME terminating
// to the client?
if (termNotif.get(meUuid) == null) {
// No we have not. So, get the Conversation and send the client
// the message about this ME. It will be up to the client to fan
// out this message to other clients connected to this ME.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "We have not sent a notification about this ME");
try {
sendMeNotificationEvent(CommsConstants.EVENTID_ME_TERMINATED, conn, null, null);
// and save that we have sent a response concerning this ME
// Note, just using a Hashtable for fast searching.
termNotif.put(meUuid, new Object());
} catch (SIException e) {
FFDCFilter.processException(e,
CLASS_NAME + ".meTerminated",
CommsConstants.SERVERSICORECONNECTIONLISTENER_MET_01,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, e.getMessage(), e);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2018", e);
}
} else {
// Yes we have - so do not do anything more
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Already sent notification about this ME");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "meTerminated");
} | java | @Override
public void meTerminated(SICoreConnection conn) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "meTerminated");
//Remember the fact that the ME has terminated so we don't issue spurious FFDCs
final Conversation conversation = conversationTable.get(conn);
//If conversation is null we do nothing.
if (conversation != null) {
final ConversationState convState = (ConversationState) conversation.getAttachment();
convState.setMETerminated();
}
// Right, so the ME that the core connection is connected to
// is dead. First of all get the ME Uuid that the connection
// refers to
String meUuid = conn.getMeUuid();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "ME Uuid: ", meUuid);
// Have we already sent a notification about this ME terminating
// to the client?
if (termNotif.get(meUuid) == null) {
// No we have not. So, get the Conversation and send the client
// the message about this ME. It will be up to the client to fan
// out this message to other clients connected to this ME.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "We have not sent a notification about this ME");
try {
sendMeNotificationEvent(CommsConstants.EVENTID_ME_TERMINATED, conn, null, null);
// and save that we have sent a response concerning this ME
// Note, just using a Hashtable for fast searching.
termNotif.put(meUuid, new Object());
} catch (SIException e) {
FFDCFilter.processException(e,
CLASS_NAME + ".meTerminated",
CommsConstants.SERVERSICORECONNECTIONLISTENER_MET_01,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, e.getMessage(), e);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2018", e);
}
} else {
// Yes we have - so do not do anything more
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Already sent notification about this ME");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "meTerminated");
} | [
"@",
"Override",
"public",
"void",
"meTerminated",
"(",
"SICoreConnection",
"conn",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"meTerminated\"",
")",
";",
"//Remember the fact that the ME has terminated so we don't issue spurious FFDCs",
"final",
"Conversation",
"conversation",
"=",
"conversationTable",
".",
"get",
"(",
"conn",
")",
";",
"//If conversation is null we do nothing.",
"if",
"(",
"conversation",
"!=",
"null",
")",
"{",
"final",
"ConversationState",
"convState",
"=",
"(",
"ConversationState",
")",
"conversation",
".",
"getAttachment",
"(",
")",
";",
"convState",
".",
"setMETerminated",
"(",
")",
";",
"}",
"// Right, so the ME that the core connection is connected to",
"// is dead. First of all get the ME Uuid that the connection",
"// refers to",
"String",
"meUuid",
"=",
"conn",
".",
"getMeUuid",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"ME Uuid: \"",
",",
"meUuid",
")",
";",
"// Have we already sent a notification about this ME terminating",
"// to the client?",
"if",
"(",
"termNotif",
".",
"get",
"(",
"meUuid",
")",
"==",
"null",
")",
"{",
"// No we have not. So, get the Conversation and send the client",
"// the message about this ME. It will be up to the client to fan",
"// out this message to other clients connected to this ME.",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"We have not sent a notification about this ME\"",
")",
";",
"try",
"{",
"sendMeNotificationEvent",
"(",
"CommsConstants",
".",
"EVENTID_ME_TERMINATED",
",",
"conn",
",",
"null",
",",
"null",
")",
";",
"// and save that we have sent a response concerning this ME",
"// Note, just using a Hashtable for fast searching.",
"termNotif",
".",
"put",
"(",
"meUuid",
",",
"new",
"Object",
"(",
")",
")",
";",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".meTerminated\"",
",",
"CommsConstants",
".",
"SERVERSICORECONNECTIONLISTENER_MET_01",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"COMMUNICATION_ERROR_SICO2018\"",
",",
"e",
")",
";",
"}",
"}",
"else",
"{",
"// Yes we have - so do not do anything more",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Already sent notification about this ME\"",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"meTerminated\"",
")",
";",
"}"
] | This method is called when the ME terminates.
@param conn | [
"This",
"method",
"is",
"called",
"when",
"the",
"ME",
"terminates",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/ServerSICoreConnectionListener.java#L252-L307 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/ServerSICoreConnectionListener.java | ServerSICoreConnectionListener.commsFailure | @Override
public void commsFailure(SICoreConnection conn, SIConnectionLostException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "commsFailure",
new Object[]
{
conn,
e
});
FFDCFilter.processException(e,
CLASS_NAME + ".commsFailure",
CommsConstants.SERVERSICORECONNECTIONLISTENER_COMMS_01,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Caught a comms exception:", e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "commsFailure");
} | java | @Override
public void commsFailure(SICoreConnection conn, SIConnectionLostException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "commsFailure",
new Object[]
{
conn,
e
});
FFDCFilter.processException(e,
CLASS_NAME + ".commsFailure",
CommsConstants.SERVERSICORECONNECTIONLISTENER_COMMS_01,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Caught a comms exception:", e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "commsFailure");
} | [
"@",
"Override",
"public",
"void",
"commsFailure",
"(",
"SICoreConnection",
"conn",
",",
"SIConnectionLostException",
"e",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"commsFailure\"",
",",
"new",
"Object",
"[",
"]",
"{",
"conn",
",",
"e",
"}",
")",
";",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".commsFailure\"",
",",
"CommsConstants",
".",
"SERVERSICORECONNECTIONLISTENER_COMMS_01",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Caught a comms exception:\"",
",",
"e",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"commsFailure\"",
")",
";",
"}"
] | This is used to indicate a communication failure on the client. Seeing
as we are the only people who would ever generate this event for the client
if this gets invoked on the server then someone has done something not bad,
not even wrong, but silly.
@param conn
@param e | [
"This",
"is",
"used",
"to",
"indicate",
"a",
"communication",
"failure",
"on",
"the",
"client",
".",
"Seeing",
"as",
"we",
"are",
"the",
"only",
"people",
"who",
"would",
"ever",
"generate",
"this",
"event",
"for",
"the",
"client",
"if",
"this",
"gets",
"invoked",
"on",
"the",
"server",
"then",
"someone",
"has",
"done",
"something",
"not",
"bad",
"not",
"even",
"wrong",
"but",
"silly",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/ServerSICoreConnectionListener.java#L458-L478 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/event/ServletInvocationEvent.java | ServletInvocationEvent.getRequestURL | public String getRequestURL()
{
HttpServletRequest httpReq = getRequest();
if (httpReq==null)
return null;
else
return httpReq.getRequestURL().toString();
} | java | public String getRequestURL()
{
HttpServletRequest httpReq = getRequest();
if (httpReq==null)
return null;
else
return httpReq.getRequestURL().toString();
} | [
"public",
"String",
"getRequestURL",
"(",
")",
"{",
"HttpServletRequest",
"httpReq",
"=",
"getRequest",
"(",
")",
";",
"if",
"(",
"httpReq",
"==",
"null",
")",
"return",
"null",
";",
"else",
"return",
"httpReq",
".",
"getRequestURL",
"(",
")",
".",
"toString",
"(",
")",
";",
"}"
] | Get the URL of this invocation. | [
"Get",
"the",
"URL",
"of",
"this",
"invocation",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/event/ServletInvocationEvent.java#L53-L60 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/event/ServletInvocationEvent.java | ServletInvocationEvent.getRequest | public HttpServletRequest getRequest()
{
// moved as part of LIDB-3598 to ServletUtil
/*
ServletRequest r = _req;
while (!(r instanceof HttpServletRequest))
{
if (r instanceof ServletRequestWrapper)
{
r = ((ServletRequestWrapper) r).getRequest();
}
}
return (HttpServletRequest) r;
*/
//begin 311003, 61FVT:Simple SIP request generating exception
ServletRequest sReq = null;
if (_req==null)
return null;
try {
sReq = ServletUtil.unwrapRequest(_req);
}
catch (RuntimeException re){
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"getRequest","Caught RuntimeException unwrapping the request",re);
return null;
}
//end 311003, 61FVT:Simple SIP request generating exception
if (sReq instanceof HttpServletRequest)
return (HttpServletRequest) sReq;
else
return null;
} | java | public HttpServletRequest getRequest()
{
// moved as part of LIDB-3598 to ServletUtil
/*
ServletRequest r = _req;
while (!(r instanceof HttpServletRequest))
{
if (r instanceof ServletRequestWrapper)
{
r = ((ServletRequestWrapper) r).getRequest();
}
}
return (HttpServletRequest) r;
*/
//begin 311003, 61FVT:Simple SIP request generating exception
ServletRequest sReq = null;
if (_req==null)
return null;
try {
sReq = ServletUtil.unwrapRequest(_req);
}
catch (RuntimeException re){
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"getRequest","Caught RuntimeException unwrapping the request",re);
return null;
}
//end 311003, 61FVT:Simple SIP request generating exception
if (sReq instanceof HttpServletRequest)
return (HttpServletRequest) sReq;
else
return null;
} | [
"public",
"HttpServletRequest",
"getRequest",
"(",
")",
"{",
"// \tmoved as part of \tLIDB-3598 to ServletUtil",
"/*\n ServletRequest r = _req;\n \n while (!(r instanceof HttpServletRequest))\n {\n if (r instanceof ServletRequestWrapper)\n {\n r = ((ServletRequestWrapper) r).getRequest();\n }\n }\n\t\t\t \n return (HttpServletRequest) r;\n */",
"//begin 311003, 61FVT:Simple SIP request generating exception",
"ServletRequest",
"sReq",
"=",
"null",
";",
"if",
"(",
"_req",
"==",
"null",
")",
"return",
"null",
";",
"try",
"{",
"sReq",
"=",
"ServletUtil",
".",
"unwrapRequest",
"(",
"_req",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"re",
")",
"{",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"getRequest\"",
",",
"\"Caught RuntimeException unwrapping the request\"",
",",
"re",
")",
";",
"return",
"null",
";",
"}",
"//end 311003, 61FVT:Simple SIP request generating exception",
"if",
"(",
"sReq",
"instanceof",
"HttpServletRequest",
")",
"return",
"(",
"HttpServletRequest",
")",
"sReq",
";",
"else",
"return",
"null",
";",
"}"
] | Get the request used for the servlet invocation. | [
"Get",
"the",
"request",
"used",
"for",
"the",
"servlet",
"invocation",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/event/ServletInvocationEvent.java#L77-L110 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/event/ServletInvocationEvent.java | ServletInvocationEvent.getResponse | public HttpServletResponse getResponse()
{
// moved as part of LIDB-3598 to ServletUtil
/*
ServletResponse r = _resp;
while (!(r instanceof HttpServletResponse))
{
if (r instanceof ServletResponseWrapper)
{
r = ((ServletResponseWrapper) r).getResponse();
}
}
return (HttpServletResponse) r;
*/
//begin 311003, 61FVT:Simple SIP request generating exception
ServletResponse sRes = null;
if (_resp==null)
return null;
try {
sRes = ServletUtil.unwrapResponse(_resp);
}
catch (RuntimeException re){
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"getResponse","Caught RuntimeException unwrapping the response",re);
return null;
}
//end 311003, 61FVT:Simple SIP request generating exception
if (sRes instanceof HttpServletResponse)
return (HttpServletResponse) sRes;
else
return null;
} | java | public HttpServletResponse getResponse()
{
// moved as part of LIDB-3598 to ServletUtil
/*
ServletResponse r = _resp;
while (!(r instanceof HttpServletResponse))
{
if (r instanceof ServletResponseWrapper)
{
r = ((ServletResponseWrapper) r).getResponse();
}
}
return (HttpServletResponse) r;
*/
//begin 311003, 61FVT:Simple SIP request generating exception
ServletResponse sRes = null;
if (_resp==null)
return null;
try {
sRes = ServletUtil.unwrapResponse(_resp);
}
catch (RuntimeException re){
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"getResponse","Caught RuntimeException unwrapping the response",re);
return null;
}
//end 311003, 61FVT:Simple SIP request generating exception
if (sRes instanceof HttpServletResponse)
return (HttpServletResponse) sRes;
else
return null;
} | [
"public",
"HttpServletResponse",
"getResponse",
"(",
")",
"{",
"// moved as part of \tLIDB-3598 to ServletUtil",
"/*\n ServletResponse r = _resp;\n\n while (!(r instanceof HttpServletResponse))\n {\n if (r instanceof ServletResponseWrapper)\n {\n r = ((ServletResponseWrapper) r).getResponse();\n }\n }\n\t\t\t \n return (HttpServletResponse) r;\n */",
"//begin 311003, 61FVT:Simple SIP request generating exception",
"ServletResponse",
"sRes",
"=",
"null",
";",
"if",
"(",
"_resp",
"==",
"null",
")",
"return",
"null",
";",
"try",
"{",
"sRes",
"=",
"ServletUtil",
".",
"unwrapResponse",
"(",
"_resp",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"re",
")",
"{",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"getResponse\"",
",",
"\"Caught RuntimeException unwrapping the response\"",
",",
"re",
")",
";",
"return",
"null",
";",
"}",
"//end 311003, 61FVT:Simple SIP request generating exception",
"if",
"(",
"sRes",
"instanceof",
"HttpServletResponse",
")",
"return",
"(",
"HttpServletResponse",
")",
"sRes",
";",
"else",
"return",
"null",
";",
"}"
] | Get the response used for the servlet invocation. | [
"Get",
"the",
"response",
"used",
"for",
"the",
"servlet",
"invocation",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/event/ServletInvocationEvent.java#L115-L148 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/websphere/pmi/PmiDataInfo.java | PmiDataInfo.isAvailableInPlatform | public boolean isAvailableInPlatform(String p) {
if (this.platform.equals(PLATFORM_ALL))
return true;
else
return (this.platform.equals(p));
} | java | public boolean isAvailableInPlatform(String p) {
if (this.platform.equals(PLATFORM_ALL))
return true;
else
return (this.platform.equals(p));
} | [
"public",
"boolean",
"isAvailableInPlatform",
"(",
"String",
"p",
")",
"{",
"if",
"(",
"this",
".",
"platform",
".",
"equals",
"(",
"PLATFORM_ALL",
")",
")",
"return",
"true",
";",
"else",
"return",
"(",
"this",
".",
"platform",
".",
"equals",
"(",
"p",
")",
")",
";",
"}"
] | Return true if this statistic is available in the given platform
@param p - platform string defined in PmiConstants | [
"Return",
"true",
"if",
"this",
"statistic",
"is",
"available",
"in",
"the",
"given",
"platform"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/websphere/pmi/PmiDataInfo.java#L329-L334 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/webcontainerext/JSPExtensionClassLoader.java | JSPExtensionClassLoader.loadClassDataFromFile | protected byte[] loadClassDataFromFile(String fileName) {
byte[] classBytes = null;
try {
InputStream in = getResourceAsStream(fileName);
if (in == null) {
return null;
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte buf[] = new byte[1024];
for (int i = 0;(i = in.read(buf)) != -1;)
baos.write(buf, 0, i);
in.close();
baos.close();
classBytes = baos.toByteArray();
}
catch (Exception ex) {
return null;
}
return classBytes;
} | java | protected byte[] loadClassDataFromFile(String fileName) {
byte[] classBytes = null;
try {
InputStream in = getResourceAsStream(fileName);
if (in == null) {
return null;
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte buf[] = new byte[1024];
for (int i = 0;(i = in.read(buf)) != -1;)
baos.write(buf, 0, i);
in.close();
baos.close();
classBytes = baos.toByteArray();
}
catch (Exception ex) {
return null;
}
return classBytes;
} | [
"protected",
"byte",
"[",
"]",
"loadClassDataFromFile",
"(",
"String",
"fileName",
")",
"{",
"byte",
"[",
"]",
"classBytes",
"=",
"null",
";",
"try",
"{",
"InputStream",
"in",
"=",
"getResourceAsStream",
"(",
"fileName",
")",
";",
"if",
"(",
"in",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"byte",
"buf",
"[",
"]",
"=",
"new",
"byte",
"[",
"1024",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"(",
"i",
"=",
"in",
".",
"read",
"(",
"buf",
")",
")",
"!=",
"-",
"1",
";",
")",
"baos",
".",
"write",
"(",
"buf",
",",
"0",
",",
"i",
")",
";",
"in",
".",
"close",
"(",
")",
";",
"baos",
".",
"close",
"(",
")",
";",
"classBytes",
"=",
"baos",
".",
"toByteArray",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"return",
"null",
";",
"}",
"return",
"classBytes",
";",
"}"
] | Load JSP class data from file. | [
"Load",
"JSP",
"class",
"data",
"from",
"file",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/webcontainerext/JSPExtensionClassLoader.java#L209-L228 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsApiMessageImpl.java | JsApiMessageImpl.typeCheck | private final Object typeCheck(Object value, int type) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "typecheck: value = " + value + ", " + value.getClass() + " , type=" + type);
switch (type) {
/* No checking, just return the value */
case Selector.UNKNOWN:
return value;
/* STRING - simple! */
case Selector.STRING:
return (value instanceof String) ? value : null;
/* BOOLEAN - Boolean or BooleanValue are suitable */
case Selector.BOOLEAN:
return (value instanceof Boolean) ? value : null;
/* Any numeric - any Number or a NumericValue are suitable */
default:
return (value instanceof Number) ? value : null;
}
} | java | private final Object typeCheck(Object value, int type) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "typecheck: value = " + value + ", " + value.getClass() + " , type=" + type);
switch (type) {
/* No checking, just return the value */
case Selector.UNKNOWN:
return value;
/* STRING - simple! */
case Selector.STRING:
return (value instanceof String) ? value : null;
/* BOOLEAN - Boolean or BooleanValue are suitable */
case Selector.BOOLEAN:
return (value instanceof Boolean) ? value : null;
/* Any numeric - any Number or a NumericValue are suitable */
default:
return (value instanceof Number) ? value : null;
}
} | [
"private",
"final",
"Object",
"typeCheck",
"(",
"Object",
"value",
",",
"int",
"type",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"typecheck: value = \"",
"+",
"value",
"+",
"\", \"",
"+",
"value",
".",
"getClass",
"(",
")",
"+",
"\" , type=\"",
"+",
"type",
")",
";",
"switch",
"(",
"type",
")",
"{",
"/* No checking, just return the value */",
"case",
"Selector",
".",
"UNKNOWN",
":",
"return",
"value",
";",
"/* STRING - simple! */",
"case",
"Selector",
".",
"STRING",
":",
"return",
"(",
"value",
"instanceof",
"String",
")",
"?",
"value",
":",
"null",
";",
"/* BOOLEAN - Boolean or BooleanValue are suitable */",
"case",
"Selector",
".",
"BOOLEAN",
":",
"return",
"(",
"value",
"instanceof",
"Boolean",
")",
"?",
"value",
":",
"null",
";",
"/* Any numeric - any Number or a NumericValue are suitable */",
"default",
":",
"return",
"(",
"value",
"instanceof",
"Number",
")",
"?",
"value",
":",
"null",
";",
"}",
"}"
] | Check the type of the value obtained from the message.
The value is returned as is if it is of the correct
type, otherwise null is returned.
@param value The Object value retrieved from the message
@param type The expected SelectorType of the value.
@return Object Either the original Object value, or null if the type of
value was not correct. | [
"Check",
"the",
"type",
"of",
"the",
"value",
"obtained",
"from",
"the",
"message",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsApiMessageImpl.java#L723-L746 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsApiMessageImpl.java | JsApiMessageImpl.restoreMapObject | final Serializable restoreMapObject(byte[] mapItemArray) throws IOException, ClassNotFoundException {
Serializable item = null;;
/* If it is a real byte array, we need to return a safe copy with the */
/* header bytes removed. */
if ((mapItemArray[0] == HEADER_BYTE_0) && (mapItemArray[1] == HEADER_BYTE_1)) {
item = new byte[mapItemArray.length - 2];
System.arraycopy(mapItemArray, 2, item, 0, ((byte[]) item).length);
}
/* Anything else needs deserializing. */
else {
ByteArrayInputStream bai = new ByteArrayInputStream(mapItemArray);
ObjectInputStream wsin = null;
if (RuntimeInfo.isThinClient() || RuntimeInfo.isFatClient()) {
//thin client environment. create ObjectInputStream from factory method.
//As of now getting twas factory class.
//Hard coding now.. once when Libery thin client get developed, this can be taken to a factory type class.
Class<?> clazz = Class.forName("com.ibm.ws.util.WsObjectInputStream");
try {
wsin = (ObjectInputStream) clazz.getConstructor(ByteArrayInputStream.class).newInstance(bai);
} catch (Exception e) {
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Exception closing the ObjectInputStream", e);
}
} else {
//Liberty server environment
ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
{
@Override
public ClassLoader run() {
return Thread.currentThread().getContextClassLoader();
}
});
wsin = new DeserializationObjectInputStream(bai, cl);
}
item = (Serializable) wsin.readObject();
try {
if (wsin != null) {
wsin.close();
}
} catch (IOException ex) {
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Exception closing the ObjectInputStream", ex);
}
}
return item;
} | java | final Serializable restoreMapObject(byte[] mapItemArray) throws IOException, ClassNotFoundException {
Serializable item = null;;
/* If it is a real byte array, we need to return a safe copy with the */
/* header bytes removed. */
if ((mapItemArray[0] == HEADER_BYTE_0) && (mapItemArray[1] == HEADER_BYTE_1)) {
item = new byte[mapItemArray.length - 2];
System.arraycopy(mapItemArray, 2, item, 0, ((byte[]) item).length);
}
/* Anything else needs deserializing. */
else {
ByteArrayInputStream bai = new ByteArrayInputStream(mapItemArray);
ObjectInputStream wsin = null;
if (RuntimeInfo.isThinClient() || RuntimeInfo.isFatClient()) {
//thin client environment. create ObjectInputStream from factory method.
//As of now getting twas factory class.
//Hard coding now.. once when Libery thin client get developed, this can be taken to a factory type class.
Class<?> clazz = Class.forName("com.ibm.ws.util.WsObjectInputStream");
try {
wsin = (ObjectInputStream) clazz.getConstructor(ByteArrayInputStream.class).newInstance(bai);
} catch (Exception e) {
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Exception closing the ObjectInputStream", e);
}
} else {
//Liberty server environment
ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
{
@Override
public ClassLoader run() {
return Thread.currentThread().getContextClassLoader();
}
});
wsin = new DeserializationObjectInputStream(bai, cl);
}
item = (Serializable) wsin.readObject();
try {
if (wsin != null) {
wsin.close();
}
} catch (IOException ex) {
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Exception closing the ObjectInputStream", ex);
}
}
return item;
} | [
"final",
"Serializable",
"restoreMapObject",
"(",
"byte",
"[",
"]",
"mapItemArray",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"Serializable",
"item",
"=",
"null",
";",
";",
"/* If it is a real byte array, we need to return a safe copy with the */",
"/* header bytes removed. */",
"if",
"(",
"(",
"mapItemArray",
"[",
"0",
"]",
"==",
"HEADER_BYTE_0",
")",
"&&",
"(",
"mapItemArray",
"[",
"1",
"]",
"==",
"HEADER_BYTE_1",
")",
")",
"{",
"item",
"=",
"new",
"byte",
"[",
"mapItemArray",
".",
"length",
"-",
"2",
"]",
";",
"System",
".",
"arraycopy",
"(",
"mapItemArray",
",",
"2",
",",
"item",
",",
"0",
",",
"(",
"(",
"byte",
"[",
"]",
")",
"item",
")",
".",
"length",
")",
";",
"}",
"/* Anything else needs deserializing. */",
"else",
"{",
"ByteArrayInputStream",
"bai",
"=",
"new",
"ByteArrayInputStream",
"(",
"mapItemArray",
")",
";",
"ObjectInputStream",
"wsin",
"=",
"null",
";",
"if",
"(",
"RuntimeInfo",
".",
"isThinClient",
"(",
")",
"||",
"RuntimeInfo",
".",
"isFatClient",
"(",
")",
")",
"{",
"//thin client environment. create ObjectInputStream from factory method.",
"//As of now getting twas factory class. ",
"//Hard coding now.. once when Libery thin client get developed, this can be taken to a factory type class.",
"Class",
"<",
"?",
">",
"clazz",
"=",
"Class",
".",
"forName",
"(",
"\"com.ibm.ws.util.WsObjectInputStream\"",
")",
";",
"try",
"{",
"wsin",
"=",
"(",
"ObjectInputStream",
")",
"clazz",
".",
"getConstructor",
"(",
"ByteArrayInputStream",
".",
"class",
")",
".",
"newInstance",
"(",
"bai",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// No FFDC code needed",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Exception closing the ObjectInputStream\"",
",",
"e",
")",
";",
"}",
"}",
"else",
"{",
"//Liberty server environment",
"ClassLoader",
"cl",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"ClassLoader",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ClassLoader",
"run",
"(",
")",
"{",
"return",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
";",
"}",
"}",
")",
";",
"wsin",
"=",
"new",
"DeserializationObjectInputStream",
"(",
"bai",
",",
"cl",
")",
";",
"}",
"item",
"=",
"(",
"Serializable",
")",
"wsin",
".",
"readObject",
"(",
")",
";",
"try",
"{",
"if",
"(",
"wsin",
"!=",
"null",
")",
"{",
"wsin",
".",
"close",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"// No FFDC code needed",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Exception closing the ObjectInputStream\"",
",",
"ex",
")",
";",
"}",
"}",
"return",
"item",
";",
"}"
] | Restore an item retrieved from a Property or SystemContext map as a byte
array into whatever it originally was.
For a Serialized property, the deserialized object is returned.
For any other byte array, a copy of the byte array is returned.
<p>
The method has package level visibility as it is used by JsSdoMessageImpl.
@param mapItemArray A byte array retrieved from the Map.
@return Serializable A reference to the Message Property or System Context item.
@exception IOException if the item could not be de-serialized
@exception ClassNotFoundException if the system context items class could not be found. | [
"Restore",
"an",
"item",
"retrieved",
"from",
"a",
"Property",
"or",
"SystemContext",
"map",
"as",
"a",
"byte",
"array",
"into",
"whatever",
"it",
"originally",
"was",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsApiMessageImpl.java#L1697-L1758 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsApiMessageImpl.java | JsApiMessageImpl.setTransportVersion | final void setTransportVersion(Object value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setTransportVersion", value);
getHdr2().setField(JsHdr2Access.TRANSPORTVERSION_DATA, value);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setTransportVersion");
} | java | final void setTransportVersion(Object value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setTransportVersion", value);
getHdr2().setField(JsHdr2Access.TRANSPORTVERSION_DATA, value);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setTransportVersion");
} | [
"final",
"void",
"setTransportVersion",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"setTransportVersion\"",
",",
"value",
")",
";",
"getHdr2",
"(",
")",
".",
"setField",
"(",
"JsHdr2Access",
".",
"TRANSPORTVERSION_DATA",
",",
"value",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"setTransportVersion\"",
")",
";",
"}"
] | Set the transportVersion field in the message header to the given value.
This method is package visibility as it is also used by JsJmsMessageImpl
@param value The value for the field, which must be a String. | [
"Set",
"the",
"transportVersion",
"field",
"in",
"the",
"message",
"header",
"to",
"the",
"given",
"value",
".",
"This",
"method",
"is",
"package",
"visibility",
"as",
"it",
"is",
"also",
"used",
"by",
"JsJmsMessageImpl"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsApiMessageImpl.java#L1813-L1819 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsApiMessageImpl.java | JsApiMessageImpl.clearTransportVersion | final void clearTransportVersion() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "clearTransportVersion");
getHdr2().setChoiceField(JsHdr2Access.TRANSPORTVERSION, JsHdr2Access.IS_TRANSPORTVERSION_EMPTY);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "clearTransportVersion");
} | java | final void clearTransportVersion() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "clearTransportVersion");
getHdr2().setChoiceField(JsHdr2Access.TRANSPORTVERSION, JsHdr2Access.IS_TRANSPORTVERSION_EMPTY);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "clearTransportVersion");
} | [
"final",
"void",
"clearTransportVersion",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"clearTransportVersion\"",
")",
";",
"getHdr2",
"(",
")",
".",
"setChoiceField",
"(",
"JsHdr2Access",
".",
"TRANSPORTVERSION",
",",
"JsHdr2Access",
".",
"IS_TRANSPORTVERSION_EMPTY",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"clearTransportVersion\"",
")",
";",
"}"
] | Clear the transportVersion field in the message header.
This method is package visibility as it is also used by JsJmsMessageImpl | [
"Clear",
"the",
"transportVersion",
"field",
"in",
"the",
"message",
"header",
".",
"This",
"method",
"is",
"package",
"visibility",
"as",
"it",
"is",
"also",
"used",
"by",
"JsJmsMessageImpl"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsApiMessageImpl.java#L1825-L1831 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/com/ibm/wsspi/jsp/resource/JspClassFactory.java | JspClassFactory.getInstanceOf | public Object getInstanceOf(String key){
try {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
return Class.forName((String)classesMap.get(key),true,loader).newInstance();
} catch (IllegalAccessException e) {
logger.logp(Level.SEVERE,"JspClassFactory","getInstanceOf","jsp.error.function.classnotfound",(String) classesMap.get(key));
} catch (InstantiationException e) {
logger.logp(Level.SEVERE,"JspClassFactory","getInstanceOf","jsp.error.function.classnotfound",(String) classesMap.get(key));
} catch (ClassNotFoundException e) {
logger.logp(Level.SEVERE,"JspClassFactory","getInstanceOf","jsp.error.function.classnotfound",(String) classesMap.get(key));
}
return null;
} | java | public Object getInstanceOf(String key){
try {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
return Class.forName((String)classesMap.get(key),true,loader).newInstance();
} catch (IllegalAccessException e) {
logger.logp(Level.SEVERE,"JspClassFactory","getInstanceOf","jsp.error.function.classnotfound",(String) classesMap.get(key));
} catch (InstantiationException e) {
logger.logp(Level.SEVERE,"JspClassFactory","getInstanceOf","jsp.error.function.classnotfound",(String) classesMap.get(key));
} catch (ClassNotFoundException e) {
logger.logp(Level.SEVERE,"JspClassFactory","getInstanceOf","jsp.error.function.classnotfound",(String) classesMap.get(key));
}
return null;
} | [
"public",
"Object",
"getInstanceOf",
"(",
"String",
"key",
")",
"{",
"try",
"{",
"ClassLoader",
"loader",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
";",
"return",
"Class",
".",
"forName",
"(",
"(",
"String",
")",
"classesMap",
".",
"get",
"(",
"key",
")",
",",
"true",
",",
"loader",
")",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"SEVERE",
",",
"\"JspClassFactory\"",
",",
"\"getInstanceOf\"",
",",
"\"jsp.error.function.classnotfound\"",
",",
"(",
"String",
")",
"classesMap",
".",
"get",
"(",
"key",
")",
")",
";",
"}",
"catch",
"(",
"InstantiationException",
"e",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"SEVERE",
",",
"\"JspClassFactory\"",
",",
"\"getInstanceOf\"",
",",
"\"jsp.error.function.classnotfound\"",
",",
"(",
"String",
")",
"classesMap",
".",
"get",
"(",
"key",
")",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"SEVERE",
",",
"\"JspClassFactory\"",
",",
"\"getInstanceOf\"",
",",
"\"jsp.error.function.classnotfound\"",
",",
"(",
"String",
")",
"classesMap",
".",
"get",
"(",
"key",
")",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Creates an instance of the type of class specified by the key arg, dependent on the
value stored in the classesMap.
@param key
@return an object of the type corresponding to the key. | [
"Creates",
"an",
"instance",
"of",
"the",
"type",
"of",
"class",
"specified",
"by",
"the",
"key",
"arg",
"dependent",
"on",
"the",
"value",
"stored",
"in",
"the",
"classesMap",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/wsspi/jsp/resource/JspClassFactory.java#L51-L66 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/subsystem/FeatureDefinitionUtils.java | FeatureDefinitionUtils.loadAttributes | static ImmutableAttributes loadAttributes(String repoType, File featureFile, ProvisioningDetails details) throws IOException {
// This will throw exceptions if required attributes mismatch or are missing
details.ensureValid();
// retrieve the symbolic name and feature manifest version
String symbolicName = details.getNameAttribute(null);
int featureVersion = details.getIBMFeatureVersion();
// Directive names are name attributes, but end with a colon
Visibility visibility = Visibility.fromString(details.getNameAttribute("visibility:"));
boolean isSingleton = Boolean.parseBoolean(details.getNameAttribute("singleton:"));
// ignore short name for features that are not public
String shortName = (visibility != Visibility.PUBLIC ? null : details.getMainAttributeValue(SHORT_NAME));
// retrieve the feature/subsystem version
Version version = VersionUtility.stringToVersion(details.getMainAttributeValue(VERSION));
// retrieve the app restart header
AppForceRestart appRestart = AppForceRestart.fromString(details.getMainAttributeValue(IBM_APP_FORCE_RESTART));
String subsystemType = details.getMainAttributeValue(TYPE);
String value = details.getCachedRawHeader(IBM_PROVISION_CAPABILITY);
boolean isAutoFeature = value != null && SubsystemContentType.FEATURE_TYPE.getValue().equals(subsystemType);
value = details.getCachedRawHeader(IBM_API_SERVICE);
boolean hasApiServices = value != null;
value = details.getCachedRawHeader(IBM_API_PACKAGE);
boolean hasApiPackages = value != null;
value = details.getCachedRawHeader(IBM_SPI_PACKAGE);
boolean hasSpiPackages = value != null;
EnumSet<ProcessType> processTypes = ProcessType.fromString(details.getCachedRawHeader(IBM_PROCESS_TYPES));
ImmutableAttributes iAttr = new ImmutableAttributes(emptyIfNull(repoType),
symbolicName,
nullIfEmpty(shortName),
featureVersion,
visibility,
appRestart,
version,
featureFile,
featureFile == null ? -1 : featureFile.lastModified(),
featureFile == null ? -1 : featureFile.length(),
isAutoFeature, hasApiServices,
hasApiPackages, hasSpiPackages, isSingleton,
processTypes);
// Link the details object and immutable attributes (used for diagnostic purposes:
// the immutable attribute values are necessary for meaningful error messages)
details.setImmutableAttributes(iAttr);
return iAttr;
} | java | static ImmutableAttributes loadAttributes(String repoType, File featureFile, ProvisioningDetails details) throws IOException {
// This will throw exceptions if required attributes mismatch or are missing
details.ensureValid();
// retrieve the symbolic name and feature manifest version
String symbolicName = details.getNameAttribute(null);
int featureVersion = details.getIBMFeatureVersion();
// Directive names are name attributes, but end with a colon
Visibility visibility = Visibility.fromString(details.getNameAttribute("visibility:"));
boolean isSingleton = Boolean.parseBoolean(details.getNameAttribute("singleton:"));
// ignore short name for features that are not public
String shortName = (visibility != Visibility.PUBLIC ? null : details.getMainAttributeValue(SHORT_NAME));
// retrieve the feature/subsystem version
Version version = VersionUtility.stringToVersion(details.getMainAttributeValue(VERSION));
// retrieve the app restart header
AppForceRestart appRestart = AppForceRestart.fromString(details.getMainAttributeValue(IBM_APP_FORCE_RESTART));
String subsystemType = details.getMainAttributeValue(TYPE);
String value = details.getCachedRawHeader(IBM_PROVISION_CAPABILITY);
boolean isAutoFeature = value != null && SubsystemContentType.FEATURE_TYPE.getValue().equals(subsystemType);
value = details.getCachedRawHeader(IBM_API_SERVICE);
boolean hasApiServices = value != null;
value = details.getCachedRawHeader(IBM_API_PACKAGE);
boolean hasApiPackages = value != null;
value = details.getCachedRawHeader(IBM_SPI_PACKAGE);
boolean hasSpiPackages = value != null;
EnumSet<ProcessType> processTypes = ProcessType.fromString(details.getCachedRawHeader(IBM_PROCESS_TYPES));
ImmutableAttributes iAttr = new ImmutableAttributes(emptyIfNull(repoType),
symbolicName,
nullIfEmpty(shortName),
featureVersion,
visibility,
appRestart,
version,
featureFile,
featureFile == null ? -1 : featureFile.lastModified(),
featureFile == null ? -1 : featureFile.length(),
isAutoFeature, hasApiServices,
hasApiPackages, hasSpiPackages, isSingleton,
processTypes);
// Link the details object and immutable attributes (used for diagnostic purposes:
// the immutable attribute values are necessary for meaningful error messages)
details.setImmutableAttributes(iAttr);
return iAttr;
} | [
"static",
"ImmutableAttributes",
"loadAttributes",
"(",
"String",
"repoType",
",",
"File",
"featureFile",
",",
"ProvisioningDetails",
"details",
")",
"throws",
"IOException",
"{",
"// This will throw exceptions if required attributes mismatch or are missing",
"details",
".",
"ensureValid",
"(",
")",
";",
"// retrieve the symbolic name and feature manifest version",
"String",
"symbolicName",
"=",
"details",
".",
"getNameAttribute",
"(",
"null",
")",
";",
"int",
"featureVersion",
"=",
"details",
".",
"getIBMFeatureVersion",
"(",
")",
";",
"// Directive names are name attributes, but end with a colon",
"Visibility",
"visibility",
"=",
"Visibility",
".",
"fromString",
"(",
"details",
".",
"getNameAttribute",
"(",
"\"visibility:\"",
")",
")",
";",
"boolean",
"isSingleton",
"=",
"Boolean",
".",
"parseBoolean",
"(",
"details",
".",
"getNameAttribute",
"(",
"\"singleton:\"",
")",
")",
";",
"// ignore short name for features that are not public",
"String",
"shortName",
"=",
"(",
"visibility",
"!=",
"Visibility",
".",
"PUBLIC",
"?",
"null",
":",
"details",
".",
"getMainAttributeValue",
"(",
"SHORT_NAME",
")",
")",
";",
"// retrieve the feature/subsystem version ",
"Version",
"version",
"=",
"VersionUtility",
".",
"stringToVersion",
"(",
"details",
".",
"getMainAttributeValue",
"(",
"VERSION",
")",
")",
";",
"// retrieve the app restart header",
"AppForceRestart",
"appRestart",
"=",
"AppForceRestart",
".",
"fromString",
"(",
"details",
".",
"getMainAttributeValue",
"(",
"IBM_APP_FORCE_RESTART",
")",
")",
";",
"String",
"subsystemType",
"=",
"details",
".",
"getMainAttributeValue",
"(",
"TYPE",
")",
";",
"String",
"value",
"=",
"details",
".",
"getCachedRawHeader",
"(",
"IBM_PROVISION_CAPABILITY",
")",
";",
"boolean",
"isAutoFeature",
"=",
"value",
"!=",
"null",
"&&",
"SubsystemContentType",
".",
"FEATURE_TYPE",
".",
"getValue",
"(",
")",
".",
"equals",
"(",
"subsystemType",
")",
";",
"value",
"=",
"details",
".",
"getCachedRawHeader",
"(",
"IBM_API_SERVICE",
")",
";",
"boolean",
"hasApiServices",
"=",
"value",
"!=",
"null",
";",
"value",
"=",
"details",
".",
"getCachedRawHeader",
"(",
"IBM_API_PACKAGE",
")",
";",
"boolean",
"hasApiPackages",
"=",
"value",
"!=",
"null",
";",
"value",
"=",
"details",
".",
"getCachedRawHeader",
"(",
"IBM_SPI_PACKAGE",
")",
";",
"boolean",
"hasSpiPackages",
"=",
"value",
"!=",
"null",
";",
"EnumSet",
"<",
"ProcessType",
">",
"processTypes",
"=",
"ProcessType",
".",
"fromString",
"(",
"details",
".",
"getCachedRawHeader",
"(",
"IBM_PROCESS_TYPES",
")",
")",
";",
"ImmutableAttributes",
"iAttr",
"=",
"new",
"ImmutableAttributes",
"(",
"emptyIfNull",
"(",
"repoType",
")",
",",
"symbolicName",
",",
"nullIfEmpty",
"(",
"shortName",
")",
",",
"featureVersion",
",",
"visibility",
",",
"appRestart",
",",
"version",
",",
"featureFile",
",",
"featureFile",
"==",
"null",
"?",
"-",
"1",
":",
"featureFile",
".",
"lastModified",
"(",
")",
",",
"featureFile",
"==",
"null",
"?",
"-",
"1",
":",
"featureFile",
".",
"length",
"(",
")",
",",
"isAutoFeature",
",",
"hasApiServices",
",",
"hasApiPackages",
",",
"hasSpiPackages",
",",
"isSingleton",
",",
"processTypes",
")",
";",
"// Link the details object and immutable attributes (used for diagnostic purposes: ",
"// the immutable attribute values are necessary for meaningful error messages)",
"details",
".",
"setImmutableAttributes",
"(",
"iAttr",
")",
";",
"return",
"iAttr",
";",
"}"
] | Create the ImmutableAttributes based on the contents read from a subsystem
manifest.
@param details ManifestDetails containing manifest parser and accessor methods
for retrieving information from the manifest.
@return new ImmutableAttributes | [
"Create",
"the",
"ImmutableAttributes",
"based",
"on",
"the",
"contents",
"read",
"from",
"a",
"subsystem",
"manifest",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/subsystem/FeatureDefinitionUtils.java#L261-L318 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/subsystem/FeatureDefinitionUtils.java | FeatureDefinitionUtils.loadAttributes | static ImmutableAttributes loadAttributes(String line,
ImmutableAttributes cachedAttributes) {
// Builder pattern for Immutable attributes
// This parses a cache line that looks like this:
// repoType|symbolicName=Lots;of;attribtues
int index = line.indexOf('=');
String key = line.substring(0, index);
String repoType = FeatureDefinitionUtils.EMPTY;
String symbolicName = key;
// Do we have a prefix repoType? If so, split the key.
int pfxIndex = key.indexOf(':');
if (pfxIndex > -1) {
repoType = key.substring(0, pfxIndex);
symbolicName = key.substring(pfxIndex + 1);
}
// Now let's work on the value half...
String[] parts = splitPattern.split(line.substring(index + 1));
// Old or mismatched cache
if (parts.length < 9)
return null;
String path = parts[0];
// Make sure file information from cache line is still accurate
// i.e. the file exists, and the modification time and size have not changed.
File featureFile = new File(path);
if (featureFile.exists()) {
// Did we have a previous entry in the cache already?
// This will happen on a subsequent feature update operation (post-initial provisioning)
if (cachedAttributes != null) {
return cachedAttributes;
}
// Assuming we're still good, but didn't have a cache entry, we should read the rest
// of the attributes..
long lastModified = getLongValue(parts[1], -1);
long fileSize = getLongValue(parts[2], -1);
String shortName = parts[3];
int featureVersion = getIntegerValue(parts[4], 2);
Visibility visibility = Visibility.fromString(parts[5]);
AppForceRestart appRestart = AppForceRestart.fromString(parts[6]);
Version version = VersionUtility.stringToVersion(parts[7]);
String flags = parts[8];
boolean isAutoFeature = toBoolean(flags.charAt(0));
boolean hasApiServices = toBoolean(flags.charAt(1));
boolean hasApiPackages = toBoolean(flags.charAt(2));
boolean hasSpiPackages = toBoolean(flags.charAt(3));
boolean isSingleton = flags.length() > 4 ? toBoolean(flags.charAt(4)) : false;
EnumSet<ProcessType> processTypes = ProcessType.fromString(parts.length > 9 ? parts[9] : null);
// Everything is ok with the cache contents,
// make a new subsystem definition from the cached information
return new ImmutableAttributes(emptyIfNull(repoType),
symbolicName,
nullIfEmpty(shortName),
featureVersion,
visibility,
appRestart,
version,
featureFile,
lastModified,
fileSize,
isAutoFeature, hasApiServices,
hasApiPackages, hasSpiPackages, isSingleton,
processTypes);
}
// The definition in the filesystem has been deleted: return null to remove it from the cache
return null;
} | java | static ImmutableAttributes loadAttributes(String line,
ImmutableAttributes cachedAttributes) {
// Builder pattern for Immutable attributes
// This parses a cache line that looks like this:
// repoType|symbolicName=Lots;of;attribtues
int index = line.indexOf('=');
String key = line.substring(0, index);
String repoType = FeatureDefinitionUtils.EMPTY;
String symbolicName = key;
// Do we have a prefix repoType? If so, split the key.
int pfxIndex = key.indexOf(':');
if (pfxIndex > -1) {
repoType = key.substring(0, pfxIndex);
symbolicName = key.substring(pfxIndex + 1);
}
// Now let's work on the value half...
String[] parts = splitPattern.split(line.substring(index + 1));
// Old or mismatched cache
if (parts.length < 9)
return null;
String path = parts[0];
// Make sure file information from cache line is still accurate
// i.e. the file exists, and the modification time and size have not changed.
File featureFile = new File(path);
if (featureFile.exists()) {
// Did we have a previous entry in the cache already?
// This will happen on a subsequent feature update operation (post-initial provisioning)
if (cachedAttributes != null) {
return cachedAttributes;
}
// Assuming we're still good, but didn't have a cache entry, we should read the rest
// of the attributes..
long lastModified = getLongValue(parts[1], -1);
long fileSize = getLongValue(parts[2], -1);
String shortName = parts[3];
int featureVersion = getIntegerValue(parts[4], 2);
Visibility visibility = Visibility.fromString(parts[5]);
AppForceRestart appRestart = AppForceRestart.fromString(parts[6]);
Version version = VersionUtility.stringToVersion(parts[7]);
String flags = parts[8];
boolean isAutoFeature = toBoolean(flags.charAt(0));
boolean hasApiServices = toBoolean(flags.charAt(1));
boolean hasApiPackages = toBoolean(flags.charAt(2));
boolean hasSpiPackages = toBoolean(flags.charAt(3));
boolean isSingleton = flags.length() > 4 ? toBoolean(flags.charAt(4)) : false;
EnumSet<ProcessType> processTypes = ProcessType.fromString(parts.length > 9 ? parts[9] : null);
// Everything is ok with the cache contents,
// make a new subsystem definition from the cached information
return new ImmutableAttributes(emptyIfNull(repoType),
symbolicName,
nullIfEmpty(shortName),
featureVersion,
visibility,
appRestart,
version,
featureFile,
lastModified,
fileSize,
isAutoFeature, hasApiServices,
hasApiPackages, hasSpiPackages, isSingleton,
processTypes);
}
// The definition in the filesystem has been deleted: return null to remove it from the cache
return null;
} | [
"static",
"ImmutableAttributes",
"loadAttributes",
"(",
"String",
"line",
",",
"ImmutableAttributes",
"cachedAttributes",
")",
"{",
"// Builder pattern for Immutable attributes",
"// This parses a cache line that looks like this: ",
"// repoType|symbolicName=Lots;of;attribtues",
"int",
"index",
"=",
"line",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"String",
"key",
"=",
"line",
".",
"substring",
"(",
"0",
",",
"index",
")",
";",
"String",
"repoType",
"=",
"FeatureDefinitionUtils",
".",
"EMPTY",
";",
"String",
"symbolicName",
"=",
"key",
";",
"// Do we have a prefix repoType? If so, split the key.",
"int",
"pfxIndex",
"=",
"key",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"pfxIndex",
">",
"-",
"1",
")",
"{",
"repoType",
"=",
"key",
".",
"substring",
"(",
"0",
",",
"pfxIndex",
")",
";",
"symbolicName",
"=",
"key",
".",
"substring",
"(",
"pfxIndex",
"+",
"1",
")",
";",
"}",
"// Now let's work on the value half... ",
"String",
"[",
"]",
"parts",
"=",
"splitPattern",
".",
"split",
"(",
"line",
".",
"substring",
"(",
"index",
"+",
"1",
")",
")",
";",
"// Old or mismatched cache",
"if",
"(",
"parts",
".",
"length",
"<",
"9",
")",
"return",
"null",
";",
"String",
"path",
"=",
"parts",
"[",
"0",
"]",
";",
"// Make sure file information from cache line is still accurate",
"// i.e. the file exists, and the modification time and size have not changed.",
"File",
"featureFile",
"=",
"new",
"File",
"(",
"path",
")",
";",
"if",
"(",
"featureFile",
".",
"exists",
"(",
")",
")",
"{",
"// Did we have a previous entry in the cache already?",
"// This will happen on a subsequent feature update operation (post-initial provisioning)",
"if",
"(",
"cachedAttributes",
"!=",
"null",
")",
"{",
"return",
"cachedAttributes",
";",
"}",
"// Assuming we're still good, but didn't have a cache entry, we should read the rest",
"// of the attributes.. ",
"long",
"lastModified",
"=",
"getLongValue",
"(",
"parts",
"[",
"1",
"]",
",",
"-",
"1",
")",
";",
"long",
"fileSize",
"=",
"getLongValue",
"(",
"parts",
"[",
"2",
"]",
",",
"-",
"1",
")",
";",
"String",
"shortName",
"=",
"parts",
"[",
"3",
"]",
";",
"int",
"featureVersion",
"=",
"getIntegerValue",
"(",
"parts",
"[",
"4",
"]",
",",
"2",
")",
";",
"Visibility",
"visibility",
"=",
"Visibility",
".",
"fromString",
"(",
"parts",
"[",
"5",
"]",
")",
";",
"AppForceRestart",
"appRestart",
"=",
"AppForceRestart",
".",
"fromString",
"(",
"parts",
"[",
"6",
"]",
")",
";",
"Version",
"version",
"=",
"VersionUtility",
".",
"stringToVersion",
"(",
"parts",
"[",
"7",
"]",
")",
";",
"String",
"flags",
"=",
"parts",
"[",
"8",
"]",
";",
"boolean",
"isAutoFeature",
"=",
"toBoolean",
"(",
"flags",
".",
"charAt",
"(",
"0",
")",
")",
";",
"boolean",
"hasApiServices",
"=",
"toBoolean",
"(",
"flags",
".",
"charAt",
"(",
"1",
")",
")",
";",
"boolean",
"hasApiPackages",
"=",
"toBoolean",
"(",
"flags",
".",
"charAt",
"(",
"2",
")",
")",
";",
"boolean",
"hasSpiPackages",
"=",
"toBoolean",
"(",
"flags",
".",
"charAt",
"(",
"3",
")",
")",
";",
"boolean",
"isSingleton",
"=",
"flags",
".",
"length",
"(",
")",
">",
"4",
"?",
"toBoolean",
"(",
"flags",
".",
"charAt",
"(",
"4",
")",
")",
":",
"false",
";",
"EnumSet",
"<",
"ProcessType",
">",
"processTypes",
"=",
"ProcessType",
".",
"fromString",
"(",
"parts",
".",
"length",
">",
"9",
"?",
"parts",
"[",
"9",
"]",
":",
"null",
")",
";",
"// Everything is ok with the cache contents, ",
"// make a new subsystem definition from the cached information",
"return",
"new",
"ImmutableAttributes",
"(",
"emptyIfNull",
"(",
"repoType",
")",
",",
"symbolicName",
",",
"nullIfEmpty",
"(",
"shortName",
")",
",",
"featureVersion",
",",
"visibility",
",",
"appRestart",
",",
"version",
",",
"featureFile",
",",
"lastModified",
",",
"fileSize",
",",
"isAutoFeature",
",",
"hasApiServices",
",",
"hasApiPackages",
",",
"hasSpiPackages",
",",
"isSingleton",
",",
"processTypes",
")",
";",
"}",
"// The definition in the filesystem has been deleted: return null to remove it from the cache",
"return",
"null",
";",
"}"
] | Create the ImmutableAttributes based on an line in a cache file.
There is no validation or warnings in this load path, as it is assumed the
definition would not have been added to the cache if it were invalid.
@param line Line containing feature information from the cache file
@param cachedEntry the previous attributes from the cache. This will be null for initial provisioning.
@return If the backing file has not changed, either the existing ImmutableAttributes or a
new ImmutableAttributes object will be returned. If the backing file has changed,
null will be returned. | [
"Create",
"the",
"ImmutableAttributes",
"based",
"on",
"an",
"line",
"in",
"a",
"cache",
"file",
".",
"There",
"is",
"no",
"validation",
"or",
"warnings",
"in",
"this",
"load",
"path",
"as",
"it",
"is",
"assumed",
"the",
"definition",
"would",
"not",
"have",
"been",
"added",
"to",
"the",
"cache",
"if",
"it",
"were",
"invalid",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/subsystem/FeatureDefinitionUtils.java#L332-L408 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/cache/links/ItemLink.java | ItemLink.commitDecrementReferenceCount | public final synchronized void commitDecrementReferenceCount(PersistentTransaction transaction) throws SevereMessageStoreException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "commitDecrementReferenceCount");
if (_referenceCount < 1)
{
SevereMessageStoreException e = new SevereMessageStoreException("Reference count decrement cannot be committed");
FFDCFilter.processException(e, "com.ibm.ws.sib.msgstore.cache.links.ItemLink.commitDecrementReferenceCount", "1:131:1.104.1.1");
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Reference count decrement cannot be committed");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "commitDecrementReferenceCount");
throw e;
}
_referenceCount--;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "reference count dropped to: " + _referenceCount);
if (0 == _referenceCount)
{
// This causes the item's itemReferencesDroppedToZero to be called after
// completion of this transaction
transaction.registerCallback(this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "commitDecrementReferenceCount");
} | java | public final synchronized void commitDecrementReferenceCount(PersistentTransaction transaction) throws SevereMessageStoreException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "commitDecrementReferenceCount");
if (_referenceCount < 1)
{
SevereMessageStoreException e = new SevereMessageStoreException("Reference count decrement cannot be committed");
FFDCFilter.processException(e, "com.ibm.ws.sib.msgstore.cache.links.ItemLink.commitDecrementReferenceCount", "1:131:1.104.1.1");
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Reference count decrement cannot be committed");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "commitDecrementReferenceCount");
throw e;
}
_referenceCount--;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "reference count dropped to: " + _referenceCount);
if (0 == _referenceCount)
{
// This causes the item's itemReferencesDroppedToZero to be called after
// completion of this transaction
transaction.registerCallback(this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "commitDecrementReferenceCount");
} | [
"public",
"final",
"synchronized",
"void",
"commitDecrementReferenceCount",
"(",
"PersistentTransaction",
"transaction",
")",
"throws",
"SevereMessageStoreException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"commitDecrementReferenceCount\"",
")",
";",
"if",
"(",
"_referenceCount",
"<",
"1",
")",
"{",
"SevereMessageStoreException",
"e",
"=",
"new",
"SevereMessageStoreException",
"(",
"\"Reference count decrement cannot be committed\"",
")",
";",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.msgstore.cache.links.ItemLink.commitDecrementReferenceCount\"",
",",
"\"1:131:1.104.1.1\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"SibTr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"Reference count decrement cannot be committed\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"commitDecrementReferenceCount\"",
")",
";",
"throw",
"e",
";",
"}",
"_referenceCount",
"--",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"reference count dropped to: \"",
"+",
"_referenceCount",
")",
";",
"if",
"(",
"0",
"==",
"_referenceCount",
")",
"{",
"// This causes the item's itemReferencesDroppedToZero to be called after",
"// completion of this transaction",
"transaction",
".",
"registerCallback",
"(",
"this",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"commitDecrementReferenceCount\"",
")",
";",
"}"
] | This method is called when committing the removal of a reference.
It should only be called by the message store code.
@param transaction The transaction
@throws SevereMessageStoreException | [
"This",
"method",
"is",
"called",
"when",
"committing",
"the",
"removal",
"of",
"a",
"reference",
".",
"It",
"should",
"only",
"be",
"called",
"by",
"the",
"message",
"store",
"code",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/cache/links/ItemLink.java#L98-L122 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/cache/links/ItemLink.java | ItemLink.incrementReferenceCount | public final synchronized void incrementReferenceCount() throws SevereMessageStoreException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "incrementReferenceCount");
if (_referenceCountIsDecreasing)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Cannot increment! Reference count has begun decreasing.");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "incrementReferenceCount");
throw new SevereMessageStoreException("Cannot add more references to an item after one has been removed");
}
_referenceCount++;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "incrementReferenceCount");
} | java | public final synchronized void incrementReferenceCount() throws SevereMessageStoreException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "incrementReferenceCount");
if (_referenceCountIsDecreasing)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Cannot increment! Reference count has begun decreasing.");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "incrementReferenceCount");
throw new SevereMessageStoreException("Cannot add more references to an item after one has been removed");
}
_referenceCount++;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "incrementReferenceCount");
} | [
"public",
"final",
"synchronized",
"void",
"incrementReferenceCount",
"(",
")",
"throws",
"SevereMessageStoreException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"incrementReferenceCount\"",
")",
";",
"if",
"(",
"_referenceCountIsDecreasing",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"SibTr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"Cannot increment! Reference count has begun decreasing.\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"incrementReferenceCount\"",
")",
";",
"throw",
"new",
"SevereMessageStoreException",
"(",
"\"Cannot add more references to an item after one has been removed\"",
")",
";",
"}",
"_referenceCount",
"++",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"incrementReferenceCount\"",
")",
";",
"}"
] | This method is called when a reference is being added by an active transaction
and when a reference is being restored.
It should only be called by the message store code.
@throws SevereMessageStoreException | [
"This",
"method",
"is",
"called",
"when",
"a",
"reference",
"is",
"being",
"added",
"by",
"an",
"active",
"transaction",
"and",
"when",
"a",
"reference",
"is",
"being",
"restored",
".",
"It",
"should",
"only",
"be",
"called",
"by",
"the",
"message",
"store",
"code",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/cache/links/ItemLink.java#L143-L156 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/cache/links/ItemLink.java | ItemLink.rollbackIncrementReferenceCount | public final synchronized void rollbackIncrementReferenceCount(PersistentTransaction transaction) throws SevereMessageStoreException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "rollbackIncrementReferenceCount");
if (_referenceCount < 1)
{
SevereMessageStoreException e = new SevereMessageStoreException("Reference count increment cannot be rolled back");
FFDCFilter.processException(e, "com.ibm.ws.sib.msgstore.cache.links.ItemLink.rollbackIncrementReferenceCount", "1:212:1.104.1.1");
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Reference count increment cannot be rolled back");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "rollbackIncrementReferenceCount");
throw e;
}
_referenceCount--;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "rollbackIncrementReferenceCount");
} | java | public final synchronized void rollbackIncrementReferenceCount(PersistentTransaction transaction) throws SevereMessageStoreException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "rollbackIncrementReferenceCount");
if (_referenceCount < 1)
{
SevereMessageStoreException e = new SevereMessageStoreException("Reference count increment cannot be rolled back");
FFDCFilter.processException(e, "com.ibm.ws.sib.msgstore.cache.links.ItemLink.rollbackIncrementReferenceCount", "1:212:1.104.1.1");
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Reference count increment cannot be rolled back");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "rollbackIncrementReferenceCount");
throw e;
}
_referenceCount--;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "rollbackIncrementReferenceCount");
} | [
"public",
"final",
"synchronized",
"void",
"rollbackIncrementReferenceCount",
"(",
"PersistentTransaction",
"transaction",
")",
"throws",
"SevereMessageStoreException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"rollbackIncrementReferenceCount\"",
")",
";",
"if",
"(",
"_referenceCount",
"<",
"1",
")",
"{",
"SevereMessageStoreException",
"e",
"=",
"new",
"SevereMessageStoreException",
"(",
"\"Reference count increment cannot be rolled back\"",
")",
";",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.msgstore.cache.links.ItemLink.rollbackIncrementReferenceCount\"",
",",
"\"1:212:1.104.1.1\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Reference count increment cannot be rolled back\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"rollbackIncrementReferenceCount\"",
")",
";",
"throw",
"e",
";",
"}",
"_referenceCount",
"--",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"rollbackIncrementReferenceCount\"",
")",
";",
"}"
] | This method is called when rolling back the addition of a reference.
It should only be called by the message store code.
@param transaction The transaction
@throws SevereMessageStoreException | [
"This",
"method",
"is",
"called",
"when",
"rolling",
"back",
"the",
"addition",
"of",
"a",
"reference",
".",
"It",
"should",
"only",
"be",
"called",
"by",
"the",
"message",
"store",
"code",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/cache/links/ItemLink.java#L179-L194 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/internal/KeystoreConfigurationFactory.java | KeystoreConfigurationFactory.performFileBasedAction | @Override
public void performFileBasedAction(Collection<File> modifiedFiles) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "performFileBasedAction", new Object[] { modifiedFiles });
try {
com.ibm.ws.ssl.config.KeyStoreManager.getInstance().clearJavaKeyStoresFromKeyStoreMap(modifiedFiles);
com.ibm.ws.ssl.provider.AbstractJSSEProvider.clearSSLContextCache(modifiedFiles);
com.ibm.ws.ssl.config.SSLConfigManager.getInstance().resetDefaultSSLContextIfNeeded(modifiedFiles);
Tr.audit(tc, "ssl.keystore.modified.CWPKI0811I", modifiedFiles.toArray());
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Exception while trying to reload keystore file, exception is: " + e.getMessage());
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "performFileBasedAction");
} | java | @Override
public void performFileBasedAction(Collection<File> modifiedFiles) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "performFileBasedAction", new Object[] { modifiedFiles });
try {
com.ibm.ws.ssl.config.KeyStoreManager.getInstance().clearJavaKeyStoresFromKeyStoreMap(modifiedFiles);
com.ibm.ws.ssl.provider.AbstractJSSEProvider.clearSSLContextCache(modifiedFiles);
com.ibm.ws.ssl.config.SSLConfigManager.getInstance().resetDefaultSSLContextIfNeeded(modifiedFiles);
Tr.audit(tc, "ssl.keystore.modified.CWPKI0811I", modifiedFiles.toArray());
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Exception while trying to reload keystore file, exception is: " + e.getMessage());
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "performFileBasedAction");
} | [
"@",
"Override",
"public",
"void",
"performFileBasedAction",
"(",
"Collection",
"<",
"File",
">",
"modifiedFiles",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"performFileBasedAction\"",
",",
"new",
"Object",
"[",
"]",
"{",
"modifiedFiles",
"}",
")",
";",
"try",
"{",
"com",
".",
"ibm",
".",
"ws",
".",
"ssl",
".",
"config",
".",
"KeyStoreManager",
".",
"getInstance",
"(",
")",
".",
"clearJavaKeyStoresFromKeyStoreMap",
"(",
"modifiedFiles",
")",
";",
"com",
".",
"ibm",
".",
"ws",
".",
"ssl",
".",
"provider",
".",
"AbstractJSSEProvider",
".",
"clearSSLContextCache",
"(",
"modifiedFiles",
")",
";",
"com",
".",
"ibm",
".",
"ws",
".",
"ssl",
".",
"config",
".",
"SSLConfigManager",
".",
"getInstance",
"(",
")",
".",
"resetDefaultSSLContextIfNeeded",
"(",
"modifiedFiles",
")",
";",
"Tr",
".",
"audit",
"(",
"tc",
",",
"\"ssl.keystore.modified.CWPKI0811I\"",
",",
"modifiedFiles",
".",
"toArray",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Exception while trying to reload keystore file, exception is: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"performFileBasedAction\"",
")",
";",
"}"
] | The specified files have been modified and we need to clear the SSLContext caches and
keystore caches. This will cause the new keystore file to get loaded on the next use of the
ssl context. If the keystore associated with the SSLContext that the process is using then
the process SSLContext needs to be reloaded. | [
"The",
"specified",
"files",
"have",
"been",
"modified",
"and",
"we",
"need",
"to",
"clear",
"the",
"SSLContext",
"caches",
"and",
"keystore",
"caches",
".",
"This",
"will",
"cause",
"the",
"new",
"keystore",
"file",
"to",
"get",
"loaded",
"on",
"the",
"next",
"use",
"of",
"the",
"ssl",
"context",
".",
"If",
"the",
"keystore",
"associated",
"with",
"the",
"SSLContext",
"that",
"the",
"process",
"is",
"using",
"then",
"the",
"process",
"SSLContext",
"needs",
"to",
"be",
"reloaded",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/internal/KeystoreConfigurationFactory.java#L187-L204 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/internal/KeystoreConfigurationFactory.java | KeystoreConfigurationFactory.unsetFileMonitorRegistration | protected void unsetFileMonitorRegistration() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "unsetFileMonitorRegistration");
}
if (keyStoreFileMonitorRegistration != null) {
keyStoreFileMonitorRegistration.unregister();
keyStoreFileMonitorRegistration = null;
}
} | java | protected void unsetFileMonitorRegistration() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "unsetFileMonitorRegistration");
}
if (keyStoreFileMonitorRegistration != null) {
keyStoreFileMonitorRegistration.unregister();
keyStoreFileMonitorRegistration = null;
}
} | [
"protected",
"void",
"unsetFileMonitorRegistration",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"unsetFileMonitorRegistration\"",
")",
";",
"}",
"if",
"(",
"keyStoreFileMonitorRegistration",
"!=",
"null",
")",
"{",
"keyStoreFileMonitorRegistration",
".",
"unregister",
"(",
")",
";",
"keyStoreFileMonitorRegistration",
"=",
"null",
";",
"}",
"}"
] | Remove the reference to the file monitor. | [
"Remove",
"the",
"reference",
"to",
"the",
"file",
"monitor",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/internal/KeystoreConfigurationFactory.java#L251-L259 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/internal/KeystoreConfigurationFactory.java | KeystoreConfigurationFactory.setFileMonitorRegistration | protected void setFileMonitorRegistration(ServiceRegistration<FileMonitor> keyStoreFileMonitorRegistration) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "setFileMonitorRegistration");
}
this.keyStoreFileMonitorRegistration = keyStoreFileMonitorRegistration;
} | java | protected void setFileMonitorRegistration(ServiceRegistration<FileMonitor> keyStoreFileMonitorRegistration) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "setFileMonitorRegistration");
}
this.keyStoreFileMonitorRegistration = keyStoreFileMonitorRegistration;
} | [
"protected",
"void",
"setFileMonitorRegistration",
"(",
"ServiceRegistration",
"<",
"FileMonitor",
">",
"keyStoreFileMonitorRegistration",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"setFileMonitorRegistration\"",
")",
";",
"}",
"this",
".",
"keyStoreFileMonitorRegistration",
"=",
"keyStoreFileMonitorRegistration",
";",
"}"
] | Sets the keystore file monitor registration.
@param keyStoreFileMonitorRegistration | [
"Sets",
"the",
"keystore",
"file",
"monitor",
"registration",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/internal/KeystoreConfigurationFactory.java#L266-L271 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/internal/KeystoreConfigurationFactory.java | KeystoreConfigurationFactory.createFileMonitor | private void createFileMonitor(String ID, String keyStoreLocation, String trigger, long interval) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "createFileMonitor", new Object[] { ID, keyStoreLocation, trigger, interval });
try {
keyStoreFileMonitor = new SecurityFileMonitor(this);
setFileMonitorRegistration(keyStoreFileMonitor.monitorFiles(ID, Arrays.asList(keyStoreLocation), interval, trigger));
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Exception creating the keystore file monitor.", e);
}
FFDCFilter.processException(e, getClass().getName(), "createFileMonitor", this, new Object[] { ID, keyStoreLocation, interval });
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "createFileMonitor");
} | java | private void createFileMonitor(String ID, String keyStoreLocation, String trigger, long interval) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "createFileMonitor", new Object[] { ID, keyStoreLocation, trigger, interval });
try {
keyStoreFileMonitor = new SecurityFileMonitor(this);
setFileMonitorRegistration(keyStoreFileMonitor.monitorFiles(ID, Arrays.asList(keyStoreLocation), interval, trigger));
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Exception creating the keystore file monitor.", e);
}
FFDCFilter.processException(e, getClass().getName(), "createFileMonitor", this, new Object[] { ID, keyStoreLocation, interval });
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "createFileMonitor");
} | [
"private",
"void",
"createFileMonitor",
"(",
"String",
"ID",
",",
"String",
"keyStoreLocation",
",",
"String",
"trigger",
",",
"long",
"interval",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"createFileMonitor\"",
",",
"new",
"Object",
"[",
"]",
"{",
"ID",
",",
"keyStoreLocation",
",",
"trigger",
",",
"interval",
"}",
")",
";",
"try",
"{",
"keyStoreFileMonitor",
"=",
"new",
"SecurityFileMonitor",
"(",
"this",
")",
";",
"setFileMonitorRegistration",
"(",
"keyStoreFileMonitor",
".",
"monitorFiles",
"(",
"ID",
",",
"Arrays",
".",
"asList",
"(",
"keyStoreLocation",
")",
",",
"interval",
",",
"trigger",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Exception creating the keystore file monitor.\"",
",",
"e",
")",
";",
"}",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"\"createFileMonitor\"",
",",
"this",
",",
"new",
"Object",
"[",
"]",
"{",
"ID",
",",
"keyStoreLocation",
",",
"interval",
"}",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"createFileMonitor\"",
")",
";",
"}"
] | Handles the creation of the keystore file monitor. | [
"Handles",
"the",
"creation",
"of",
"the",
"keystore",
"file",
"monitor",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/internal/KeystoreConfigurationFactory.java#L276-L290 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/internal/KeystoreConfigurationFactory.java | KeystoreConfigurationFactory.unsetKeyringMonitorRegistration | protected void unsetKeyringMonitorRegistration() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "unsetKeyringMonitorRegistration");
}
if (keyringMonitorRegistration != null) {
keyringMonitorRegistration.unregister();
keyringMonitorRegistration = null;
}
} | java | protected void unsetKeyringMonitorRegistration() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "unsetKeyringMonitorRegistration");
}
if (keyringMonitorRegistration != null) {
keyringMonitorRegistration.unregister();
keyringMonitorRegistration = null;
}
} | [
"protected",
"void",
"unsetKeyringMonitorRegistration",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"unsetKeyringMonitorRegistration\"",
")",
";",
"}",
"if",
"(",
"keyringMonitorRegistration",
"!=",
"null",
")",
"{",
"keyringMonitorRegistration",
".",
"unregister",
"(",
")",
";",
"keyringMonitorRegistration",
"=",
"null",
";",
"}",
"}"
] | Remove the reference to the keyRing monitor. | [
"Remove",
"the",
"reference",
"to",
"the",
"keyRing",
"monitor",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/internal/KeystoreConfigurationFactory.java#L295-L303 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/internal/KeystoreConfigurationFactory.java | KeystoreConfigurationFactory.setKeyringMonitorRegistration | protected void setKeyringMonitorRegistration(ServiceRegistration<KeyringMonitor> keyringMonitorRegistration) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "setKeyringMonitorRegistration");
}
this.keyringMonitorRegistration = keyringMonitorRegistration;
} | java | protected void setKeyringMonitorRegistration(ServiceRegistration<KeyringMonitor> keyringMonitorRegistration) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "setKeyringMonitorRegistration");
}
this.keyringMonitorRegistration = keyringMonitorRegistration;
} | [
"protected",
"void",
"setKeyringMonitorRegistration",
"(",
"ServiceRegistration",
"<",
"KeyringMonitor",
">",
"keyringMonitorRegistration",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"setKeyringMonitorRegistration\"",
")",
";",
"}",
"this",
".",
"keyringMonitorRegistration",
"=",
"keyringMonitorRegistration",
";",
"}"
] | Sets the keyring monitor registration.
@param keyringMonitorRegistration | [
"Sets",
"the",
"keyring",
"monitor",
"registration",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/internal/KeystoreConfigurationFactory.java#L310-L315 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/internal/KeystoreConfigurationFactory.java | KeystoreConfigurationFactory.createKeyringMonitor | private void createKeyringMonitor(String ID, String trigger, String keyStoreLocation) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "createKeyringMonitor", new Object[] { ID, trigger });
try {
KeyringMonitor = new KeyringMonitorImpl(this);
setKeyringMonitorRegistration(KeyringMonitor.monitorKeyRings(ID, trigger, keyStoreLocation));
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Exception creating the keyring monitor.", e);
}
FFDCFilter.processException(e, getClass().getName(), "createKeyringMonitor", this, new Object[] { ID, keyStoreLocation });
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "createKeyringMonitor");
} | java | private void createKeyringMonitor(String ID, String trigger, String keyStoreLocation) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "createKeyringMonitor", new Object[] { ID, trigger });
try {
KeyringMonitor = new KeyringMonitorImpl(this);
setKeyringMonitorRegistration(KeyringMonitor.monitorKeyRings(ID, trigger, keyStoreLocation));
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Exception creating the keyring monitor.", e);
}
FFDCFilter.processException(e, getClass().getName(), "createKeyringMonitor", this, new Object[] { ID, keyStoreLocation });
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "createKeyringMonitor");
} | [
"private",
"void",
"createKeyringMonitor",
"(",
"String",
"ID",
",",
"String",
"trigger",
",",
"String",
"keyStoreLocation",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"createKeyringMonitor\"",
",",
"new",
"Object",
"[",
"]",
"{",
"ID",
",",
"trigger",
"}",
")",
";",
"try",
"{",
"KeyringMonitor",
"=",
"new",
"KeyringMonitorImpl",
"(",
"this",
")",
";",
"setKeyringMonitorRegistration",
"(",
"KeyringMonitor",
".",
"monitorKeyRings",
"(",
"ID",
",",
"trigger",
",",
"keyStoreLocation",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Exception creating the keyring monitor.\"",
",",
"e",
")",
";",
"}",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"\"createKeyringMonitor\"",
",",
"this",
",",
"new",
"Object",
"[",
"]",
"{",
"ID",
",",
"keyStoreLocation",
"}",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"createKeyringMonitor\"",
")",
";",
"}"
] | Handles the creation of the keyring monitor. | [
"Handles",
"the",
"creation",
"of",
"the",
"keyring",
"monitor",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/internal/KeystoreConfigurationFactory.java#L320-L334 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/util/Util.java | Util.encodeDN | public static byte[] encodeDN(Codec codec, String distinguishedName) throws Exception {
X500Principal issuer = new X500Principal(distinguishedName);
X509CertSelector certSelector = new X509CertSelector();
certSelector.setIssuer(issuer);
byte[] asnX501DN = certSelector.getIssuerAsBytes();
Any a = ORB.init().create_any();
X501DistinguishedNameHelper.insert(a, asnX501DN);
return codec.encode_value(a);
} | java | public static byte[] encodeDN(Codec codec, String distinguishedName) throws Exception {
X500Principal issuer = new X500Principal(distinguishedName);
X509CertSelector certSelector = new X509CertSelector();
certSelector.setIssuer(issuer);
byte[] asnX501DN = certSelector.getIssuerAsBytes();
Any a = ORB.init().create_any();
X501DistinguishedNameHelper.insert(a, asnX501DN);
return codec.encode_value(a);
} | [
"public",
"static",
"byte",
"[",
"]",
"encodeDN",
"(",
"Codec",
"codec",
",",
"String",
"distinguishedName",
")",
"throws",
"Exception",
"{",
"X500Principal",
"issuer",
"=",
"new",
"X500Principal",
"(",
"distinguishedName",
")",
";",
"X509CertSelector",
"certSelector",
"=",
"new",
"X509CertSelector",
"(",
")",
";",
"certSelector",
".",
"setIssuer",
"(",
"issuer",
")",
";",
"byte",
"[",
"]",
"asnX501DN",
"=",
"certSelector",
".",
"getIssuerAsBytes",
"(",
")",
";",
"Any",
"a",
"=",
"ORB",
".",
"init",
"(",
")",
".",
"create_any",
"(",
")",
";",
"X501DistinguishedNameHelper",
".",
"insert",
"(",
"a",
",",
"asnX501DN",
")",
";",
"return",
"codec",
".",
"encode_value",
"(",
"a",
")",
";",
"}"
] | Encode a distinguished name into a codec encoded ASN.1 X501 encoded Distinguished Name.
@param codec The codec to do the encoding of the Any.
@param distinguishedName The distinguished name.
@return the codec encoded ASN.1 X501 encoded Distinguished Name.
@throws Exception | [
"Encode",
"a",
"distinguished",
"name",
"into",
"a",
"codec",
"encoded",
"ASN",
".",
"1",
"X501",
"encoded",
"Distinguished",
"Name",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/util/Util.java#L692-L701 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/util/Util.java | Util.decodeDN | public static String decodeDN(Codec codec, byte[] encodedDN) throws SASException {
String dn = null;
try {
Any any = codec.decode_value(encodedDN, X501DistinguishedNameHelper.type());
byte[] asnX501DN = X501DistinguishedNameHelper.extract(any);
X500Principal x500Principal = new X500Principal(asnX501DN);
// To maintain compatibility with tWAS, the toString() method
// "is intentionally used because this is the only method which decodes extended attributes"
dn = x500Principal.toString();
} catch (Exception e) {
throw new SASException(1, e);
}
return dn;
} | java | public static String decodeDN(Codec codec, byte[] encodedDN) throws SASException {
String dn = null;
try {
Any any = codec.decode_value(encodedDN, X501DistinguishedNameHelper.type());
byte[] asnX501DN = X501DistinguishedNameHelper.extract(any);
X500Principal x500Principal = new X500Principal(asnX501DN);
// To maintain compatibility with tWAS, the toString() method
// "is intentionally used because this is the only method which decodes extended attributes"
dn = x500Principal.toString();
} catch (Exception e) {
throw new SASException(1, e);
}
return dn;
} | [
"public",
"static",
"String",
"decodeDN",
"(",
"Codec",
"codec",
",",
"byte",
"[",
"]",
"encodedDN",
")",
"throws",
"SASException",
"{",
"String",
"dn",
"=",
"null",
";",
"try",
"{",
"Any",
"any",
"=",
"codec",
".",
"decode_value",
"(",
"encodedDN",
",",
"X501DistinguishedNameHelper",
".",
"type",
"(",
")",
")",
";",
"byte",
"[",
"]",
"asnX501DN",
"=",
"X501DistinguishedNameHelper",
".",
"extract",
"(",
"any",
")",
";",
"X500Principal",
"x500Principal",
"=",
"new",
"X500Principal",
"(",
"asnX501DN",
")",
";",
"// To maintain compatibility with tWAS, the toString() method",
"// \"is intentionally used because this is the only method which decodes extended attributes\"",
"dn",
"=",
"x500Principal",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"SASException",
"(",
"1",
",",
"e",
")",
";",
"}",
"return",
"dn",
";",
"}"
] | Decode a distinguished name from an ASN.1 X501 encoded Distinguished Name
@param codec The codec to do the decoding of the Any.
@param encodedDN The codec encoded byte[] containing the ASN.1 X501 encoded Distinguished Name.
@return the distinguished name.
@throws SASException | [
"Decode",
"a",
"distinguished",
"name",
"from",
"an",
"ASN",
".",
"1",
"X501",
"encoded",
"Distinguished",
"Name"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/util/Util.java#L711-L726 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/util/Util.java | Util.upperCaseIndexString | private static String upperCaseIndexString(String iiopName) {
StringBuilder StringBuilder = new StringBuilder();
for (int i = 0; i < iiopName.length(); i++) {
char c = iiopName.charAt(i);
if (Character.isUpperCase(c)) {
StringBuilder.append('_').append(i);
}
}
return StringBuilder.toString();
} | java | private static String upperCaseIndexString(String iiopName) {
StringBuilder StringBuilder = new StringBuilder();
for (int i = 0; i < iiopName.length(); i++) {
char c = iiopName.charAt(i);
if (Character.isUpperCase(c)) {
StringBuilder.append('_').append(i);
}
}
return StringBuilder.toString();
} | [
"private",
"static",
"String",
"upperCaseIndexString",
"(",
"String",
"iiopName",
")",
"{",
"StringBuilder",
"StringBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"iiopName",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"char",
"c",
"=",
"iiopName",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"Character",
".",
"isUpperCase",
"(",
"c",
")",
")",
"{",
"StringBuilder",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"i",
")",
";",
"}",
"}",
"return",
"StringBuilder",
".",
"toString",
"(",
")",
";",
"}"
] | Return the a string containing an underscore '_' index of each uppercase character in the iiop name.
This is used for distinction of names that only differ by case, since corba does not support case sensitive names. | [
"Return",
"the",
"a",
"string",
"containing",
"an",
"underscore",
"_",
"index",
"of",
"each",
"uppercase",
"character",
"in",
"the",
"iiop",
"name",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/util/Util.java#L1235-L1244 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/util/Util.java | Util.replace | private static String replace(String source, char oldChar, String newString) {
StringBuilder StringBuilder = new StringBuilder(source.length());
for (int i = 0; i < source.length(); i++) {
char c = source.charAt(i);
if (c == oldChar) {
StringBuilder.append(newString);
} else {
StringBuilder.append(c);
}
}
return StringBuilder.toString();
} | java | private static String replace(String source, char oldChar, String newString) {
StringBuilder StringBuilder = new StringBuilder(source.length());
for (int i = 0; i < source.length(); i++) {
char c = source.charAt(i);
if (c == oldChar) {
StringBuilder.append(newString);
} else {
StringBuilder.append(c);
}
}
return StringBuilder.toString();
} | [
"private",
"static",
"String",
"replace",
"(",
"String",
"source",
",",
"char",
"oldChar",
",",
"String",
"newString",
")",
"{",
"StringBuilder",
"StringBuilder",
"=",
"new",
"StringBuilder",
"(",
"source",
".",
"length",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"source",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"char",
"c",
"=",
"source",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"c",
"==",
"oldChar",
")",
"{",
"StringBuilder",
".",
"append",
"(",
"newString",
")",
";",
"}",
"else",
"{",
"StringBuilder",
".",
"append",
"(",
"c",
")",
";",
"}",
"}",
"return",
"StringBuilder",
".",
"toString",
"(",
")",
";",
"}"
] | Replaces any occurnace of the specified "oldChar" with the nes string.
This is used to replace occurances if '$' in corba names since '$' is a special character | [
"Replaces",
"any",
"occurnace",
"of",
"the",
"specified",
"oldChar",
"with",
"the",
"nes",
"string",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/util/Util.java#L1251-L1262 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/util/Util.java | Util.buildOverloadParameterString | private static String buildOverloadParameterString(Class<?> parameterType) {
String name = "_";
int arrayDimensions = 0;
while (parameterType.isArray()) {
arrayDimensions++;
parameterType = parameterType.getComponentType();
}
// arrays start with org_omg_boxedRMI_
if (arrayDimensions > 0) {
name += "_org_omg_boxedRMI";
}
// IDLEntity types must be prefixed with org_omg_boxedIDL_
if (IDLEntity.class.isAssignableFrom(parameterType)) {
name += "_org_omg_boxedIDL";
}
// add package... some types have special mappings in corba
String packageName = specialTypePackages.get(parameterType.getName());
if (packageName == null) {
packageName = getPackageName(parameterType.getName());
}
if (packageName.length() > 0) {
name += "_" + packageName;
}
// arrays now contain a dimension indicator
if (arrayDimensions > 0) {
name += "_" + "seq" + arrayDimensions;
}
// add the class name
String className = specialTypeNames.get(parameterType.getName());
if (className == null) {
className = buildClassName(parameterType);
}
name += "_" + className;
return name;
} | java | private static String buildOverloadParameterString(Class<?> parameterType) {
String name = "_";
int arrayDimensions = 0;
while (parameterType.isArray()) {
arrayDimensions++;
parameterType = parameterType.getComponentType();
}
// arrays start with org_omg_boxedRMI_
if (arrayDimensions > 0) {
name += "_org_omg_boxedRMI";
}
// IDLEntity types must be prefixed with org_omg_boxedIDL_
if (IDLEntity.class.isAssignableFrom(parameterType)) {
name += "_org_omg_boxedIDL";
}
// add package... some types have special mappings in corba
String packageName = specialTypePackages.get(parameterType.getName());
if (packageName == null) {
packageName = getPackageName(parameterType.getName());
}
if (packageName.length() > 0) {
name += "_" + packageName;
}
// arrays now contain a dimension indicator
if (arrayDimensions > 0) {
name += "_" + "seq" + arrayDimensions;
}
// add the class name
String className = specialTypeNames.get(parameterType.getName());
if (className == null) {
className = buildClassName(parameterType);
}
name += "_" + className;
return name;
} | [
"private",
"static",
"String",
"buildOverloadParameterString",
"(",
"Class",
"<",
"?",
">",
"parameterType",
")",
"{",
"String",
"name",
"=",
"\"_\"",
";",
"int",
"arrayDimensions",
"=",
"0",
";",
"while",
"(",
"parameterType",
".",
"isArray",
"(",
")",
")",
"{",
"arrayDimensions",
"++",
";",
"parameterType",
"=",
"parameterType",
".",
"getComponentType",
"(",
")",
";",
"}",
"// arrays start with org_omg_boxedRMI_",
"if",
"(",
"arrayDimensions",
">",
"0",
")",
"{",
"name",
"+=",
"\"_org_omg_boxedRMI\"",
";",
"}",
"// IDLEntity types must be prefixed with org_omg_boxedIDL_",
"if",
"(",
"IDLEntity",
".",
"class",
".",
"isAssignableFrom",
"(",
"parameterType",
")",
")",
"{",
"name",
"+=",
"\"_org_omg_boxedIDL\"",
";",
"}",
"// add package... some types have special mappings in corba",
"String",
"packageName",
"=",
"specialTypePackages",
".",
"get",
"(",
"parameterType",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"packageName",
"==",
"null",
")",
"{",
"packageName",
"=",
"getPackageName",
"(",
"parameterType",
".",
"getName",
"(",
")",
")",
";",
"}",
"if",
"(",
"packageName",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"name",
"+=",
"\"_\"",
"+",
"packageName",
";",
"}",
"// arrays now contain a dimension indicator",
"if",
"(",
"arrayDimensions",
">",
"0",
")",
"{",
"name",
"+=",
"\"_\"",
"+",
"\"seq\"",
"+",
"arrayDimensions",
";",
"}",
"// add the class name",
"String",
"className",
"=",
"specialTypeNames",
".",
"get",
"(",
"parameterType",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"className",
"==",
"null",
")",
"{",
"className",
"=",
"buildClassName",
"(",
"parameterType",
")",
";",
"}",
"name",
"+=",
"\"_\"",
"+",
"className",
";",
"return",
"name",
";",
"}"
] | Returns a single parameter type encoded using the Java to IDL rules. | [
"Returns",
"a",
"single",
"parameter",
"type",
"encoded",
"using",
"the",
"Java",
"to",
"IDL",
"rules",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/util/Util.java#L1289-L1330 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/util/Util.java | Util.buildClassName | private static String buildClassName(Class<?> type) {
if (type.isArray()) {
throw new IllegalArgumentException("type is an array: " + type);
}
// get the classname
String typeName = type.getName();
int endIndex = typeName.lastIndexOf('.');
if (endIndex < 0) {
return typeName;
}
StringBuilder className = new StringBuilder(typeName.substring(endIndex + 1));
// for innerclasses replace the $ separator with two underscores
// we can't just blindly replace all $ characters since class names can contain the $ character
if (type.getDeclaringClass() != null) {
String declaringClassName = getClassName(type.getDeclaringClass());
assert className.toString().startsWith(declaringClassName + "$");
className.replace(declaringClassName.length(), declaringClassName.length() + 1, "__");
}
// if we have a leading underscore prepend with J
if (className.charAt(0) == '_') {
className.insert(0, "J");
}
return className.toString();
} | java | private static String buildClassName(Class<?> type) {
if (type.isArray()) {
throw new IllegalArgumentException("type is an array: " + type);
}
// get the classname
String typeName = type.getName();
int endIndex = typeName.lastIndexOf('.');
if (endIndex < 0) {
return typeName;
}
StringBuilder className = new StringBuilder(typeName.substring(endIndex + 1));
// for innerclasses replace the $ separator with two underscores
// we can't just blindly replace all $ characters since class names can contain the $ character
if (type.getDeclaringClass() != null) {
String declaringClassName = getClassName(type.getDeclaringClass());
assert className.toString().startsWith(declaringClassName + "$");
className.replace(declaringClassName.length(), declaringClassName.length() + 1, "__");
}
// if we have a leading underscore prepend with J
if (className.charAt(0) == '_') {
className.insert(0, "J");
}
return className.toString();
} | [
"private",
"static",
"String",
"buildClassName",
"(",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"if",
"(",
"type",
".",
"isArray",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"type is an array: \"",
"+",
"type",
")",
";",
"}",
"// get the classname",
"String",
"typeName",
"=",
"type",
".",
"getName",
"(",
")",
";",
"int",
"endIndex",
"=",
"typeName",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"endIndex",
"<",
"0",
")",
"{",
"return",
"typeName",
";",
"}",
"StringBuilder",
"className",
"=",
"new",
"StringBuilder",
"(",
"typeName",
".",
"substring",
"(",
"endIndex",
"+",
"1",
")",
")",
";",
"// for innerclasses replace the $ separator with two underscores",
"// we can't just blindly replace all $ characters since class names can contain the $ character",
"if",
"(",
"type",
".",
"getDeclaringClass",
"(",
")",
"!=",
"null",
")",
"{",
"String",
"declaringClassName",
"=",
"getClassName",
"(",
"type",
".",
"getDeclaringClass",
"(",
")",
")",
";",
"assert",
"className",
".",
"toString",
"(",
")",
".",
"startsWith",
"(",
"declaringClassName",
"+",
"\"$\"",
")",
";",
"className",
".",
"replace",
"(",
"declaringClassName",
".",
"length",
"(",
")",
",",
"declaringClassName",
".",
"length",
"(",
")",
"+",
"1",
",",
"\"__\"",
")",
";",
"}",
"// if we have a leading underscore prepend with J",
"if",
"(",
"className",
".",
"charAt",
"(",
"0",
")",
"==",
"'",
"'",
")",
"{",
"className",
".",
"insert",
"(",
"0",
",",
"\"J\"",
")",
";",
"}",
"return",
"className",
".",
"toString",
"(",
")",
";",
"}"
] | Returns a string contianing an encoded class name. | [
"Returns",
"a",
"string",
"contianing",
"an",
"encoded",
"class",
"name",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/util/Util.java#L1335-L1361 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jpa.container.ormdiagnostics/src/com/ibm/ws/jpa/diagnostics/puparser/jaxb/puxml10/Persistence.java | Persistence.getPersistenceUnit | public List<Persistence.PersistenceUnit> getPersistenceUnit() {
if (persistenceUnit == null) {
persistenceUnit = new ArrayList<Persistence.PersistenceUnit>();
}
return this.persistenceUnit;
} | java | public List<Persistence.PersistenceUnit> getPersistenceUnit() {
if (persistenceUnit == null) {
persistenceUnit = new ArrayList<Persistence.PersistenceUnit>();
}
return this.persistenceUnit;
} | [
"public",
"List",
"<",
"Persistence",
".",
"PersistenceUnit",
">",
"getPersistenceUnit",
"(",
")",
"{",
"if",
"(",
"persistenceUnit",
"==",
"null",
")",
"{",
"persistenceUnit",
"=",
"new",
"ArrayList",
"<",
"Persistence",
".",
"PersistenceUnit",
">",
"(",
")",
";",
"}",
"return",
"this",
".",
"persistenceUnit",
";",
"}"
] | Gets the value of the persistenceUnit property.
<p>
This accessor method returns a reference to the live list,
not a snapshot. Therefore any modification you make to the
returned list will be present inside the JAXB object.
This is why there is not a <CODE>set</CODE> method for the persistenceUnit property.
<p>
For example, to add a new item, do as follows:
<pre>
getPersistenceUnit().add(newItem);
</pre>
<p>
Objects of the following type(s) are allowed in the list
{@link Persistence.PersistenceUnit } | [
"Gets",
"the",
"value",
"of",
"the",
"persistenceUnit",
"property",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.ormdiagnostics/src/com/ibm/ws/jpa/diagnostics/puparser/jaxb/puxml10/Persistence.java#L137-L142 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/PersistenceType.java | PersistenceType.getPersistenceType | public final static PersistenceType getPersistenceType(Byte aValue) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc,"Value = " + aValue);
return set[aValue.intValue()];
} | java | public final static PersistenceType getPersistenceType(Byte aValue) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc,"Value = " + aValue);
return set[aValue.intValue()];
} | [
"public",
"final",
"static",
"PersistenceType",
"getPersistenceType",
"(",
"Byte",
"aValue",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Value = \"",
"+",
"aValue",
")",
";",
"return",
"set",
"[",
"aValue",
".",
"intValue",
"(",
")",
"]",
";",
"}"
] | Returns the corresponding PersistenceType for a given Byte.
This method should NOT be called by any code outside the MFP component.
It is only public so that it can be accessed by sub-packages.
@param aValue The Byte for which an PersistenceType is required.
@return The corresponding PersistenceType | [
"Returns",
"the",
"corresponding",
"PersistenceType",
"for",
"a",
"given",
"Byte",
".",
"This",
"method",
"should",
"NOT",
"be",
"called",
"by",
"any",
"code",
"outside",
"the",
"MFP",
"component",
".",
"It",
"is",
"only",
"public",
"so",
"that",
"it",
"can",
"be",
"accessed",
"by",
"sub",
"-",
"packages",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/PersistenceType.java#L59-L62 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ffdc/SibDiagnosticModule.java | SibDiagnosticModule.register | protected void register(String[] specificPackageList)
{
if (TraceComponent.isAnyTracingEnabled() && _tc.isEntryEnabled()) SibTr.entry(_tc, "register", new Object[] { this, specificPackageList });
synchronized(SibDiagnosticModule.class)
{
if (!_registeredMasterDiagnosticModule)
{
SibDiagnosticModule masterModule = new SibDiagnosticModule();
masterModule.registerModule(SIB_PACKAGE_LIST);
_registeredMasterDiagnosticModule = true;
}
}
this.registerModule(specificPackageList);
if (TraceComponent.isAnyTracingEnabled() && _tc.isEntryEnabled()) SibTr.exit(_tc, "register");
} | java | protected void register(String[] specificPackageList)
{
if (TraceComponent.isAnyTracingEnabled() && _tc.isEntryEnabled()) SibTr.entry(_tc, "register", new Object[] { this, specificPackageList });
synchronized(SibDiagnosticModule.class)
{
if (!_registeredMasterDiagnosticModule)
{
SibDiagnosticModule masterModule = new SibDiagnosticModule();
masterModule.registerModule(SIB_PACKAGE_LIST);
_registeredMasterDiagnosticModule = true;
}
}
this.registerModule(specificPackageList);
if (TraceComponent.isAnyTracingEnabled() && _tc.isEntryEnabled()) SibTr.exit(_tc, "register");
} | [
"protected",
"void",
"register",
"(",
"String",
"[",
"]",
"specificPackageList",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"_tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"_tc",
",",
"\"register\"",
",",
"new",
"Object",
"[",
"]",
"{",
"this",
",",
"specificPackageList",
"}",
")",
";",
"synchronized",
"(",
"SibDiagnosticModule",
".",
"class",
")",
"{",
"if",
"(",
"!",
"_registeredMasterDiagnosticModule",
")",
"{",
"SibDiagnosticModule",
"masterModule",
"=",
"new",
"SibDiagnosticModule",
"(",
")",
";",
"masterModule",
".",
"registerModule",
"(",
"SIB_PACKAGE_LIST",
")",
";",
"_registeredMasterDiagnosticModule",
"=",
"true",
";",
"}",
"}",
"this",
".",
"registerModule",
"(",
"specificPackageList",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"_tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"_tc",
",",
"\"register\"",
")",
";",
"}"
] | Register a subclass of this diagnostic module with FFDC
@param specificPackageList The package list for which it is being registered | [
"Register",
"a",
"subclass",
"of",
"this",
"diagnostic",
"module",
"with",
"FFDC"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ffdc/SibDiagnosticModule.java#L126-L143 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ffdc/SibDiagnosticModule.java | SibDiagnosticModule.captureDefaultInformation | protected void captureDefaultInformation(IncidentStream is, Throwable th)
{
is.writeLine("Platform Messaging :: Messaging engine:", SibTr.getMEName(null));
// is.writeLine("Platform Messaging :: Release name: ", BuildInfo.getBuildRelease());
// is.writeLine("Platform Messaging :: Level name: ", BuildInfo.getBuildLevel());
if (th != null)
{
StackTraceElement[] ste = th.getStackTrace();
Set classes = new HashSet();
for (int i = 0; i < ste.length; i++)
{
final StackTraceElement elem = ste[i];
try
{
String className = elem.getClassName();
// We only care about .sib. classes
if (className.indexOf(SIB_PACKAGE_NAME)>=0)
{
if (!classes.contains(className))
{
//Kavitha - commenting out as ClassUtil removed
/* String sccid = (String)AccessController.doPrivileged(new GetClassSccsidPrivilegedOperation(className)) ;
if (sccid != null)
{
is.writeLine(className, sccid);
}*/
classes.add(className);
}
}
}
catch (Exception exception)
{
// No FFDC code needed
}
}
}
} | java | protected void captureDefaultInformation(IncidentStream is, Throwable th)
{
is.writeLine("Platform Messaging :: Messaging engine:", SibTr.getMEName(null));
// is.writeLine("Platform Messaging :: Release name: ", BuildInfo.getBuildRelease());
// is.writeLine("Platform Messaging :: Level name: ", BuildInfo.getBuildLevel());
if (th != null)
{
StackTraceElement[] ste = th.getStackTrace();
Set classes = new HashSet();
for (int i = 0; i < ste.length; i++)
{
final StackTraceElement elem = ste[i];
try
{
String className = elem.getClassName();
// We only care about .sib. classes
if (className.indexOf(SIB_PACKAGE_NAME)>=0)
{
if (!classes.contains(className))
{
//Kavitha - commenting out as ClassUtil removed
/* String sccid = (String)AccessController.doPrivileged(new GetClassSccsidPrivilegedOperation(className)) ;
if (sccid != null)
{
is.writeLine(className, sccid);
}*/
classes.add(className);
}
}
}
catch (Exception exception)
{
// No FFDC code needed
}
}
}
} | [
"protected",
"void",
"captureDefaultInformation",
"(",
"IncidentStream",
"is",
",",
"Throwable",
"th",
")",
"{",
"is",
".",
"writeLine",
"(",
"\"Platform Messaging :: Messaging engine:\"",
",",
"SibTr",
".",
"getMEName",
"(",
"null",
")",
")",
";",
"// is.writeLine(\"Platform Messaging :: Release name: \", BuildInfo.getBuildRelease());",
"// is.writeLine(\"Platform Messaging :: Level name: \", BuildInfo.getBuildLevel());",
"if",
"(",
"th",
"!=",
"null",
")",
"{",
"StackTraceElement",
"[",
"]",
"ste",
"=",
"th",
".",
"getStackTrace",
"(",
")",
";",
"Set",
"classes",
"=",
"new",
"HashSet",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ste",
".",
"length",
";",
"i",
"++",
")",
"{",
"final",
"StackTraceElement",
"elem",
"=",
"ste",
"[",
"i",
"]",
";",
"try",
"{",
"String",
"className",
"=",
"elem",
".",
"getClassName",
"(",
")",
";",
"// We only care about .sib. classes",
"if",
"(",
"className",
".",
"indexOf",
"(",
"SIB_PACKAGE_NAME",
")",
">=",
"0",
")",
"{",
"if",
"(",
"!",
"classes",
".",
"contains",
"(",
"className",
")",
")",
"{",
"//Kavitha - commenting out as ClassUtil removed",
"/* String sccid = (String)AccessController.doPrivileged(new GetClassSccsidPrivilegedOperation(className)) ;\n if (sccid != null)\n {\n is.writeLine(className, sccid);\n }*/",
"classes",
".",
"add",
"(",
"className",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"Exception",
"exception",
")",
"{",
"// No FFDC code needed",
"}",
"}",
"}",
"}"
] | Capture the default information about the messaging engine, exception etc.
@param is The incident stream into which to place the information
@param th The Throwable that caused the FFDC (may be null) | [
"Capture",
"the",
"default",
"information",
"about",
"the",
"messaging",
"engine",
"exception",
"etc",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ffdc/SibDiagnosticModule.java#L165-L206 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ffdc/SibDiagnosticModule.java | SibDiagnosticModule.ffdcDumpDefault | public void ffdcDumpDefault(Throwable t, IncidentStream is, Object callerThis, Object[] objs, String sourceId)
{
is.writeLine("SIB FFDC dump for:", t);
captureDefaultInformation(is,t);
if (callerThis != null)
{
is.writeLine("SibDiagnosticModule :: Dump of callerThis (DiagnosticModule)", toFFDCString(callerThis)); //255802
is.introspectAndWriteLine("Introspection of callerThis:", callerThis); //255802
}
if (objs != null)
{
for (int i = 0; i < objs.length; i++)
{
is.writeLine("callerArg (DiagnosticModule) [" + i + "]", //255802
toFFDCString(objs[i])); //287897
is.introspectAndWriteLine("callerArg [" + i + "] (Introspection)", objs[i]); //255802
}
}
} | java | public void ffdcDumpDefault(Throwable t, IncidentStream is, Object callerThis, Object[] objs, String sourceId)
{
is.writeLine("SIB FFDC dump for:", t);
captureDefaultInformation(is,t);
if (callerThis != null)
{
is.writeLine("SibDiagnosticModule :: Dump of callerThis (DiagnosticModule)", toFFDCString(callerThis)); //255802
is.introspectAndWriteLine("Introspection of callerThis:", callerThis); //255802
}
if (objs != null)
{
for (int i = 0; i < objs.length; i++)
{
is.writeLine("callerArg (DiagnosticModule) [" + i + "]", //255802
toFFDCString(objs[i])); //287897
is.introspectAndWriteLine("callerArg [" + i + "] (Introspection)", objs[i]); //255802
}
}
} | [
"public",
"void",
"ffdcDumpDefault",
"(",
"Throwable",
"t",
",",
"IncidentStream",
"is",
",",
"Object",
"callerThis",
",",
"Object",
"[",
"]",
"objs",
",",
"String",
"sourceId",
")",
"{",
"is",
".",
"writeLine",
"(",
"\"SIB FFDC dump for:\"",
",",
"t",
")",
";",
"captureDefaultInformation",
"(",
"is",
",",
"t",
")",
";",
"if",
"(",
"callerThis",
"!=",
"null",
")",
"{",
"is",
".",
"writeLine",
"(",
"\"SibDiagnosticModule :: Dump of callerThis (DiagnosticModule)\"",
",",
"toFFDCString",
"(",
"callerThis",
")",
")",
";",
"//255802",
"is",
".",
"introspectAndWriteLine",
"(",
"\"Introspection of callerThis:\"",
",",
"callerThis",
")",
";",
"//255802",
"}",
"if",
"(",
"objs",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"objs",
".",
"length",
";",
"i",
"++",
")",
"{",
"is",
".",
"writeLine",
"(",
"\"callerArg (DiagnosticModule) [\"",
"+",
"i",
"+",
"\"]\"",
",",
"//255802",
"toFFDCString",
"(",
"objs",
"[",
"i",
"]",
")",
")",
";",
"//287897",
"is",
".",
"introspectAndWriteLine",
"(",
"\"callerArg [\"",
"+",
"i",
"+",
"\"] (Introspection)\"",
",",
"objs",
"[",
"i",
"]",
")",
";",
"//255802",
"}",
"}",
"}"
] | Capture information about this problem into the incidentStream
@param t The exception which triggered the FFDC capture process.
@param is The IncidentStream. Data to be captured is written to this stream.
@param callerThis The 'this' pointer for the object which invoked the filter. The value
will be null if the method which invoked the filter was static, or if
the method which invoked the filter does not correspond to the DM
being invoked.
@param objs The value of the array may be null. If not null, it contains an array of
objects which the caller to the filter provided. Since the information in
the array may vary depending upon the location in the code, the first
index of the array may contain hints as to the content of the rest of the
array.
@param sourceId The sourceId passed to the filter. | [
"Capture",
"information",
"about",
"this",
"problem",
"into",
"the",
"incidentStream"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ffdc/SibDiagnosticModule.java#L255-L277 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ffdc/SibDiagnosticModule.java | SibDiagnosticModule.toFFDCString | public final String toFFDCString(Object obj)
{
if (obj instanceof Map)
{
return toFFDCString((Map) obj);
}
else if (obj instanceof Collection)
{
return toFFDCString((Collection) obj);
}
else if (obj instanceof Object[])
{
return toFFDCString((Object[]) obj);
}
return toFFDCStringSingleObject(obj);
} | java | public final String toFFDCString(Object obj)
{
if (obj instanceof Map)
{
return toFFDCString((Map) obj);
}
else if (obj instanceof Collection)
{
return toFFDCString((Collection) obj);
}
else if (obj instanceof Object[])
{
return toFFDCString((Object[]) obj);
}
return toFFDCStringSingleObject(obj);
} | [
"public",
"final",
"String",
"toFFDCString",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"obj",
"instanceof",
"Map",
")",
"{",
"return",
"toFFDCString",
"(",
"(",
"Map",
")",
"obj",
")",
";",
"}",
"else",
"if",
"(",
"obj",
"instanceof",
"Collection",
")",
"{",
"return",
"toFFDCString",
"(",
"(",
"Collection",
")",
"obj",
")",
";",
"}",
"else",
"if",
"(",
"obj",
"instanceof",
"Object",
"[",
"]",
")",
"{",
"return",
"toFFDCString",
"(",
"(",
"Object",
"[",
"]",
")",
"obj",
")",
";",
"}",
"return",
"toFFDCStringSingleObject",
"(",
"obj",
")",
";",
"}"
] | Generates a string representation of the object for FFDC.
If the object is an Object Array, Collection or Map the
elements are inspected individually up to a maximum of
multiple_object_count_to_ffdc
@param obj
Object to generate a string representation of
@return
The string representation of the object | [
"Generates",
"a",
"string",
"representation",
"of",
"the",
"object",
"for",
"FFDC",
".",
"If",
"the",
"object",
"is",
"an",
"Object",
"Array",
"Collection",
"or",
"Map",
"the",
"elements",
"are",
"inspected",
"individually",
"up",
"to",
"a",
"maximum",
"of",
"multiple_object_count_to_ffdc"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ffdc/SibDiagnosticModule.java#L291-L306 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ffdc/SibDiagnosticModule.java | SibDiagnosticModule.toFFDCStringSingleObject | protected String toFFDCStringSingleObject(Object obj)
{
if (obj == null)
{
return "<null>";
}
else if (obj instanceof Traceable)
{
return ((Traceable) obj).toTraceString();
}
else if (obj instanceof String)
{
return ((String) obj);
}
else if (obj instanceof byte[])
{
return toFFDCString((byte[]) obj);
}
else
{
return obj.toString();
}
} | java | protected String toFFDCStringSingleObject(Object obj)
{
if (obj == null)
{
return "<null>";
}
else if (obj instanceof Traceable)
{
return ((Traceable) obj).toTraceString();
}
else if (obj instanceof String)
{
return ((String) obj);
}
else if (obj instanceof byte[])
{
return toFFDCString((byte[]) obj);
}
else
{
return obj.toString();
}
} | [
"protected",
"String",
"toFFDCStringSingleObject",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"return",
"\"<null>\"",
";",
"}",
"else",
"if",
"(",
"obj",
"instanceof",
"Traceable",
")",
"{",
"return",
"(",
"(",
"Traceable",
")",
"obj",
")",
".",
"toTraceString",
"(",
")",
";",
"}",
"else",
"if",
"(",
"obj",
"instanceof",
"String",
")",
"{",
"return",
"(",
"(",
"String",
")",
"obj",
")",
";",
"}",
"else",
"if",
"(",
"obj",
"instanceof",
"byte",
"[",
"]",
")",
"{",
"return",
"toFFDCString",
"(",
"(",
"byte",
"[",
"]",
")",
"obj",
")",
";",
"}",
"else",
"",
"{",
"return",
"obj",
".",
"toString",
"(",
")",
";",
"}",
"}"
] | Generates a string representation of an object for FFDC.
@param obj
Object to generate a string representation of
@return
The string representation of the object | [
"Generates",
"a",
"string",
"representation",
"of",
"an",
"object",
"for",
"FFDC",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ffdc/SibDiagnosticModule.java#L317-L339 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ffdc/SibDiagnosticModule.java | SibDiagnosticModule.toFFDCString | public final String toFFDCString(Collection aCollection)
{
StringBuffer buffer = new StringBuffer();
buffer.append('{');
if (aCollection == null)
{
buffer.append("<null>");
}
else
{
Iterator i = aCollection.iterator();
boolean hasNext = i.hasNext();
int ctr = 0;
while (hasNext)
{
Object value = i.next();
buffer.append((value == aCollection ? "<this list>" : toFFDCStringSingleObject(value)) + lineSeparator);
hasNext = i.hasNext();
if (ctr > multiple_object_count_to_ffdc)
{
buffer.append("........contd");
hasNext = false;
}
}
}
buffer.append('}');
return buffer.toString();
} | java | public final String toFFDCString(Collection aCollection)
{
StringBuffer buffer = new StringBuffer();
buffer.append('{');
if (aCollection == null)
{
buffer.append("<null>");
}
else
{
Iterator i = aCollection.iterator();
boolean hasNext = i.hasNext();
int ctr = 0;
while (hasNext)
{
Object value = i.next();
buffer.append((value == aCollection ? "<this list>" : toFFDCStringSingleObject(value)) + lineSeparator);
hasNext = i.hasNext();
if (ctr > multiple_object_count_to_ffdc)
{
buffer.append("........contd");
hasNext = false;
}
}
}
buffer.append('}');
return buffer.toString();
} | [
"public",
"final",
"String",
"toFFDCString",
"(",
"Collection",
"aCollection",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"buffer",
".",
"append",
"(",
"'",
"'",
")",
";",
"if",
"(",
"aCollection",
"==",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"\"<null>\"",
")",
";",
"}",
"else",
"{",
"Iterator",
"i",
"=",
"aCollection",
".",
"iterator",
"(",
")",
";",
"boolean",
"hasNext",
"=",
"i",
".",
"hasNext",
"(",
")",
";",
"int",
"ctr",
"=",
"0",
";",
"while",
"(",
"hasNext",
")",
"{",
"Object",
"value",
"=",
"i",
".",
"next",
"(",
")",
";",
"buffer",
".",
"append",
"(",
"(",
"value",
"==",
"aCollection",
"?",
"\"<this list>\"",
":",
"toFFDCStringSingleObject",
"(",
"value",
")",
")",
"+",
"lineSeparator",
")",
";",
"hasNext",
"=",
"i",
".",
"hasNext",
"(",
")",
";",
"if",
"(",
"ctr",
">",
"multiple_object_count_to_ffdc",
")",
"{",
"buffer",
".",
"append",
"(",
"\"........contd\"",
")",
";",
"hasNext",
"=",
"false",
";",
"}",
"}",
"}",
"buffer",
".",
"append",
"(",
"'",
"'",
")",
";",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}"
] | Generates a String representation of a Collection, calling toFFDCStringObject for the first multiple_object_count_to_ffdc
elements
@param aCollection
@return the string representation of a Collection. | [
"Generates",
"a",
"String",
"representation",
"of",
"a",
"Collection",
"calling",
"toFFDCStringObject",
"for",
"the",
"first",
"multiple_object_count_to_ffdc",
"elements"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ffdc/SibDiagnosticModule.java#L468-L498 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ffdc/SibDiagnosticModule.java | SibDiagnosticModule.toFFDCString | public final String toFFDCString(Map aMap)
{
StringBuffer buffer = new StringBuffer();
buffer.append('{');
if (aMap == null)
{
buffer.append("<null>");
}
else
{
Iterator i = aMap.entrySet().iterator();
boolean hasNext = i.hasNext();
int ctr = 0;
while (hasNext)
{
Map.Entry entry = (Map.Entry) (i.next());
Object key = entry.getKey();
Object value = entry.getValue();
buffer.append((key == aMap ? "<this map>" : toFFDCStringSingleObject(key)) + "="
+ (value == aMap ? "<this map>" : toFFDCStringSingleObject(value)) + lineSeparator);
hasNext = i.hasNext();
if (ctr > multiple_object_count_to_ffdc)
{
buffer.append("........contd");
hasNext = false;
}
}
}
buffer.append('}');
return buffer.toString();
} | java | public final String toFFDCString(Map aMap)
{
StringBuffer buffer = new StringBuffer();
buffer.append('{');
if (aMap == null)
{
buffer.append("<null>");
}
else
{
Iterator i = aMap.entrySet().iterator();
boolean hasNext = i.hasNext();
int ctr = 0;
while (hasNext)
{
Map.Entry entry = (Map.Entry) (i.next());
Object key = entry.getKey();
Object value = entry.getValue();
buffer.append((key == aMap ? "<this map>" : toFFDCStringSingleObject(key)) + "="
+ (value == aMap ? "<this map>" : toFFDCStringSingleObject(value)) + lineSeparator);
hasNext = i.hasNext();
if (ctr > multiple_object_count_to_ffdc)
{
buffer.append("........contd");
hasNext = false;
}
}
}
buffer.append('}');
return buffer.toString();
} | [
"public",
"final",
"String",
"toFFDCString",
"(",
"Map",
"aMap",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"buffer",
".",
"append",
"(",
"'",
"'",
")",
";",
"if",
"(",
"aMap",
"==",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"\"<null>\"",
")",
";",
"}",
"else",
"{",
"Iterator",
"i",
"=",
"aMap",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"boolean",
"hasNext",
"=",
"i",
".",
"hasNext",
"(",
")",
";",
"int",
"ctr",
"=",
"0",
";",
"while",
"(",
"hasNext",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"(",
"Map",
".",
"Entry",
")",
"(",
"i",
".",
"next",
"(",
")",
")",
";",
"Object",
"key",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"Object",
"value",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"buffer",
".",
"append",
"(",
"(",
"key",
"==",
"aMap",
"?",
"\"<this map>\"",
":",
"toFFDCStringSingleObject",
"(",
"key",
")",
")",
"+",
"\"=\"",
"+",
"(",
"value",
"==",
"aMap",
"?",
"\"<this map>\"",
":",
"toFFDCStringSingleObject",
"(",
"value",
")",
")",
"+",
"lineSeparator",
")",
";",
"hasNext",
"=",
"i",
".",
"hasNext",
"(",
")",
";",
"if",
"(",
"ctr",
">",
"multiple_object_count_to_ffdc",
")",
"{",
"buffer",
".",
"append",
"(",
"\"........contd\"",
")",
";",
"hasNext",
"=",
"false",
";",
"}",
"}",
"}",
"buffer",
".",
"append",
"(",
"'",
"'",
")",
";",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}"
] | Generates a String representation of a Map, calling toFFDCStringObject for the first multiple_object_count_to_ffdc
elements
@param aMap
@return the string representation of the map. | [
"Generates",
"a",
"String",
"representation",
"of",
"a",
"Map",
"calling",
"toFFDCStringObject",
"for",
"the",
"first",
"multiple_object_count_to_ffdc",
"elements"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ffdc/SibDiagnosticModule.java#L543-L576 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.http.plugin.merge/src/com/ibm/ws/http/plugin/merge/internal/PluginMergeToolImpl.java | PluginMergeToolImpl.removeComments | private boolean removeComments(DocumentBuilder parser, Document doc) {
try {
// Check for the traversal module
DOMImplementation impl = parser.getDOMImplementation();
if (!impl.hasFeature("traversal", "2.0")) {
// DOM implementation does not support traversal unable to remove comments
return false;
}
Node root = doc.getDocumentElement();
DocumentTraversal traversable = (DocumentTraversal) doc;
NodeIterator iterator = traversable.createNodeIterator(root, NodeFilter.SHOW_COMMENT, null, true);
Node node = null;
while ((node = iterator.nextNode()) != null) {
if (node.getNodeValue().trim().compareTo("Properties") != 0) {
root.removeChild(node);
}
}
} catch (FactoryConfigurationError e) {
return false;
}
return true;
} | java | private boolean removeComments(DocumentBuilder parser, Document doc) {
try {
// Check for the traversal module
DOMImplementation impl = parser.getDOMImplementation();
if (!impl.hasFeature("traversal", "2.0")) {
// DOM implementation does not support traversal unable to remove comments
return false;
}
Node root = doc.getDocumentElement();
DocumentTraversal traversable = (DocumentTraversal) doc;
NodeIterator iterator = traversable.createNodeIterator(root, NodeFilter.SHOW_COMMENT, null, true);
Node node = null;
while ((node = iterator.nextNode()) != null) {
if (node.getNodeValue().trim().compareTo("Properties") != 0) {
root.removeChild(node);
}
}
} catch (FactoryConfigurationError e) {
return false;
}
return true;
} | [
"private",
"boolean",
"removeComments",
"(",
"DocumentBuilder",
"parser",
",",
"Document",
"doc",
")",
"{",
"try",
"{",
"// Check for the traversal module",
"DOMImplementation",
"impl",
"=",
"parser",
".",
"getDOMImplementation",
"(",
")",
";",
"if",
"(",
"!",
"impl",
".",
"hasFeature",
"(",
"\"traversal\"",
",",
"\"2.0\"",
")",
")",
"{",
"// DOM implementation does not support traversal unable to remove comments",
"return",
"false",
";",
"}",
"Node",
"root",
"=",
"doc",
".",
"getDocumentElement",
"(",
")",
";",
"DocumentTraversal",
"traversable",
"=",
"(",
"DocumentTraversal",
")",
"doc",
";",
"NodeIterator",
"iterator",
"=",
"traversable",
".",
"createNodeIterator",
"(",
"root",
",",
"NodeFilter",
".",
"SHOW_COMMENT",
",",
"null",
",",
"true",
")",
";",
"Node",
"node",
"=",
"null",
";",
"while",
"(",
"(",
"node",
"=",
"iterator",
".",
"nextNode",
"(",
")",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"node",
".",
"getNodeValue",
"(",
")",
".",
"trim",
"(",
")",
".",
"compareTo",
"(",
"\"Properties\"",
")",
"!=",
"0",
")",
"{",
"root",
".",
"removeChild",
"(",
"node",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"FactoryConfigurationError",
"e",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | Removes all comments from the document except for the Properties comment
All exceptions are suppressed because this is just a nicety to improve human readability.
@param parser
@param doc
@return | [
"Removes",
"all",
"comments",
"from",
"the",
"document",
"except",
"for",
"the",
"Properties",
"comment",
"All",
"exceptions",
"are",
"suppressed",
"because",
"this",
"is",
"just",
"a",
"nicety",
"to",
"improve",
"human",
"readability",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.http.plugin.merge/src/com/ibm/ws/http/plugin/merge/internal/PluginMergeToolImpl.java#L120-L143 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.http.plugin.merge/src/com/ibm/ws/http/plugin/merge/internal/PluginMergeToolImpl.java | PluginMergeToolImpl.nodeListRemoveAll | public static void nodeListRemoveAll(Element xEml, NodeList nodes) {
int cnt = nodes.getLength();
for (int i = 0; i < cnt; i++)
xEml.removeChild(nodes.item(0));
} | java | public static void nodeListRemoveAll(Element xEml, NodeList nodes) {
int cnt = nodes.getLength();
for (int i = 0; i < cnt; i++)
xEml.removeChild(nodes.item(0));
} | [
"public",
"static",
"void",
"nodeListRemoveAll",
"(",
"Element",
"xEml",
",",
"NodeList",
"nodes",
")",
"{",
"int",
"cnt",
"=",
"nodes",
".",
"getLength",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cnt",
";",
"i",
"++",
")",
"xEml",
".",
"removeChild",
"(",
"nodes",
".",
"item",
"(",
"0",
")",
")",
";",
"}"
] | Removes all nodes contained in the NodeList from the Element.
Convenience method because NodeList objects in the DOM are live.
@param xEml
@param nodes | [
"Removes",
"all",
"nodes",
"contained",
"in",
"the",
"NodeList",
"from",
"the",
"Element",
".",
"Convenience",
"method",
"because",
"NodeList",
"objects",
"in",
"the",
"DOM",
"are",
"live",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.http.plugin.merge/src/com/ibm/ws/http/plugin/merge/internal/PluginMergeToolImpl.java#L432-L436 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.j2ee.mbeans/src/com/ibm/ws/messaging/jms/j2ee/mbeans/internal/JMSMbeansActivator.java | JMSMbeansActivator.registerMBeanService | private ServiceRegistration<?> registerMBeanService(String jmsResourceName, BundleContext bundleContext) {
Dictionary<String, String> props = new Hashtable<String, String>();
props.put(KEY_SERVICE_VENDOR, "IBM");
JmsServiceProviderMBeanImpl jmsProviderMBean = new JmsServiceProviderMBeanImpl(getServerName(), KEY_JMS2_PROVIDER);
props.put(KEY_JMX_OBJECTNAME, jmsProviderMBean.getobjectName());
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "JmsQueueMBeanImpl=" + jmsProviderMBean.getobjectName() + " props=" + props);
}
return bundleContext.registerService(JmsServiceProviderMBeanImpl.class, jmsProviderMBean, props);
} | java | private ServiceRegistration<?> registerMBeanService(String jmsResourceName, BundleContext bundleContext) {
Dictionary<String, String> props = new Hashtable<String, String>();
props.put(KEY_SERVICE_VENDOR, "IBM");
JmsServiceProviderMBeanImpl jmsProviderMBean = new JmsServiceProviderMBeanImpl(getServerName(), KEY_JMS2_PROVIDER);
props.put(KEY_JMX_OBJECTNAME, jmsProviderMBean.getobjectName());
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "JmsQueueMBeanImpl=" + jmsProviderMBean.getobjectName() + " props=" + props);
}
return bundleContext.registerService(JmsServiceProviderMBeanImpl.class, jmsProviderMBean, props);
} | [
"private",
"ServiceRegistration",
"<",
"?",
">",
"registerMBeanService",
"(",
"String",
"jmsResourceName",
",",
"BundleContext",
"bundleContext",
")",
"{",
"Dictionary",
"<",
"String",
",",
"String",
">",
"props",
"=",
"new",
"Hashtable",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"props",
".",
"put",
"(",
"KEY_SERVICE_VENDOR",
",",
"\"IBM\"",
")",
";",
"JmsServiceProviderMBeanImpl",
"jmsProviderMBean",
"=",
"new",
"JmsServiceProviderMBeanImpl",
"(",
"getServerName",
"(",
")",
",",
"KEY_JMS2_PROVIDER",
")",
";",
"props",
".",
"put",
"(",
"KEY_JMX_OBJECTNAME",
",",
"jmsProviderMBean",
".",
"getobjectName",
"(",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"JmsQueueMBeanImpl=\"",
"+",
"jmsProviderMBean",
".",
"getobjectName",
"(",
")",
"+",
"\" props=\"",
"+",
"props",
")",
";",
"}",
"return",
"bundleContext",
".",
"registerService",
"(",
"JmsServiceProviderMBeanImpl",
".",
"class",
",",
"jmsProviderMBean",
",",
"props",
")",
";",
"}"
] | Registers MBean for JMSServiceProvider .. in future can be made generic.
@param jmsResourceName
@param bundleContext
@return | [
"Registers",
"MBean",
"for",
"JMSServiceProvider",
"..",
"in",
"future",
"can",
"be",
"made",
"generic",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.j2ee.mbeans/src/com/ibm/ws/messaging/jms/j2ee/mbeans/internal/JMSMbeansActivator.java#L105-L116 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.org.apache.cxf.cxf.rt.rs.client.3.2/src/org/apache/cxf/jaxrs/client/ClientProxyImpl.java | ClientProxyImpl.invokeDefaultMethodUsingPrivateLookup | private static Object invokeDefaultMethodUsingPrivateLookup(Class<?> declaringClass, Object o, Method m,
Object[] params) throws WrappedException, NoSuchMethodException {
try {
final Method privateLookup = MethodHandles
.class
.getDeclaredMethod("privateLookupIn", Class.class, MethodHandles.Lookup.class);
return ((MethodHandles.Lookup)privateLookup
.invoke(null, declaringClass, MethodHandles.lookup()))
.unreflectSpecial(m, declaringClass)
.bindTo(o)
.invokeWithArguments(params);
} catch (NoSuchMethodException t) {
throw t;
} catch (Throwable t) {
throw new WrappedException(t);
}
} | java | private static Object invokeDefaultMethodUsingPrivateLookup(Class<?> declaringClass, Object o, Method m,
Object[] params) throws WrappedException, NoSuchMethodException {
try {
final Method privateLookup = MethodHandles
.class
.getDeclaredMethod("privateLookupIn", Class.class, MethodHandles.Lookup.class);
return ((MethodHandles.Lookup)privateLookup
.invoke(null, declaringClass, MethodHandles.lookup()))
.unreflectSpecial(m, declaringClass)
.bindTo(o)
.invokeWithArguments(params);
} catch (NoSuchMethodException t) {
throw t;
} catch (Throwable t) {
throw new WrappedException(t);
}
} | [
"private",
"static",
"Object",
"invokeDefaultMethodUsingPrivateLookup",
"(",
"Class",
"<",
"?",
">",
"declaringClass",
",",
"Object",
"o",
",",
"Method",
"m",
",",
"Object",
"[",
"]",
"params",
")",
"throws",
"WrappedException",
",",
"NoSuchMethodException",
"{",
"try",
"{",
"final",
"Method",
"privateLookup",
"=",
"MethodHandles",
".",
"class",
".",
"getDeclaredMethod",
"(",
"\"privateLookupIn\"",
",",
"Class",
".",
"class",
",",
"MethodHandles",
".",
"Lookup",
".",
"class",
")",
";",
"return",
"(",
"(",
"MethodHandles",
".",
"Lookup",
")",
"privateLookup",
".",
"invoke",
"(",
"null",
",",
"declaringClass",
",",
"MethodHandles",
".",
"lookup",
"(",
")",
")",
")",
".",
"unreflectSpecial",
"(",
"m",
",",
"declaringClass",
")",
".",
"bindTo",
"(",
"o",
")",
".",
"invokeWithArguments",
"(",
"params",
")",
";",
"}",
"catch",
"(",
"NoSuchMethodException",
"t",
")",
"{",
"throw",
"t",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"throw",
"new",
"WrappedException",
"(",
"t",
")",
";",
"}",
"}"
] | For JDK 9+, we could use MethodHandles.privateLookupIn, which is not
available in JDK 8. | [
"For",
"JDK",
"9",
"+",
"we",
"could",
"use",
"MethodHandles",
".",
"privateLookupIn",
"which",
"is",
"not",
"available",
"in",
"JDK",
"8",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.rt.rs.client.3.2/src/org/apache/cxf/jaxrs/client/ClientProxyImpl.java#L237-L254 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/frames/FrameData.java | FrameData.buildFrameForWrite | @Override
public WsByteBuffer buildFrameForWrite() {
WsByteBuffer[] output = buildFrameArrayForWrite();
int size = 0;
for (WsByteBuffer b : output) {
if (b != null) {
size += b.remaining();
}
}
WsByteBuffer singleBuffer = this.getBuffer(size);
singleBuffer.put(output);
singleBuffer.flip();
return singleBuffer;
} | java | @Override
public WsByteBuffer buildFrameForWrite() {
WsByteBuffer[] output = buildFrameArrayForWrite();
int size = 0;
for (WsByteBuffer b : output) {
if (b != null) {
size += b.remaining();
}
}
WsByteBuffer singleBuffer = this.getBuffer(size);
singleBuffer.put(output);
singleBuffer.flip();
return singleBuffer;
} | [
"@",
"Override",
"public",
"WsByteBuffer",
"buildFrameForWrite",
"(",
")",
"{",
"WsByteBuffer",
"[",
"]",
"output",
"=",
"buildFrameArrayForWrite",
"(",
")",
";",
"int",
"size",
"=",
"0",
";",
"for",
"(",
"WsByteBuffer",
"b",
":",
"output",
")",
"{",
"if",
"(",
"b",
"!=",
"null",
")",
"{",
"size",
"+=",
"b",
".",
"remaining",
"(",
")",
";",
"}",
"}",
"WsByteBuffer",
"singleBuffer",
"=",
"this",
".",
"getBuffer",
"(",
"size",
")",
";",
"singleBuffer",
".",
"put",
"(",
"output",
")",
";",
"singleBuffer",
".",
"flip",
"(",
")",
";",
"return",
"singleBuffer",
";",
"}"
] | The test code expects a single buffer instead of an array of buffers, as returned by buildFrameArrayForWrite | [
"The",
"test",
"code",
"expects",
"a",
"single",
"buffer",
"instead",
"of",
"an",
"array",
"of",
"buffers",
"as",
"returned",
"by",
"buildFrameArrayForWrite"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/frames/FrameData.java#L149-L163 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/HomeOfHomes.java | HomeOfHomes.create | public EJSHome create(BeanMetaData beanMetaData)
throws RemoteException
{
J2EEName name = beanMetaData.j2eeName;
HomeRecord hr = beanMetaData.homeRecord;
StatelessBeanO homeBeanO = null;
EJSHome result = null;
try {
result = (EJSHome) beanMetaData.homeBeanClass.newInstance();
homeBeanO = (StatelessBeanO) beanOFactory.create(container, null, false);
homeBeanO.setEnterpriseBean(result);
} catch (Exception ex) {
FFDCFilter.processException(ex, CLASS_NAME + ".create", "90", this);
throw new InvalidEJBClassNameException("", ex);
}
homeBeanO.reentrant = true;
hr.beanO = homeBeanO; //LIDB859-4
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "created new home bean", name);
return result;
} | java | public EJSHome create(BeanMetaData beanMetaData)
throws RemoteException
{
J2EEName name = beanMetaData.j2eeName;
HomeRecord hr = beanMetaData.homeRecord;
StatelessBeanO homeBeanO = null;
EJSHome result = null;
try {
result = (EJSHome) beanMetaData.homeBeanClass.newInstance();
homeBeanO = (StatelessBeanO) beanOFactory.create(container, null, false);
homeBeanO.setEnterpriseBean(result);
} catch (Exception ex) {
FFDCFilter.processException(ex, CLASS_NAME + ".create", "90", this);
throw new InvalidEJBClassNameException("", ex);
}
homeBeanO.reentrant = true;
hr.beanO = homeBeanO; //LIDB859-4
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "created new home bean", name);
return result;
} | [
"public",
"EJSHome",
"create",
"(",
"BeanMetaData",
"beanMetaData",
")",
"throws",
"RemoteException",
"{",
"J2EEName",
"name",
"=",
"beanMetaData",
".",
"j2eeName",
";",
"HomeRecord",
"hr",
"=",
"beanMetaData",
".",
"homeRecord",
";",
"StatelessBeanO",
"homeBeanO",
"=",
"null",
";",
"EJSHome",
"result",
"=",
"null",
";",
"try",
"{",
"result",
"=",
"(",
"EJSHome",
")",
"beanMetaData",
".",
"homeBeanClass",
".",
"newInstance",
"(",
")",
";",
"homeBeanO",
"=",
"(",
"StatelessBeanO",
")",
"beanOFactory",
".",
"create",
"(",
"container",
",",
"null",
",",
"false",
")",
";",
"homeBeanO",
".",
"setEnterpriseBean",
"(",
"result",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"CLASS_NAME",
"+",
"\".create\"",
",",
"\"90\"",
",",
"this",
")",
";",
"throw",
"new",
"InvalidEJBClassNameException",
"(",
"\"\"",
",",
"ex",
")",
";",
"}",
"homeBeanO",
".",
"reentrant",
"=",
"true",
";",
"hr",
".",
"beanO",
"=",
"homeBeanO",
";",
"//LIDB859-4",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"created new home bean\"",
",",
"name",
")",
";",
"return",
"result",
";",
"}"
] | Create a new EJSHome instance. | [
"Create",
"a",
"new",
"EJSHome",
"instance",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/HomeOfHomes.java#L99-L124 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/HomeOfHomes.java | HomeOfHomes.addHome | public void addHome(BeanMetaData bmd) // F743-26072
throws RemoteException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "addHome : " + bmd.j2eeName);
if (homesByName.get(bmd.j2eeName) != null) {
throw new DuplicateHomeNameException(bmd.j2eeName.toString());
}
homesByName.put(bmd.j2eeName, bmd.homeRecord); // d366845.3
J2EEName j2eeName = bmd.j2eeName;
String application = j2eeName.getApplication();
AppLinkData linkData;
// F743-26072 - Use AppLinkData
synchronized (ivAppLinkData)
{
linkData = ivAppLinkData.get(application);
if (linkData == null)
{
if (isTraceOn && tc.isEntryEnabled())
Tr.debug(tc, "adding application link data for " + application);
linkData = new AppLinkData();
ivAppLinkData.put(application, linkData);
}
}
updateAppLinkData(linkData, true, j2eeName, bmd);
// For version cable modules, the serialized BeanId will contain the
// unversioned (or base) name, so a map is created from unversioned to
// active to enable properly routing incoming requests. F54184
if (bmd._moduleMetaData.isVersionedModule())
{
EJBModuleMetaDataImpl mmd = bmd._moduleMetaData;
bmd.ivUnversionedJ2eeName = j2eeNameFactory.create(mmd.ivVersionedAppBaseName,
mmd.ivVersionedModuleBaseName,
j2eeName.getComponent());
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "Versioned Mapping Added : " + bmd.ivUnversionedJ2eeName + " -> " + j2eeName);
J2EEName dupBaseName = ivVersionedModuleNames.put(bmd.ivUnversionedJ2eeName, j2eeName);
if (dupBaseName != null) // F54184.2
{
ivVersionedModuleNames.put(bmd.ivUnversionedJ2eeName, dupBaseName);
throw new DuplicateHomeNameException("Base Name : " + bmd.ivUnversionedJ2eeName);
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "addHome");
} | java | public void addHome(BeanMetaData bmd) // F743-26072
throws RemoteException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "addHome : " + bmd.j2eeName);
if (homesByName.get(bmd.j2eeName) != null) {
throw new DuplicateHomeNameException(bmd.j2eeName.toString());
}
homesByName.put(bmd.j2eeName, bmd.homeRecord); // d366845.3
J2EEName j2eeName = bmd.j2eeName;
String application = j2eeName.getApplication();
AppLinkData linkData;
// F743-26072 - Use AppLinkData
synchronized (ivAppLinkData)
{
linkData = ivAppLinkData.get(application);
if (linkData == null)
{
if (isTraceOn && tc.isEntryEnabled())
Tr.debug(tc, "adding application link data for " + application);
linkData = new AppLinkData();
ivAppLinkData.put(application, linkData);
}
}
updateAppLinkData(linkData, true, j2eeName, bmd);
// For version cable modules, the serialized BeanId will contain the
// unversioned (or base) name, so a map is created from unversioned to
// active to enable properly routing incoming requests. F54184
if (bmd._moduleMetaData.isVersionedModule())
{
EJBModuleMetaDataImpl mmd = bmd._moduleMetaData;
bmd.ivUnversionedJ2eeName = j2eeNameFactory.create(mmd.ivVersionedAppBaseName,
mmd.ivVersionedModuleBaseName,
j2eeName.getComponent());
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "Versioned Mapping Added : " + bmd.ivUnversionedJ2eeName + " -> " + j2eeName);
J2EEName dupBaseName = ivVersionedModuleNames.put(bmd.ivUnversionedJ2eeName, j2eeName);
if (dupBaseName != null) // F54184.2
{
ivVersionedModuleNames.put(bmd.ivUnversionedJ2eeName, dupBaseName);
throw new DuplicateHomeNameException("Base Name : " + bmd.ivUnversionedJ2eeName);
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "addHome");
} | [
"public",
"void",
"addHome",
"(",
"BeanMetaData",
"bmd",
")",
"// F743-26072",
"throws",
"RemoteException",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"addHome : \"",
"+",
"bmd",
".",
"j2eeName",
")",
";",
"if",
"(",
"homesByName",
".",
"get",
"(",
"bmd",
".",
"j2eeName",
")",
"!=",
"null",
")",
"{",
"throw",
"new",
"DuplicateHomeNameException",
"(",
"bmd",
".",
"j2eeName",
".",
"toString",
"(",
")",
")",
";",
"}",
"homesByName",
".",
"put",
"(",
"bmd",
".",
"j2eeName",
",",
"bmd",
".",
"homeRecord",
")",
";",
"// d366845.3",
"J2EEName",
"j2eeName",
"=",
"bmd",
".",
"j2eeName",
";",
"String",
"application",
"=",
"j2eeName",
".",
"getApplication",
"(",
")",
";",
"AppLinkData",
"linkData",
";",
"// F743-26072 - Use AppLinkData",
"synchronized",
"(",
"ivAppLinkData",
")",
"{",
"linkData",
"=",
"ivAppLinkData",
".",
"get",
"(",
"application",
")",
";",
"if",
"(",
"linkData",
"==",
"null",
")",
"{",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"adding application link data for \"",
"+",
"application",
")",
";",
"linkData",
"=",
"new",
"AppLinkData",
"(",
")",
";",
"ivAppLinkData",
".",
"put",
"(",
"application",
",",
"linkData",
")",
";",
"}",
"}",
"updateAppLinkData",
"(",
"linkData",
",",
"true",
",",
"j2eeName",
",",
"bmd",
")",
";",
"// For version cable modules, the serialized BeanId will contain the",
"// unversioned (or base) name, so a map is created from unversioned to",
"// active to enable properly routing incoming requests. F54184",
"if",
"(",
"bmd",
".",
"_moduleMetaData",
".",
"isVersionedModule",
"(",
")",
")",
"{",
"EJBModuleMetaDataImpl",
"mmd",
"=",
"bmd",
".",
"_moduleMetaData",
";",
"bmd",
".",
"ivUnversionedJ2eeName",
"=",
"j2eeNameFactory",
".",
"create",
"(",
"mmd",
".",
"ivVersionedAppBaseName",
",",
"mmd",
".",
"ivVersionedModuleBaseName",
",",
"j2eeName",
".",
"getComponent",
"(",
")",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Versioned Mapping Added : \"",
"+",
"bmd",
".",
"ivUnversionedJ2eeName",
"+",
"\" -> \"",
"+",
"j2eeName",
")",
";",
"J2EEName",
"dupBaseName",
"=",
"ivVersionedModuleNames",
".",
"put",
"(",
"bmd",
".",
"ivUnversionedJ2eeName",
",",
"j2eeName",
")",
";",
"if",
"(",
"dupBaseName",
"!=",
"null",
")",
"// F54184.2",
"{",
"ivVersionedModuleNames",
".",
"put",
"(",
"bmd",
".",
"ivUnversionedJ2eeName",
",",
"dupBaseName",
")",
";",
"throw",
"new",
"DuplicateHomeNameException",
"(",
"\"Base Name : \"",
"+",
"bmd",
".",
"ivUnversionedJ2eeName",
")",
";",
"}",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"addHome\"",
")",
";",
"}"
] | LIDB859-4 d429866.2 | [
"LIDB859",
"-",
"4",
"d429866",
".",
"2"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/HomeOfHomes.java#L134-L189 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/HomeOfHomes.java | HomeOfHomes.updateAppLinkData | private void updateAppLinkData(AppLinkData linkData, boolean add, J2EEName j2eeName, BeanMetaData bmd) // F743-26072
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "updateAppLinkData: " + j2eeName + ", add=" + add);
int numBeans;
synchronized (linkData)
{
linkData.ivNumBeans += add ? 1 : -1;
numBeans = linkData.ivNumBeans;
// Update the table of bean names for this application, in support
// of ejb-link. d429866.1
updateAppLinkDataTable(linkData.ivBeansByName, add, j2eeName.getComponent(), j2eeName, "ivBeansByName");
// Update the table of bean interfaces for this application, in support
// of auto-link. d429866.2
updateAutoLink(linkData, add, j2eeName, bmd);
// F743-25385CodRv d648723
// Update the table of logical-to-physical module names, in support of
// ejb-link.
// F743-26072 - This will redundantly add the same entry for every
// bean in the module, but it will remove the entry for the first bean
// to be removed. In other words, we do not support removing a single
// bean from a module.
updateAppLinkDataTable(linkData.ivModulesByLogicalName, add,
bmd._moduleMetaData.ivLogicalName, j2eeName.getModule(), "ivModulesByLogicalName");
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "updateAppLinkData: " + j2eeName + ", add=" + add + ", numBeans=" + numBeans);
} | java | private void updateAppLinkData(AppLinkData linkData, boolean add, J2EEName j2eeName, BeanMetaData bmd) // F743-26072
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "updateAppLinkData: " + j2eeName + ", add=" + add);
int numBeans;
synchronized (linkData)
{
linkData.ivNumBeans += add ? 1 : -1;
numBeans = linkData.ivNumBeans;
// Update the table of bean names for this application, in support
// of ejb-link. d429866.1
updateAppLinkDataTable(linkData.ivBeansByName, add, j2eeName.getComponent(), j2eeName, "ivBeansByName");
// Update the table of bean interfaces for this application, in support
// of auto-link. d429866.2
updateAutoLink(linkData, add, j2eeName, bmd);
// F743-25385CodRv d648723
// Update the table of logical-to-physical module names, in support of
// ejb-link.
// F743-26072 - This will redundantly add the same entry for every
// bean in the module, but it will remove the entry for the first bean
// to be removed. In other words, we do not support removing a single
// bean from a module.
updateAppLinkDataTable(linkData.ivModulesByLogicalName, add,
bmd._moduleMetaData.ivLogicalName, j2eeName.getModule(), "ivModulesByLogicalName");
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "updateAppLinkData: " + j2eeName + ", add=" + add + ", numBeans=" + numBeans);
} | [
"private",
"void",
"updateAppLinkData",
"(",
"AppLinkData",
"linkData",
",",
"boolean",
"add",
",",
"J2EEName",
"j2eeName",
",",
"BeanMetaData",
"bmd",
")",
"// F743-26072",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"updateAppLinkData: \"",
"+",
"j2eeName",
"+",
"\", add=\"",
"+",
"add",
")",
";",
"int",
"numBeans",
";",
"synchronized",
"(",
"linkData",
")",
"{",
"linkData",
".",
"ivNumBeans",
"+=",
"add",
"?",
"1",
":",
"-",
"1",
";",
"numBeans",
"=",
"linkData",
".",
"ivNumBeans",
";",
"// Update the table of bean names for this application, in support",
"// of ejb-link. d429866.1",
"updateAppLinkDataTable",
"(",
"linkData",
".",
"ivBeansByName",
",",
"add",
",",
"j2eeName",
".",
"getComponent",
"(",
")",
",",
"j2eeName",
",",
"\"ivBeansByName\"",
")",
";",
"// Update the table of bean interfaces for this application, in support",
"// of auto-link. d429866.2",
"updateAutoLink",
"(",
"linkData",
",",
"add",
",",
"j2eeName",
",",
"bmd",
")",
";",
"// F743-25385CodRv d648723",
"// Update the table of logical-to-physical module names, in support of",
"// ejb-link.",
"// F743-26072 - This will redundantly add the same entry for every",
"// bean in the module, but it will remove the entry for the first bean",
"// to be removed. In other words, we do not support removing a single",
"// bean from a module.",
"updateAppLinkDataTable",
"(",
"linkData",
".",
"ivModulesByLogicalName",
",",
"add",
",",
"bmd",
".",
"_moduleMetaData",
".",
"ivLogicalName",
",",
"j2eeName",
".",
"getModule",
"(",
")",
",",
"\"ivModulesByLogicalName\"",
")",
";",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"updateAppLinkData: \"",
"+",
"j2eeName",
"+",
"\", add=\"",
"+",
"add",
"+",
"\", numBeans=\"",
"+",
"numBeans",
")",
";",
"}"
] | Updates the EJB-link and auto-link data for a bean.
@param linkData
@param add <tt>true</tt> if data for the bean should be added, or
<tt>false</tt> if data should be removed
@param bmd | [
"Updates",
"the",
"EJB",
"-",
"link",
"and",
"auto",
"-",
"link",
"data",
"for",
"a",
"bean",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/HomeOfHomes.java#L918-L951 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/HomeOfHomes.java | HomeOfHomes.updateAppLinkDataTable | private static <T> void updateAppLinkDataTable(Map<String, Set<T>> table,
boolean add,
String key,
T value,
String tracePrefix) // F743-26072
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
Set<T> values = table.get(key);
if (add)
{
if (isTraceOn && tc.isDebugEnabled() && tracePrefix != null)
Tr.debug(tc, tracePrefix + ": adding " + key + " = " + value);
if (values == null)
{
values = new LinkedHashSet<T>();
table.put(key, values);
}
values.add(value);
}
else
{
if (isTraceOn && tc.isDebugEnabled() && tracePrefix != null)
Tr.debug(tc, tracePrefix + ": removing " + key + " = " + value);
if (values != null) // d657052
{
values.remove(value);
if (values.size() == 0) // d657052
{
if (isTraceOn && tc.isDebugEnabled() && tracePrefix != null)
Tr.debug(tc, tracePrefix + ": removing " + key);
table.remove(key);
}
}
else
{
if (isTraceOn && tc.isDebugEnabled() && tracePrefix != null)
Tr.debug(tc, tracePrefix + ": key not found: " + key);
}
}
} | java | private static <T> void updateAppLinkDataTable(Map<String, Set<T>> table,
boolean add,
String key,
T value,
String tracePrefix) // F743-26072
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
Set<T> values = table.get(key);
if (add)
{
if (isTraceOn && tc.isDebugEnabled() && tracePrefix != null)
Tr.debug(tc, tracePrefix + ": adding " + key + " = " + value);
if (values == null)
{
values = new LinkedHashSet<T>();
table.put(key, values);
}
values.add(value);
}
else
{
if (isTraceOn && tc.isDebugEnabled() && tracePrefix != null)
Tr.debug(tc, tracePrefix + ": removing " + key + " = " + value);
if (values != null) // d657052
{
values.remove(value);
if (values.size() == 0) // d657052
{
if (isTraceOn && tc.isDebugEnabled() && tracePrefix != null)
Tr.debug(tc, tracePrefix + ": removing " + key);
table.remove(key);
}
}
else
{
if (isTraceOn && tc.isDebugEnabled() && tracePrefix != null)
Tr.debug(tc, tracePrefix + ": key not found: " + key);
}
}
} | [
"private",
"static",
"<",
"T",
">",
"void",
"updateAppLinkDataTable",
"(",
"Map",
"<",
"String",
",",
"Set",
"<",
"T",
">",
">",
"table",
",",
"boolean",
"add",
",",
"String",
"key",
",",
"T",
"value",
",",
"String",
"tracePrefix",
")",
"// F743-26072",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"Set",
"<",
"T",
">",
"values",
"=",
"table",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"add",
")",
"{",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
"&&",
"tracePrefix",
"!=",
"null",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"tracePrefix",
"+",
"\": adding \"",
"+",
"key",
"+",
"\" = \"",
"+",
"value",
")",
";",
"if",
"(",
"values",
"==",
"null",
")",
"{",
"values",
"=",
"new",
"LinkedHashSet",
"<",
"T",
">",
"(",
")",
";",
"table",
".",
"put",
"(",
"key",
",",
"values",
")",
";",
"}",
"values",
".",
"add",
"(",
"value",
")",
";",
"}",
"else",
"{",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
"&&",
"tracePrefix",
"!=",
"null",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"tracePrefix",
"+",
"\": removing \"",
"+",
"key",
"+",
"\" = \"",
"+",
"value",
")",
";",
"if",
"(",
"values",
"!=",
"null",
")",
"// d657052",
"{",
"values",
".",
"remove",
"(",
"value",
")",
";",
"if",
"(",
"values",
".",
"size",
"(",
")",
"==",
"0",
")",
"// d657052",
"{",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
"&&",
"tracePrefix",
"!=",
"null",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"tracePrefix",
"+",
"\": removing \"",
"+",
"key",
")",
";",
"table",
".",
"remove",
"(",
"key",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
"&&",
"tracePrefix",
"!=",
"null",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"tracePrefix",
"+",
"\": key not found: \"",
"+",
"key",
")",
";",
"}",
"}",
"}"
] | Updates a map from name to set of values.
@param table the table to update
@param add <tt>true</tt> if data should be added, or <tt>false</tt> if
data should be removed
@param key the key to add or remove
@param value the value to add | [
"Updates",
"a",
"map",
"from",
"name",
"to",
"set",
"of",
"values",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/HomeOfHomes.java#L979-L1022 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/HomeOfHomes.java | HomeOfHomes.updateAutoLink | private void updateAutoLink(AppLinkData linkData, boolean add, J2EEName j2eeName, BeanMetaData bmd)
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "updateAutoLink");
String module = j2eeName.getModule();
String beanInterface = null;
// -----------------------------------------------------------------------
// Locate the table of interfaces for the module and application d446993
// -----------------------------------------------------------------------
Map<String, Set<J2EEName>> appTable = linkData.ivBeansByType;
Map<String, Set<J2EEName>> moduleTable = linkData.ivBeansByModuleByType.get(module);
if (moduleTable == null)
{
moduleTable = new HashMap<String, Set<J2EEName>>(7);
linkData.ivBeansByModuleByType.put(module, moduleTable);
}
// -----------------------------------------------------------------------
// Add all of the interfaces of the EJB which may be injected/looked up
// -----------------------------------------------------------------------
beanInterface = bmd.homeInterfaceClassName;
if (beanInterface != null)
{
updateAppLinkDataTable(appTable, add, beanInterface, j2eeName, "ivBeansByType");
updateAppLinkDataTable(moduleTable, add, beanInterface, j2eeName, null);
}
beanInterface = bmd.localHomeInterfaceClassName;
if (beanInterface != null)
{
updateAppLinkDataTable(appTable, add, beanInterface, j2eeName, "ivBeansByType");
updateAppLinkDataTable(moduleTable, add, beanInterface, j2eeName, null);
}
String[] businessRemoteInterfaceName = bmd.ivBusinessRemoteInterfaceClassNames;
if (businessRemoteInterfaceName != null)
{
for (String remoteInterface : businessRemoteInterfaceName)
{
updateAppLinkDataTable(appTable, add, remoteInterface, j2eeName, "ivBeansByType");
updateAppLinkDataTable(moduleTable, add, remoteInterface, j2eeName, null);
}
}
String[] businessLocalInterfaceName = bmd.ivBusinessLocalInterfaceClassNames;
if (businessLocalInterfaceName != null)
{
for (String localInterface : businessLocalInterfaceName)
{
updateAppLinkDataTable(appTable, add, localInterface, j2eeName, "ivBeansByType");
updateAppLinkDataTable(moduleTable, add, localInterface, j2eeName, null);
}
}
// F743-1756 - Also add No-Interface View to maps for injection/lookup
if (bmd.ivLocalBean)
{
beanInterface = bmd.enterpriseBeanClassName;
updateAppLinkDataTable(appTable, add, beanInterface, j2eeName, "ivBeansByType");
updateAppLinkDataTable(moduleTable, add, beanInterface, j2eeName, null);
}
// F743-26072 - If this was the last bean in the module type table, then
// remove the module type table.
if (moduleTable.isEmpty())
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "ivBeansByModuleByType: removing " + module);
linkData.ivBeansByModuleByType.remove(module);
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "updateAutoLink");
} | java | private void updateAutoLink(AppLinkData linkData, boolean add, J2EEName j2eeName, BeanMetaData bmd)
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "updateAutoLink");
String module = j2eeName.getModule();
String beanInterface = null;
// -----------------------------------------------------------------------
// Locate the table of interfaces for the module and application d446993
// -----------------------------------------------------------------------
Map<String, Set<J2EEName>> appTable = linkData.ivBeansByType;
Map<String, Set<J2EEName>> moduleTable = linkData.ivBeansByModuleByType.get(module);
if (moduleTable == null)
{
moduleTable = new HashMap<String, Set<J2EEName>>(7);
linkData.ivBeansByModuleByType.put(module, moduleTable);
}
// -----------------------------------------------------------------------
// Add all of the interfaces of the EJB which may be injected/looked up
// -----------------------------------------------------------------------
beanInterface = bmd.homeInterfaceClassName;
if (beanInterface != null)
{
updateAppLinkDataTable(appTable, add, beanInterface, j2eeName, "ivBeansByType");
updateAppLinkDataTable(moduleTable, add, beanInterface, j2eeName, null);
}
beanInterface = bmd.localHomeInterfaceClassName;
if (beanInterface != null)
{
updateAppLinkDataTable(appTable, add, beanInterface, j2eeName, "ivBeansByType");
updateAppLinkDataTable(moduleTable, add, beanInterface, j2eeName, null);
}
String[] businessRemoteInterfaceName = bmd.ivBusinessRemoteInterfaceClassNames;
if (businessRemoteInterfaceName != null)
{
for (String remoteInterface : businessRemoteInterfaceName)
{
updateAppLinkDataTable(appTable, add, remoteInterface, j2eeName, "ivBeansByType");
updateAppLinkDataTable(moduleTable, add, remoteInterface, j2eeName, null);
}
}
String[] businessLocalInterfaceName = bmd.ivBusinessLocalInterfaceClassNames;
if (businessLocalInterfaceName != null)
{
for (String localInterface : businessLocalInterfaceName)
{
updateAppLinkDataTable(appTable, add, localInterface, j2eeName, "ivBeansByType");
updateAppLinkDataTable(moduleTable, add, localInterface, j2eeName, null);
}
}
// F743-1756 - Also add No-Interface View to maps for injection/lookup
if (bmd.ivLocalBean)
{
beanInterface = bmd.enterpriseBeanClassName;
updateAppLinkDataTable(appTable, add, beanInterface, j2eeName, "ivBeansByType");
updateAppLinkDataTable(moduleTable, add, beanInterface, j2eeName, null);
}
// F743-26072 - If this was the last bean in the module type table, then
// remove the module type table.
if (moduleTable.isEmpty())
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "ivBeansByModuleByType: removing " + module);
linkData.ivBeansByModuleByType.remove(module);
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "updateAutoLink");
} | [
"private",
"void",
"updateAutoLink",
"(",
"AppLinkData",
"linkData",
",",
"boolean",
"add",
",",
"J2EEName",
"j2eeName",
",",
"BeanMetaData",
"bmd",
")",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"updateAutoLink\"",
")",
";",
"String",
"module",
"=",
"j2eeName",
".",
"getModule",
"(",
")",
";",
"String",
"beanInterface",
"=",
"null",
";",
"// -----------------------------------------------------------------------",
"// Locate the table of interfaces for the module and application d446993",
"// -----------------------------------------------------------------------",
"Map",
"<",
"String",
",",
"Set",
"<",
"J2EEName",
">",
">",
"appTable",
"=",
"linkData",
".",
"ivBeansByType",
";",
"Map",
"<",
"String",
",",
"Set",
"<",
"J2EEName",
">",
">",
"moduleTable",
"=",
"linkData",
".",
"ivBeansByModuleByType",
".",
"get",
"(",
"module",
")",
";",
"if",
"(",
"moduleTable",
"==",
"null",
")",
"{",
"moduleTable",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Set",
"<",
"J2EEName",
">",
">",
"(",
"7",
")",
";",
"linkData",
".",
"ivBeansByModuleByType",
".",
"put",
"(",
"module",
",",
"moduleTable",
")",
";",
"}",
"// -----------------------------------------------------------------------",
"// Add all of the interfaces of the EJB which may be injected/looked up",
"// -----------------------------------------------------------------------",
"beanInterface",
"=",
"bmd",
".",
"homeInterfaceClassName",
";",
"if",
"(",
"beanInterface",
"!=",
"null",
")",
"{",
"updateAppLinkDataTable",
"(",
"appTable",
",",
"add",
",",
"beanInterface",
",",
"j2eeName",
",",
"\"ivBeansByType\"",
")",
";",
"updateAppLinkDataTable",
"(",
"moduleTable",
",",
"add",
",",
"beanInterface",
",",
"j2eeName",
",",
"null",
")",
";",
"}",
"beanInterface",
"=",
"bmd",
".",
"localHomeInterfaceClassName",
";",
"if",
"(",
"beanInterface",
"!=",
"null",
")",
"{",
"updateAppLinkDataTable",
"(",
"appTable",
",",
"add",
",",
"beanInterface",
",",
"j2eeName",
",",
"\"ivBeansByType\"",
")",
";",
"updateAppLinkDataTable",
"(",
"moduleTable",
",",
"add",
",",
"beanInterface",
",",
"j2eeName",
",",
"null",
")",
";",
"}",
"String",
"[",
"]",
"businessRemoteInterfaceName",
"=",
"bmd",
".",
"ivBusinessRemoteInterfaceClassNames",
";",
"if",
"(",
"businessRemoteInterfaceName",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"remoteInterface",
":",
"businessRemoteInterfaceName",
")",
"{",
"updateAppLinkDataTable",
"(",
"appTable",
",",
"add",
",",
"remoteInterface",
",",
"j2eeName",
",",
"\"ivBeansByType\"",
")",
";",
"updateAppLinkDataTable",
"(",
"moduleTable",
",",
"add",
",",
"remoteInterface",
",",
"j2eeName",
",",
"null",
")",
";",
"}",
"}",
"String",
"[",
"]",
"businessLocalInterfaceName",
"=",
"bmd",
".",
"ivBusinessLocalInterfaceClassNames",
";",
"if",
"(",
"businessLocalInterfaceName",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"localInterface",
":",
"businessLocalInterfaceName",
")",
"{",
"updateAppLinkDataTable",
"(",
"appTable",
",",
"add",
",",
"localInterface",
",",
"j2eeName",
",",
"\"ivBeansByType\"",
")",
";",
"updateAppLinkDataTable",
"(",
"moduleTable",
",",
"add",
",",
"localInterface",
",",
"j2eeName",
",",
"null",
")",
";",
"}",
"}",
"// F743-1756 - Also add No-Interface View to maps for injection/lookup",
"if",
"(",
"bmd",
".",
"ivLocalBean",
")",
"{",
"beanInterface",
"=",
"bmd",
".",
"enterpriseBeanClassName",
";",
"updateAppLinkDataTable",
"(",
"appTable",
",",
"add",
",",
"beanInterface",
",",
"j2eeName",
",",
"\"ivBeansByType\"",
")",
";",
"updateAppLinkDataTable",
"(",
"moduleTable",
",",
"add",
",",
"beanInterface",
",",
"j2eeName",
",",
"null",
")",
";",
"}",
"// F743-26072 - If this was the last bean in the module type table, then",
"// remove the module type table.",
"if",
"(",
"moduleTable",
".",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"ivBeansByModuleByType: removing \"",
"+",
"module",
")",
";",
"linkData",
".",
"ivBeansByModuleByType",
".",
"remove",
"(",
"module",
")",
";",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"updateAutoLink\"",
")",
";",
"}"
] | d429866.2 | [
"d429866",
".",
"2"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/HomeOfHomes.java#L1035-L1114 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/HomeOfHomes.java | HomeOfHomes.createBeanO | @Override
public BeanO createBeanO(EJBThreadData threadData, ContainerTx tx, BeanId id)
throws RemoteException
{
J2EEName homeKey = id.getJ2EEName(); // d366845.3
HomeRecord hr = homesByName.get(homeKey); // d366845.3
BeanO result = null; // d199071
if (hr != null) { // d199071
result = hr.beanO; // d199071
}
if (result == null)
{
// This will only ever occur when an attempt is being made to
// invoke a method on a home wrapper, where the home has been
// uninstalled since the wrapper was obtained. Doing nothing
// would result in an NPE, so instead, a meaningful exception
// should be reported. d547849
// If HR exists, but no beanO, then the application was started
// again, but the bean hasn't started yet, still an error. d716824
String msgTxt =
"The referenced version of the " + homeKey.getComponent() +
" bean in the " + homeKey.getApplication() +
" application has been stopped and may no longer be used. " +
"If the " + homeKey.getApplication() +
" application has been started again, a new reference for " +
"the new image of the " + homeKey.getComponent() +
" bean must be obtained. Local references to a bean or home " +
"are no longer valid once the application has been stopped.";
throw new EJBStoppedException(msgTxt);
}
return result;
} | java | @Override
public BeanO createBeanO(EJBThreadData threadData, ContainerTx tx, BeanId id)
throws RemoteException
{
J2EEName homeKey = id.getJ2EEName(); // d366845.3
HomeRecord hr = homesByName.get(homeKey); // d366845.3
BeanO result = null; // d199071
if (hr != null) { // d199071
result = hr.beanO; // d199071
}
if (result == null)
{
// This will only ever occur when an attempt is being made to
// invoke a method on a home wrapper, where the home has been
// uninstalled since the wrapper was obtained. Doing nothing
// would result in an NPE, so instead, a meaningful exception
// should be reported. d547849
// If HR exists, but no beanO, then the application was started
// again, but the bean hasn't started yet, still an error. d716824
String msgTxt =
"The referenced version of the " + homeKey.getComponent() +
" bean in the " + homeKey.getApplication() +
" application has been stopped and may no longer be used. " +
"If the " + homeKey.getApplication() +
" application has been started again, a new reference for " +
"the new image of the " + homeKey.getComponent() +
" bean must be obtained. Local references to a bean or home " +
"are no longer valid once the application has been stopped.";
throw new EJBStoppedException(msgTxt);
}
return result;
} | [
"@",
"Override",
"public",
"BeanO",
"createBeanO",
"(",
"EJBThreadData",
"threadData",
",",
"ContainerTx",
"tx",
",",
"BeanId",
"id",
")",
"throws",
"RemoteException",
"{",
"J2EEName",
"homeKey",
"=",
"id",
".",
"getJ2EEName",
"(",
")",
";",
"// d366845.3",
"HomeRecord",
"hr",
"=",
"homesByName",
".",
"get",
"(",
"homeKey",
")",
";",
"// d366845.3",
"BeanO",
"result",
"=",
"null",
";",
"// d199071",
"if",
"(",
"hr",
"!=",
"null",
")",
"{",
"// d199071",
"result",
"=",
"hr",
".",
"beanO",
";",
"// d199071",
"}",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"// This will only ever occur when an attempt is being made to",
"// invoke a method on a home wrapper, where the home has been",
"// uninstalled since the wrapper was obtained. Doing nothing",
"// would result in an NPE, so instead, a meaningful exception",
"// should be reported. d547849",
"// If HR exists, but no beanO, then the application was started",
"// again, but the bean hasn't started yet, still an error. d716824",
"String",
"msgTxt",
"=",
"\"The referenced version of the \"",
"+",
"homeKey",
".",
"getComponent",
"(",
")",
"+",
"\" bean in the \"",
"+",
"homeKey",
".",
"getApplication",
"(",
")",
"+",
"\" application has been stopped and may no longer be used. \"",
"+",
"\"If the \"",
"+",
"homeKey",
".",
"getApplication",
"(",
")",
"+",
"\" application has been started again, a new reference for \"",
"+",
"\"the new image of the \"",
"+",
"homeKey",
".",
"getComponent",
"(",
")",
"+",
"\" bean must be obtained. Local references to a bean or home \"",
"+",
"\"are no longer valid once the application has been stopped.\"",
";",
"throw",
"new",
"EJBStoppedException",
"(",
"msgTxt",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Added ContainerTx d168509 | [
"Added",
"ContainerTx",
"d168509"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/HomeOfHomes.java#L1223-L1258 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/HomeOfHomes.java | HomeOfHomes.getEnterpriseBeanClassName | @Override
public String getEnterpriseBeanClassName(Object homeKey)
{
HomeRecord hr = homesByName.get(homeKey); // d366845.3
return hr.homeInternal.getEnterpriseBeanClassName(homeKey);
} | java | @Override
public String getEnterpriseBeanClassName(Object homeKey)
{
HomeRecord hr = homesByName.get(homeKey); // d366845.3
return hr.homeInternal.getEnterpriseBeanClassName(homeKey);
} | [
"@",
"Override",
"public",
"String",
"getEnterpriseBeanClassName",
"(",
"Object",
"homeKey",
")",
"{",
"HomeRecord",
"hr",
"=",
"homesByName",
".",
"get",
"(",
"homeKey",
")",
";",
"// d366845.3",
"return",
"hr",
".",
"homeInternal",
".",
"getEnterpriseBeanClassName",
"(",
"homeKey",
")",
";",
"}"
] | Return the name of the class that implements the bean's owned
by the given home. | [
"Return",
"the",
"name",
"of",
"the",
"class",
"that",
"implements",
"the",
"bean",
"s",
"owned",
"by",
"the",
"given",
"home",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/HomeOfHomes.java#L1404-L1409 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/org/apache/jasper/runtime/JspContextWrapper.java | JspContextWrapper.resolveVariable | public Object resolveVariable(String pName) throws ELException {
ELContext ctx = this.getELContext();
return ctx.getELResolver().getValue(ctx, null, pName);
} | java | public Object resolveVariable(String pName) throws ELException {
ELContext ctx = this.getELContext();
return ctx.getELResolver().getValue(ctx, null, pName);
} | [
"public",
"Object",
"resolveVariable",
"(",
"String",
"pName",
")",
"throws",
"ELException",
"{",
"ELContext",
"ctx",
"=",
"this",
".",
"getELContext",
"(",
")",
";",
"return",
"ctx",
".",
"getELResolver",
"(",
")",
".",
"getValue",
"(",
"ctx",
",",
"null",
",",
"pName",
")",
";",
"}"
] | LIDB4147-9 Begin - modified for JSP 2.1 | [
"LIDB4147",
"-",
"9",
"Begin",
"-",
"modified",
"for",
"JSP",
"2",
".",
"1"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/org/apache/jasper/runtime/JspContextWrapper.java#L369-L372 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/org/apache/jasper/runtime/JspContextWrapper.java | JspContextWrapper.copyTagToPageScope | private void copyTagToPageScope(int scope) {
Iterator iter = null;
switch (scope) {
case VariableInfo.NESTED:
if (nestedVars != null) {
iter = nestedVars.iterator();
}
break;
case VariableInfo.AT_BEGIN:
if (atBeginVars != null) {
iter = atBeginVars.iterator();
}
break;
case VariableInfo.AT_END:
if (atEndVars != null) {
iter = atEndVars.iterator();
}
break;
}
while ((iter != null) && iter.hasNext()) {
String varName = (String) iter.next();
Object obj = getAttribute(varName);
varName = findAlias(varName);
if (obj != null) {
invokingJspCtxt.setAttribute(varName, obj);
} else {
invokingJspCtxt.removeAttribute(varName, PAGE_SCOPE);
}
}
} | java | private void copyTagToPageScope(int scope) {
Iterator iter = null;
switch (scope) {
case VariableInfo.NESTED:
if (nestedVars != null) {
iter = nestedVars.iterator();
}
break;
case VariableInfo.AT_BEGIN:
if (atBeginVars != null) {
iter = atBeginVars.iterator();
}
break;
case VariableInfo.AT_END:
if (atEndVars != null) {
iter = atEndVars.iterator();
}
break;
}
while ((iter != null) && iter.hasNext()) {
String varName = (String) iter.next();
Object obj = getAttribute(varName);
varName = findAlias(varName);
if (obj != null) {
invokingJspCtxt.setAttribute(varName, obj);
} else {
invokingJspCtxt.removeAttribute(varName, PAGE_SCOPE);
}
}
} | [
"private",
"void",
"copyTagToPageScope",
"(",
"int",
"scope",
")",
"{",
"Iterator",
"iter",
"=",
"null",
";",
"switch",
"(",
"scope",
")",
"{",
"case",
"VariableInfo",
".",
"NESTED",
":",
"if",
"(",
"nestedVars",
"!=",
"null",
")",
"{",
"iter",
"=",
"nestedVars",
".",
"iterator",
"(",
")",
";",
"}",
"break",
";",
"case",
"VariableInfo",
".",
"AT_BEGIN",
":",
"if",
"(",
"atBeginVars",
"!=",
"null",
")",
"{",
"iter",
"=",
"atBeginVars",
".",
"iterator",
"(",
")",
";",
"}",
"break",
";",
"case",
"VariableInfo",
".",
"AT_END",
":",
"if",
"(",
"atEndVars",
"!=",
"null",
")",
"{",
"iter",
"=",
"atEndVars",
".",
"iterator",
"(",
")",
";",
"}",
"break",
";",
"}",
"while",
"(",
"(",
"iter",
"!=",
"null",
")",
"&&",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"String",
"varName",
"=",
"(",
"String",
")",
"iter",
".",
"next",
"(",
")",
";",
"Object",
"obj",
"=",
"getAttribute",
"(",
"varName",
")",
";",
"varName",
"=",
"findAlias",
"(",
"varName",
")",
";",
"if",
"(",
"obj",
"!=",
"null",
")",
"{",
"invokingJspCtxt",
".",
"setAttribute",
"(",
"varName",
",",
"obj",
")",
";",
"}",
"else",
"{",
"invokingJspCtxt",
".",
"removeAttribute",
"(",
"varName",
",",
"PAGE_SCOPE",
")",
";",
"}",
"}",
"}"
] | Copies the variables of the given scope from the virtual page scope of
this JSP context wrapper to the page scope of the invoking JSP context.
@param scope variable scope (one of NESTED, AT_BEGIN, or AT_END) | [
"Copies",
"the",
"variables",
"of",
"the",
"given",
"scope",
"from",
"the",
"virtual",
"page",
"scope",
"of",
"this",
"JSP",
"context",
"wrapper",
"to",
"the",
"page",
"scope",
"of",
"the",
"invoking",
"JSP",
"context",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/org/apache/jasper/runtime/JspContextWrapper.java#L405-L436 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/org/apache/jasper/runtime/JspContextWrapper.java | JspContextWrapper.saveNestedVariables | private void saveNestedVariables() {
if (nestedVars != null) {
Iterator iter = nestedVars.iterator();
while (iter.hasNext()) {
String varName = (String) iter.next();
varName = findAlias(varName);
Object obj = invokingJspCtxt.getAttribute(varName);
if (obj != null) {
originalNestedVars.put(varName, obj);
}
}
}
} | java | private void saveNestedVariables() {
if (nestedVars != null) {
Iterator iter = nestedVars.iterator();
while (iter.hasNext()) {
String varName = (String) iter.next();
varName = findAlias(varName);
Object obj = invokingJspCtxt.getAttribute(varName);
if (obj != null) {
originalNestedVars.put(varName, obj);
}
}
}
} | [
"private",
"void",
"saveNestedVariables",
"(",
")",
"{",
"if",
"(",
"nestedVars",
"!=",
"null",
")",
"{",
"Iterator",
"iter",
"=",
"nestedVars",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"String",
"varName",
"=",
"(",
"String",
")",
"iter",
".",
"next",
"(",
")",
";",
"varName",
"=",
"findAlias",
"(",
"varName",
")",
";",
"Object",
"obj",
"=",
"invokingJspCtxt",
".",
"getAttribute",
"(",
"varName",
")",
";",
"if",
"(",
"obj",
"!=",
"null",
")",
"{",
"originalNestedVars",
".",
"put",
"(",
"varName",
",",
"obj",
")",
";",
"}",
"}",
"}",
"}"
] | Saves the values of any NESTED variables that are present in
the invoking JSP context, so they can later be restored. | [
"Saves",
"the",
"values",
"of",
"any",
"NESTED",
"variables",
"that",
"are",
"present",
"in",
"the",
"invoking",
"JSP",
"context",
"so",
"they",
"can",
"later",
"be",
"restored",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/org/apache/jasper/runtime/JspContextWrapper.java#L442-L454 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/org/apache/jasper/runtime/JspContextWrapper.java | JspContextWrapper.restoreNestedVariables | private void restoreNestedVariables() {
if (nestedVars != null) {
Iterator iter = nestedVars.iterator();
while (iter.hasNext()) {
String varName = (String) iter.next();
varName = findAlias(varName);
Object obj = originalNestedVars.get(varName);
if (obj != null) {
invokingJspCtxt.setAttribute(varName, obj);
} else {
invokingJspCtxt.removeAttribute(varName, PAGE_SCOPE);
}
}
}
} | java | private void restoreNestedVariables() {
if (nestedVars != null) {
Iterator iter = nestedVars.iterator();
while (iter.hasNext()) {
String varName = (String) iter.next();
varName = findAlias(varName);
Object obj = originalNestedVars.get(varName);
if (obj != null) {
invokingJspCtxt.setAttribute(varName, obj);
} else {
invokingJspCtxt.removeAttribute(varName, PAGE_SCOPE);
}
}
}
} | [
"private",
"void",
"restoreNestedVariables",
"(",
")",
"{",
"if",
"(",
"nestedVars",
"!=",
"null",
")",
"{",
"Iterator",
"iter",
"=",
"nestedVars",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"String",
"varName",
"=",
"(",
"String",
")",
"iter",
".",
"next",
"(",
")",
";",
"varName",
"=",
"findAlias",
"(",
"varName",
")",
";",
"Object",
"obj",
"=",
"originalNestedVars",
".",
"get",
"(",
"varName",
")",
";",
"if",
"(",
"obj",
"!=",
"null",
")",
"{",
"invokingJspCtxt",
".",
"setAttribute",
"(",
"varName",
",",
"obj",
")",
";",
"}",
"else",
"{",
"invokingJspCtxt",
".",
"removeAttribute",
"(",
"varName",
",",
"PAGE_SCOPE",
")",
";",
"}",
"}",
"}",
"}"
] | Restores the values of any NESTED variables in the invoking JSP
context. | [
"Restores",
"the",
"values",
"of",
"any",
"NESTED",
"variables",
"in",
"the",
"invoking",
"JSP",
"context",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/org/apache/jasper/runtime/JspContextWrapper.java#L460-L474 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/ARangeList.java | ARangeList.getNext | public RangeObject getNext()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getNext", Integer.valueOf(cursor));
int curr = cursor;
cursor = cursor < (blockVector.size() - 1) ? cursor + 1 : cursor;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getNext", new Object[] {blockVector.get(curr), Integer.valueOf(cursor)});
return (RangeObject) blockVector.get(curr);
} | java | public RangeObject getNext()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getNext", Integer.valueOf(cursor));
int curr = cursor;
cursor = cursor < (blockVector.size() - 1) ? cursor + 1 : cursor;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getNext", new Object[] {blockVector.get(curr), Integer.valueOf(cursor)});
return (RangeObject) blockVector.get(curr);
} | [
"public",
"RangeObject",
"getNext",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getNext\"",
",",
"Integer",
".",
"valueOf",
"(",
"cursor",
")",
")",
";",
"int",
"curr",
"=",
"cursor",
";",
"cursor",
"=",
"cursor",
"<",
"(",
"blockVector",
".",
"size",
"(",
")",
"-",
"1",
")",
"?",
"cursor",
"+",
"1",
":",
"cursor",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getNext\"",
",",
"new",
"Object",
"[",
"]",
"{",
"blockVector",
".",
"get",
"(",
"curr",
")",
",",
"Integer",
".",
"valueOf",
"(",
"cursor",
")",
"}",
")",
";",
"return",
"(",
"RangeObject",
")",
"blockVector",
".",
"get",
"(",
"curr",
")",
";",
"}"
] | Returns the next range object | [
"Returns",
"the",
"next",
"range",
"object"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/ARangeList.java#L119-L131 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/ARangeList.java | ARangeList.replacePrefix | public void replacePrefix(RangeObject w)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "replacePrefix", w);
long lstamp = w.endstamp;
// Set index to position of lstamp.
int lindex;
RangeObject lastro;
for (lindex = 0;; lindex++)
{
lastro = (RangeObject) blockVector.get(lindex);
if ((lstamp <= lastro.endstamp) && (lstamp >= lastro.startstamp))
break;
}
if (lstamp < lastro.endstamp)
{
// lastro will not be removed so change its range
// lastro = (RangeObject) lastro.clone();
lastro.startstamp = lstamp + 1;
// blockVector.m_data[lindex] = lastro;
// figure out how much space to add or remove
if (lindex == 0)
{ // need to create 1 space
blockVector.insertNullElementsAt(0, 1);
}
else
{ // remove lindex - 1 elements
if ((lindex - 1) > 0)
blockVector.removeElementsAt(0, lindex - 1);
}
}
else
{ // everything upto and including lindex will be discarded
if (lindex > 0)
blockVector.removeElementsAt(0, lindex);
}
blockVector.set(0, w);
cursor = 0;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "replacePrefix");
} | java | public void replacePrefix(RangeObject w)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "replacePrefix", w);
long lstamp = w.endstamp;
// Set index to position of lstamp.
int lindex;
RangeObject lastro;
for (lindex = 0;; lindex++)
{
lastro = (RangeObject) blockVector.get(lindex);
if ((lstamp <= lastro.endstamp) && (lstamp >= lastro.startstamp))
break;
}
if (lstamp < lastro.endstamp)
{
// lastro will not be removed so change its range
// lastro = (RangeObject) lastro.clone();
lastro.startstamp = lstamp + 1;
// blockVector.m_data[lindex] = lastro;
// figure out how much space to add or remove
if (lindex == 0)
{ // need to create 1 space
blockVector.insertNullElementsAt(0, 1);
}
else
{ // remove lindex - 1 elements
if ((lindex - 1) > 0)
blockVector.removeElementsAt(0, lindex - 1);
}
}
else
{ // everything upto and including lindex will be discarded
if (lindex > 0)
blockVector.removeElementsAt(0, lindex);
}
blockVector.set(0, w);
cursor = 0;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "replacePrefix");
} | [
"public",
"void",
"replacePrefix",
"(",
"RangeObject",
"w",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"replacePrefix\"",
",",
"w",
")",
";",
"long",
"lstamp",
"=",
"w",
".",
"endstamp",
";",
"// Set index to position of lstamp.",
"int",
"lindex",
";",
"RangeObject",
"lastro",
";",
"for",
"(",
"lindex",
"=",
"0",
";",
";",
"lindex",
"++",
")",
"{",
"lastro",
"=",
"(",
"RangeObject",
")",
"blockVector",
".",
"get",
"(",
"lindex",
")",
";",
"if",
"(",
"(",
"lstamp",
"<=",
"lastro",
".",
"endstamp",
")",
"&&",
"(",
"lstamp",
">=",
"lastro",
".",
"startstamp",
")",
")",
"break",
";",
"}",
"if",
"(",
"lstamp",
"<",
"lastro",
".",
"endstamp",
")",
"{",
"// lastro will not be removed so change its range",
"// lastro = (RangeObject) lastro.clone();",
"lastro",
".",
"startstamp",
"=",
"lstamp",
"+",
"1",
";",
"// blockVector.m_data[lindex] = lastro;",
"// figure out how much space to add or remove",
"if",
"(",
"lindex",
"==",
"0",
")",
"{",
"// need to create 1 space",
"blockVector",
".",
"insertNullElementsAt",
"(",
"0",
",",
"1",
")",
";",
"}",
"else",
"{",
"// remove lindex - 1 elements",
"if",
"(",
"(",
"lindex",
"-",
"1",
")",
">",
"0",
")",
"blockVector",
".",
"removeElementsAt",
"(",
"0",
",",
"lindex",
"-",
"1",
")",
";",
"}",
"}",
"else",
"{",
"// everything upto and including lindex will be discarded",
"if",
"(",
"lindex",
">",
"0",
")",
"blockVector",
".",
"removeElementsAt",
"(",
"0",
",",
"lindex",
")",
";",
"}",
"blockVector",
".",
"set",
"(",
"0",
",",
"w",
")",
";",
"cursor",
"=",
"0",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"replacePrefix\"",
")",
";",
"}"
] | return a list of RangeObjects that are removed | [
"return",
"a",
"list",
"of",
"RangeObjects",
"that",
"are",
"removed"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/ARangeList.java#L338-L384 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/ARangeList.java | ARangeList.getIndex | protected final int getIndex(long stamp)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getIndex", Long.valueOf(stamp));
int first = 0;
int last = blockVector.size();
int index = linearSearch(stamp, first, last - 1);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getIndex", index);
return index;
} | java | protected final int getIndex(long stamp)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getIndex", Long.valueOf(stamp));
int first = 0;
int last = blockVector.size();
int index = linearSearch(stamp, first, last - 1);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getIndex", index);
return index;
} | [
"protected",
"final",
"int",
"getIndex",
"(",
"long",
"stamp",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getIndex\"",
",",
"Long",
".",
"valueOf",
"(",
"stamp",
")",
")",
";",
"int",
"first",
"=",
"0",
";",
"int",
"last",
"=",
"blockVector",
".",
"size",
"(",
")",
";",
"int",
"index",
"=",
"linearSearch",
"(",
"stamp",
",",
"first",
",",
"last",
"-",
"1",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getIndex\"",
",",
"index",
")",
";",
"return",
"index",
";",
"}"
] | gets the index in blockVector for the RangeObject containing stamp | [
"gets",
"the",
"index",
"in",
"blockVector",
"for",
"the",
"RangeObject",
"containing",
"stamp"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/ARangeList.java#L585-L599 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/web/JwtEndpointServices.java | JwtEndpointServices.handleJwtRequest | protected void handleJwtRequest(HttpServletRequest request, HttpServletResponse response,
ServletContext servletContext, JwtConfig jwtConfig, EndpointType endpointType) throws IOException {
if (jwtConfig == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "No JwtConfig object provided");
}
return;
}
switch (endpointType) {
case jwk:
processJWKRequest(response, jwtConfig);
return;
case token:
try {
if (!isTransportSecure(request)) {
String url = request.getRequestURL().toString();
Tr.error(tc, "SECURITY.JWT.ERROR.WRONG.HTTP.SCHEME", new Object[] { url });
response.sendError(HttpServletResponse.SC_NOT_FOUND,
Tr.formatMessage(tc, "SECURITY.JWT.ERROR.WRONG.HTTP.SCHEME", new Object[] { url }));
return;
}
boolean result = request.authenticate(response);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "request.authenticate result: " + result);
}
// if false, then not authenticated,
// a 401 w. auth challenge will be sent back and
// the response will be committed.
// Requester can then try again with creds on a new request.
if (result == false) {
return;
}
} catch (ServletException e) {
// ffdc
return;
}
processTokenRequest(response, jwtConfig);
return;
default:
break;
}
} | java | protected void handleJwtRequest(HttpServletRequest request, HttpServletResponse response,
ServletContext servletContext, JwtConfig jwtConfig, EndpointType endpointType) throws IOException {
if (jwtConfig == null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "No JwtConfig object provided");
}
return;
}
switch (endpointType) {
case jwk:
processJWKRequest(response, jwtConfig);
return;
case token:
try {
if (!isTransportSecure(request)) {
String url = request.getRequestURL().toString();
Tr.error(tc, "SECURITY.JWT.ERROR.WRONG.HTTP.SCHEME", new Object[] { url });
response.sendError(HttpServletResponse.SC_NOT_FOUND,
Tr.formatMessage(tc, "SECURITY.JWT.ERROR.WRONG.HTTP.SCHEME", new Object[] { url }));
return;
}
boolean result = request.authenticate(response);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "request.authenticate result: " + result);
}
// if false, then not authenticated,
// a 401 w. auth challenge will be sent back and
// the response will be committed.
// Requester can then try again with creds on a new request.
if (result == false) {
return;
}
} catch (ServletException e) {
// ffdc
return;
}
processTokenRequest(response, jwtConfig);
return;
default:
break;
}
} | [
"protected",
"void",
"handleJwtRequest",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"ServletContext",
"servletContext",
",",
"JwtConfig",
"jwtConfig",
",",
"EndpointType",
"endpointType",
")",
"throws",
"IOException",
"{",
"if",
"(",
"jwtConfig",
"==",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"No JwtConfig object provided\"",
")",
";",
"}",
"return",
";",
"}",
"switch",
"(",
"endpointType",
")",
"{",
"case",
"jwk",
":",
"processJWKRequest",
"(",
"response",
",",
"jwtConfig",
")",
";",
"return",
";",
"case",
"token",
":",
"try",
"{",
"if",
"(",
"!",
"isTransportSecure",
"(",
"request",
")",
")",
"{",
"String",
"url",
"=",
"request",
".",
"getRequestURL",
"(",
")",
".",
"toString",
"(",
")",
";",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"SECURITY.JWT.ERROR.WRONG.HTTP.SCHEME\"",
",",
"new",
"Object",
"[",
"]",
"{",
"url",
"}",
")",
";",
"response",
".",
"sendError",
"(",
"HttpServletResponse",
".",
"SC_NOT_FOUND",
",",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"SECURITY.JWT.ERROR.WRONG.HTTP.SCHEME\"",
",",
"new",
"Object",
"[",
"]",
"{",
"url",
"}",
")",
")",
";",
"return",
";",
"}",
"boolean",
"result",
"=",
"request",
".",
"authenticate",
"(",
"response",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"request.authenticate result: \"",
"+",
"result",
")",
";",
"}",
"// if false, then not authenticated,",
"// a 401 w. auth challenge will be sent back and",
"// the response will be committed.",
"// Requester can then try again with creds on a new request.",
"if",
"(",
"result",
"==",
"false",
")",
"{",
"return",
";",
"}",
"}",
"catch",
"(",
"ServletException",
"e",
")",
"{",
"// ffdc",
"return",
";",
"}",
"processTokenRequest",
"(",
"response",
",",
"jwtConfig",
")",
";",
"return",
";",
"default",
":",
"break",
";",
"}",
"}"
] | Handle the request for the respective endpoint to which the request was
directed.
@param request
@param response
@param servletContext
@param jwtConfig
@param endpointType
@throws IOException | [
"Handle",
"the",
"request",
"for",
"the",
"respective",
"endpoint",
"to",
"which",
"the",
"request",
"was",
"directed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/web/JwtEndpointServices.java#L149-L191 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/web/JwtEndpointServices.java | JwtEndpointServices.isTransportSecure | private boolean isTransportSecure(HttpServletRequest req) {
String url = req.getRequestURL().toString();
if (req.getScheme().equals("https")) {
return true;
}
String value = req.getHeader("X-Forwarded-Proto");
if (value != null && value.toLowerCase().equals("https")) {
return true;
}
return false;
} | java | private boolean isTransportSecure(HttpServletRequest req) {
String url = req.getRequestURL().toString();
if (req.getScheme().equals("https")) {
return true;
}
String value = req.getHeader("X-Forwarded-Proto");
if (value != null && value.toLowerCase().equals("https")) {
return true;
}
return false;
} | [
"private",
"boolean",
"isTransportSecure",
"(",
"HttpServletRequest",
"req",
")",
"{",
"String",
"url",
"=",
"req",
".",
"getRequestURL",
"(",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"req",
".",
"getScheme",
"(",
")",
".",
"equals",
"(",
"\"https\"",
")",
")",
"{",
"return",
"true",
";",
"}",
"String",
"value",
"=",
"req",
".",
"getHeader",
"(",
"\"X-Forwarded-Proto\"",
")",
";",
"if",
"(",
"value",
"!=",
"null",
"&&",
"value",
".",
"toLowerCase",
"(",
")",
".",
"equals",
"(",
"\"https\"",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | determine if transport is secure. Either the protocol must be https or we
must see a forwarding header that indicates it was https upstream of a
proxy. Use of a configuration property to allow plain http was rejected
in review.
@param req
@return | [
"determine",
"if",
"transport",
"is",
"secure",
".",
"Either",
"the",
"protocol",
"must",
"be",
"https",
"or",
"we",
"must",
"see",
"a",
"forwarding",
"header",
"that",
"indicates",
"it",
"was",
"https",
"upstream",
"of",
"a",
"proxy",
".",
"Use",
"of",
"a",
"configuration",
"property",
"to",
"allow",
"plain",
"http",
"was",
"rejected",
"in",
"review",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/web/JwtEndpointServices.java#L202-L213 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/web/JwtEndpointServices.java | JwtEndpointServices.processTokenRequest | private void processTokenRequest(HttpServletResponse response, JwtConfig jwtConfig) throws IOException {
String tokenString = new TokenBuilder().createTokenString(jwtConfig);
addNoCacheHeaders(response);
response.setStatus(200);
if (tokenString == null) {
return;
}
try {
PrintWriter pw = response.getWriter();
response.setHeader(WebConstants.HTTP_HEADER_CONTENT_TYPE, WebConstants.HTTP_CONTENT_TYPE_JSON);
pw.write("{\"token\": \"" + tokenString + "\"}");
pw.flush();
pw.close();
} catch (IOException e) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Caught an exception attempting to get the response writer: " + e.getLocalizedMessage());
}
}
} | java | private void processTokenRequest(HttpServletResponse response, JwtConfig jwtConfig) throws IOException {
String tokenString = new TokenBuilder().createTokenString(jwtConfig);
addNoCacheHeaders(response);
response.setStatus(200);
if (tokenString == null) {
return;
}
try {
PrintWriter pw = response.getWriter();
response.setHeader(WebConstants.HTTP_HEADER_CONTENT_TYPE, WebConstants.HTTP_CONTENT_TYPE_JSON);
pw.write("{\"token\": \"" + tokenString + "\"}");
pw.flush();
pw.close();
} catch (IOException e) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Caught an exception attempting to get the response writer: " + e.getLocalizedMessage());
}
}
} | [
"private",
"void",
"processTokenRequest",
"(",
"HttpServletResponse",
"response",
",",
"JwtConfig",
"jwtConfig",
")",
"throws",
"IOException",
"{",
"String",
"tokenString",
"=",
"new",
"TokenBuilder",
"(",
")",
".",
"createTokenString",
"(",
"jwtConfig",
")",
";",
"addNoCacheHeaders",
"(",
"response",
")",
";",
"response",
".",
"setStatus",
"(",
"200",
")",
";",
"if",
"(",
"tokenString",
"==",
"null",
")",
"{",
"return",
";",
"}",
"try",
"{",
"PrintWriter",
"pw",
"=",
"response",
".",
"getWriter",
"(",
")",
";",
"response",
".",
"setHeader",
"(",
"WebConstants",
".",
"HTTP_HEADER_CONTENT_TYPE",
",",
"WebConstants",
".",
"HTTP_CONTENT_TYPE_JSON",
")",
";",
"pw",
".",
"write",
"(",
"\"{\\\"token\\\": \\\"\"",
"+",
"tokenString",
"+",
"\"\\\"}\"",
")",
";",
"pw",
".",
"flush",
"(",
")",
";",
"pw",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Caught an exception attempting to get the response writer: \"",
"+",
"e",
".",
"getLocalizedMessage",
"(",
")",
")",
";",
"}",
"}",
"}"
] | produces a JWT token based upon the jwt Configuration, and the security
credentials of the authenticated user that called this method. Returns
the token as JSON in the response.
@param response
@param jwtConfig
@throws IOException | [
"produces",
"a",
"JWT",
"token",
"based",
"upon",
"the",
"jwt",
"Configuration",
"and",
"the",
"security",
"credentials",
"of",
"the",
"authenticated",
"user",
"that",
"called",
"this",
"method",
".",
"Returns",
"the",
"token",
"as",
"JSON",
"in",
"the",
"response",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/web/JwtEndpointServices.java#L224-L244 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/web/JwtEndpointServices.java | JwtEndpointServices.processJWKRequest | private void processJWKRequest(HttpServletResponse response, JwtConfig jwtConfig) throws IOException {
/*
* if (!jwtConfig.isJwkEnabled()) { String errorMsg =
* Tr.formatMessage(tc, "JWK_ENDPOINT_JWK_NOT_ENABLED", new Object[] {
* jwtConfig.getId() }); Tr.error(tc, errorMsg);
* response.sendError(HttpServletResponse.SC_BAD_REQUEST, errorMsg);
* return; }
*/
String signatureAlg = jwtConfig.getSignatureAlgorithm();
if (!Constants.SIGNATURE_ALG_RS256.equals(signatureAlg)) {
String errorMsg = Tr.formatMessage(tc, "JWK_ENDPOINT_WRONG_ALGORITHM",
new Object[] { jwtConfig.getId(), signatureAlg, Constants.SIGNATURE_ALG_RS256 });
Tr.error(tc, errorMsg);
response.sendError(HttpServletResponse.SC_BAD_REQUEST, errorMsg);
return;
}
String jwkString = jwtConfig.getJwkJsonString();
addNoCacheHeaders(response);
response.setStatus(200);
if (jwkString == null) {
return;
}
try {
PrintWriter pw = response.getWriter();
response.setHeader(WebConstants.HTTP_HEADER_CONTENT_TYPE, WebConstants.HTTP_CONTENT_TYPE_JSON);
pw.write(jwkString);
pw.flush();
pw.close();
} catch (IOException e) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Caught an exception attempting to get the response writer: " + e.getLocalizedMessage());
}
}
} | java | private void processJWKRequest(HttpServletResponse response, JwtConfig jwtConfig) throws IOException {
/*
* if (!jwtConfig.isJwkEnabled()) { String errorMsg =
* Tr.formatMessage(tc, "JWK_ENDPOINT_JWK_NOT_ENABLED", new Object[] {
* jwtConfig.getId() }); Tr.error(tc, errorMsg);
* response.sendError(HttpServletResponse.SC_BAD_REQUEST, errorMsg);
* return; }
*/
String signatureAlg = jwtConfig.getSignatureAlgorithm();
if (!Constants.SIGNATURE_ALG_RS256.equals(signatureAlg)) {
String errorMsg = Tr.formatMessage(tc, "JWK_ENDPOINT_WRONG_ALGORITHM",
new Object[] { jwtConfig.getId(), signatureAlg, Constants.SIGNATURE_ALG_RS256 });
Tr.error(tc, errorMsg);
response.sendError(HttpServletResponse.SC_BAD_REQUEST, errorMsg);
return;
}
String jwkString = jwtConfig.getJwkJsonString();
addNoCacheHeaders(response);
response.setStatus(200);
if (jwkString == null) {
return;
}
try {
PrintWriter pw = response.getWriter();
response.setHeader(WebConstants.HTTP_HEADER_CONTENT_TYPE, WebConstants.HTTP_CONTENT_TYPE_JSON);
pw.write(jwkString);
pw.flush();
pw.close();
} catch (IOException e) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Caught an exception attempting to get the response writer: " + e.getLocalizedMessage());
}
}
} | [
"private",
"void",
"processJWKRequest",
"(",
"HttpServletResponse",
"response",
",",
"JwtConfig",
"jwtConfig",
")",
"throws",
"IOException",
"{",
"/*\n\t\t * if (!jwtConfig.isJwkEnabled()) { String errorMsg =\n\t\t * Tr.formatMessage(tc, \"JWK_ENDPOINT_JWK_NOT_ENABLED\", new Object[] {\n\t\t * jwtConfig.getId() }); Tr.error(tc, errorMsg);\n\t\t * response.sendError(HttpServletResponse.SC_BAD_REQUEST, errorMsg);\n\t\t * return; }\n\t\t */",
"String",
"signatureAlg",
"=",
"jwtConfig",
".",
"getSignatureAlgorithm",
"(",
")",
";",
"if",
"(",
"!",
"Constants",
".",
"SIGNATURE_ALG_RS256",
".",
"equals",
"(",
"signatureAlg",
")",
")",
"{",
"String",
"errorMsg",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"JWK_ENDPOINT_WRONG_ALGORITHM\"",
",",
"new",
"Object",
"[",
"]",
"{",
"jwtConfig",
".",
"getId",
"(",
")",
",",
"signatureAlg",
",",
"Constants",
".",
"SIGNATURE_ALG_RS256",
"}",
")",
";",
"Tr",
".",
"error",
"(",
"tc",
",",
"errorMsg",
")",
";",
"response",
".",
"sendError",
"(",
"HttpServletResponse",
".",
"SC_BAD_REQUEST",
",",
"errorMsg",
")",
";",
"return",
";",
"}",
"String",
"jwkString",
"=",
"jwtConfig",
".",
"getJwkJsonString",
"(",
")",
";",
"addNoCacheHeaders",
"(",
"response",
")",
";",
"response",
".",
"setStatus",
"(",
"200",
")",
";",
"if",
"(",
"jwkString",
"==",
"null",
")",
"{",
"return",
";",
"}",
"try",
"{",
"PrintWriter",
"pw",
"=",
"response",
".",
"getWriter",
"(",
")",
";",
"response",
".",
"setHeader",
"(",
"WebConstants",
".",
"HTTP_HEADER_CONTENT_TYPE",
",",
"WebConstants",
".",
"HTTP_CONTENT_TYPE_JSON",
")",
";",
"pw",
".",
"write",
"(",
"jwkString",
")",
";",
"pw",
".",
"flush",
"(",
")",
";",
"pw",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Caught an exception attempting to get the response writer: \"",
"+",
"e",
".",
"getLocalizedMessage",
"(",
")",
")",
";",
"}",
"}",
"}"
] | Obtains the JWK string that is active in the specified config and prints
it in JSON format in the response. If a JWK is not found, the response
will be empty.
@param response
@param jwtConfig
@throws IOException | [
"Obtains",
"the",
"JWK",
"string",
"that",
"is",
"active",
"in",
"the",
"specified",
"config",
"and",
"prints",
"it",
"in",
"JSON",
"format",
"in",
"the",
"response",
".",
"If",
"a",
"JWK",
"is",
"not",
"found",
"the",
"response",
"will",
"be",
"empty",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/web/JwtEndpointServices.java#L255-L293 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/web/JwtEndpointServices.java | JwtEndpointServices.addNoCacheHeaders | protected void addNoCacheHeaders(HttpServletResponse response) {
String cacheControlValue = response.getHeader(WebConstants.HEADER_CACHE_CONTROL);
if (cacheControlValue != null && !cacheControlValue.isEmpty()) {
cacheControlValue = cacheControlValue + ", " + WebConstants.CACHE_CONTROL_NO_STORE;
} else {
cacheControlValue = WebConstants.CACHE_CONTROL_NO_STORE;
}
response.setHeader(WebConstants.HEADER_CACHE_CONTROL, cacheControlValue);
response.setHeader(WebConstants.HEADER_PRAGMA, WebConstants.PRAGMA_NO_CACHE);
} | java | protected void addNoCacheHeaders(HttpServletResponse response) {
String cacheControlValue = response.getHeader(WebConstants.HEADER_CACHE_CONTROL);
if (cacheControlValue != null && !cacheControlValue.isEmpty()) {
cacheControlValue = cacheControlValue + ", " + WebConstants.CACHE_CONTROL_NO_STORE;
} else {
cacheControlValue = WebConstants.CACHE_CONTROL_NO_STORE;
}
response.setHeader(WebConstants.HEADER_CACHE_CONTROL, cacheControlValue);
response.setHeader(WebConstants.HEADER_PRAGMA, WebConstants.PRAGMA_NO_CACHE);
} | [
"protected",
"void",
"addNoCacheHeaders",
"(",
"HttpServletResponse",
"response",
")",
"{",
"String",
"cacheControlValue",
"=",
"response",
".",
"getHeader",
"(",
"WebConstants",
".",
"HEADER_CACHE_CONTROL",
")",
";",
"if",
"(",
"cacheControlValue",
"!=",
"null",
"&&",
"!",
"cacheControlValue",
".",
"isEmpty",
"(",
")",
")",
"{",
"cacheControlValue",
"=",
"cacheControlValue",
"+",
"\", \"",
"+",
"WebConstants",
".",
"CACHE_CONTROL_NO_STORE",
";",
"}",
"else",
"{",
"cacheControlValue",
"=",
"WebConstants",
".",
"CACHE_CONTROL_NO_STORE",
";",
"}",
"response",
".",
"setHeader",
"(",
"WebConstants",
".",
"HEADER_CACHE_CONTROL",
",",
"cacheControlValue",
")",
";",
"response",
".",
"setHeader",
"(",
"WebConstants",
".",
"HEADER_PRAGMA",
",",
"WebConstants",
".",
"PRAGMA_NO_CACHE",
")",
";",
"}"
] | Adds header values to avoid caching of the provided response.
@param response | [
"Adds",
"header",
"values",
"to",
"avoid",
"caching",
"of",
"the",
"provided",
"response",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/web/JwtEndpointServices.java#L300-L311 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/MonitoringProxyActivator.java | MonitoringProxyActivator.activate | protected void activate() throws Exception {
// If the ProbeProxy class is available, check it's version
String runtimeVersion = getRuntimeClassVersion();
if (runtimeVersion != null && !runtimeVersion.equals(getCurrentVersion())) {
// TODO: Use a compatibility check instead
throw new IllegalStateException("Incompatible proxy code (version " + runtimeVersion + ")");
}
// Find or create the proxy jar if the runtime code isn't loaded
if (runtimeVersion == null) {
JarFile proxyJar = getBootProxyJarIfCurrent();
if (proxyJar == null) {
proxyJar = createBootProxyJar();
}
instrumentation.appendToBootstrapClassLoaderSearch(proxyJar);
}
// Hook up the proxies
activateProbeProxyTarget();
activateClassAvailableProxyTarget();
} | java | protected void activate() throws Exception {
// If the ProbeProxy class is available, check it's version
String runtimeVersion = getRuntimeClassVersion();
if (runtimeVersion != null && !runtimeVersion.equals(getCurrentVersion())) {
// TODO: Use a compatibility check instead
throw new IllegalStateException("Incompatible proxy code (version " + runtimeVersion + ")");
}
// Find or create the proxy jar if the runtime code isn't loaded
if (runtimeVersion == null) {
JarFile proxyJar = getBootProxyJarIfCurrent();
if (proxyJar == null) {
proxyJar = createBootProxyJar();
}
instrumentation.appendToBootstrapClassLoaderSearch(proxyJar);
}
// Hook up the proxies
activateProbeProxyTarget();
activateClassAvailableProxyTarget();
} | [
"protected",
"void",
"activate",
"(",
")",
"throws",
"Exception",
"{",
"// If the ProbeProxy class is available, check it's version",
"String",
"runtimeVersion",
"=",
"getRuntimeClassVersion",
"(",
")",
";",
"if",
"(",
"runtimeVersion",
"!=",
"null",
"&&",
"!",
"runtimeVersion",
".",
"equals",
"(",
"getCurrentVersion",
"(",
")",
")",
")",
"{",
"// TODO: Use a compatibility check instead",
"throw",
"new",
"IllegalStateException",
"(",
"\"Incompatible proxy code (version \"",
"+",
"runtimeVersion",
"+",
"\")\"",
")",
";",
"}",
"// Find or create the proxy jar if the runtime code isn't loaded",
"if",
"(",
"runtimeVersion",
"==",
"null",
")",
"{",
"JarFile",
"proxyJar",
"=",
"getBootProxyJarIfCurrent",
"(",
")",
";",
"if",
"(",
"proxyJar",
"==",
"null",
")",
"{",
"proxyJar",
"=",
"createBootProxyJar",
"(",
")",
";",
"}",
"instrumentation",
".",
"appendToBootstrapClassLoaderSearch",
"(",
"proxyJar",
")",
";",
"}",
"// Hook up the proxies",
"activateProbeProxyTarget",
"(",
")",
";",
"activateClassAvailableProxyTarget",
"(",
")",
";",
"}"
] | Activate this declarative services component. Bundles that are
currently active will be examined for monitoring metadata and
registered as appropriate.
@throws Exception if an error occurs during proxy setup | [
"Activate",
"this",
"declarative",
"services",
"component",
".",
"Bundles",
"that",
"are",
"currently",
"active",
"will",
"be",
"examined",
"for",
"monitoring",
"metadata",
"and",
"registered",
"as",
"appropriate",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/MonitoringProxyActivator.java#L135-L155 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/MonitoringProxyActivator.java | MonitoringProxyActivator.getRuntimeClassVersion | @FFDCIgnore(Exception.class)
String getRuntimeClassVersion() {
String runtimeVersion = null;
try {
Class<?> clazz = Class.forName(PROBE_PROXY_CLASS_NAME);
Field version = ReflectionHelper.getDeclaredField(clazz, VERSION_FIELD_NAME);
runtimeVersion = (String) version.get(null);
} catch (Exception e) {
}
return runtimeVersion;
} | java | @FFDCIgnore(Exception.class)
String getRuntimeClassVersion() {
String runtimeVersion = null;
try {
Class<?> clazz = Class.forName(PROBE_PROXY_CLASS_NAME);
Field version = ReflectionHelper.getDeclaredField(clazz, VERSION_FIELD_NAME);
runtimeVersion = (String) version.get(null);
} catch (Exception e) {
}
return runtimeVersion;
} | [
"@",
"FFDCIgnore",
"(",
"Exception",
".",
"class",
")",
"String",
"getRuntimeClassVersion",
"(",
")",
"{",
"String",
"runtimeVersion",
"=",
"null",
";",
"try",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"Class",
".",
"forName",
"(",
"PROBE_PROXY_CLASS_NAME",
")",
";",
"Field",
"version",
"=",
"ReflectionHelper",
".",
"getDeclaredField",
"(",
"clazz",
",",
"VERSION_FIELD_NAME",
")",
";",
"runtimeVersion",
"=",
"(",
"String",
")",
"version",
".",
"get",
"(",
"null",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"}",
"return",
"runtimeVersion",
";",
"}"
] | Determine if the boot delegated proxy is already available and, if so,
what its version is.
@return the runtime version of the emitter proxy or null if the class
is not currently available | [
"Determine",
"if",
"the",
"boot",
"delegated",
"proxy",
"is",
"already",
"available",
"and",
"if",
"so",
"what",
"its",
"version",
"is",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/MonitoringProxyActivator.java#L178-L188 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/MonitoringProxyActivator.java | MonitoringProxyActivator.getBootProxyJarIfCurrent | JarFile getBootProxyJarIfCurrent() {
File dataFile = bundleContext.getDataFile("boot-proxy.jar");
if (!dataFile.exists()) {
return null;
}
JarFile jarFile = null;
try {
jarFile = new JarFile(dataFile);
Manifest manifest = jarFile.getManifest();
Attributes attrs = manifest.getMainAttributes();
String jarVersion = attrs.getValue(MONITORING_VERSION_MANIFEST_HEADER);
if (!getCurrentVersion().equals(jarVersion)) {
jarFile.close();
jarFile = null;
}
} catch (Exception e) {
}
return jarFile;
} | java | JarFile getBootProxyJarIfCurrent() {
File dataFile = bundleContext.getDataFile("boot-proxy.jar");
if (!dataFile.exists()) {
return null;
}
JarFile jarFile = null;
try {
jarFile = new JarFile(dataFile);
Manifest manifest = jarFile.getManifest();
Attributes attrs = manifest.getMainAttributes();
String jarVersion = attrs.getValue(MONITORING_VERSION_MANIFEST_HEADER);
if (!getCurrentVersion().equals(jarVersion)) {
jarFile.close();
jarFile = null;
}
} catch (Exception e) {
}
return jarFile;
} | [
"JarFile",
"getBootProxyJarIfCurrent",
"(",
")",
"{",
"File",
"dataFile",
"=",
"bundleContext",
".",
"getDataFile",
"(",
"\"boot-proxy.jar\"",
")",
";",
"if",
"(",
"!",
"dataFile",
".",
"exists",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"JarFile",
"jarFile",
"=",
"null",
";",
"try",
"{",
"jarFile",
"=",
"new",
"JarFile",
"(",
"dataFile",
")",
";",
"Manifest",
"manifest",
"=",
"jarFile",
".",
"getManifest",
"(",
")",
";",
"Attributes",
"attrs",
"=",
"manifest",
".",
"getMainAttributes",
"(",
")",
";",
"String",
"jarVersion",
"=",
"attrs",
".",
"getValue",
"(",
"MONITORING_VERSION_MANIFEST_HEADER",
")",
";",
"if",
"(",
"!",
"getCurrentVersion",
"(",
")",
".",
"equals",
"(",
"jarVersion",
")",
")",
"{",
"jarFile",
".",
"close",
"(",
")",
";",
"jarFile",
"=",
"null",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"}",
"return",
"jarFile",
";",
"}"
] | Get the boot proxy jar from the current data area if the code
matches the current bundle version.
@return the proxy jar iff the proxy jar exits and matches this
bundle's version | [
"Get",
"the",
"boot",
"proxy",
"jar",
"from",
"the",
"current",
"data",
"area",
"if",
"the",
"code",
"matches",
"the",
"current",
"bundle",
"version",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/MonitoringProxyActivator.java#L197-L217 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/MonitoringProxyActivator.java | MonitoringProxyActivator.createBootProxyJar | JarFile createBootProxyJar() throws IOException {
File dataFile = bundleContext.getDataFile("boot-proxy.jar");
// Create the file if it doesn't already exist
if (!dataFile.exists()) {
dataFile.createNewFile();
}
// Generate a manifest
Manifest manifest = createBootJarManifest();
// Create the file
FileOutputStream fileOutputStream = new FileOutputStream(dataFile, false);
JarOutputStream jarOutputStream = new JarOutputStream(fileOutputStream, manifest);
// Add the jar path entries to reduce class load times
createDirectoryEntries(jarOutputStream, BOOT_DELEGATED_PACKAGE);
// Map the template classes into the delegation package and add to the jar
Bundle bundle = bundleContext.getBundle();
Enumeration<?> entryPaths = bundle.getEntryPaths(TEMPLATE_CLASSES_PATH);
if (entryPaths != null) {
while (entryPaths.hasMoreElements()) {
URL sourceClassResource = bundle.getEntry((String) entryPaths.nextElement());
if (sourceClassResource != null)
writeRemappedClass(sourceClassResource, jarOutputStream, BOOT_DELEGATED_PACKAGE);
}
}
jarOutputStream.close();
fileOutputStream.close();
return new JarFile(dataFile);
} | java | JarFile createBootProxyJar() throws IOException {
File dataFile = bundleContext.getDataFile("boot-proxy.jar");
// Create the file if it doesn't already exist
if (!dataFile.exists()) {
dataFile.createNewFile();
}
// Generate a manifest
Manifest manifest = createBootJarManifest();
// Create the file
FileOutputStream fileOutputStream = new FileOutputStream(dataFile, false);
JarOutputStream jarOutputStream = new JarOutputStream(fileOutputStream, manifest);
// Add the jar path entries to reduce class load times
createDirectoryEntries(jarOutputStream, BOOT_DELEGATED_PACKAGE);
// Map the template classes into the delegation package and add to the jar
Bundle bundle = bundleContext.getBundle();
Enumeration<?> entryPaths = bundle.getEntryPaths(TEMPLATE_CLASSES_PATH);
if (entryPaths != null) {
while (entryPaths.hasMoreElements()) {
URL sourceClassResource = bundle.getEntry((String) entryPaths.nextElement());
if (sourceClassResource != null)
writeRemappedClass(sourceClassResource, jarOutputStream, BOOT_DELEGATED_PACKAGE);
}
}
jarOutputStream.close();
fileOutputStream.close();
return new JarFile(dataFile);
} | [
"JarFile",
"createBootProxyJar",
"(",
")",
"throws",
"IOException",
"{",
"File",
"dataFile",
"=",
"bundleContext",
".",
"getDataFile",
"(",
"\"boot-proxy.jar\"",
")",
";",
"// Create the file if it doesn't already exist",
"if",
"(",
"!",
"dataFile",
".",
"exists",
"(",
")",
")",
"{",
"dataFile",
".",
"createNewFile",
"(",
")",
";",
"}",
"// Generate a manifest",
"Manifest",
"manifest",
"=",
"createBootJarManifest",
"(",
")",
";",
"// Create the file",
"FileOutputStream",
"fileOutputStream",
"=",
"new",
"FileOutputStream",
"(",
"dataFile",
",",
"false",
")",
";",
"JarOutputStream",
"jarOutputStream",
"=",
"new",
"JarOutputStream",
"(",
"fileOutputStream",
",",
"manifest",
")",
";",
"// Add the jar path entries to reduce class load times",
"createDirectoryEntries",
"(",
"jarOutputStream",
",",
"BOOT_DELEGATED_PACKAGE",
")",
";",
"// Map the template classes into the delegation package and add to the jar",
"Bundle",
"bundle",
"=",
"bundleContext",
".",
"getBundle",
"(",
")",
";",
"Enumeration",
"<",
"?",
">",
"entryPaths",
"=",
"bundle",
".",
"getEntryPaths",
"(",
"TEMPLATE_CLASSES_PATH",
")",
";",
"if",
"(",
"entryPaths",
"!=",
"null",
")",
"{",
"while",
"(",
"entryPaths",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"URL",
"sourceClassResource",
"=",
"bundle",
".",
"getEntry",
"(",
"(",
"String",
")",
"entryPaths",
".",
"nextElement",
"(",
")",
")",
";",
"if",
"(",
"sourceClassResource",
"!=",
"null",
")",
"writeRemappedClass",
"(",
"sourceClassResource",
",",
"jarOutputStream",
",",
"BOOT_DELEGATED_PACKAGE",
")",
";",
"}",
"}",
"jarOutputStream",
".",
"close",
"(",
")",
";",
"fileOutputStream",
".",
"close",
"(",
")",
";",
"return",
"new",
"JarFile",
"(",
"dataFile",
")",
";",
"}"
] | Create a jar file that contains the proxy code that will live in the
boot delegation package.
@return the jar file containing the proxy code to append to the boot
class path
@throws IOException if a file I/O error occurs | [
"Create",
"a",
"jar",
"file",
"that",
"contains",
"the",
"proxy",
"code",
"that",
"will",
"live",
"in",
"the",
"boot",
"delegation",
"package",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/MonitoringProxyActivator.java#L228-L261 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/MonitoringProxyActivator.java | MonitoringProxyActivator.createDirectoryEntries | public void createDirectoryEntries(JarOutputStream jarStream, String packageName) throws IOException {
StringBuilder entryName = new StringBuilder(packageName.length());
for (String str : packageName.split("\\.")) {
entryName.append(str).append("/");
JarEntry jarEntry = new JarEntry(entryName.toString());
jarStream.putNextEntry(jarEntry);
}
} | java | public void createDirectoryEntries(JarOutputStream jarStream, String packageName) throws IOException {
StringBuilder entryName = new StringBuilder(packageName.length());
for (String str : packageName.split("\\.")) {
entryName.append(str).append("/");
JarEntry jarEntry = new JarEntry(entryName.toString());
jarStream.putNextEntry(jarEntry);
}
} | [
"public",
"void",
"createDirectoryEntries",
"(",
"JarOutputStream",
"jarStream",
",",
"String",
"packageName",
")",
"throws",
"IOException",
"{",
"StringBuilder",
"entryName",
"=",
"new",
"StringBuilder",
"(",
"packageName",
".",
"length",
"(",
")",
")",
";",
"for",
"(",
"String",
"str",
":",
"packageName",
".",
"split",
"(",
"\"\\\\.\"",
")",
")",
"{",
"entryName",
".",
"append",
"(",
"str",
")",
".",
"append",
"(",
"\"/\"",
")",
";",
"JarEntry",
"jarEntry",
"=",
"new",
"JarEntry",
"(",
"entryName",
".",
"toString",
"(",
")",
")",
";",
"jarStream",
".",
"putNextEntry",
"(",
"jarEntry",
")",
";",
"}",
"}"
] | Create the jar directory entries corresponding to the specified package
name.
@param jarStream the target jar's output stream
@param packageName the target package name
@throws IOException if an IO exception raised while creating the entries | [
"Create",
"the",
"jar",
"directory",
"entries",
"corresponding",
"to",
"the",
"specified",
"package",
"name",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/MonitoringProxyActivator.java#L272-L279 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/MonitoringProxyActivator.java | MonitoringProxyActivator.writeRemappedClass | private void writeRemappedClass(URL classUrl, JarOutputStream jarStream, String targetPackage) throws IOException {
InputStream inputStream = classUrl.openStream();
String sourceInternalName = getClassInternalName(classUrl);
String targetInternalName = getTargetInternalName(sourceInternalName, targetPackage);
SimpleRemapper remapper = new SimpleRemapper(sourceInternalName, targetInternalName);
ClassReader reader = new ClassReader(inputStream);
ClassWriter writer = new ClassWriter(reader, ClassWriter.COMPUTE_FRAMES);
ClassRemapper remappingVisitor = new ClassRemapper(writer, remapper);
ClassVisitor versionVisitor = new AddVersionFieldClassAdapter(remappingVisitor, VERSION_FIELD_NAME, getCurrentVersion());
reader.accept(versionVisitor, ClassReader.EXPAND_FRAMES);
JarEntry jarEntry = new JarEntry(targetInternalName + ".class");
jarStream.putNextEntry(jarEntry);
jarStream.write(writer.toByteArray());
} | java | private void writeRemappedClass(URL classUrl, JarOutputStream jarStream, String targetPackage) throws IOException {
InputStream inputStream = classUrl.openStream();
String sourceInternalName = getClassInternalName(classUrl);
String targetInternalName = getTargetInternalName(sourceInternalName, targetPackage);
SimpleRemapper remapper = new SimpleRemapper(sourceInternalName, targetInternalName);
ClassReader reader = new ClassReader(inputStream);
ClassWriter writer = new ClassWriter(reader, ClassWriter.COMPUTE_FRAMES);
ClassRemapper remappingVisitor = new ClassRemapper(writer, remapper);
ClassVisitor versionVisitor = new AddVersionFieldClassAdapter(remappingVisitor, VERSION_FIELD_NAME, getCurrentVersion());
reader.accept(versionVisitor, ClassReader.EXPAND_FRAMES);
JarEntry jarEntry = new JarEntry(targetInternalName + ".class");
jarStream.putNextEntry(jarEntry);
jarStream.write(writer.toByteArray());
} | [
"private",
"void",
"writeRemappedClass",
"(",
"URL",
"classUrl",
",",
"JarOutputStream",
"jarStream",
",",
"String",
"targetPackage",
")",
"throws",
"IOException",
"{",
"InputStream",
"inputStream",
"=",
"classUrl",
".",
"openStream",
"(",
")",
";",
"String",
"sourceInternalName",
"=",
"getClassInternalName",
"(",
"classUrl",
")",
";",
"String",
"targetInternalName",
"=",
"getTargetInternalName",
"(",
"sourceInternalName",
",",
"targetPackage",
")",
";",
"SimpleRemapper",
"remapper",
"=",
"new",
"SimpleRemapper",
"(",
"sourceInternalName",
",",
"targetInternalName",
")",
";",
"ClassReader",
"reader",
"=",
"new",
"ClassReader",
"(",
"inputStream",
")",
";",
"ClassWriter",
"writer",
"=",
"new",
"ClassWriter",
"(",
"reader",
",",
"ClassWriter",
".",
"COMPUTE_FRAMES",
")",
";",
"ClassRemapper",
"remappingVisitor",
"=",
"new",
"ClassRemapper",
"(",
"writer",
",",
"remapper",
")",
";",
"ClassVisitor",
"versionVisitor",
"=",
"new",
"AddVersionFieldClassAdapter",
"(",
"remappingVisitor",
",",
"VERSION_FIELD_NAME",
",",
"getCurrentVersion",
"(",
")",
")",
";",
"reader",
".",
"accept",
"(",
"versionVisitor",
",",
"ClassReader",
".",
"EXPAND_FRAMES",
")",
";",
"JarEntry",
"jarEntry",
"=",
"new",
"JarEntry",
"(",
"targetInternalName",
"+",
"\".class\"",
")",
";",
"jarStream",
".",
"putNextEntry",
"(",
"jarEntry",
")",
";",
"jarStream",
".",
"write",
"(",
"writer",
".",
"toByteArray",
"(",
")",
")",
";",
"}"
] | Transform the proxy template class that's in this package into a class
that's in a package on the framework boot delegation package list.
@return the byte array containing the updated class
@throws IOException if an IO exception raised while processing the class | [
"Transform",
"the",
"proxy",
"template",
"class",
"that",
"s",
"in",
"this",
"package",
"into",
"a",
"class",
"that",
"s",
"in",
"a",
"package",
"on",
"the",
"framework",
"boot",
"delegation",
"package",
"list",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/MonitoringProxyActivator.java#L289-L304 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/MonitoringProxyActivator.java | MonitoringProxyActivator.getTargetInternalName | String getTargetInternalName(String sourceInternalName, String targetPackage) {
StringBuilder targetInternalName = new StringBuilder();
targetInternalName.append(targetPackage.replaceAll("\\.", "/"));
int lastSlashIndex = sourceInternalName.lastIndexOf('/');
targetInternalName.append(sourceInternalName.substring(lastSlashIndex));
return targetInternalName.toString();
} | java | String getTargetInternalName(String sourceInternalName, String targetPackage) {
StringBuilder targetInternalName = new StringBuilder();
targetInternalName.append(targetPackage.replaceAll("\\.", "/"));
int lastSlashIndex = sourceInternalName.lastIndexOf('/');
targetInternalName.append(sourceInternalName.substring(lastSlashIndex));
return targetInternalName.toString();
} | [
"String",
"getTargetInternalName",
"(",
"String",
"sourceInternalName",
",",
"String",
"targetPackage",
")",
"{",
"StringBuilder",
"targetInternalName",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"targetInternalName",
".",
"append",
"(",
"targetPackage",
".",
"replaceAll",
"(",
"\"\\\\.\"",
",",
"\"/\"",
")",
")",
";",
"int",
"lastSlashIndex",
"=",
"sourceInternalName",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"targetInternalName",
".",
"append",
"(",
"sourceInternalName",
".",
"substring",
"(",
"lastSlashIndex",
")",
")",
";",
"return",
"targetInternalName",
".",
"toString",
"(",
")",
";",
"}"
] | Get the class internal name that should be used where moving the internal
class across packages.
@param sourceInternalName the internal name of the template class
@param targetPackage the package to move the class to
@return the target class name | [
"Get",
"the",
"class",
"internal",
"name",
"that",
"should",
"be",
"used",
"where",
"moving",
"the",
"internal",
"class",
"across",
"packages",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/MonitoringProxyActivator.java#L335-L343 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/MonitoringProxyActivator.java | MonitoringProxyActivator.activateProbeProxyTarget | void activateProbeProxyTarget() throws Exception {
Method method = ReflectionHelper.getDeclaredMethod(
probeManagerImpl.getClass(),
ProbeMethodAdapter.FIRE_PROBE_METHOD_NAME,
long.class, Object.class, Object.class, Object.class);
ReflectionHelper.setAccessible(method, true);
if (!Type.getMethodDescriptor(method).equals(ProbeMethodAdapter.FIRE_PROBE_METHOD_DESC)) {
throw new IncompatibleClassChangeError("Proxy method signature does not match byte code");
}
findProbeProxySetFireProbeTargetMethod().invoke(null, probeManagerImpl, method);
} | java | void activateProbeProxyTarget() throws Exception {
Method method = ReflectionHelper.getDeclaredMethod(
probeManagerImpl.getClass(),
ProbeMethodAdapter.FIRE_PROBE_METHOD_NAME,
long.class, Object.class, Object.class, Object.class);
ReflectionHelper.setAccessible(method, true);
if (!Type.getMethodDescriptor(method).equals(ProbeMethodAdapter.FIRE_PROBE_METHOD_DESC)) {
throw new IncompatibleClassChangeError("Proxy method signature does not match byte code");
}
findProbeProxySetFireProbeTargetMethod().invoke(null, probeManagerImpl, method);
} | [
"void",
"activateProbeProxyTarget",
"(",
")",
"throws",
"Exception",
"{",
"Method",
"method",
"=",
"ReflectionHelper",
".",
"getDeclaredMethod",
"(",
"probeManagerImpl",
".",
"getClass",
"(",
")",
",",
"ProbeMethodAdapter",
".",
"FIRE_PROBE_METHOD_NAME",
",",
"long",
".",
"class",
",",
"Object",
".",
"class",
",",
"Object",
".",
"class",
",",
"Object",
".",
"class",
")",
";",
"ReflectionHelper",
".",
"setAccessible",
"(",
"method",
",",
"true",
")",
";",
"if",
"(",
"!",
"Type",
".",
"getMethodDescriptor",
"(",
"method",
")",
".",
"equals",
"(",
"ProbeMethodAdapter",
".",
"FIRE_PROBE_METHOD_DESC",
")",
")",
"{",
"throw",
"new",
"IncompatibleClassChangeError",
"(",
"\"Proxy method signature does not match byte code\"",
")",
";",
"}",
"findProbeProxySetFireProbeTargetMethod",
"(",
")",
".",
"invoke",
"(",
"null",
",",
"probeManagerImpl",
",",
"method",
")",
";",
"}"
] | Hook up the monitoring boot proxy delegate.
@throws Exception the method invocation exception | [
"Hook",
"up",
"the",
"monitoring",
"boot",
"proxy",
"delegate",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/MonitoringProxyActivator.java#L394-L404 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/webapp/WebAppConfiguration.java | WebAppConfiguration.setWebApp | @Override
public void setWebApp(com.ibm.ws.webcontainer.webapp.WebApp webApp)
{
super.setWebApp((WebApp)webApp);
} | java | @Override
public void setWebApp(com.ibm.ws.webcontainer.webapp.WebApp webApp)
{
super.setWebApp((WebApp)webApp);
} | [
"@",
"Override",
"public",
"void",
"setWebApp",
"(",
"com",
".",
"ibm",
".",
"ws",
".",
"webcontainer",
".",
"webapp",
".",
"WebApp",
"webApp",
")",
"{",
"super",
".",
"setWebApp",
"(",
"(",
"WebApp",
")",
"webApp",
")",
";",
"}"
] | Override to ensure all WebApp are osgi.WebApp. | [
"Override",
"to",
"ensure",
"all",
"WebApp",
"are",
"osgi",
".",
"WebApp",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/webapp/WebAppConfiguration.java#L62-L66 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/validator/_ExternalSpecifications.java | _ExternalSpecifications.isBeanValidationAvailable | public static boolean isBeanValidationAvailable()
{
if (beanValidationAvailable == null)
{
try
{
try
{
beanValidationAvailable = (Class.forName("javax.validation.Validation") != null);
}
catch(ClassNotFoundException e)
{
beanValidationAvailable = Boolean.FALSE;
}
if (beanValidationAvailable)
{
try
{
// Trial-error approach to check for Bean Validation impl existence.
// If any Exception occurs here, we assume that Bean Validation is not available.
// The cause may be anything, i.e. NoClassDef, config error...
_ValidationUtils.tryBuildDefaultValidatorFactory();
}
catch (Throwable t)
{
log.log(Level.FINE, "Error initializing Bean Validation (could be normal)", t);
beanValidationAvailable = false;
}
}
}
catch (Throwable t)
{
log.log(Level.FINE, "Error loading class (could be normal)", t);
beanValidationAvailable = false;
}
//log.info("MyFaces Bean Validation support " + (beanValidationAvailable ? "enabled" : "disabled"));
}
return beanValidationAvailable;
} | java | public static boolean isBeanValidationAvailable()
{
if (beanValidationAvailable == null)
{
try
{
try
{
beanValidationAvailable = (Class.forName("javax.validation.Validation") != null);
}
catch(ClassNotFoundException e)
{
beanValidationAvailable = Boolean.FALSE;
}
if (beanValidationAvailable)
{
try
{
// Trial-error approach to check for Bean Validation impl existence.
// If any Exception occurs here, we assume that Bean Validation is not available.
// The cause may be anything, i.e. NoClassDef, config error...
_ValidationUtils.tryBuildDefaultValidatorFactory();
}
catch (Throwable t)
{
log.log(Level.FINE, "Error initializing Bean Validation (could be normal)", t);
beanValidationAvailable = false;
}
}
}
catch (Throwable t)
{
log.log(Level.FINE, "Error loading class (could be normal)", t);
beanValidationAvailable = false;
}
//log.info("MyFaces Bean Validation support " + (beanValidationAvailable ? "enabled" : "disabled"));
}
return beanValidationAvailable;
} | [
"public",
"static",
"boolean",
"isBeanValidationAvailable",
"(",
")",
"{",
"if",
"(",
"beanValidationAvailable",
"==",
"null",
")",
"{",
"try",
"{",
"try",
"{",
"beanValidationAvailable",
"=",
"(",
"Class",
".",
"forName",
"(",
"\"javax.validation.Validation\"",
")",
"!=",
"null",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"beanValidationAvailable",
"=",
"Boolean",
".",
"FALSE",
";",
"}",
"if",
"(",
"beanValidationAvailable",
")",
"{",
"try",
"{",
"// Trial-error approach to check for Bean Validation impl existence.",
"// If any Exception occurs here, we assume that Bean Validation is not available.",
"// The cause may be anything, i.e. NoClassDef, config error...",
"_ValidationUtils",
".",
"tryBuildDefaultValidatorFactory",
"(",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"log",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"Error initializing Bean Validation (could be normal)\"",
",",
"t",
")",
";",
"beanValidationAvailable",
"=",
"false",
";",
"}",
"}",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"log",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"Error loading class (could be normal)\"",
",",
"t",
")",
";",
"beanValidationAvailable",
"=",
"false",
";",
"}",
"//log.info(\"MyFaces Bean Validation support \" + (beanValidationAvailable ? \"enabled\" : \"disabled\"));",
"}",
"return",
"beanValidationAvailable",
";",
"}"
] | This method determines if Bean Validation is present.
Eager initialization is used for performance. This means Bean Validation binaries
should not be added at runtime after this variable has been set.
@return true if Bean Validation is available, false otherwise. | [
"This",
"method",
"determines",
"if",
"Bean",
"Validation",
"is",
"present",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/validator/_ExternalSpecifications.java#L50-L90 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/NeighbourProxyListener.java | NeighbourProxyListener.handleRollback | void handleRollback(SubscriptionMessage subMessage,
LocalTransaction transaction)
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "handleRollback", new Object[] { subMessage, transaction });
try
{
if (transaction != null)
{
try
{
transaction.rollback();
}
catch (SIException e)
{
// If there are any exceptions, then this is bad, log a FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.proxyhandler.NeighbourProxyListener.handleRollback",
"1:330:1.73",
this);
SibTr.exception(tc, e);
}
}
Transaction msTran = iProxyHandler.getMessageProcessor().resolveAndEnlistMsgStoreTransaction(transaction);
switch (subMessage.getSubscriptionMessageType().toInt())
{
case SubscriptionMessageType.CREATE_INT :
// Remove any created Proxy subscriptions
iProxyHandler.remoteUnsubscribeEvent(iAddTopicSpaces,
iAddTopics,
subMessage.getBus(),
msTran,
false);
break;
case SubscriptionMessageType.DELETE_INT :
// Create any removed Proxy subscriptions
iProxyHandler.remoteSubscribeEvent(iDeleteTopicSpaces,
iDeleteTopics,
subMessage.getBus(),
msTran,
false);
break;
case SubscriptionMessageType.RESET_INT :
// Remove any created Proxy subscriptions
iProxyHandler.remoteUnsubscribeEvent(iAddTopicSpaces,
iAddTopics,
subMessage.getBus(),
msTran,
false);
// Create any removed Proxy subscriptions
iProxyHandler.remoteSubscribeEvent(iDeleteTopicSpaces,
iDeleteTopics,
subMessage.getBus(),
msTran,
false);
break;
default :
// Log Message
break;
}
}
catch (SIException e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.proxyhandler.NeighbourProxyListener.handleRollback",
"1:392:1.73",
this);
}
if (tc.isEntryEnabled())
SibTr.exit(tc, "handleRollback");
} | java | void handleRollback(SubscriptionMessage subMessage,
LocalTransaction transaction)
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "handleRollback", new Object[] { subMessage, transaction });
try
{
if (transaction != null)
{
try
{
transaction.rollback();
}
catch (SIException e)
{
// If there are any exceptions, then this is bad, log a FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.proxyhandler.NeighbourProxyListener.handleRollback",
"1:330:1.73",
this);
SibTr.exception(tc, e);
}
}
Transaction msTran = iProxyHandler.getMessageProcessor().resolveAndEnlistMsgStoreTransaction(transaction);
switch (subMessage.getSubscriptionMessageType().toInt())
{
case SubscriptionMessageType.CREATE_INT :
// Remove any created Proxy subscriptions
iProxyHandler.remoteUnsubscribeEvent(iAddTopicSpaces,
iAddTopics,
subMessage.getBus(),
msTran,
false);
break;
case SubscriptionMessageType.DELETE_INT :
// Create any removed Proxy subscriptions
iProxyHandler.remoteSubscribeEvent(iDeleteTopicSpaces,
iDeleteTopics,
subMessage.getBus(),
msTran,
false);
break;
case SubscriptionMessageType.RESET_INT :
// Remove any created Proxy subscriptions
iProxyHandler.remoteUnsubscribeEvent(iAddTopicSpaces,
iAddTopics,
subMessage.getBus(),
msTran,
false);
// Create any removed Proxy subscriptions
iProxyHandler.remoteSubscribeEvent(iDeleteTopicSpaces,
iDeleteTopics,
subMessage.getBus(),
msTran,
false);
break;
default :
// Log Message
break;
}
}
catch (SIException e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.proxyhandler.NeighbourProxyListener.handleRollback",
"1:392:1.73",
this);
}
if (tc.isEntryEnabled())
SibTr.exit(tc, "handleRollback");
} | [
"void",
"handleRollback",
"(",
"SubscriptionMessage",
"subMessage",
",",
"LocalTransaction",
"transaction",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"handleRollback\"",
",",
"new",
"Object",
"[",
"]",
"{",
"subMessage",
",",
"transaction",
"}",
")",
";",
"try",
"{",
"if",
"(",
"transaction",
"!=",
"null",
")",
"{",
"try",
"{",
"transaction",
".",
"rollback",
"(",
")",
";",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"// If there are any exceptions, then this is bad, log a FFDC",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.processor.proxyhandler.NeighbourProxyListener.handleRollback\"",
",",
"\"1:330:1.73\"",
",",
"this",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"}",
"}",
"Transaction",
"msTran",
"=",
"iProxyHandler",
".",
"getMessageProcessor",
"(",
")",
".",
"resolveAndEnlistMsgStoreTransaction",
"(",
"transaction",
")",
";",
"switch",
"(",
"subMessage",
".",
"getSubscriptionMessageType",
"(",
")",
".",
"toInt",
"(",
")",
")",
"{",
"case",
"SubscriptionMessageType",
".",
"CREATE_INT",
":",
"// Remove any created Proxy subscriptions",
"iProxyHandler",
".",
"remoteUnsubscribeEvent",
"(",
"iAddTopicSpaces",
",",
"iAddTopics",
",",
"subMessage",
".",
"getBus",
"(",
")",
",",
"msTran",
",",
"false",
")",
";",
"break",
";",
"case",
"SubscriptionMessageType",
".",
"DELETE_INT",
":",
"// Create any removed Proxy subscriptions",
"iProxyHandler",
".",
"remoteSubscribeEvent",
"(",
"iDeleteTopicSpaces",
",",
"iDeleteTopics",
",",
"subMessage",
".",
"getBus",
"(",
")",
",",
"msTran",
",",
"false",
")",
";",
"break",
";",
"case",
"SubscriptionMessageType",
".",
"RESET_INT",
":",
"// Remove any created Proxy subscriptions",
"iProxyHandler",
".",
"remoteUnsubscribeEvent",
"(",
"iAddTopicSpaces",
",",
"iAddTopics",
",",
"subMessage",
".",
"getBus",
"(",
")",
",",
"msTran",
",",
"false",
")",
";",
"// Create any removed Proxy subscriptions",
"iProxyHandler",
".",
"remoteSubscribeEvent",
"(",
"iDeleteTopicSpaces",
",",
"iDeleteTopics",
",",
"subMessage",
".",
"getBus",
"(",
")",
",",
"msTran",
",",
"false",
")",
";",
"break",
";",
"default",
":",
"// Log Message",
"break",
";",
"}",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"// FFDC",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.processor.proxyhandler.NeighbourProxyListener.handleRollback\"",
",",
"\"1:392:1.73\"",
",",
"this",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"handleRollback\"",
")",
";",
"}"
] | Rolls back and readds the proxy subscriptions that may have been removed.
@param subMessage | [
"Rolls",
"back",
"and",
"readds",
"the",
"proxy",
"subscriptions",
"that",
"may",
"have",
"been",
"removed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/NeighbourProxyListener.java#L290-L378 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/NeighbourProxyListener.java | NeighbourProxyListener.handleDeleteProxySubscription | void handleDeleteProxySubscription(SubscriptionMessage deleteMessage,
Transaction transaction) throws SIResourceException
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "handleDeleteProxySubscription",
new Object[] { deleteMessage, transaction });
// Get the iterators that we require for this method
final Iterator topics = deleteMessage.getTopics().iterator();
final Iterator topicSpaces = deleteMessage.getTopicSpaces().iterator();
final Iterator topicSpaceMappings = deleteMessage.getTopicSpaceMappings().iterator();
// Get the Me name and ME uuid
final byte[] meUUIDArr = deleteMessage.getMEUUID();
final SIBUuid8 meUUID = new SIBUuid8(meUUIDArr);
// Get the bus that this message arrived from
final String busId = deleteMessage.getBusName();
//now we have the relevant information we
//can delete the proxy subscription
deleteProxySubscription(topics,
topicSpaces, topicSpaceMappings, meUUID, busId, transaction);
if (tc.isEntryEnabled())
SibTr.exit(tc, "handleDeleteProxySubscription");
} | java | void handleDeleteProxySubscription(SubscriptionMessage deleteMessage,
Transaction transaction) throws SIResourceException
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "handleDeleteProxySubscription",
new Object[] { deleteMessage, transaction });
// Get the iterators that we require for this method
final Iterator topics = deleteMessage.getTopics().iterator();
final Iterator topicSpaces = deleteMessage.getTopicSpaces().iterator();
final Iterator topicSpaceMappings = deleteMessage.getTopicSpaceMappings().iterator();
// Get the Me name and ME uuid
final byte[] meUUIDArr = deleteMessage.getMEUUID();
final SIBUuid8 meUUID = new SIBUuid8(meUUIDArr);
// Get the bus that this message arrived from
final String busId = deleteMessage.getBusName();
//now we have the relevant information we
//can delete the proxy subscription
deleteProxySubscription(topics,
topicSpaces, topicSpaceMappings, meUUID, busId, transaction);
if (tc.isEntryEnabled())
SibTr.exit(tc, "handleDeleteProxySubscription");
} | [
"void",
"handleDeleteProxySubscription",
"(",
"SubscriptionMessage",
"deleteMessage",
",",
"Transaction",
"transaction",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"handleDeleteProxySubscription\"",
",",
"new",
"Object",
"[",
"]",
"{",
"deleteMessage",
",",
"transaction",
"}",
")",
";",
"// Get the iterators that we require for this method",
"final",
"Iterator",
"topics",
"=",
"deleteMessage",
".",
"getTopics",
"(",
")",
".",
"iterator",
"(",
")",
";",
"final",
"Iterator",
"topicSpaces",
"=",
"deleteMessage",
".",
"getTopicSpaces",
"(",
")",
".",
"iterator",
"(",
")",
";",
"final",
"Iterator",
"topicSpaceMappings",
"=",
"deleteMessage",
".",
"getTopicSpaceMappings",
"(",
")",
".",
"iterator",
"(",
")",
";",
"// Get the Me name and ME uuid",
"final",
"byte",
"[",
"]",
"meUUIDArr",
"=",
"deleteMessage",
".",
"getMEUUID",
"(",
")",
";",
"final",
"SIBUuid8",
"meUUID",
"=",
"new",
"SIBUuid8",
"(",
"meUUIDArr",
")",
";",
"// Get the bus that this message arrived from",
"final",
"String",
"busId",
"=",
"deleteMessage",
".",
"getBusName",
"(",
")",
";",
"//now we have the relevant information we ",
"//can delete the proxy subscription",
"deleteProxySubscription",
"(",
"topics",
",",
"topicSpaces",
",",
"topicSpaceMappings",
",",
"meUUID",
",",
"busId",
",",
"transaction",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"handleDeleteProxySubscription\"",
")",
";",
"}"
] | Used to remove a proxy subscription on this Neighbour
There can be more than one Subscription to be removed in this
message so the list of topics needs to be iterated through.
The message can also be empty indicating that this Neighbour
can now be removed.
@param deleteMessage This is the message containing the delete
information.
@param transaction The transaction to do the delete under | [
"Used",
"to",
"remove",
"a",
"proxy",
"subscription",
"on",
"this",
"Neighbour"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/NeighbourProxyListener.java#L665-L690 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java | WSRdbManagedConnectionImpl.setKerberosConnection | public void setKerberosConnection() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "setting this mc to indicate it was gotten using kerberos");
kerberosConnection = true;
} | java | public void setKerberosConnection() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "setting this mc to indicate it was gotten using kerberos");
kerberosConnection = true;
} | [
"public",
"void",
"setKerberosConnection",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"setting this mc to indicate it was gotten using kerberos\"",
")",
";",
"kerberosConnection",
"=",
"true",
";",
"}"
] | new code RRS | [
"new",
"code",
"RRS"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L185-L190 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java | WSRdbManagedConnectionImpl.markStale | public void markStale() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "mark mc stale");
_mcStale = true;
} | java | public void markStale() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "mark mc stale");
_mcStale = true;
} | [
"public",
"void",
"markStale",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"mark mc stale\"",
")",
";",
"_mcStale",
"=",
"true",
";",
"}"
] | Marks the managed connection as stale. | [
"Marks",
"the",
"managed",
"connection",
"as",
"stale",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L210-L214 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java | WSRdbManagedConnectionImpl.addHandle | private final void addHandle(WSJdbcConnection handle) throws ResourceException {
(numHandlesInUse < handlesInUse.length - 1 ? handlesInUse : resizeHandleList())[numHandlesInUse++] = handle;
if (!inRequest && dsConfig.get().enableBeginEndRequest)
try {
inRequest = true;
mcf.jdbcRuntime.beginRequest(sqlConn);
} catch (SQLException x) {
FFDCFilter.processException(x, getClass().getName(), "548", this);
throw new DataStoreAdapterException("DSA_ERROR", x, getClass());
}
} | java | private final void addHandle(WSJdbcConnection handle) throws ResourceException {
(numHandlesInUse < handlesInUse.length - 1 ? handlesInUse : resizeHandleList())[numHandlesInUse++] = handle;
if (!inRequest && dsConfig.get().enableBeginEndRequest)
try {
inRequest = true;
mcf.jdbcRuntime.beginRequest(sqlConn);
} catch (SQLException x) {
FFDCFilter.processException(x, getClass().getName(), "548", this);
throw new DataStoreAdapterException("DSA_ERROR", x, getClass());
}
} | [
"private",
"final",
"void",
"addHandle",
"(",
"WSJdbcConnection",
"handle",
")",
"throws",
"ResourceException",
"{",
"(",
"numHandlesInUse",
"<",
"handlesInUse",
".",
"length",
"-",
"1",
"?",
"handlesInUse",
":",
"resizeHandleList",
"(",
")",
")",
"[",
"numHandlesInUse",
"++",
"]",
"=",
"handle",
";",
"if",
"(",
"!",
"inRequest",
"&&",
"dsConfig",
".",
"get",
"(",
")",
".",
"enableBeginEndRequest",
")",
"try",
"{",
"inRequest",
"=",
"true",
";",
"mcf",
".",
"jdbcRuntime",
".",
"beginRequest",
"(",
"sqlConn",
")",
";",
"}",
"catch",
"(",
"SQLException",
"x",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"x",
",",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"\"548\"",
",",
"this",
")",
";",
"throw",
"new",
"DataStoreAdapterException",
"(",
"\"DSA_ERROR\"",
",",
"x",
",",
"getClass",
"(",
")",
")",
";",
"}",
"}"
] | Add a handle to this ManagedConnection's list of handles.
Signal the JDBC 4.3+ driver that a request is starting.
@param handle the handle to add.
@throws ResourceException if a JDBC 4.3+ driver rejects the beginRequest operation | [
"Add",
"a",
"handle",
"to",
"this",
"ManagedConnection",
"s",
"list",
"of",
"handles",
".",
"Signal",
"the",
"JDBC",
"4",
".",
"3",
"+",
"driver",
"that",
"a",
"request",
"is",
"starting",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L547-L557 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java | WSRdbManagedConnectionImpl.connectionClosed | public void connectionClosed(javax.sql.ConnectionEvent event) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
Tr.event(this, tc, "connectionClosed", "Notification of connection closed received from the JDBC driver", AdapterUtil.toString(event.getSource()));
// We have intentionally removed our connection event listener prior to closing the
// underlying connection. Therefore, if this event ever occurs, it indicates a
// scenario where the connection has been closed unexpectedly by the JDBC driver
// or database. We will treat this as a connection error.
if(isAborted()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "The connection was aborted, so this event will not be processed");
} else {
processConnectionErrorOccurredEvent(null, event.getSQLException());
}
} | java | public void connectionClosed(javax.sql.ConnectionEvent event) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
Tr.event(this, tc, "connectionClosed", "Notification of connection closed received from the JDBC driver", AdapterUtil.toString(event.getSource()));
// We have intentionally removed our connection event listener prior to closing the
// underlying connection. Therefore, if this event ever occurs, it indicates a
// scenario where the connection has been closed unexpectedly by the JDBC driver
// or database. We will treat this as a connection error.
if(isAborted()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "The connection was aborted, so this event will not be processed");
} else {
processConnectionErrorOccurredEvent(null, event.getSQLException());
}
} | [
"public",
"void",
"connectionClosed",
"(",
"javax",
".",
"sql",
".",
"ConnectionEvent",
"event",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"Tr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"connectionClosed\"",
",",
"\"Notification of connection closed received from the JDBC driver\"",
",",
"AdapterUtil",
".",
"toString",
"(",
"event",
".",
"getSource",
"(",
")",
")",
")",
";",
"// We have intentionally removed our connection event listener prior to closing the",
"// underlying connection. Therefore, if this event ever occurs, it indicates a",
"// scenario where the connection has been closed unexpectedly by the JDBC driver",
"// or database. We will treat this as a connection error.",
"if",
"(",
"isAborted",
"(",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"The connection was aborted, so this event will not be processed\"",
")",
";",
"}",
"else",
"{",
"processConnectionErrorOccurredEvent",
"(",
"null",
",",
"event",
".",
"getSQLException",
"(",
")",
")",
";",
"}",
"}"
] | Invoked by the JDBC driver when the java.sql.Connection is closed.
@param event a data structure containing information about the event. | [
"Invoked",
"by",
"the",
"JDBC",
"driver",
"when",
"the",
"java",
".",
"sql",
".",
"Connection",
"is",
"closed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L577-L591 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java | WSRdbManagedConnectionImpl.destroyStatement | private void destroyStatement(Object unwantedStatement) {
try {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc,
"Statement cache at capacity. Discarding a statement.",
AdapterUtil.toString(unwantedStatement));
((Statement) unwantedStatement).close();
} catch (SQLException closeX) {
FFDCFilter.processException(
closeX, getClass().getName() + ".discardStatement", "511", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Error closing statement", AdapterUtil.toString(unwantedStatement), closeX);
}
} | java | private void destroyStatement(Object unwantedStatement) {
try {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc,
"Statement cache at capacity. Discarding a statement.",
AdapterUtil.toString(unwantedStatement));
((Statement) unwantedStatement).close();
} catch (SQLException closeX) {
FFDCFilter.processException(
closeX, getClass().getName() + ".discardStatement", "511", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Error closing statement", AdapterUtil.toString(unwantedStatement), closeX);
}
} | [
"private",
"void",
"destroyStatement",
"(",
"Object",
"unwantedStatement",
")",
"{",
"try",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Statement cache at capacity. Discarding a statement.\"",
",",
"AdapterUtil",
".",
"toString",
"(",
"unwantedStatement",
")",
")",
";",
"(",
"(",
"Statement",
")",
"unwantedStatement",
")",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"SQLException",
"closeX",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"closeX",
",",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\".discardStatement\"",
",",
"\"511\"",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Error closing statement\"",
",",
"AdapterUtil",
".",
"toString",
"(",
"unwantedStatement",
")",
",",
"closeX",
")",
";",
"}",
"}"
] | Destroy an unwanted statement. This method should close the statement.
@param unwantedStatement a statement we don't want in the cache anymore. | [
"Destroy",
"an",
"unwanted",
"statement",
".",
"This",
"method",
"should",
"close",
"the",
"statement",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L682-L697 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java | WSRdbManagedConnectionImpl.detectMultithreadedAccess | final void detectMultithreadedAccess() {
Thread currentThreadID = Thread.currentThread();
if (currentThreadID == threadID)
return;
if (threadID == null)
threadID = currentThreadID;
else {
mcf.detectedMultithreadedAccess = true;
java.io.StringWriter writer = new java.io.StringWriter();
new Error().printStackTrace(new java.io.PrintWriter(writer));
Tr.warning(tc, "MULTITHREADED_ACCESS_DETECTED",
this,
Integer.toHexString(threadID.hashCode()) + ' ' + threadID,
Integer.toHexString(currentThreadID.hashCode()) + ' ' + currentThreadID,
writer.getBuffer().delete(0, "java.lang.Error".length())
);
}
} | java | final void detectMultithreadedAccess() {
Thread currentThreadID = Thread.currentThread();
if (currentThreadID == threadID)
return;
if (threadID == null)
threadID = currentThreadID;
else {
mcf.detectedMultithreadedAccess = true;
java.io.StringWriter writer = new java.io.StringWriter();
new Error().printStackTrace(new java.io.PrintWriter(writer));
Tr.warning(tc, "MULTITHREADED_ACCESS_DETECTED",
this,
Integer.toHexString(threadID.hashCode()) + ' ' + threadID,
Integer.toHexString(currentThreadID.hashCode()) + ' ' + currentThreadID,
writer.getBuffer().delete(0, "java.lang.Error".length())
);
}
} | [
"final",
"void",
"detectMultithreadedAccess",
"(",
")",
"{",
"Thread",
"currentThreadID",
"=",
"Thread",
".",
"currentThread",
"(",
")",
";",
"if",
"(",
"currentThreadID",
"==",
"threadID",
")",
"return",
";",
"if",
"(",
"threadID",
"==",
"null",
")",
"threadID",
"=",
"currentThreadID",
";",
"else",
"{",
"mcf",
".",
"detectedMultithreadedAccess",
"=",
"true",
";",
"java",
".",
"io",
".",
"StringWriter",
"writer",
"=",
"new",
"java",
".",
"io",
".",
"StringWriter",
"(",
")",
";",
"new",
"Error",
"(",
")",
".",
"printStackTrace",
"(",
"new",
"java",
".",
"io",
".",
"PrintWriter",
"(",
"writer",
")",
")",
";",
"Tr",
".",
"warning",
"(",
"tc",
",",
"\"MULTITHREADED_ACCESS_DETECTED\"",
",",
"this",
",",
"Integer",
".",
"toHexString",
"(",
"threadID",
".",
"hashCode",
"(",
")",
")",
"+",
"'",
"'",
"+",
"threadID",
",",
"Integer",
".",
"toHexString",
"(",
"currentThreadID",
".",
"hashCode",
"(",
")",
")",
"+",
"'",
"'",
"+",
"currentThreadID",
",",
"writer",
".",
"getBuffer",
"(",
")",
".",
"delete",
"(",
"0",
",",
"\"java.lang.Error\"",
".",
"length",
"(",
")",
")",
")",
";",
"}",
"}"
] | Detect multithreaded access. This method is called only if detection is enabled.
The method ensures that the current thread id matches the saved thread id for this MC.
If the MC was just taken out the pool, the thread id may not have been recorded yet.
In this case, we save the current thread id. Otherwise, if the thread ids don't match,
log a message indicating that multithreaded access was detected. | [
"Detect",
"multithreaded",
"access",
".",
"This",
"method",
"is",
"called",
"only",
"if",
"detection",
"is",
"enabled",
".",
"The",
"method",
"ensures",
"that",
"the",
"current",
"thread",
"id",
"matches",
"the",
"saved",
"thread",
"id",
"for",
"this",
"MC",
".",
"If",
"the",
"MC",
"was",
"just",
"taken",
"out",
"the",
"pool",
"the",
"thread",
"id",
"may",
"not",
"have",
"been",
"recorded",
"yet",
".",
"In",
"this",
"case",
"we",
"save",
"the",
"current",
"thread",
"id",
".",
"Otherwise",
"if",
"the",
"thread",
"ids",
"don",
"t",
"match",
"log",
"a",
"message",
"indicating",
"that",
"multithreaded",
"access",
"was",
"detected",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L706-L727 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java | WSRdbManagedConnectionImpl.dissociateConnections | public void dissociateConnections() throws ResourceException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(this, tc, "dissociateConnections");
// The first exception to occur while dissociating connection handles.
ResourceException firstX = null;
// Indicate that we are cleaning up handles, so we know not to send events for
// operations done in the cleanup.
cleaningUpHandles = true;
for (int i = numHandlesInUse; i > 0;)
try
{
handlesInUse[--i].dissociate();
handlesInUse[i] = null;
} catch (ResourceException dissociationX) {
// No FFDC code needed because the following method does any FFDC that might
// be necessary.
dissociationX = processHandleDissociationError(i, dissociationX);
if (firstX == null)
firstX = dissociationX;
}
numHandlesInUse = 0;
cleaningUpHandles = false;
// - need to dissociate the cachedConnection too
// - we can't dissocate the cachedConnection because DB2 has direct access to our WSJccConnection
// and the preparedStatement wrapper. They can't follow the normal jdbc model because the sqlj engine
// was written by Oracle. Therefore, we put the restriction that the BMP must run in a unshareable mode
// it caches the handle. In this case, we never need to dissociate the cached handle.
/*
* try
* if (cachedConnection != null)
* ((Reassociateable)cachedConnection).dissociate();
* }catch (ResourceException dissociationX2)
* // No FFDC code needed because the following method does any FFDC that might
* // be necessary.
* dissociationX2 = processHandleDissociationError2((Reassociateable)cachedConnection, dissociationX2);
* if (firstX == null) firstX = dissociationX2;
*/
if (firstX != null) {
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "dissociateConnections", firstX);
throw firstX;
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "dissociateConnections");
} | java | public void dissociateConnections() throws ResourceException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(this, tc, "dissociateConnections");
// The first exception to occur while dissociating connection handles.
ResourceException firstX = null;
// Indicate that we are cleaning up handles, so we know not to send events for
// operations done in the cleanup.
cleaningUpHandles = true;
for (int i = numHandlesInUse; i > 0;)
try
{
handlesInUse[--i].dissociate();
handlesInUse[i] = null;
} catch (ResourceException dissociationX) {
// No FFDC code needed because the following method does any FFDC that might
// be necessary.
dissociationX = processHandleDissociationError(i, dissociationX);
if (firstX == null)
firstX = dissociationX;
}
numHandlesInUse = 0;
cleaningUpHandles = false;
// - need to dissociate the cachedConnection too
// - we can't dissocate the cachedConnection because DB2 has direct access to our WSJccConnection
// and the preparedStatement wrapper. They can't follow the normal jdbc model because the sqlj engine
// was written by Oracle. Therefore, we put the restriction that the BMP must run in a unshareable mode
// it caches the handle. In this case, we never need to dissociate the cached handle.
/*
* try
* if (cachedConnection != null)
* ((Reassociateable)cachedConnection).dissociate();
* }catch (ResourceException dissociationX2)
* // No FFDC code needed because the following method does any FFDC that might
* // be necessary.
* dissociationX2 = processHandleDissociationError2((Reassociateable)cachedConnection, dissociationX2);
* if (firstX == null) firstX = dissociationX2;
*/
if (firstX != null) {
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "dissociateConnections", firstX);
throw firstX;
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "dissociateConnections");
} | [
"public",
"void",
"dissociateConnections",
"(",
")",
"throws",
"ResourceException",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"dissociateConnections\"",
")",
";",
"// The first exception to occur while dissociating connection handles.",
"ResourceException",
"firstX",
"=",
"null",
";",
"// Indicate that we are cleaning up handles, so we know not to send events for",
"// operations done in the cleanup. ",
"cleaningUpHandles",
"=",
"true",
";",
"for",
"(",
"int",
"i",
"=",
"numHandlesInUse",
";",
"i",
">",
"0",
";",
")",
"try",
"{",
"handlesInUse",
"[",
"--",
"i",
"]",
".",
"dissociate",
"(",
")",
";",
"handlesInUse",
"[",
"i",
"]",
"=",
"null",
";",
"}",
"catch",
"(",
"ResourceException",
"dissociationX",
")",
"{",
"// No FFDC code needed because the following method does any FFDC that might",
"// be necessary.",
"dissociationX",
"=",
"processHandleDissociationError",
"(",
"i",
",",
"dissociationX",
")",
";",
"if",
"(",
"firstX",
"==",
"null",
")",
"firstX",
"=",
"dissociationX",
";",
"}",
"numHandlesInUse",
"=",
"0",
";",
"cleaningUpHandles",
"=",
"false",
";",
"// - need to dissociate the cachedConnection too",
"// - we can't dissocate the cachedConnection because DB2 has direct access to our WSJccConnection",
"// and the preparedStatement wrapper. They can't follow the normal jdbc model because the sqlj engine",
"// was written by Oracle. Therefore, we put the restriction that the BMP must run in a unshareable mode",
"// it caches the handle. In this case, we never need to dissociate the cached handle.",
"/*\n * try\n * if (cachedConnection != null)\n * ((Reassociateable)cachedConnection).dissociate();\n * }catch (ResourceException dissociationX2)\n * // No FFDC code needed because the following method does any FFDC that might\n * // be necessary.\n * dissociationX2 = processHandleDissociationError2((Reassociateable)cachedConnection, dissociationX2);\n * if (firstX == null) firstX = dissociationX2;\n */",
"if",
"(",
"firstX",
"!=",
"null",
")",
"{",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"dissociateConnections\"",
",",
"firstX",
")",
";",
"throw",
"firstX",
";",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"dissociateConnections\"",
")",
";",
"}"
] | Dissociate all connection handles from this ManagedConnection, transitioning the handles
to an inactive state where are not associated with any ManagedConnection. Processing
continues when errors occur. All errors are logged, and the first error is saved to be
thrown when processing completes.
@throws ResourceException the first error to occur while dissociating the handles. | [
"Dissociate",
"all",
"connection",
"handles",
"from",
"this",
"ManagedConnection",
"transitioning",
"the",
"handles",
"to",
"an",
"inactive",
"state",
"where",
"are",
"not",
"associated",
"with",
"any",
"ManagedConnection",
".",
"Processing",
"continues",
"when",
"errors",
"occur",
".",
"All",
"errors",
"are",
"logged",
"and",
"the",
"first",
"error",
"is",
"saved",
"to",
"be",
"thrown",
"when",
"processing",
"completes",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L737-L789 | train |
Subsets and Splits