https://issues.apache.org/bugzilla/show_bug.cgi?id=52563
Bug #: 52563
Summary: Incorrect behavior while checking the thread binding
in DirContextURLStreamHandler
Product: Tomcat 7
Version: trunk
Platform: PC
Status: NEW
Severity: normal
Priority: P2
Component: Catalina
AssignedTo: [email protected]
ReportedBy: [email protected]
Classification: Unclassified
In the get method of DirContextURLStreamHandler class, it seems that binding
value with thread are not processed correctly. Now its value will be only
returned if no binding value on the current thread context classloader and it
has no parent classloader, think that the value will not be returned in most
scenarios.
Think that the code logic should be something like :
a. Check whether a value is binding on the current thread context classloader,
if does then return.
b. Check whether a value is binding with the current thread, if does then
return.
c. Check the classloader hierarchy to find a binding value.
public static DirContext get() {
DirContext result = null;
Thread currentThread = Thread.currentThread();
ClassLoader currentCL = currentThread.getContextClassLoader();
// Checking CL binding
result = clBindings.get(currentCL);
if (result != null)
return result;
// Checking thread biding
result = threadBindings.get(currentThread);
// Checking parent CL binding
currentCL = currentCL.getParent();
while (currentCL != null) {
result = clBindings.get(currentCL);
if (result != null)
return result;
currentCL = currentCL.getParent();
}
if (result == null)
throw new IllegalStateException("Illegal class loader binding");
return result;
}
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]