Skip to content

Commit 8e5a9e1

Browse files
committed
FileLocator#classPathRoutine(): refactored the assertion to the FilesystemResourceInitializationException
1 parent b1b4342 commit 8e5a9e1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,10 @@ public void initialize(int size) throws IOException {
148148

149149
/**
150150
* Commands for the classpath routines.
151+
*
152+
* @throws FilesystemResourceInitializationException if the classpath routine fails to locate the file.
151153
*/
152-
protected void classPathRoutine() {
154+
protected void classPathRoutine() throws FilesystemResourceInitializationException {
153155
SnapLoaderLogger.log(Level.INFO, getClass().getName(), "initialize(int)",
154156
"File locator initialized using classpath routine with hash key #" + getHashKey());
155157
// Use the AppClassLoader, a BuiltinClassLoader to get the resources from the classpath
@@ -162,8 +164,9 @@ protected void classPathRoutine() {
162164
// getClassLoader() is invoked on them, it will return "null" pointer
163165
// indicating the invalidity of active loaders
164166
this.fileInputStream = getClass().getClassLoader().getResourceAsStream(filePath);
165-
assert (this.fileInputStream != null):
166-
"Classpath Routine failed: the file is not in the classpath!";
167+
if (this.fileInputStream == null) {
168+
throw new FilesystemResourceInitializationException("Classpath Routine failed: the file is not in the classpath!");
169+
}
167170
}
168171

169172
/**

0 commit comments

Comments
 (0)