Skip to content

Commit d140d9e

Browse files
committed
FileLocator: docs about ClassLoaders
1 parent fdcfe49 commit d140d9e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

snaploader/src/main/java/electrostatic4j/snaploader/filesystem/FileLocator.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,15 @@ public void initialize(int size) throws IOException {
152152
protected void classPathRoutine() {
153153
SnapLoaderLogger.log(Level.INFO, getClass().getName(), "initialize(int)",
154154
"File locator initialized using classpath routine with hash key #" + getHashKey());
155-
// use the AppClassLoader, a BuiltinClassLoader to get the resources from the classpath
155+
// Use the AppClassLoader, a BuiltinClassLoader to get the resources from the classpath
156156
// notice that the JVM Classloaders are arranged in a tree-like structure
157157
// 1) The BootStrap ClassLoader is the most ancestor
158158
// 2) The Java Platform ClassLoader is the next in the tree.
159159
// 3) The AppClassLoader is the last in the tree.
160+
// So, each one backs up to its ancestor!
161+
// However, all those classloaders are loaded by the BootStrap, so if
162+
// getClassLoader() is invoked on them, it will return "null" pointer
163+
// indicating the invalidity of active loaders
160164
this.fileInputStream = getClass().getClassLoader().getResourceAsStream(filePath);
161165
}
162166

0 commit comments

Comments
 (0)