Electrostat-Lab / Electrostat-Lab/jSnapLoader

NativeBinaryLoader.loadLibrary() fails silently if clean extraction fails

Open
#46 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
9
Forks
3
PR merge metrics
No merged PRs in 30d

Description

```java
try {
loader.loadLibrary(LoadingCriterion.CLEAN_EXTRACTION);
} catch (Exception exception) {
throw new IllegalStateException(
"Failed to load a native library!", exception);
}
```

If none of the registered native libraries is loadable (for instance because the libraries with matching predicates are missing from the JAR) the code above does not throw an exception. The failure isn't discovered until the application tries to invoke a native method, at which time a `UnsatisfiedLinkError` is thrown.

I expected an exception to be thrown during `loadLibrary()`. Ideally diagnostics should indicate:
+ which libraries it tried to extract and load
and
+ why each one failed to load.

Contributor guide

Open the contributing guide

Research direction

Start at NativeBinaryLoader.loadLibrary() with LoadingCriterion.CLEAN_EXTRACTION and trace how registered native libraries are extracted and loaded. Done means loadLibrary() throws when no matching library loads and its diagnostics identify each attempted library and why it failed.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.