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.repository.resolver/src/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverRepository.java | KernelResolverRepository.isApplicable | private boolean isApplicable(RepositoryResource resource) {
if (resource instanceof ApplicableToProduct) {
if (((ApplicableToProduct) resource).getAppliesTo() == null) {
return true; // No appliesTo -> applicable
}
}
return ((RepositoryResourceImpl) resource).doesResourceMatch(productDefinitions, null);
} | java | private boolean isApplicable(RepositoryResource resource) {
if (resource instanceof ApplicableToProduct) {
if (((ApplicableToProduct) resource).getAppliesTo() == null) {
return true; // No appliesTo -> applicable
}
}
return ((RepositoryResourceImpl) resource).doesResourceMatch(productDefinitions, null);
} | [
"private",
"boolean",
"isApplicable",
"(",
"RepositoryResource",
"resource",
")",
"{",
"if",
"(",
"resource",
"instanceof",
"ApplicableToProduct",
")",
"{",
"if",
"(",
"(",
"(",
"ApplicableToProduct",
")",
"resource",
")",
".",
"getAppliesTo",
"(",
")",
"==",
"null",
")",
"{",
"return",
"true",
";",
"// No appliesTo -> applicable",
"}",
"}",
"return",
"(",
"(",
"RepositoryResourceImpl",
")",
"resource",
")",
".",
"doesResourceMatch",
"(",
"productDefinitions",
",",
"null",
")",
";",
"}"
] | Return whether the given resource is applicable to the current product definitions.
@param resource the repository resource
@return {@code true} if the resource is applicable, otherwise {@code false} | [
"Return",
"whether",
"the",
"given",
"resource",
"is",
"applicable",
"to",
"the",
"current",
"product",
"definitions",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverRepository.java#L260-L267 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverRepository.java | KernelResolverRepository.getNonApplicableResourcesForName | public Collection<ApplicableToProduct> getNonApplicableResourcesForName(String resourceName) {
List<ApplicableToProduct> result = nameToNonApplicableResources.get(resourceName);
if (result == null) {
// We don't expect this to happen, if we're looking for non-applicable resources, it's because we failed to resolve it earlier
cacheFeaturesForName(resourceName);
result = nameToNonApplicableResources.get(resourceName);
}
if (result == null) {
// Still null, very odd
return Collections.emptySet();
}
return Collections.unmodifiableList(result);
} | java | public Collection<ApplicableToProduct> getNonApplicableResourcesForName(String resourceName) {
List<ApplicableToProduct> result = nameToNonApplicableResources.get(resourceName);
if (result == null) {
// We don't expect this to happen, if we're looking for non-applicable resources, it's because we failed to resolve it earlier
cacheFeaturesForName(resourceName);
result = nameToNonApplicableResources.get(resourceName);
}
if (result == null) {
// Still null, very odd
return Collections.emptySet();
}
return Collections.unmodifiableList(result);
} | [
"public",
"Collection",
"<",
"ApplicableToProduct",
">",
"getNonApplicableResourcesForName",
"(",
"String",
"resourceName",
")",
"{",
"List",
"<",
"ApplicableToProduct",
">",
"result",
"=",
"nameToNonApplicableResources",
".",
"get",
"(",
"resourceName",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"// We don't expect this to happen, if we're looking for non-applicable resources, it's because we failed to resolve it earlier",
"cacheFeaturesForName",
"(",
"resourceName",
")",
";",
"result",
"=",
"nameToNonApplicableResources",
".",
"get",
"(",
"resourceName",
")",
";",
"}",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"// Still null, very odd",
"return",
"Collections",
".",
"emptySet",
"(",
")",
";",
"}",
"return",
"Collections",
".",
"unmodifiableList",
"(",
"result",
")",
";",
"}"
] | Return all features and samples in the repository with the given name which don't apply to the installed products
@param resourceName a short or symbolic name
@return the features and samples which don't apply to the installed products | [
"Return",
"all",
"features",
"and",
"samples",
"in",
"the",
"repository",
"with",
"the",
"given",
"name",
"which",
"don",
"t",
"apply",
"to",
"the",
"installed",
"products"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverRepository.java#L275-L290 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcObject.java | WSJdbcObject.close | protected void close(boolean closeWrapperOnly) throws SQLException
{
TraceComponent tc = getTracer();
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(this, tc, "close");
// Make sure we only get closed once.
if (state == State.CLOSED) // already closed, just return
{
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "close", "Already closed");
return;
}
state = State.CLOSED;
if (isTraceOn && tc.isEventEnabled())
Tr.event(this, tc, "state --> " + state.name());
// Close all children. Then close the current wrapper, saving the first exception
// encountered. Others are logged.
closeChildWrappers();
SQLException sqlX = freeResourcesOnClose ? closeResources() : null;
SQLException sqlX2 = closeWrapper(closeWrapperOnly);
sqlX = sqlX == null ? sqlX2 : sqlX;
// When JDBC event listeners are enabled, the connection error notification is sent
// prior to raising the error, which means close is invoked prior to mapException.
// The reference to the parent wrapper must be kept so that exception mapping can
// still be performed.
childWrappers = null;
ifcToDynamicWrapper.clear();
dynamicWrapperToImpl.clear();
if (sqlX != null) {
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "close", sqlX);
throw sqlX;
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "close");
} | java | protected void close(boolean closeWrapperOnly) throws SQLException
{
TraceComponent tc = getTracer();
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(this, tc, "close");
// Make sure we only get closed once.
if (state == State.CLOSED) // already closed, just return
{
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "close", "Already closed");
return;
}
state = State.CLOSED;
if (isTraceOn && tc.isEventEnabled())
Tr.event(this, tc, "state --> " + state.name());
// Close all children. Then close the current wrapper, saving the first exception
// encountered. Others are logged.
closeChildWrappers();
SQLException sqlX = freeResourcesOnClose ? closeResources() : null;
SQLException sqlX2 = closeWrapper(closeWrapperOnly);
sqlX = sqlX == null ? sqlX2 : sqlX;
// When JDBC event listeners are enabled, the connection error notification is sent
// prior to raising the error, which means close is invoked prior to mapException.
// The reference to the parent wrapper must be kept so that exception mapping can
// still be performed.
childWrappers = null;
ifcToDynamicWrapper.clear();
dynamicWrapperToImpl.clear();
if (sqlX != null) {
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "close", sqlX);
throw sqlX;
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "close");
} | [
"protected",
"void",
"close",
"(",
"boolean",
"closeWrapperOnly",
")",
"throws",
"SQLException",
"{",
"TraceComponent",
"tc",
"=",
"getTracer",
"(",
")",
";",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"close\"",
")",
";",
"// Make sure we only get closed once.",
"if",
"(",
"state",
"==",
"State",
".",
"CLOSED",
")",
"// already closed, just return",
"{",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"close\"",
",",
"\"Already closed\"",
")",
";",
"return",
";",
"}",
"state",
"=",
"State",
".",
"CLOSED",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"Tr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"state --> \"",
"+",
"state",
".",
"name",
"(",
")",
")",
";",
"// Close all children. Then close the current wrapper, saving the first exception",
"// encountered. Others are logged.",
"closeChildWrappers",
"(",
")",
";",
"SQLException",
"sqlX",
"=",
"freeResourcesOnClose",
"?",
"closeResources",
"(",
")",
":",
"null",
";",
"SQLException",
"sqlX2",
"=",
"closeWrapper",
"(",
"closeWrapperOnly",
")",
";",
"sqlX",
"=",
"sqlX",
"==",
"null",
"?",
"sqlX2",
":",
"sqlX",
";",
"// When JDBC event listeners are enabled, the connection error notification is sent",
"// prior to raising the error, which means close is invoked prior to mapException.",
"// The reference to the parent wrapper must be kept so that exception mapping can",
"// still be performed. ",
"childWrappers",
"=",
"null",
";",
"ifcToDynamicWrapper",
".",
"clear",
"(",
")",
";",
"dynamicWrapperToImpl",
".",
"clear",
"(",
")",
";",
"if",
"(",
"sqlX",
"!=",
"null",
")",
"{",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"close\"",
",",
"sqlX",
")",
";",
"throw",
"sqlX",
";",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"close\"",
")",
";",
"}"
] | Default close method for all JDBC wrappers, accessible to users. This method closes all
child wrappers and invokes the closeWrapper method implemented by the wrapper subclass.
If the wrapper is already closed, a message stating the wrapper has already been closed
is logged to the trace.
@param closeWrapperOnly boolean flag to indicate that only wrapper-closure activities
should be performed, but close of the underlying object is unnecessary.
@throws SQLException the first error to occur while closing the object. | [
"Default",
"close",
"method",
"for",
"all",
"JDBC",
"wrappers",
"accessible",
"to",
"users",
".",
"This",
"method",
"closes",
"all",
"child",
"wrappers",
"and",
"invokes",
"the",
"closeWrapper",
"method",
"implemented",
"by",
"the",
"wrapper",
"subclass",
".",
"If",
"the",
"wrapper",
"is",
"already",
"closed",
"a",
"message",
"stating",
"the",
"wrapper",
"has",
"already",
"been",
"closed",
"is",
"logged",
"to",
"the",
"trace",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcObject.java#L124-L171 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcObject.java | WSJdbcObject.closeChildWrappers | final void closeChildWrappers()
{
TraceComponent tc = getTracer();
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
// Close any child wrappers in the child wrapper list.
if (childWrappers != null && !childWrappers.isEmpty()) {
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(this, tc, "Closing child wrappers");
WSJdbcObject wrapper = null;
// Children remove themselves from the childWrappers list as they are closed.
for (int i = childWrappers.size(); i > 0;)
try {
wrapper = (WSJdbcObject) childWrappers.get(--i);
wrapper.close();
} catch (SQLException closeX) // can't fail here, need to keep closing
{
FFDCFilter.processException(closeX,
"com.ibm.ws.rsadapter.jdbc.WSJdbcObject.closeChildWrappers", "554", this);
} catch (IndexOutOfBoundsException ioobX)
{
if (isTraceOn && tc.isDebugEnabled())
{
Tr.debug(this, tc, "ArrayIndexOutOfBoundsException is caught during closeChildWrappers() of the WSJdbcObject");
Tr.debug(this, tc, "Possible causes:");
Tr.debug(this, tc, "multithreaded access of JDBC objects by the Application");
Tr.debug(this, tc, "Application is closing JDBC objects in a finalize()");
Tr.debug(this, tc, "Exception is: ", ioobX);
}
throw ioobX;
}
}
// Close this object's single child wrapper, if one exists.
if (childWrapper != null)
try {
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(this, tc, "Closing child wrapper");
childWrapper.close();
} catch (SQLException closeX) {
FFDCFilter.processException(closeX,
"com.ibm.ws.rsadapter.jdbc.WSJdbcObject.closeChildWrappers", "573", this);
}
} | java | final void closeChildWrappers()
{
TraceComponent tc = getTracer();
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
// Close any child wrappers in the child wrapper list.
if (childWrappers != null && !childWrappers.isEmpty()) {
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(this, tc, "Closing child wrappers");
WSJdbcObject wrapper = null;
// Children remove themselves from the childWrappers list as they are closed.
for (int i = childWrappers.size(); i > 0;)
try {
wrapper = (WSJdbcObject) childWrappers.get(--i);
wrapper.close();
} catch (SQLException closeX) // can't fail here, need to keep closing
{
FFDCFilter.processException(closeX,
"com.ibm.ws.rsadapter.jdbc.WSJdbcObject.closeChildWrappers", "554", this);
} catch (IndexOutOfBoundsException ioobX)
{
if (isTraceOn && tc.isDebugEnabled())
{
Tr.debug(this, tc, "ArrayIndexOutOfBoundsException is caught during closeChildWrappers() of the WSJdbcObject");
Tr.debug(this, tc, "Possible causes:");
Tr.debug(this, tc, "multithreaded access of JDBC objects by the Application");
Tr.debug(this, tc, "Application is closing JDBC objects in a finalize()");
Tr.debug(this, tc, "Exception is: ", ioobX);
}
throw ioobX;
}
}
// Close this object's single child wrapper, if one exists.
if (childWrapper != null)
try {
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(this, tc, "Closing child wrapper");
childWrapper.close();
} catch (SQLException closeX) {
FFDCFilter.processException(closeX,
"com.ibm.ws.rsadapter.jdbc.WSJdbcObject.closeChildWrappers", "573", this);
}
} | [
"final",
"void",
"closeChildWrappers",
"(",
")",
"{",
"TraceComponent",
"tc",
"=",
"getTracer",
"(",
")",
";",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"// Close any child wrappers in the child wrapper list.",
"if",
"(",
"childWrappers",
"!=",
"null",
"&&",
"!",
"childWrappers",
".",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Closing child wrappers\"",
")",
";",
"WSJdbcObject",
"wrapper",
"=",
"null",
";",
"// Children remove themselves from the childWrappers list as they are closed.",
"for",
"(",
"int",
"i",
"=",
"childWrappers",
".",
"size",
"(",
")",
";",
"i",
">",
"0",
";",
")",
"try",
"{",
"wrapper",
"=",
"(",
"WSJdbcObject",
")",
"childWrappers",
".",
"get",
"(",
"--",
"i",
")",
";",
"wrapper",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"SQLException",
"closeX",
")",
"// can't fail here, need to keep closing",
"{",
"FFDCFilter",
".",
"processException",
"(",
"closeX",
",",
"\"com.ibm.ws.rsadapter.jdbc.WSJdbcObject.closeChildWrappers\"",
",",
"\"554\"",
",",
"this",
")",
";",
"}",
"catch",
"(",
"IndexOutOfBoundsException",
"ioobX",
")",
"{",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"ArrayIndexOutOfBoundsException is caught during closeChildWrappers() of the WSJdbcObject\"",
")",
";",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Possible causes:\"",
")",
";",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"multithreaded access of JDBC objects by the Application\"",
")",
";",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Application is closing JDBC objects in a finalize()\"",
")",
";",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Exception is: \"",
",",
"ioobX",
")",
";",
"}",
"throw",
"ioobX",
";",
"}",
"}",
"// Close this object's single child wrapper, if one exists.",
"if",
"(",
"childWrapper",
"!=",
"null",
")",
"try",
"{",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Closing child wrapper\"",
")",
";",
"childWrapper",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"SQLException",
"closeX",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"closeX",
",",
"\"com.ibm.ws.rsadapter.jdbc.WSJdbcObject.closeChildWrappers\"",
",",
"\"573\"",
",",
"this",
")",
";",
"}",
"}"
] | Close all child objects of this wrapper. Errors that occur while closing child objects
should not be thrown. Errors may be logged instead. | [
"Close",
"all",
"child",
"objects",
"of",
"this",
"wrapper",
".",
"Errors",
"that",
"occur",
"while",
"closing",
"child",
"objects",
"should",
"not",
"be",
"thrown",
".",
"Errors",
"may",
"be",
"logged",
"instead",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcObject.java#L177-L224 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcObject.java | WSJdbcObject.init | final void init(WSJdbcObject parent) {
if (parent != null) {
parentWrapper = parent;
dsConfig = parent.dsConfig;
freeResourcesOnClose = parent.freeResourcesOnClose;
}
if (freeResourcesOnClose) // then initialize data structures to track them
{
arrays = new LinkedList<Array>();
blobs = new LinkedList<Blob>();
clobs = new LinkedList<Clob>();
resources = new LinkedList<Closeable>();
xmls = new LinkedList<SQLXML>();
}
} | java | final void init(WSJdbcObject parent) {
if (parent != null) {
parentWrapper = parent;
dsConfig = parent.dsConfig;
freeResourcesOnClose = parent.freeResourcesOnClose;
}
if (freeResourcesOnClose) // then initialize data structures to track them
{
arrays = new LinkedList<Array>();
blobs = new LinkedList<Blob>();
clobs = new LinkedList<Clob>();
resources = new LinkedList<Closeable>();
xmls = new LinkedList<SQLXML>();
}
} | [
"final",
"void",
"init",
"(",
"WSJdbcObject",
"parent",
")",
"{",
"if",
"(",
"parent",
"!=",
"null",
")",
"{",
"parentWrapper",
"=",
"parent",
";",
"dsConfig",
"=",
"parent",
".",
"dsConfig",
";",
"freeResourcesOnClose",
"=",
"parent",
".",
"freeResourcesOnClose",
";",
"}",
"if",
"(",
"freeResourcesOnClose",
")",
"// then initialize data structures to track them",
"{",
"arrays",
"=",
"new",
"LinkedList",
"<",
"Array",
">",
"(",
")",
";",
"blobs",
"=",
"new",
"LinkedList",
"<",
"Blob",
">",
"(",
")",
";",
"clobs",
"=",
"new",
"LinkedList",
"<",
"Clob",
">",
"(",
")",
";",
"resources",
"=",
"new",
"LinkedList",
"<",
"Closeable",
">",
"(",
")",
";",
"xmls",
"=",
"new",
"LinkedList",
"<",
"SQLXML",
">",
"(",
")",
";",
"}",
"}"
] | Initialize the parent wrapper field and copy some fields from the parent wrapper.
@param parent the parent wrapper, or NULL if initializing a connection wrapper. | [
"Initialize",
"the",
"parent",
"wrapper",
"field",
"and",
"copy",
"some",
"fields",
"from",
"the",
"parent",
"wrapper",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcObject.java#L377-L392 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcObject.java | WSJdbcObject.introspectAll | protected void introspectAll(FFDCLogger info)
{
info.append(this.toString());
// Allow any wrapper specific info to be inserted first.
introspectWrapperSpecificInfo(info);
// Display generic information.
info.append("Wrapper State: ", state.name());
info.append("Parent wrapper:", parentWrapper);
info.append("Child wrapper:");
info.indent(childWrapper);
if (childWrappers != null) {
try {
info.append("# of Child Wrappers " + childWrappers.size());
info.append("Child wrappers:");
for (int i = 0; i < childWrappers.size(); i++) {
info.indent(childWrappers.get(i));
}
} catch (Throwable th) {
// No FFDC code needed; closed on another thread; ignore.
}
}//end if
info.eoln();
} | java | protected void introspectAll(FFDCLogger info)
{
info.append(this.toString());
// Allow any wrapper specific info to be inserted first.
introspectWrapperSpecificInfo(info);
// Display generic information.
info.append("Wrapper State: ", state.name());
info.append("Parent wrapper:", parentWrapper);
info.append("Child wrapper:");
info.indent(childWrapper);
if (childWrappers != null) {
try {
info.append("# of Child Wrappers " + childWrappers.size());
info.append("Child wrappers:");
for (int i = 0; i < childWrappers.size(); i++) {
info.indent(childWrappers.get(i));
}
} catch (Throwable th) {
// No FFDC code needed; closed on another thread; ignore.
}
}//end if
info.eoln();
} | [
"protected",
"void",
"introspectAll",
"(",
"FFDCLogger",
"info",
")",
"{",
"info",
".",
"append",
"(",
"this",
".",
"toString",
"(",
")",
")",
";",
"// Allow any wrapper specific info to be inserted first.",
"introspectWrapperSpecificInfo",
"(",
"info",
")",
";",
"// Display generic information.",
"info",
".",
"append",
"(",
"\"Wrapper State: \"",
",",
"state",
".",
"name",
"(",
")",
")",
";",
"info",
".",
"append",
"(",
"\"Parent wrapper:\"",
",",
"parentWrapper",
")",
";",
"info",
".",
"append",
"(",
"\"Child wrapper:\"",
")",
";",
"info",
".",
"indent",
"(",
"childWrapper",
")",
";",
"if",
"(",
"childWrappers",
"!=",
"null",
")",
"{",
"try",
"{",
"info",
".",
"append",
"(",
"\"# of Child Wrappers \"",
"+",
"childWrappers",
".",
"size",
"(",
")",
")",
";",
"info",
".",
"append",
"(",
"\"Child wrappers:\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"childWrappers",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"info",
".",
"indent",
"(",
"childWrappers",
".",
"get",
"(",
"i",
")",
")",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"th",
")",
"{",
"// No FFDC code needed; closed on another thread; ignore.",
"}",
"}",
"//end if ",
"info",
".",
"eoln",
"(",
")",
";",
"}"
] | Collects generic FFDC information applicable to all JDBC wrappers. Formats this
information to the provided FFDC logger. FFDC information for all child wrappers should
be included in the result.
@param info FFDCLogger on which to record the FFDC information. | [
"Collects",
"generic",
"FFDC",
"information",
"applicable",
"to",
"all",
"JDBC",
"wrappers",
".",
"Formats",
"this",
"information",
"to",
"the",
"provided",
"FFDC",
"logger",
".",
"FFDC",
"information",
"for",
"all",
"child",
"wrappers",
"should",
"be",
"included",
"in",
"the",
"result",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcObject.java#L419-L449 | train |
OpenLiberty/open-liberty | dev/wlp-metatypeValidator/src/com/ibm/ws/metatype/validator/MetatypeValidator.java | MetatypeValidator.gatherMetatypeFilesAndStats | private void gatherMetatypeFilesAndStats() throws IOException, JAXBException {
for (File bundle : directory.listFiles()) {
if (bundle.isFile()) {
analyzeBundle(bundle);
}
}
} | java | private void gatherMetatypeFilesAndStats() throws IOException, JAXBException {
for (File bundle : directory.listFiles()) {
if (bundle.isFile()) {
analyzeBundle(bundle);
}
}
} | [
"private",
"void",
"gatherMetatypeFilesAndStats",
"(",
")",
"throws",
"IOException",
",",
"JAXBException",
"{",
"for",
"(",
"File",
"bundle",
":",
"directory",
".",
"listFiles",
"(",
")",
")",
"{",
"if",
"(",
"bundle",
".",
"isFile",
"(",
")",
")",
"{",
"analyzeBundle",
"(",
"bundle",
")",
";",
"}",
"}",
"}"
] | Iterates through and gathers the projects to validate along with scanning all the other
projects to gather their information for validating the projects.
@throws IOException
@throws JAXBException | [
"Iterates",
"through",
"and",
"gathers",
"the",
"projects",
"to",
"validate",
"along",
"with",
"scanning",
"all",
"the",
"other",
"projects",
"to",
"gather",
"their",
"information",
"for",
"validating",
"the",
"projects",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp-metatypeValidator/src/com/ibm/ws/metatype/validator/MetatypeValidator.java#L79-L85 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/AccessHelper.java | AccessHelper.getFreeSpace | static long getFreeSpace(final File fileInFs) {
try {
long result = (long) getInstance().doPrivileged(new PrivilegedAction<Long>() {
public Long run() {
return fileInFs.getFreeSpace() ;
}
});
return result ;
} catch (SecurityException se) {
return -1 ;
}
} | java | static long getFreeSpace(final File fileInFs) {
try {
long result = (long) getInstance().doPrivileged(new PrivilegedAction<Long>() {
public Long run() {
return fileInFs.getFreeSpace() ;
}
});
return result ;
} catch (SecurityException se) {
return -1 ;
}
} | [
"static",
"long",
"getFreeSpace",
"(",
"final",
"File",
"fileInFs",
")",
"{",
"try",
"{",
"long",
"result",
"=",
"(",
"long",
")",
"getInstance",
"(",
")",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"Long",
">",
"(",
")",
"{",
"public",
"Long",
"run",
"(",
")",
"{",
"return",
"fileInFs",
".",
"getFreeSpace",
"(",
")",
";",
"}",
"}",
")",
";",
"return",
"result",
";",
"}",
"catch",
"(",
"SecurityException",
"se",
")",
"{",
"return",
"-",
"1",
";",
"}",
"}"
] | Returns free space on a file system containing the passed in file | [
"Returns",
"free",
"space",
"on",
"a",
"file",
"system",
"containing",
"the",
"passed",
"in",
"file"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/AccessHelper.java#L358-L369 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/AccessHelper.java | AccessHelper.createTimer | static Timer createTimer() {
try {
return getInstance().doPrivileged(new PrivilegedAction<Timer>() {
@Override
public Timer run() {
return new Timer(true); // 691649
}
});
} catch (SecurityException se) {
// TODO: Add logging here but be careful since this code is used in logging logic itself
// and may result in an indefinite loop.
return null;
}
} | java | static Timer createTimer() {
try {
return getInstance().doPrivileged(new PrivilegedAction<Timer>() {
@Override
public Timer run() {
return new Timer(true); // 691649
}
});
} catch (SecurityException se) {
// TODO: Add logging here but be careful since this code is used in logging logic itself
// and may result in an indefinite loop.
return null;
}
} | [
"static",
"Timer",
"createTimer",
"(",
")",
"{",
"try",
"{",
"return",
"getInstance",
"(",
")",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"Timer",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Timer",
"run",
"(",
")",
"{",
"return",
"new",
"Timer",
"(",
"true",
")",
";",
"// 691649",
"}",
"}",
")",
";",
"}",
"catch",
"(",
"SecurityException",
"se",
")",
"{",
"// TODO: Add logging here but be careful since this code is used in logging logic itself",
"// and may result in an indefinite loop.",
"return",
"null",
";",
"}",
"}"
] | creates a new nameless non-daemon Timer
@return new Timer instance or <code>null</code> on access violation. | [
"creates",
"a",
"new",
"nameless",
"non",
"-",
"daemon",
"Timer"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/AccessHelper.java#L391-L404 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/cdi/util/ContextualStorage.java | ContextualStorage.getBeanKey | public <T> Object getBeanKey(Contextual<T> bean)
{
if (passivationCapable)
{
// if the
return ((PassivationCapable) bean).getId();
}
return bean;
} | java | public <T> Object getBeanKey(Contextual<T> bean)
{
if (passivationCapable)
{
// if the
return ((PassivationCapable) bean).getId();
}
return bean;
} | [
"public",
"<",
"T",
">",
"Object",
"getBeanKey",
"(",
"Contextual",
"<",
"T",
">",
"bean",
")",
"{",
"if",
"(",
"passivationCapable",
")",
"{",
"// if the",
"return",
"(",
"(",
"PassivationCapable",
")",
"bean",
")",
".",
"getId",
"(",
")",
";",
"}",
"return",
"bean",
";",
"}"
] | If the context is a passivating scope then we return
the passivationId of the Bean. Otherwise we use
the Bean directly.
@return the key to use in the context map | [
"If",
"the",
"context",
"is",
"a",
"passivating",
"scope",
"then",
"we",
"return",
"the",
"passivationId",
"of",
"the",
"Bean",
".",
"Otherwise",
"we",
"use",
"the",
"Bean",
"directly",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/cdi/util/ContextualStorage.java#L147-L156 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/cdi/util/ContextualStorage.java | ContextualStorage.getBean | public Contextual<?> getBean(Object beanKey)
{
if (passivationCapable)
{
return beanManager.getPassivationCapableBean((String) beanKey);
}
else
{
return (Contextual<?>) beanKey;
}
} | java | public Contextual<?> getBean(Object beanKey)
{
if (passivationCapable)
{
return beanManager.getPassivationCapableBean((String) beanKey);
}
else
{
return (Contextual<?>) beanKey;
}
} | [
"public",
"Contextual",
"<",
"?",
">",
"getBean",
"(",
"Object",
"beanKey",
")",
"{",
"if",
"(",
"passivationCapable",
")",
"{",
"return",
"beanManager",
".",
"getPassivationCapableBean",
"(",
"(",
"String",
")",
"beanKey",
")",
";",
"}",
"else",
"{",
"return",
"(",
"Contextual",
"<",
"?",
">",
")",
"beanKey",
";",
"}",
"}"
] | Restores the Bean from its beanKey.
@see #getBeanKey(javax.enterprise.context.spi.Contextual) | [
"Restores",
"the",
"Bean",
"from",
"its",
"beanKey",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/cdi/util/ContextualStorage.java#L162-L172 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.config/src/com/ibm/ws/config/admin/internal/ManagedServiceTracker.java | ManagedServiceTracker.addingService | @Override
public ManagedService addingService(ServiceReference<ManagedService> reference) {
String[] pids = getServicePid(reference);
if (pids == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "handleRegistration(): Invalid service.pid type: " + reference);
}
return null;
}
ManagedService ms = context.getService(reference);
if (ms == null)
return null;
synchronized (caFactory.getConfigurationStore()) {
for (String pid : pids) {
add(reference, pid, ms);
}
}
return ms;
} | java | @Override
public ManagedService addingService(ServiceReference<ManagedService> reference) {
String[] pids = getServicePid(reference);
if (pids == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "handleRegistration(): Invalid service.pid type: " + reference);
}
return null;
}
ManagedService ms = context.getService(reference);
if (ms == null)
return null;
synchronized (caFactory.getConfigurationStore()) {
for (String pid : pids) {
add(reference, pid, ms);
}
}
return ms;
} | [
"@",
"Override",
"public",
"ManagedService",
"addingService",
"(",
"ServiceReference",
"<",
"ManagedService",
">",
"reference",
")",
"{",
"String",
"[",
"]",
"pids",
"=",
"getServicePid",
"(",
"reference",
")",
";",
"if",
"(",
"pids",
"==",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"handleRegistration(): Invalid service.pid type: \"",
"+",
"reference",
")",
";",
"}",
"return",
"null",
";",
"}",
"ManagedService",
"ms",
"=",
"context",
".",
"getService",
"(",
"reference",
")",
";",
"if",
"(",
"ms",
"==",
"null",
")",
"return",
"null",
";",
"synchronized",
"(",
"caFactory",
".",
"getConfigurationStore",
"(",
")",
")",
"{",
"for",
"(",
"String",
"pid",
":",
"pids",
")",
"{",
"add",
"(",
"reference",
",",
"pid",
",",
"ms",
")",
";",
"}",
"}",
"return",
"ms",
";",
"}"
] | Processes registered ManagedService and updates each with their own
configuration properties.
@param reference | [
"Processes",
"registered",
"ManagedService",
"and",
"updates",
"each",
"with",
"their",
"own",
"configuration",
"properties",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/admin/internal/ManagedServiceTracker.java#L89-L110 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/ws/logging/internal/WsLogger.java | WsLogger.createLogRecord | private LogRecord createLogRecord(Level level, String msg, Object[] params, String sourceClassName, String sourceMethodName, String resourceBundleName, Throwable thrown) {
ResourceBundle resourceBundle = null;
if (level.intValue() >= this.ivMinimumLocalizationLevelIntValue) {
if (null == this.ivCachedResourceBundle) {
this.ivCachedResourceBundle = super.getResourceBundle();
this.ivCachedResourceBundleName = super.getResourceBundleName();
}
// if resourceBundleName not set by caller, look it up from logger
// (and logger's parents if needed).
if (resourceBundleName == null) {
resourceBundleName = computeResourceBundleName();
}
// get the resourceBundle
if (resourceBundleName != null) {
if (resourceBundleName.equals(this.ivCachedResourceBundleName)) {
resourceBundle = this.ivCachedResourceBundle;
} else {
resourceBundle = getResourceBundle(resourceBundleName);
}
}
if (null == resourceBundle && null != sourceClassName) {
try {
Class<?> source = Class.forName(sourceClassName);
resourceBundle = ResourceBundle.getBundle(resourceBundleName, Locale.getDefault(), source.getClassLoader());
} catch (Throwable t) {
// unable to find the resource bundle
}
}
}
return createWsLogRecord(level, msg, params, sourceClassName, sourceMethodName, resourceBundleName, resourceBundle, thrown);
} | java | private LogRecord createLogRecord(Level level, String msg, Object[] params, String sourceClassName, String sourceMethodName, String resourceBundleName, Throwable thrown) {
ResourceBundle resourceBundle = null;
if (level.intValue() >= this.ivMinimumLocalizationLevelIntValue) {
if (null == this.ivCachedResourceBundle) {
this.ivCachedResourceBundle = super.getResourceBundle();
this.ivCachedResourceBundleName = super.getResourceBundleName();
}
// if resourceBundleName not set by caller, look it up from logger
// (and logger's parents if needed).
if (resourceBundleName == null) {
resourceBundleName = computeResourceBundleName();
}
// get the resourceBundle
if (resourceBundleName != null) {
if (resourceBundleName.equals(this.ivCachedResourceBundleName)) {
resourceBundle = this.ivCachedResourceBundle;
} else {
resourceBundle = getResourceBundle(resourceBundleName);
}
}
if (null == resourceBundle && null != sourceClassName) {
try {
Class<?> source = Class.forName(sourceClassName);
resourceBundle = ResourceBundle.getBundle(resourceBundleName, Locale.getDefault(), source.getClassLoader());
} catch (Throwable t) {
// unable to find the resource bundle
}
}
}
return createWsLogRecord(level, msg, params, sourceClassName, sourceMethodName, resourceBundleName, resourceBundle, thrown);
} | [
"private",
"LogRecord",
"createLogRecord",
"(",
"Level",
"level",
",",
"String",
"msg",
",",
"Object",
"[",
"]",
"params",
",",
"String",
"sourceClassName",
",",
"String",
"sourceMethodName",
",",
"String",
"resourceBundleName",
",",
"Throwable",
"thrown",
")",
"{",
"ResourceBundle",
"resourceBundle",
"=",
"null",
";",
"if",
"(",
"level",
".",
"intValue",
"(",
")",
">=",
"this",
".",
"ivMinimumLocalizationLevelIntValue",
")",
"{",
"if",
"(",
"null",
"==",
"this",
".",
"ivCachedResourceBundle",
")",
"{",
"this",
".",
"ivCachedResourceBundle",
"=",
"super",
".",
"getResourceBundle",
"(",
")",
";",
"this",
".",
"ivCachedResourceBundleName",
"=",
"super",
".",
"getResourceBundleName",
"(",
")",
";",
"}",
"// if resourceBundleName not set by caller, look it up from logger",
"// (and logger's parents if needed).",
"if",
"(",
"resourceBundleName",
"==",
"null",
")",
"{",
"resourceBundleName",
"=",
"computeResourceBundleName",
"(",
")",
";",
"}",
"// get the resourceBundle",
"if",
"(",
"resourceBundleName",
"!=",
"null",
")",
"{",
"if",
"(",
"resourceBundleName",
".",
"equals",
"(",
"this",
".",
"ivCachedResourceBundleName",
")",
")",
"{",
"resourceBundle",
"=",
"this",
".",
"ivCachedResourceBundle",
";",
"}",
"else",
"{",
"resourceBundle",
"=",
"getResourceBundle",
"(",
"resourceBundleName",
")",
";",
"}",
"}",
"if",
"(",
"null",
"==",
"resourceBundle",
"&&",
"null",
"!=",
"sourceClassName",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"source",
"=",
"Class",
".",
"forName",
"(",
"sourceClassName",
")",
";",
"resourceBundle",
"=",
"ResourceBundle",
".",
"getBundle",
"(",
"resourceBundleName",
",",
"Locale",
".",
"getDefault",
"(",
")",
",",
"source",
".",
"getClassLoader",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"// unable to find the resource bundle",
"}",
"}",
"}",
"return",
"createWsLogRecord",
"(",
"level",
",",
"msg",
",",
"params",
",",
"sourceClassName",
",",
"sourceMethodName",
",",
"resourceBundleName",
",",
"resourceBundle",
",",
"thrown",
")",
";",
"}"
] | Creates a LogRecord using any available input parameters from the various
Logger methods.
@param level
@param msg
@param params
@param sourceClassName
@param sourceMethodName
@param resourceBundleName
@param thrown
@return LogRecord | [
"Creates",
"a",
"LogRecord",
"using",
"any",
"available",
"input",
"parameters",
"from",
"the",
"various",
"Logger",
"methods",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ws/logging/internal/WsLogger.java#L157-L190 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/ws/logging/internal/WsLogger.java | WsLogger.createWsLogRecord | private WsLogRecord createWsLogRecord(Level level, String msg, Object[] params, String sourceClassName, String sourceMethodName, String resourceBundleName,
ResourceBundle resourceBundle, Throwable thrown) {
WsLogRecord logRecord = new WsLogRecord(level, msg);
if (params != null) {
logRecord.setParameters(params);
// special handling for byte arrays in the first param position
if ((params.length > 0 && params[0] != null) && byte.class.equals(params[0].getClass().getComponentType()))
logRecord.setRawData((byte[]) params[0]);
}
if (sourceClassName != null) {
logRecord.setSourceClassName(sourceClassName);
}
if (sourceMethodName != null) {
logRecord.setSourceMethodName(sourceMethodName);
}
if (resourceBundleName != null) {
logRecord.setResourceBundleName(resourceBundleName);
}
if (resourceBundle != null) {
logRecord.setResourceBundle(resourceBundle);
}
if (thrown != null) {
logRecord.setThrown(thrown);
}
if (getName() != null) {
logRecord.setLoggerName(getName());
}
if (getOrganization() != null) {
logRecord.setOrganization(getOrganization());
}
if (getProduct() != null) {
logRecord.setProduct(getProduct());
}
if (getComponent() != null) {
logRecord.setComponent(getComponent());
}
LogRecordContext.getExtensions(logRecord.getExtensions());
logRecord.setTraceClass(ivTC.getTraceClass());
// populate runtime data
// Note: this is WAS version, UOW, process ID, etc
// WsLoggerRuntimeData.getInstance().populate(logRecord);
return logRecord;
} | java | private WsLogRecord createWsLogRecord(Level level, String msg, Object[] params, String sourceClassName, String sourceMethodName, String resourceBundleName,
ResourceBundle resourceBundle, Throwable thrown) {
WsLogRecord logRecord = new WsLogRecord(level, msg);
if (params != null) {
logRecord.setParameters(params);
// special handling for byte arrays in the first param position
if ((params.length > 0 && params[0] != null) && byte.class.equals(params[0].getClass().getComponentType()))
logRecord.setRawData((byte[]) params[0]);
}
if (sourceClassName != null) {
logRecord.setSourceClassName(sourceClassName);
}
if (sourceMethodName != null) {
logRecord.setSourceMethodName(sourceMethodName);
}
if (resourceBundleName != null) {
logRecord.setResourceBundleName(resourceBundleName);
}
if (resourceBundle != null) {
logRecord.setResourceBundle(resourceBundle);
}
if (thrown != null) {
logRecord.setThrown(thrown);
}
if (getName() != null) {
logRecord.setLoggerName(getName());
}
if (getOrganization() != null) {
logRecord.setOrganization(getOrganization());
}
if (getProduct() != null) {
logRecord.setProduct(getProduct());
}
if (getComponent() != null) {
logRecord.setComponent(getComponent());
}
LogRecordContext.getExtensions(logRecord.getExtensions());
logRecord.setTraceClass(ivTC.getTraceClass());
// populate runtime data
// Note: this is WAS version, UOW, process ID, etc
// WsLoggerRuntimeData.getInstance().populate(logRecord);
return logRecord;
} | [
"private",
"WsLogRecord",
"createWsLogRecord",
"(",
"Level",
"level",
",",
"String",
"msg",
",",
"Object",
"[",
"]",
"params",
",",
"String",
"sourceClassName",
",",
"String",
"sourceMethodName",
",",
"String",
"resourceBundleName",
",",
"ResourceBundle",
"resourceBundle",
",",
"Throwable",
"thrown",
")",
"{",
"WsLogRecord",
"logRecord",
"=",
"new",
"WsLogRecord",
"(",
"level",
",",
"msg",
")",
";",
"if",
"(",
"params",
"!=",
"null",
")",
"{",
"logRecord",
".",
"setParameters",
"(",
"params",
")",
";",
"// special handling for byte arrays in the first param position",
"if",
"(",
"(",
"params",
".",
"length",
">",
"0",
"&&",
"params",
"[",
"0",
"]",
"!=",
"null",
")",
"&&",
"byte",
".",
"class",
".",
"equals",
"(",
"params",
"[",
"0",
"]",
".",
"getClass",
"(",
")",
".",
"getComponentType",
"(",
")",
")",
")",
"logRecord",
".",
"setRawData",
"(",
"(",
"byte",
"[",
"]",
")",
"params",
"[",
"0",
"]",
")",
";",
"}",
"if",
"(",
"sourceClassName",
"!=",
"null",
")",
"{",
"logRecord",
".",
"setSourceClassName",
"(",
"sourceClassName",
")",
";",
"}",
"if",
"(",
"sourceMethodName",
"!=",
"null",
")",
"{",
"logRecord",
".",
"setSourceMethodName",
"(",
"sourceMethodName",
")",
";",
"}",
"if",
"(",
"resourceBundleName",
"!=",
"null",
")",
"{",
"logRecord",
".",
"setResourceBundleName",
"(",
"resourceBundleName",
")",
";",
"}",
"if",
"(",
"resourceBundle",
"!=",
"null",
")",
"{",
"logRecord",
".",
"setResourceBundle",
"(",
"resourceBundle",
")",
";",
"}",
"if",
"(",
"thrown",
"!=",
"null",
")",
"{",
"logRecord",
".",
"setThrown",
"(",
"thrown",
")",
";",
"}",
"if",
"(",
"getName",
"(",
")",
"!=",
"null",
")",
"{",
"logRecord",
".",
"setLoggerName",
"(",
"getName",
"(",
")",
")",
";",
"}",
"if",
"(",
"getOrganization",
"(",
")",
"!=",
"null",
")",
"{",
"logRecord",
".",
"setOrganization",
"(",
"getOrganization",
"(",
")",
")",
";",
"}",
"if",
"(",
"getProduct",
"(",
")",
"!=",
"null",
")",
"{",
"logRecord",
".",
"setProduct",
"(",
"getProduct",
"(",
")",
")",
";",
"}",
"if",
"(",
"getComponent",
"(",
")",
"!=",
"null",
")",
"{",
"logRecord",
".",
"setComponent",
"(",
"getComponent",
"(",
")",
")",
";",
"}",
"LogRecordContext",
".",
"getExtensions",
"(",
"logRecord",
".",
"getExtensions",
"(",
")",
")",
";",
"logRecord",
".",
"setTraceClass",
"(",
"ivTC",
".",
"getTraceClass",
"(",
")",
")",
";",
"// populate runtime data",
"// Note: this is WAS version, UOW, process ID, etc",
"// WsLoggerRuntimeData.getInstance().populate(logRecord);",
"return",
"logRecord",
";",
"}"
] | Construct a WsLogRecord with the given level and message values.
@param level
the logging Level value. Must NOT be null
@param msg
the message. May be a text message, pre-localized message or a
message key (in a resource bundle).
@param sourceClassName
@param sourceMethodName
@param resourceBundleName
@param resourceBundle
@param thrown | [
"Construct",
"a",
"WsLogRecord",
"with",
"the",
"given",
"level",
"and",
"message",
"values",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ws/logging/internal/WsLogger.java#L206-L254 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/ws/logging/internal/WsLogger.java | WsLogger.computeResourceBundleName | private String computeResourceBundleName() {
Logger logger = this;
while (logger != null) {
String name = logger.getResourceBundleName();
if (name != null) {
return name;
}
logger = logger.getParent();
}
return null;
} | java | private String computeResourceBundleName() {
Logger logger = this;
while (logger != null) {
String name = logger.getResourceBundleName();
if (name != null) {
return name;
}
logger = logger.getParent();
}
return null;
} | [
"private",
"String",
"computeResourceBundleName",
"(",
")",
"{",
"Logger",
"logger",
"=",
"this",
";",
"while",
"(",
"logger",
"!=",
"null",
")",
"{",
"String",
"name",
"=",
"logger",
".",
"getResourceBundleName",
"(",
")",
";",
"if",
"(",
"name",
"!=",
"null",
")",
"{",
"return",
"name",
";",
"}",
"logger",
"=",
"logger",
".",
"getParent",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Worker method to determine the resource bundle name to use for logger. If
set, this is just the resource bundle name of this logger. If not set,
move up through the list of parents and find the first non-null resource
bundle name.
@return String the resource bundle name | [
"Worker",
"method",
"to",
"determine",
"the",
"resource",
"bundle",
"name",
"to",
"use",
"for",
"logger",
".",
"If",
"set",
"this",
"is",
"just",
"the",
"resource",
"bundle",
"name",
"of",
"this",
"logger",
".",
"If",
"not",
"set",
"move",
"up",
"through",
"the",
"list",
"of",
"parents",
"and",
"find",
"the",
"first",
"non",
"-",
"null",
"resource",
"bundle",
"name",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ws/logging/internal/WsLogger.java#L592-L604 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/IntrospectionLevelMember.java | IntrospectionLevelMember.introspectViaReflection | private void introspectViaReflection() {
{
Class<?> memberClass = _member.getClass();
if (memberClass.isArray()) {
int length = Array.getLength(_member);
Class<?> componentType = memberClass.getComponentType();
if (componentType.isPrimitive()) {
addNewChild(componentType + "[0.." + (length - 1) + "]", _member);
} else {
String simpleName = componentType.getSimpleName();
for (int i = 0; i < length && i < MAX_ARRAY_LENGTH; i++) {
Object value = Array.get(_member, i);
addNewChild(simpleName + "[" + i + "]", value);
}
if (length > MAX_ARRAY_LENGTH) {
addNewChild(simpleName + "[...]", "/* array length = " + length + " */");
}
}
} else {
/*
* Loop around the fields of the object (including fields of its
* superclass) adding them as children (and, it we haven't seen
* the child before, getting introspected at the next level if
* its worth doing so)
*/
Class<?> currentClass = _member.getClass();
while (currentClass != Object.class) {
Field[] fields = getFields(currentClass);
for (int i = 0; i < fields.length && i < MAX_ARRAY_LENGTH; i++) {
final Field field = fields[i];
Object value = getFieldValue(field);
addNewChild(field.getName(), value);
}
if (fields.length > MAX_ARRAY_LENGTH) {
addNewChild("field...", "/* total # of fields = " + fields.length + " */");
}
currentClass = currentClass.getSuperclass();
}
}
}
} | java | private void introspectViaReflection() {
{
Class<?> memberClass = _member.getClass();
if (memberClass.isArray()) {
int length = Array.getLength(_member);
Class<?> componentType = memberClass.getComponentType();
if (componentType.isPrimitive()) {
addNewChild(componentType + "[0.." + (length - 1) + "]", _member);
} else {
String simpleName = componentType.getSimpleName();
for (int i = 0; i < length && i < MAX_ARRAY_LENGTH; i++) {
Object value = Array.get(_member, i);
addNewChild(simpleName + "[" + i + "]", value);
}
if (length > MAX_ARRAY_LENGTH) {
addNewChild(simpleName + "[...]", "/* array length = " + length + " */");
}
}
} else {
/*
* Loop around the fields of the object (including fields of its
* superclass) adding them as children (and, it we haven't seen
* the child before, getting introspected at the next level if
* its worth doing so)
*/
Class<?> currentClass = _member.getClass();
while (currentClass != Object.class) {
Field[] fields = getFields(currentClass);
for (int i = 0; i < fields.length && i < MAX_ARRAY_LENGTH; i++) {
final Field field = fields[i];
Object value = getFieldValue(field);
addNewChild(field.getName(), value);
}
if (fields.length > MAX_ARRAY_LENGTH) {
addNewChild("field...", "/* total # of fields = " + fields.length + " */");
}
currentClass = currentClass.getSuperclass();
}
}
}
} | [
"private",
"void",
"introspectViaReflection",
"(",
")",
"{",
"{",
"Class",
"<",
"?",
">",
"memberClass",
"=",
"_member",
".",
"getClass",
"(",
")",
";",
"if",
"(",
"memberClass",
".",
"isArray",
"(",
")",
")",
"{",
"int",
"length",
"=",
"Array",
".",
"getLength",
"(",
"_member",
")",
";",
"Class",
"<",
"?",
">",
"componentType",
"=",
"memberClass",
".",
"getComponentType",
"(",
")",
";",
"if",
"(",
"componentType",
".",
"isPrimitive",
"(",
")",
")",
"{",
"addNewChild",
"(",
"componentType",
"+",
"\"[0..\"",
"+",
"(",
"length",
"-",
"1",
")",
"+",
"\"]\"",
",",
"_member",
")",
";",
"}",
"else",
"{",
"String",
"simpleName",
"=",
"componentType",
".",
"getSimpleName",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
"&&",
"i",
"<",
"MAX_ARRAY_LENGTH",
";",
"i",
"++",
")",
"{",
"Object",
"value",
"=",
"Array",
".",
"get",
"(",
"_member",
",",
"i",
")",
";",
"addNewChild",
"(",
"simpleName",
"+",
"\"[\"",
"+",
"i",
"+",
"\"]\"",
",",
"value",
")",
";",
"}",
"if",
"(",
"length",
">",
"MAX_ARRAY_LENGTH",
")",
"{",
"addNewChild",
"(",
"simpleName",
"+",
"\"[...]\"",
",",
"\"/* array length = \"",
"+",
"length",
"+",
"\" */\"",
")",
";",
"}",
"}",
"}",
"else",
"{",
"/*\n * Loop around the fields of the object (including fields of its\n * superclass) adding them as children (and, it we haven't seen\n * the child before, getting introspected at the next level if\n * its worth doing so)\n */",
"Class",
"<",
"?",
">",
"currentClass",
"=",
"_member",
".",
"getClass",
"(",
")",
";",
"while",
"(",
"currentClass",
"!=",
"Object",
".",
"class",
")",
"{",
"Field",
"[",
"]",
"fields",
"=",
"getFields",
"(",
"currentClass",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"fields",
".",
"length",
"&&",
"i",
"<",
"MAX_ARRAY_LENGTH",
";",
"i",
"++",
")",
"{",
"final",
"Field",
"field",
"=",
"fields",
"[",
"i",
"]",
";",
"Object",
"value",
"=",
"getFieldValue",
"(",
"field",
")",
";",
"addNewChild",
"(",
"field",
".",
"getName",
"(",
")",
",",
"value",
")",
";",
"}",
"if",
"(",
"fields",
".",
"length",
">",
"MAX_ARRAY_LENGTH",
")",
"{",
"addNewChild",
"(",
"\"field...\"",
",",
"\"/* total # of fields = \"",
"+",
"fields",
".",
"length",
"+",
"\" */\"",
")",
";",
"}",
"currentClass",
"=",
"currentClass",
".",
"getSuperclass",
"(",
")",
";",
"}",
"}",
"}",
"}"
] | Introspect the object via reflection | [
"Introspect",
"the",
"object",
"via",
"reflection"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/IntrospectionLevelMember.java#L172-L212 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/IntrospectionLevelMember.java | IntrospectionLevelMember.addNewChild | private void addNewChild(String name, Object value) {
IntrospectionLevelMember prospectiveMember = new IntrospectionLevelMember(_level + 1, name, makeDescription(value), makeMember(value), _allKnownMembersInThisTree);
if (makeMember(value) != null) {
// OK, we'd like to introspect the object further - have we seen it?
if (_allKnownMembersInThisTree.contains(prospectiveMember)) {
// Already seen it, so ensure we don't reexamine it
prospectiveMember = new IntrospectionLevelMember(_level + 1, name, makeDescription(value), null, _allKnownMembersInThisTree);
} else {
// Ensure we don't reexamine it if we see it again!
_allKnownMembersInThisTree.add(prospectiveMember);
}
}
_children.add(prospectiveMember);
} | java | private void addNewChild(String name, Object value) {
IntrospectionLevelMember prospectiveMember = new IntrospectionLevelMember(_level + 1, name, makeDescription(value), makeMember(value), _allKnownMembersInThisTree);
if (makeMember(value) != null) {
// OK, we'd like to introspect the object further - have we seen it?
if (_allKnownMembersInThisTree.contains(prospectiveMember)) {
// Already seen it, so ensure we don't reexamine it
prospectiveMember = new IntrospectionLevelMember(_level + 1, name, makeDescription(value), null, _allKnownMembersInThisTree);
} else {
// Ensure we don't reexamine it if we see it again!
_allKnownMembersInThisTree.add(prospectiveMember);
}
}
_children.add(prospectiveMember);
} | [
"private",
"void",
"addNewChild",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"IntrospectionLevelMember",
"prospectiveMember",
"=",
"new",
"IntrospectionLevelMember",
"(",
"_level",
"+",
"1",
",",
"name",
",",
"makeDescription",
"(",
"value",
")",
",",
"makeMember",
"(",
"value",
")",
",",
"_allKnownMembersInThisTree",
")",
";",
"if",
"(",
"makeMember",
"(",
"value",
")",
"!=",
"null",
")",
"{",
"// OK, we'd like to introspect the object further - have we seen it?",
"if",
"(",
"_allKnownMembersInThisTree",
".",
"contains",
"(",
"prospectiveMember",
")",
")",
"{",
"// Already seen it, so ensure we don't reexamine it",
"prospectiveMember",
"=",
"new",
"IntrospectionLevelMember",
"(",
"_level",
"+",
"1",
",",
"name",
",",
"makeDescription",
"(",
"value",
")",
",",
"null",
",",
"_allKnownMembersInThisTree",
")",
";",
"}",
"else",
"{",
"// Ensure we don't reexamine it if we see it again!",
"_allKnownMembersInThisTree",
".",
"add",
"(",
"prospectiveMember",
")",
";",
"}",
"}",
"_children",
".",
"add",
"(",
"prospectiveMember",
")",
";",
"}"
] | Add a new IntrospectionLevelMember to _children List (Checking to see if
the new child should be introspected further
@param name
The name of the new child
@param value
The value of the new child | [
"Add",
"a",
"new",
"IntrospectionLevelMember",
"to",
"_children",
"List",
"(",
"Checking",
"to",
"see",
"if",
"the",
"new",
"child",
"should",
"be",
"introspected",
"further"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/IntrospectionLevelMember.java#L256-L269 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/IntrospectionLevelMember.java | IntrospectionLevelMember.getFieldValue | private Object getFieldValue(final Field field) {
Object field_value = AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() {
try {
Object value = field.get(_member);
// Don't dump sensitive data
boolean sensitive = _member.getClass().isAnnotationPresent(Sensitive.class) || field.isAnnotationPresent(Sensitive.class);
if (value != null && sensitive) {
value = DataFormatHelper.sensitiveToString(value);
}
return value;
} catch (IllegalAccessException e) {
// No FFDC code needed - we're in the middle of FFDC'ing!
// Should not happen - if it does return a string :-)
return "/* Could not access " + field.getName() + " */";
}
}
});
return field_value;
} | java | private Object getFieldValue(final Field field) {
Object field_value = AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() {
try {
Object value = field.get(_member);
// Don't dump sensitive data
boolean sensitive = _member.getClass().isAnnotationPresent(Sensitive.class) || field.isAnnotationPresent(Sensitive.class);
if (value != null && sensitive) {
value = DataFormatHelper.sensitiveToString(value);
}
return value;
} catch (IllegalAccessException e) {
// No FFDC code needed - we're in the middle of FFDC'ing!
// Should not happen - if it does return a string :-)
return "/* Could not access " + field.getName() + " */";
}
}
});
return field_value;
} | [
"private",
"Object",
"getFieldValue",
"(",
"final",
"Field",
"field",
")",
"{",
"Object",
"field_value",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"Object",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Object",
"run",
"(",
")",
"{",
"try",
"{",
"Object",
"value",
"=",
"field",
".",
"get",
"(",
"_member",
")",
";",
"// Don't dump sensitive data",
"boolean",
"sensitive",
"=",
"_member",
".",
"getClass",
"(",
")",
".",
"isAnnotationPresent",
"(",
"Sensitive",
".",
"class",
")",
"||",
"field",
".",
"isAnnotationPresent",
"(",
"Sensitive",
".",
"class",
")",
";",
"if",
"(",
"value",
"!=",
"null",
"&&",
"sensitive",
")",
"{",
"value",
"=",
"DataFormatHelper",
".",
"sensitiveToString",
"(",
"value",
")",
";",
"}",
"return",
"value",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"// No FFDC code needed - we're in the middle of FFDC'ing!",
"// Should not happen - if it does return a string :-)",
"return",
"\"/* Could not access \"",
"+",
"field",
".",
"getName",
"(",
")",
"+",
"\" */\"",
";",
"}",
"}",
"}",
")",
";",
"return",
"field_value",
";",
"}"
] | Return the value of the member's field
@param field
The field to be queried
@return The value of the field | [
"Return",
"the",
"value",
"of",
"the",
"member",
"s",
"field"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/IntrospectionLevelMember.java#L278-L300 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/IntrospectionLevelMember.java | IntrospectionLevelMember.getFields | private Field[] getFields(final Class<?> currentClass) {
final Field[] objectFields = AccessController.doPrivileged(new PrivilegedAction<Field[]>() {
@Override
public Field[] run() {
try {
Field[] tempObjectFields = currentClass.getDeclaredFields();
if (tempObjectFields.length != 0) {
AccessibleObject.setAccessible(tempObjectFields, true);
}
return tempObjectFields;
} catch (Throwable t) {
// Introspection of field failed
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
t.printStackTrace(pw);
addNewChild("Failed to resolve fields for " + currentClass.getName(), sw.toString());
}
return new Field[0];
}
});
return objectFields;
} | java | private Field[] getFields(final Class<?> currentClass) {
final Field[] objectFields = AccessController.doPrivileged(new PrivilegedAction<Field[]>() {
@Override
public Field[] run() {
try {
Field[] tempObjectFields = currentClass.getDeclaredFields();
if (tempObjectFields.length != 0) {
AccessibleObject.setAccessible(tempObjectFields, true);
}
return tempObjectFields;
} catch (Throwable t) {
// Introspection of field failed
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
t.printStackTrace(pw);
addNewChild("Failed to resolve fields for " + currentClass.getName(), sw.toString());
}
return new Field[0];
}
});
return objectFields;
} | [
"private",
"Field",
"[",
"]",
"getFields",
"(",
"final",
"Class",
"<",
"?",
">",
"currentClass",
")",
"{",
"final",
"Field",
"[",
"]",
"objectFields",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"Field",
"[",
"]",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Field",
"[",
"]",
"run",
"(",
")",
"{",
"try",
"{",
"Field",
"[",
"]",
"tempObjectFields",
"=",
"currentClass",
".",
"getDeclaredFields",
"(",
")",
";",
"if",
"(",
"tempObjectFields",
".",
"length",
"!=",
"0",
")",
"{",
"AccessibleObject",
".",
"setAccessible",
"(",
"tempObjectFields",
",",
"true",
")",
";",
"}",
"return",
"tempObjectFields",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"// Introspection of field failed",
"StringWriter",
"sw",
"=",
"new",
"StringWriter",
"(",
")",
";",
"PrintWriter",
"pw",
"=",
"new",
"PrintWriter",
"(",
"sw",
")",
";",
"t",
".",
"printStackTrace",
"(",
"pw",
")",
";",
"addNewChild",
"(",
"\"Failed to resolve fields for \"",
"+",
"currentClass",
".",
"getName",
"(",
")",
",",
"sw",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"new",
"Field",
"[",
"0",
"]",
";",
"}",
"}",
")",
";",
"return",
"objectFields",
";",
"}"
] | Return the fields in a particular class
@param currentClass
The class to be introspected
@return the fields of the class | [
"Return",
"the",
"fields",
"in",
"a",
"particular",
"class"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/IntrospectionLevelMember.java#L309-L330 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/IntrospectionLevelMember.java | IntrospectionLevelMember.makeDescription | private String makeDescription(Object value) {
String answer; // Not initialized, so the compiler tells if we miss a
// case
if (value == null) {
answer = "null";
} else if (value instanceof String) {
answer = "\"" + value + "\"";
} else {
Class<?> objClass = value.getClass();
if ((objClass == Boolean.class) || (objClass == Character.class) || (objClass == Byte.class) || (objClass == Short.class) || (objClass == Integer.class)
|| (objClass == Long.class) || (objClass == Float.class) || (objClass == Double.class)) {
answer = value.toString();
} else if (objClass.isArray()) {
if (objClass.getComponentType().isPrimitive()) {
answer = convertSimpleArrayToString(value);
} else {
answer = objClass.getComponentType() + "[" + Array.getLength(value) + "]";
}
} else {
answer = value.getClass().toString() + "@" + Integer.toHexString(System.identityHashCode(value));
}
}
return answer;
} | java | private String makeDescription(Object value) {
String answer; // Not initialized, so the compiler tells if we miss a
// case
if (value == null) {
answer = "null";
} else if (value instanceof String) {
answer = "\"" + value + "\"";
} else {
Class<?> objClass = value.getClass();
if ((objClass == Boolean.class) || (objClass == Character.class) || (objClass == Byte.class) || (objClass == Short.class) || (objClass == Integer.class)
|| (objClass == Long.class) || (objClass == Float.class) || (objClass == Double.class)) {
answer = value.toString();
} else if (objClass.isArray()) {
if (objClass.getComponentType().isPrimitive()) {
answer = convertSimpleArrayToString(value);
} else {
answer = objClass.getComponentType() + "[" + Array.getLength(value) + "]";
}
} else {
answer = value.getClass().toString() + "@" + Integer.toHexString(System.identityHashCode(value));
}
}
return answer;
} | [
"private",
"String",
"makeDescription",
"(",
"Object",
"value",
")",
"{",
"String",
"answer",
";",
"// Not initialized, so the compiler tells if we miss a",
"// case",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"answer",
"=",
"\"null\"",
";",
"}",
"else",
"if",
"(",
"value",
"instanceof",
"String",
")",
"{",
"answer",
"=",
"\"\\\"\"",
"+",
"value",
"+",
"\"\\\"\"",
";",
"}",
"else",
"{",
"Class",
"<",
"?",
">",
"objClass",
"=",
"value",
".",
"getClass",
"(",
")",
";",
"if",
"(",
"(",
"objClass",
"==",
"Boolean",
".",
"class",
")",
"||",
"(",
"objClass",
"==",
"Character",
".",
"class",
")",
"||",
"(",
"objClass",
"==",
"Byte",
".",
"class",
")",
"||",
"(",
"objClass",
"==",
"Short",
".",
"class",
")",
"||",
"(",
"objClass",
"==",
"Integer",
".",
"class",
")",
"||",
"(",
"objClass",
"==",
"Long",
".",
"class",
")",
"||",
"(",
"objClass",
"==",
"Float",
".",
"class",
")",
"||",
"(",
"objClass",
"==",
"Double",
".",
"class",
")",
")",
"{",
"answer",
"=",
"value",
".",
"toString",
"(",
")",
";",
"}",
"else",
"if",
"(",
"objClass",
".",
"isArray",
"(",
")",
")",
"{",
"if",
"(",
"objClass",
".",
"getComponentType",
"(",
")",
".",
"isPrimitive",
"(",
")",
")",
"{",
"answer",
"=",
"convertSimpleArrayToString",
"(",
"value",
")",
";",
"}",
"else",
"{",
"answer",
"=",
"objClass",
".",
"getComponentType",
"(",
")",
"+",
"\"[\"",
"+",
"Array",
".",
"getLength",
"(",
"value",
")",
"+",
"\"]\"",
";",
"}",
"}",
"else",
"{",
"answer",
"=",
"value",
".",
"getClass",
"(",
")",
".",
"toString",
"(",
")",
"+",
"\"@\"",
"+",
"Integer",
".",
"toHexString",
"(",
"System",
".",
"identityHashCode",
"(",
"value",
")",
")",
";",
"}",
"}",
"return",
"answer",
";",
"}"
] | Make a string that describes this object
@param value
The value needing a description
@return The description | [
"Make",
"a",
"string",
"that",
"describes",
"this",
"object"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/IntrospectionLevelMember.java#L339-L363 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/IntrospectionLevelMember.java | IntrospectionLevelMember.print | public void print(IncidentStream is, int maxDepth) {
StringBuffer fullName = new StringBuffer();
for (int i = 0; i < _level; i++)
fullName.append(" ");
fullName.append(_name);
is.writeLine(fullName.toString(), _description);
if (_level < maxDepth) {
List<IntrospectionLevelMember> children = getChildren();
for (IntrospectionLevelMember ilm : children) {
ilm.print(is, maxDepth);
}
}
} | java | public void print(IncidentStream is, int maxDepth) {
StringBuffer fullName = new StringBuffer();
for (int i = 0; i < _level; i++)
fullName.append(" ");
fullName.append(_name);
is.writeLine(fullName.toString(), _description);
if (_level < maxDepth) {
List<IntrospectionLevelMember> children = getChildren();
for (IntrospectionLevelMember ilm : children) {
ilm.print(is, maxDepth);
}
}
} | [
"public",
"void",
"print",
"(",
"IncidentStream",
"is",
",",
"int",
"maxDepth",
")",
"{",
"StringBuffer",
"fullName",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"_level",
";",
"i",
"++",
")",
"fullName",
".",
"append",
"(",
"\" \"",
")",
";",
"fullName",
".",
"append",
"(",
"_name",
")",
";",
"is",
".",
"writeLine",
"(",
"fullName",
".",
"toString",
"(",
")",
",",
"_description",
")",
";",
"if",
"(",
"_level",
"<",
"maxDepth",
")",
"{",
"List",
"<",
"IntrospectionLevelMember",
">",
"children",
"=",
"getChildren",
"(",
")",
";",
"for",
"(",
"IntrospectionLevelMember",
"ilm",
":",
"children",
")",
"{",
"ilm",
".",
"print",
"(",
"is",
",",
"maxDepth",
")",
";",
"}",
"}",
"}"
] | Print this IntrospectionLevelMember to an incident stream
@param is
The incident stream
@param maxDepth
The maximum depth to descend | [
"Print",
"this",
"IntrospectionLevelMember",
"to",
"an",
"incident",
"stream"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/IntrospectionLevelMember.java#L435-L447 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecoveryDirectorFactory.java | RecoveryDirectorFactory.recoveryDirector | public static RecoveryDirector recoveryDirector() throws InternalLogException
{
if (tc.isEntryEnabled())
Tr.entry(tc, "recoveryDirector");
// If the recovery director is null its an error in JET
if (_recoveryDirector == null)
{
final InternalLogException ile = new InternalLogException();
if (tc.isEntryEnabled())
Tr.exit(tc, "recoveryDirector", ile);
throw ile;
}
if (tc.isEntryEnabled())
Tr.exit(tc, "recoveryDirector", _recoveryDirector);
return _recoveryDirector;
} | java | public static RecoveryDirector recoveryDirector() throws InternalLogException
{
if (tc.isEntryEnabled())
Tr.entry(tc, "recoveryDirector");
// If the recovery director is null its an error in JET
if (_recoveryDirector == null)
{
final InternalLogException ile = new InternalLogException();
if (tc.isEntryEnabled())
Tr.exit(tc, "recoveryDirector", ile);
throw ile;
}
if (tc.isEntryEnabled())
Tr.exit(tc, "recoveryDirector", _recoveryDirector);
return _recoveryDirector;
} | [
"public",
"static",
"RecoveryDirector",
"recoveryDirector",
"(",
")",
"throws",
"InternalLogException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"recoveryDirector\"",
")",
";",
"// If the recovery director is null its an error in JET",
"if",
"(",
"_recoveryDirector",
"==",
"null",
")",
"{",
"final",
"InternalLogException",
"ile",
"=",
"new",
"InternalLogException",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"recoveryDirector\"",
",",
"ile",
")",
";",
"throw",
"ile",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"recoveryDirector\"",
",",
"_recoveryDirector",
")",
";",
"return",
"_recoveryDirector",
";",
"}"
] | Returns the singleton instance of the RecoveryDirector class. This method
uses reflection rather then a direct reference to the underlying class to avoid
a cyclic build dependency.
@return RecoveryDirector The singleton instance of the RecoveryDirectorImpl. | [
"Returns",
"the",
"singleton",
"instance",
"of",
"the",
"RecoveryDirector",
"class",
".",
"This",
"method",
"uses",
"reflection",
"rather",
"then",
"a",
"direct",
"reference",
"to",
"the",
"underlying",
"class",
"to",
"avoid",
"a",
"cyclic",
"build",
"dependency",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecoveryDirectorFactory.java#L55-L72 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecoveryDirectorFactory.java | RecoveryDirectorFactory.createRecoveryDirector | public static RecoveryDirector createRecoveryDirector()
{
if (tc.isEntryEnabled())
Tr.entry(tc, "createRecoveryDirector");
_recoveryDirector = LibertyRecoveryDirectorImpl.instance();
if (tc.isEntryEnabled())
Tr.exit(tc, "createRecoveryDirector", _recoveryDirector);
return _recoveryDirector;
} | java | public static RecoveryDirector createRecoveryDirector()
{
if (tc.isEntryEnabled())
Tr.entry(tc, "createRecoveryDirector");
_recoveryDirector = LibertyRecoveryDirectorImpl.instance();
if (tc.isEntryEnabled())
Tr.exit(tc, "createRecoveryDirector", _recoveryDirector);
return _recoveryDirector;
} | [
"public",
"static",
"RecoveryDirector",
"createRecoveryDirector",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"createRecoveryDirector\"",
")",
";",
"_recoveryDirector",
"=",
"LibertyRecoveryDirectorImpl",
".",
"instance",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"createRecoveryDirector\"",
",",
"_recoveryDirector",
")",
";",
"return",
"_recoveryDirector",
";",
"}"
] | Create a RecoveryDirector singleton
@return RecoveryDirector instance | [
"Create",
"a",
"RecoveryDirector",
"singleton"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecoveryDirectorFactory.java#L79-L88 | train |