You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2022/07/01 23:37:21 UTC

[commons-crypto] branch master updated: Minor tidy; no code changes

This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-crypto.git


The following commit(s) were added to refs/heads/master by this push:
     new d6527ce  Minor tidy; no code changes
d6527ce is described below

commit d6527ceb7cad60e0590e3feb657abfcebc8633ea
Author: Sebb <se...@apache.org>
AuthorDate: Sat Jul 2 00:37:13 2022 +0100

    Minor tidy; no code changes
    
    [skip ci]
---
 .../java/org/apache/commons/crypto/NativeCodeLoader.java     | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/commons/crypto/NativeCodeLoader.java b/src/main/java/org/apache/commons/crypto/NativeCodeLoader.java
index 64063a3..0ed1fd2 100644
--- a/src/main/java/org/apache/commons/crypto/NativeCodeLoader.java
+++ b/src/main/java/org/apache/commons/crypto/NativeCodeLoader.java
@@ -38,6 +38,8 @@ import org.apache.commons.crypto.utils.Utils;
  */
 final class NativeCodeLoader {
 
+    private static final String NATIVE_LIBNAME = "commons-crypto";
+
     /**
      * End of file pseudo-character.
      */
@@ -45,7 +47,7 @@ final class NativeCodeLoader {
 
     private static final Throwable loadingError;
 
-    private final static boolean nativeCodeLoaded;
+    private static final boolean nativeCodeLoaded;
 
     static {
         loadingError = loadLibrary(); // will be null if loaded OK
@@ -197,12 +199,8 @@ final class NativeCodeLoader {
 
         // Try to load the library in commons-crypto.lib.path */
         String nativeLibraryPath = props.getProperty(Crypto.LIB_PATH_KEY);
-        String nativeLibraryName = props.getProperty(Crypto.LIB_NAME_KEY);
+        String nativeLibraryName = props.getProperty(Crypto.LIB_NAME_KEY, System.mapLibraryName(NATIVE_LIBNAME));
 
-        // Resolve the library file name with a suffix (e.g., dll, .so, etc.)
-        if (nativeLibraryName == null) {
-            nativeLibraryName = System.mapLibraryName("commons-crypto");
-        }
         if (nativeLibraryPath != null) {
             final File nativeLib = new File(nativeLibraryPath, nativeLibraryName);
             if (nativeLib.exists()) {
@@ -284,7 +282,7 @@ final class NativeCodeLoader {
                 System.load(absolutePath);
             } else {
                 // Load preinstalled library (in the path -Djava.library.path)
-                final String libname = "commons-crypto";
+                final String libname = NATIVE_LIBNAME;
                 debug("System.loadLibrary('%s')", libname);
                 System.loadLibrary(libname);
             }