Another java fix

This commit is contained in:
Ryan Hill 2021-05-10 15:15:05 -07:00
parent 6076ef965b
commit c419ff2487

View file

@ -191,6 +191,9 @@ final class OnnxRuntime {
try (InputStream is = OnnxRuntime.class.getResourceAsStream(resourcePath)) {
if (is == null) {
// 3a) Not found in resources, load from library path
if( !systemLoad ) {
return; // Failure is expected if we try to pull in optional components we don't need to load
}
logger.log(
Level.FINE, "Attempting to load native library '" + library + "' from library path");
System.loadLibrary(library);
@ -219,11 +222,6 @@ final class OnnxRuntime {
logger.log(Level.FINE, "Extracted native library '" + library + "' from resource path");
}
}
} catch (Exception e) {
if (systemLoad) {
// We only throw if we're loading the library, otherwise failure is okay
throw e;
}
} finally {
cleanUp(tempFile, !systemLoad);
}