Author: isapir
Date: Thu Oct  4 21:07:54 2018
New Revision: 1842849

URL: http://svn.apache.org/viewvc?rev=1842849&view=rev
Log:
System.load() expects absolute path.

Error message was being discarded during tests so now it is logged.

Modified:
    tomcat/trunk/java/org/apache/tomcat/jni/Library.java
    tomcat/trunk/test/org/apache/tomcat/util/net/TesterSupport.java
    tomcat/trunk/test/org/apache/tomcat/util/net/openssl/TestOpenSSLConf.java

Modified: tomcat/trunk/java/org/apache/tomcat/jni/Library.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/jni/Library.java?rev=1842849&r1=1842848&r2=1842849&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/jni/Library.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/jni/Library.java Thu Oct  4 21:07:54 
2018
@@ -39,7 +39,7 @@ public final class Library {
         for (int i = 0; i < NAMES.length; i++) {
             File library = new File(binLib, System.mapLibraryName(NAMES[i]));
             try {
-                System.load(library.getPath());
+                System.load(library.getAbsolutePath());
                 loaded = true;
             } catch (ThreadDeath t) {
                 throw t;
@@ -83,7 +83,7 @@ public final class Library {
                             throw t;
                         }
                     }
-                    if (i > 0) {
+                    if (err.length() > 0) {
                         err.append(", ");
                     }
                     err.append(t.getMessage());

Modified: tomcat/trunk/test/org/apache/tomcat/util/net/TesterSupport.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/net/TesterSupport.java?rev=1842849&r1=1842848&r2=1842849&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/tomcat/util/net/TesterSupport.java (original)
+++ tomcat/trunk/test/org/apache/tomcat/util/net/TesterSupport.java Thu Oct  4 
21:07:54 2018
@@ -72,6 +72,7 @@ public final class TesterSupport {
     public static final String LOCALHOST_KEY_PEM = SSL_DIR + 
"localhost-key.pem";
     public static final boolean OPENSSL_AVAILABLE;
     public static final int OPENSSL_VERSION;
+    public static final String OPENSSL_ERROR;
 
     public static final String ROLE = "testrole";
 
@@ -82,16 +83,18 @@ public final class TesterSupport {
     static {
         boolean available = false;
         int version = 0;
+        String err = "";
         try {
             Library.initialize(null);
             available = true;
             version = SSL.version();
             Library.terminate();
         } catch (Exception | LibraryNotFoundError ex) {
-            // Ignore
+            err = ex.getMessage();
         }
         OPENSSL_AVAILABLE = available;
         OPENSSL_VERSION = version;
+        OPENSSL_ERROR = err;
     }
 
     public static boolean isOpensslAvailable() {

Modified: 
tomcat/trunk/test/org/apache/tomcat/util/net/openssl/TestOpenSSLConf.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/net/openssl/TestOpenSSLConf.java?rev=1842849&r1=1842848&r2=1842849&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/tomcat/util/net/openssl/TestOpenSSLConf.java 
(original)
+++ tomcat/trunk/test/org/apache/tomcat/util/net/openssl/TestOpenSSLConf.java 
Thu Oct  4 21:07:54 2018
@@ -87,7 +87,11 @@ public class TestOpenSSLConf extends Tom
 
     @Test
     public void testOpenSSLConfCmdCipher() throws Exception {
-        log.info("Found OpenSSL version 0x" + 
Integer.toHexString(OPENSSL_VERSION));
+        if (TesterSupport.isOpensslAvailable())
+            log.info("Found OpenSSL version 0x" + 
Integer.toHexString(OPENSSL_VERSION));
+        else
+            log.warn("OpenSSL not found: " + TesterSupport.OPENSSL_ERROR);
+
         SSLHostConfig sslHostConfig;
         if (hasTLS13()) {
             // Ensure TLSv1.3 ciphers aren't returned
@@ -106,7 +110,11 @@ public class TestOpenSSLConf extends Tom
 
     @Test
     public void testOpenSSLConfCmdProtocol() throws Exception {
-        log.info("Found OpenSSL version 0x" + 
Integer.toHexString(OPENSSL_VERSION));
+        if (TesterSupport.isOpensslAvailable())
+            log.info("Found OpenSSL version 0x" + 
Integer.toHexString(OPENSSL_VERSION));
+        else
+            log.warn("OpenSSL not found: " + TesterSupport.OPENSSL_ERROR);
+
         Set<String> disabledProtocols = new 
HashSet<>(Arrays.asList(DISABLED_PROTOCOLS));
         StringBuilder sb = new StringBuilder();
         for (String protocol : DISABLED_PROTOCOLS) {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to