Skip to content

Commit

Permalink
NativeLibraryLoader: Don't check UnsatisfiedLinkError message
Browse files Browse the repository at this point in the history
We currently check the message text of an UnsatisfiedLinkError to decide
if we should try to load a library from user.home/user.dir when loading
from the temporary directory fails. The idea is that only certain
failures merit that fallback.

Unfortunately, checking the message text of an UnsatisfiedLinkError is
not reliable.

Since this operation only happens once upon load, remove that
optimization, and try all other paths regardless of message text.

#140
  • Loading branch information
kohlschuetter committed Sep 29, 2023
1 parent 71a134b commit 09548da
Showing 1 changed file with 0 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicBoolean;
Expand Down Expand Up @@ -194,11 +193,6 @@ synchronized String load() throws IOException, LinkageError {
try {
System.load(libFile.getAbsolutePath());
} catch (UnsatisfiedLinkError e) {
String message = e.getMessage().toLowerCase(Locale.getDefault());
if (!message.contains("perm")) {
throw e;
}

// Operation not permitted; permission denied; EPERM...
// -> tmp directory may be mounted with "noexec", try loading from user.home, user.dir

Expand Down

0 comments on commit 09548da

Please sign in to comment.