[jffi-next] 24/49: Make the stub lib path searching actually work.
Tim Potter
tpot-guest at moszumanska.debian.org
Wed Mar 4 04:51:11 UTC 2015
This is an automated email from the git hooks/post-receive script.
tpot-guest pushed a commit to annotated tag upstream/1.0.10
in repository jffi-next.
commit aa4930ccfe72a0d76fe6aed726038ed4f126d04d
Author: Wayne Meissner <wmeissner at gmail.com>
Date: Sun Mar 6 19:10:56 2011 +1000
Make the stub lib path searching actually work.
---
src/com/kenai/jffi/Init.java | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/com/kenai/jffi/Init.java b/src/com/kenai/jffi/Init.java
index 1a35732..5691d6c 100644
--- a/src/com/kenai/jffi/Init.java
+++ b/src/com/kenai/jffi/Init.java
@@ -39,6 +39,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
+import java.util.Arrays;
import java.util.Properties;
/**
@@ -173,18 +174,22 @@ final class Init {
String stubPath = getStubLibraryPath();
ClassLoader cl = Init.class.getClassLoader();
InputStream is = null;
-
- for (String path : new String[] { stubPath, "/" + stubPath }) {
+ String[] paths = { stubPath, "/" + stubPath };
+
+ for (String path : paths) {
is = cl.getResourceAsStream(path);
// On MacOS, the stub might be named .dylib or .jnilib - cater for both
if (is == null && Platform.getPlatform().getOS() == Platform.OS.DARWIN) {
is = cl.getResourceAsStream(path.replaceAll("dylib", "jnilib"));
- }
+ }
+ if (is != null) {
+ break;
+ }
}
if (is == null) {
- throw new UnsatisfiedLinkError("Could not locate stub library ("
- + stubPath + ") in jar file");
+ throw new UnsatisfiedLinkError("Could not locate stub library"
+ + " in jar file. Tried " + Arrays.deepToString(paths));
}
return is;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jffi-next.git
More information about the pkg-java-commits
mailing list