Repository: logging-log4j2
Updated Branches:
  refs/heads/master 741be7fc6 -> d8fd76440


[LOG4J2-2015] Allow KeyStoreConfiguration and TrustStoreConfiguration to
find files as resources. Better logging and exception reporting.

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/d8fd7644
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/d8fd7644
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/d8fd7644

Branch: refs/heads/master
Commit: d8fd76440e58faa1134b729167ed312185ba4d41
Parents: 741be7f
Author: Gary Gregory <[email protected]>
Authored: Tue Aug 15 17:01:58 2017 -0600
Committer: Gary Gregory <[email protected]>
Committed: Tue Aug 15 17:01:58 2017 -0600

----------------------------------------------------------------------
 .../net/ssl/AbstractKeyStoreConfiguration.java  | 24 ++++++++++----------
 .../net/ssl/StoreConfigurationException.java    |  4 ++++
 2 files changed, 16 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d8fd7644/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/AbstractKeyStoreConfiguration.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/AbstractKeyStoreConfiguration.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/AbstractKeyStoreConfiguration.java
index 6530b21..95d6ec2 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/AbstractKeyStoreConfiguration.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/AbstractKeyStoreConfiguration.java
@@ -57,7 +57,7 @@ public class AbstractKeyStoreConfiguration extends 
StoreConfiguration<KeyStore>
     @Override
     protected KeyStore load() throws StoreConfigurationException {
         final String loadLocation = this.getLocation();
-        LOGGER.debug("Loading keystore from file with params(location={})", 
loadLocation);
+        LOGGER.debug("Loading keystore from location {}", loadLocation);
         try {
             if (loadLocation == null) {
                 throw new IOException("The location is null");
@@ -65,24 +65,24 @@ public class AbstractKeyStoreConfiguration extends 
StoreConfiguration<KeyStore>
             try (final InputStream fin = openInputStream(loadLocation)) {
                 final KeyStore ks = KeyStore.getInstance(this.keyStoreType);
                 ks.load(fin, this.getPasswordAsCharArray());
-                LOGGER.debug("Keystore successfully loaded with 
params(location={})", loadLocation);
+                LOGGER.debug("KeyStore successfully loaded from location {}", 
loadLocation);
                 return ks;
             }
         } catch (final CertificateException e) {
-            LOGGER.error("No Provider supports a KeyStoreSpi implementation 
for the specified type" + this.keyStoreType, e);
-            throw new StoreConfigurationException(e);
+            LOGGER.error("No Provider supports a KeyStoreSpi implementation 
for the specified type {} for location {}", this.keyStoreType, loadLocation, e);
+            throw new StoreConfigurationException(loadLocation, e);
         } catch (final NoSuchAlgorithmException e) {
-            LOGGER.error("The algorithm used to check the integrity of the 
keystore cannot be found", e);
-            throw new StoreConfigurationException(e);
+            LOGGER.error("The algorithm used to check the integrity of the 
keystore cannot be found for location {}", loadLocation, e);
+            throw new StoreConfigurationException(loadLocation, e);
         } catch (final KeyStoreException e) {
-            LOGGER.error(e);
-            throw new StoreConfigurationException(e);
+            LOGGER.error("KeyStoreException for location {}", loadLocation, e);
+            throw new StoreConfigurationException(loadLocation, e);
         } catch (final FileNotFoundException e) {
-            LOGGER.error("The keystore file(" + loadLocation + ") is not 
found", e);
-            throw new StoreConfigurationException(e);
+            LOGGER.error("The keystore file {} is not found", loadLocation, e);
+            throw new StoreConfigurationException(loadLocation, e);
         } catch (final IOException e) {
-            LOGGER.error("Something is wrong with the format of the keystore 
or the given password", e);
-            throw new StoreConfigurationException(e);
+            LOGGER.error("Something is wrong with the format of the keystore 
or the given password for location", loadLocation, e);
+            throw new StoreConfigurationException(loadLocation, e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d8fd7644/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/StoreConfigurationException.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/StoreConfigurationException.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/StoreConfigurationException.java
index 00d3f32..793e6df 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/StoreConfigurationException.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/StoreConfigurationException.java
@@ -29,4 +29,8 @@ public class StoreConfigurationException extends Exception {
     public StoreConfigurationException(final String message) {
         super(message);
     }
+
+    public StoreConfigurationException(String message, Exception e) {
+        super(message, e);
+    }
 }

Reply via email to