From e5725d1e2539ccd8705fe59110fae4c70b7d14ce Mon Sep 17 00:00:00 2001 From: Ceriel Jacobs Date: Tue, 10 Apr 2018 16:23:40 +0200 Subject: [PATCH] Removed debug prints, added cause to UnsatisfiedLinkException --- src/vlog/java/karmaresearch/vlog/VLog.java | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/vlog/java/karmaresearch/vlog/VLog.java b/src/vlog/java/karmaresearch/vlog/VLog.java index 54db0a35..d29edfca 100644 --- a/src/vlog/java/karmaresearch/vlog/VLog.java +++ b/src/vlog/java/karmaresearch/vlog/VLog.java @@ -16,8 +16,6 @@ */ public class VLog { - private static final boolean DEBUG = false; - private static final AtomicInteger VlogCounter = new AtomicInteger(0); static { @@ -33,10 +31,6 @@ private static void loadLibrary(String s) { // First try to just load the shared library. try { System.loadLibrary(s); - if (DEBUG) { - System.out - .println("Loaded " + s + " with System.loadLibrary()"); - } } catch (Throwable ex) { // Did not work, now try to load it from the same directory as the // jar file. First determine prefix and suffix, depending on OS. @@ -47,7 +41,9 @@ private static void loadLibrary(String s) { jarFile = new File(VLog.class.getProtectionDomain() .getCodeSource().getLocation().toURI()); } catch (Throwable e) { - throw new UnsatisfiedLinkError(e.getMessage()); + throw (UnsatisfiedLinkError) new UnsatisfiedLinkError( + "while loading " + s + ": " + e.getMessage()) + .initCause(e.getCause()); } // Next, determine OS. @@ -69,21 +65,16 @@ private static void loadLibrary(String s) { try { loadFromDir(jarFile, libName); - if (DEBUG) { - System.out.println("Loaded " + s - + " from the directory in which the jar resides"); - } } catch (Throwable e) { try { loadFromJar(jarFile, libName, os); - if (DEBUG) { - System.out.println("Loaded " + s + " from the jar"); - } } catch (Throwable e1) { // System.err.println("Could not load library " + s // + ", exceptions are temporarily disabled to accomodate // windows version"); - throw new UnsatisfiedLinkError(e1.getMessage()); + throw (UnsatisfiedLinkError) new UnsatisfiedLinkError( + "while loading " + s + ": " + e1.getMessage()) + .initCause(e1.getCause()); } } }