When checking the code, I ran into this construct, ContextClassLoader , from what I see was not initialized, it is unclear what the ClassLoader getContextClassLoader() method variable returns to the cl , shouldn't ClassLoader getContextClassLoader() return null ?
ClassLoader getContextClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); // Что содержит CL на данный момент ? } catch (SecurityException ex) { } return cl; } }); } Below is the code inside the Thread class:
@CallerSensitive public ClassLoader getContextClassLoader() { if (contextClassLoader == null) return null; SecurityManager sm = System.getSecurityManager(); if (sm != null) { ClassLoader.checkClassLoaderPermission(contextClassLoader, Reflection.getCallerClass()); } return contextClassLoader; } /* The context ClassLoader for this thread */ private ClassLoader contextClassLoader; public static native Thread currentThread();