Hi, devs, in the get method of DirContextURLStreamHandler class, I saw the
codes below :
--->
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);
<-------------- Here, the value from threadBindings is always ignored ? is
there something like "if (result != null) return result;" required there ?
// 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;
}
--
Ivan