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 2023/11/27 11:33:26 UTC

(commons-crypto) branch master updated: Clarify that constant is a property name

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 b2979482 Clarify that constant is a property name
b2979482 is described below

commit b2979482eccddbd64d0c7bc2f7f00f56ad2e4beb
Author: Sebb <se...@apache.org>
AuthorDate: Mon Nov 27 11:33:19 2023 +0000

    Clarify that constant is a property name
---
 src/main/java/org/apache/commons/crypto/Crypto.java          | 12 ++++++------
 .../org/apache/commons/crypto/jna/LibreSsl20XNativeJna.java  |  2 +-
 .../org/apache/commons/crypto/jna/OpenSsl11XNativeJna.java   |  2 +-
 .../org/apache/commons/crypto/jna/OpenSsl30XNativeJna.java   |  2 +-
 src/main/java/org/apache/commons/crypto/jna/OpenSslJna.java  |  4 ++--
 .../java/org/apache/commons/crypto/jna/OpenSslNativeJna.java |  8 ++++----
 src/main/java/org/apache/commons/crypto/utils/Utils.java     |  4 ++--
 7 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/main/java/org/apache/commons/crypto/Crypto.java b/src/main/java/org/apache/commons/crypto/Crypto.java
index 5aca20ad..2facf3f1 100644
--- a/src/main/java/org/apache/commons/crypto/Crypto.java
+++ b/src/main/java/org/apache/commons/crypto/Crypto.java
@@ -86,23 +86,23 @@ public final class Crypto {
      * Where to find the SSL crypto library when using JNI
      * This is used in Utils.libraryPath()
     */
-    public static final String JNI_LIBRARY_PATH = "jni.library.path";
+    public static final String JNI_LIBRARY_PATH_PROPERTY = "jni.library.path";
 
     /**
      * Override property for the default SSL crypto library name when using JNI
      */
-    public static final String JNI_LIBRARY_NAME = "commons.crypto.OpenSslNativeJni";
+    public static final String JNI_LIBRARY_NAME_PROPERTY = "commons.crypto.OpenSslNativeJni";
 
     /**
      * Where to find the SSL crypto library when using JNA
      * This is used by the JNA library code
     */
-    public static final String JNA_LIBRARY_PATH = "jna.library.path";
+    public static final String JNA_LIBRARY_PATH_PROPERTY = "jna.library.path";
 
     /**
      * Override property for the default SSL crypto library name when using JNA
      */
-    public static final String JNA_LIBRARY_NAME = Crypto.CONF_PREFIX + "OpenSslNativeJna";
+    public static final String JNA_LIBRARY_NAME_PROPERTY = Crypto.CONF_PREFIX + "OpenSslNativeJna";
 
     /** Default name for loading SSL crypto library using JNA */
     public static final String JNA_LIBRARY_NAME_DEFAULT = "crypto";
@@ -184,8 +184,8 @@ public final class Crypto {
      */
     public static void main(final String[] args) throws Exception {
         quiet = args.length == 1 && args[0].equals("-q");
-        info("%s=%s", JNI_LIBRARY_PATH, System.getProperty(JNI_LIBRARY_PATH));
-        info("%s=%s", JNI_LIBRARY_NAME, System.getProperty(JNI_LIBRARY_NAME));
+        info("%s=%s", JNI_LIBRARY_PATH_PROPERTY, System.getProperty(JNI_LIBRARY_PATH_PROPERTY));
+        info("%s=%s", JNI_LIBRARY_NAME_PROPERTY, System.getProperty(JNI_LIBRARY_NAME_PROPERTY));
         info("%s %s", getComponentName(), getComponentVersion());
         if (isNativeCodeLoaded()) {
             info("Native code loaded OK: %s", OpenSslInfoNative.NativeVersion());
diff --git a/src/main/java/org/apache/commons/crypto/jna/LibreSsl20XNativeJna.java b/src/main/java/org/apache/commons/crypto/jna/LibreSsl20XNativeJna.java
index 74aa6f7f..5deb4c86 100644
--- a/src/main/java/org/apache/commons/crypto/jna/LibreSsl20XNativeJna.java
+++ b/src/main/java/org/apache/commons/crypto/jna/LibreSsl20XNativeJna.java
@@ -37,7 +37,7 @@ final class LibreSsl20XNativeJna implements OpenSslInterfaceNativeJna {
         boolean ok = false;
         Throwable thrown = null;
         try {
-            final String libName = System.getProperty(Crypto.JNA_LIBRARY_NAME, Crypto.JNA_LIBRARY_NAME_DEFAULT);
+            final String libName = System.getProperty(Crypto.JNA_LIBRARY_NAME_PROPERTY, Crypto.JNA_LIBRARY_NAME_DEFAULT);
             OpenSslJna.debug("Native.register('%s')", libName);
             Native.register(libName);
             ok = true;
diff --git a/src/main/java/org/apache/commons/crypto/jna/OpenSsl11XNativeJna.java b/src/main/java/org/apache/commons/crypto/jna/OpenSsl11XNativeJna.java
index 153c5a17..e70971f5 100644
--- a/src/main/java/org/apache/commons/crypto/jna/OpenSsl11XNativeJna.java
+++ b/src/main/java/org/apache/commons/crypto/jna/OpenSsl11XNativeJna.java
@@ -36,7 +36,7 @@ final class OpenSsl11XNativeJna  implements OpenSslInterfaceNativeJna {
         boolean ok = false;
         Throwable thrown = null;
         try {
-            final String libName = System.getProperty(Crypto.JNA_LIBRARY_NAME, Crypto.JNA_LIBRARY_NAME_DEFAULT);
+            final String libName = System.getProperty(Crypto.JNA_LIBRARY_NAME_PROPERTY, Crypto.JNA_LIBRARY_NAME_DEFAULT);
             OpenSslJna.debug("Native.register('%s')", libName);
             Native.register(libName);
             ok = true;
diff --git a/src/main/java/org/apache/commons/crypto/jna/OpenSsl30XNativeJna.java b/src/main/java/org/apache/commons/crypto/jna/OpenSsl30XNativeJna.java
index 8d8acc80..5db9d4f4 100644
--- a/src/main/java/org/apache/commons/crypto/jna/OpenSsl30XNativeJna.java
+++ b/src/main/java/org/apache/commons/crypto/jna/OpenSsl30XNativeJna.java
@@ -38,7 +38,7 @@ final class OpenSsl30XNativeJna implements OpenSslInterfaceNativeJna {
         boolean ok = false;
         Throwable thrown = null;
         try {
-            final String libName = System.getProperty(Crypto.JNA_LIBRARY_NAME, Crypto.JNA_LIBRARY_NAME_DEFAULT);
+            final String libName = System.getProperty(Crypto.JNA_LIBRARY_NAME_PROPERTY, Crypto.JNA_LIBRARY_NAME_DEFAULT);
             OpenSslJna.debug("Native.register('%s')", libName);
             Native.register(libName);
             ok = true;
diff --git a/src/main/java/org/apache/commons/crypto/jna/OpenSslJna.java b/src/main/java/org/apache/commons/crypto/jna/OpenSslJna.java
index 9bb1c934..4906b117 100644
--- a/src/main/java/org/apache/commons/crypto/jna/OpenSslJna.java
+++ b/src/main/java/org/apache/commons/crypto/jna/OpenSslJna.java
@@ -98,9 +98,9 @@ public final class OpenSslJna {
      */
     public static void main(final String[] args) throws Throwable {
         // These are used by JNA code if defined:
-        info("%s=%s", Crypto.JNA_LIBRARY_PATH, System.getProperty(Crypto.JNA_LIBRARY_PATH));
+        info("%s=%s", Crypto.JNA_LIBRARY_PATH_PROPERTY, System.getProperty(Crypto.JNA_LIBRARY_PATH_PROPERTY));
         info("jna.platform.library.path=%s", System.getProperty("jna.platform.library.path"));
-        info("%s=%s\n", Crypto.JNA_LIBRARY_NAME, System.getProperty(Crypto.JNA_LIBRARY_NAME));
+        info("%s=%s\n", Crypto.JNA_LIBRARY_NAME_PROPERTY, System.getProperty(Crypto.JNA_LIBRARY_NAME_PROPERTY));
         // can set jna.debug_load=true for loading info
         info(Crypto.getComponentName() + " OpenSslJna: enabled = %s, version = 0x%08X", isEnabled(), OpenSslNativeJna.VERSION);
         final Throwable initialisationError = initialisationError();
diff --git a/src/main/java/org/apache/commons/crypto/jna/OpenSslNativeJna.java b/src/main/java/org/apache/commons/crypto/jna/OpenSslNativeJna.java
index 82fc8142..b7071545 100644
--- a/src/main/java/org/apache/commons/crypto/jna/OpenSslNativeJna.java
+++ b/src/main/java/org/apache/commons/crypto/jna/OpenSslNativeJna.java
@@ -53,18 +53,18 @@ final class OpenSslNativeJna {
 
     static {
         OpenSslJna.debug("OpenSslNativeJna static init start");
-        final String libraryName = System.getProperty(Crypto.JNA_LIBRARY_NAME, Crypto.JNA_LIBRARY_NAME_DEFAULT);
+        final String libraryName = System.getProperty(Crypto.JNA_LIBRARY_NAME_PROPERTY, Crypto.JNA_LIBRARY_NAME_DEFAULT);
         OpenSslJna.debug("OpenSslNativeJna NativeLibrary.getInstance('%s')", libraryName);
         // CRYPTO-179 - avoid crash
         if ("Mac OS X".equals(System.getProperty("os.name"))
-            && System.getProperty(Crypto.JNA_LIBRARY_NAME, "").isEmpty()
-            && System.getProperty(Crypto.JNA_LIBRARY_PATH, "").isEmpty()
+            && System.getProperty(Crypto.JNA_LIBRARY_NAME_PROPERTY, "").isEmpty()
+            && System.getProperty(Crypto.JNA_LIBRARY_PATH_PROPERTY, "").isEmpty()
         ) {
             String ret = OpenSslMacOS.checkLibrary(Crypto.MACOS_LIBRARY_NAME_DEFAULT);
             if (ret != null) {
                 throw new UnsatisfiedLinkError(
                     String.format("Cannot load default library '%s'; please define %s! (%s)",
-                        Crypto.MACOS_LIBRARY_NAME_DEFAULT, Crypto.JNA_LIBRARY_PATH, ret));
+                        Crypto.MACOS_LIBRARY_NAME_DEFAULT, Crypto.JNA_LIBRARY_PATH_PROPERTY, ret));
             }
         }
         @SuppressWarnings("resource") // NativeLibrary.getInstance returns a singleton
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 27afb62b..fbc61ec2 100644
--- a/src/main/java/org/apache/commons/crypto/utils/Utils.java
+++ b/src/main/java/org/apache/commons/crypto/utils/Utils.java
@@ -212,8 +212,8 @@ public final class Utils {
      * Do not change the method name or its signature!
      */
     static String libraryPath(final String name) {
-        final String overridename = System.getProperty(Crypto.JNI_LIBRARY_NAME, name);
-        final String override = System.getProperty(Crypto.JNI_LIBRARY_PATH);
+        final String overridename = System.getProperty(Crypto.JNI_LIBRARY_NAME_PROPERTY, name);
+        final String override = System.getProperty(Crypto.JNI_LIBRARY_PATH_PROPERTY);
         if (override != null && new File(override).isDirectory()) {
             return new File(override, overridename).getPath();
         }