commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject commons-crypto git commit: CRYPTO-87 Reduce util package API footprint
Date Sat, 25 Jun 2016 12:24:05 GMT
Repository: commons-crypto
Updated Branches:
  refs/heads/master f0ba94cb1 -> 984ee1024


CRYPTO-87 Reduce util package API footprint

Project: http://git-wip-us.apache.org/repos/asf/commons-crypto/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-crypto/commit/984ee102
Tree: http://git-wip-us.apache.org/repos/asf/commons-crypto/tree/984ee102
Diff: http://git-wip-us.apache.org/repos/asf/commons-crypto/diff/984ee102

Branch: refs/heads/master
Commit: 984ee10249aae5c1e48e929b3311aed2abfc45e4
Parents: f0ba94c
Author: Sebb <sebb@apache.org>
Authored: Sat Jun 25 13:24:02 2016 +0100
Committer: Sebb <sebb@apache.org>
Committed: Sat Jun 25 13:24:02 2016 +0100

----------------------------------------------------------------------
 .../apache/commons/crypto/NativeCodeLoader.java | 36 +++++++++++++++++---
 .../org/apache/commons/crypto/utils/Utils.java  | 28 ---------------
 2 files changed, 32 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/984ee102/src/main/java/org/apache/commons/crypto/NativeCodeLoader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/crypto/NativeCodeLoader.java b/src/main/java/org/apache/commons/crypto/NativeCodeLoader.java
index 5c7d1f3..6a89a6f 100644
--- a/src/main/java/org/apache/commons/crypto/NativeCodeLoader.java
+++ b/src/main/java/org/apache/commons/crypto/NativeCodeLoader.java
@@ -27,7 +27,7 @@ import java.net.URL;
 import java.util.Properties;
 import java.util.UUID;
 
-import org.apache.commons.crypto.utils.Utils;
+import org.apache.commons.crypto.conf.ConfigurationKeys;
 
 /**
  * A helper to load the native code i.e. libcommons-crypto.so. This handles the
@@ -73,8 +73,8 @@ final class NativeCodeLoader {
      */
     private static File findNativeLibrary() {
         // Try to load the library in commons-crypto.lib.path */
-        String nativeLibraryPath = Utils.getLibPath();
-        String nativeLibraryName = Utils.getLibName();
+        String nativeLibraryPath = NativeCodeLoader.getLibPath();
+        String nativeLibraryName = NativeCodeLoader.getLibName();
 
         // Resolve the library file name with a suffix (e.g., dll, .so, etc.)
         if (nativeLibraryName == null) {
@@ -110,7 +110,7 @@ final class NativeCodeLoader {
 
         // Temporary folder for the native lib. Use the value of
         // commons-crypto.tempdir or java.io.tmpdir
-        String tempFolder = new File(Utils.getTmpDir()).getAbsolutePath();
+        String tempFolder = new File(NativeCodeLoader.getTmpDir()).getAbsolutePath();
 
         // Extract and load a native library inside the jar file
         return extractLibraryFile(nativeLibraryPath, nativeLibraryName,
@@ -286,4 +286,32 @@ final class NativeCodeLoader {
     static boolean isNativeCodeLoaded() {
         return nativeCodeLoaded;
     }
+
+    /**
+     * Gets the temp directory for extracting crypto library.
+     *
+     * @return the temp directory.
+     */
+    private static String getTmpDir() {
+        return System.getProperty(ConfigurationKeys.LIB_TEMPDIR_KEY,
+                System.getProperty("java.io.tmpdir"));
+    }
+
+    /**
+     * Gets the file name of native library.
+     *
+     * @return the file name of native library.
+     */
+    private static String getLibName() {
+        return System.getProperty(ConfigurationKeys.LIB_NAME_KEY);
+    }
+
+    /**
+     * Gets path of native library.
+     *
+     * @return the path of native library.
+     */
+    private static String getLibPath() {
+        return System.getProperty(ConfigurationKeys.LIB_PATH_KEY);
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/984ee102/src/main/java/org/apache/commons/crypto/utils/Utils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/crypto/utils/Utils.java b/src/main/java/org/apache/commons/crypto/utils/Utils.java
index 5c1800c..3a113f3 100644
--- a/src/main/java/org/apache/commons/crypto/utils/Utils.java
+++ b/src/main/java/org/apache/commons/crypto/utils/Utils.java
@@ -136,34 +136,6 @@ public final class Utils {
     }
 
     /**
-     * Gets path of native library.
-     *
-     * @return the path of native library.
-     */
-    public static String getLibPath() {
-        return System.getProperty(ConfigurationKeys.LIB_PATH_KEY);
-    }
-
-    /**
-     * Gets the file name of native library.
-     *
-     * @return the file name of native library.
-     */
-    public static String getLibName() {
-        return System.getProperty(ConfigurationKeys.LIB_NAME_KEY);
-    }
-
-    /**
-     * Gets the temp directory for extracting crypto library.
-     *
-     * @return the temp directory.
-     */
-    public static String getTmpDir() {
-        return System.getProperty(ConfigurationKeys.LIB_TEMPDIR_KEY,
-                System.getProperty("java.io.tmpdir"));
-    }
-
-    /**
      * <p>
      * This method is only for Counter (CTR) mode. Generally the CryptoCipher
      * calculates the IV and maintain encryption context internally.For example


Mime
View raw message