You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by co...@apache.org on 2018/02/26 12:32:47 UTC

svn commit: r1825365 - in /santuario/xml-security-java/branches/2.0.x-fixes/src/main/java/org/apache/xml/security/keys/keyresolver/implementations: EncryptedKeyResolver.java RSAKeyValueResolver.java

Author: coheigea
Date: Mon Feb 26 12:32:47 2018
New Revision: 1825365

URL: http://svn.apache.org/viewvc?rev=1825365&view=rev
Log:
Avoiding some potential NPEs when debug logging is enabled

Modified:
    santuario/xml-security-java/branches/2.0.x-fixes/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/EncryptedKeyResolver.java
    santuario/xml-security-java/branches/2.0.x-fixes/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/RSAKeyValueResolver.java

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/EncryptedKeyResolver.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/EncryptedKeyResolver.java?rev=1825365&r1=1825364&r2=1825365&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/EncryptedKeyResolver.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/EncryptedKeyResolver.java Mon Feb 26 12:32:47 2018
@@ -107,14 +107,14 @@ public class EncryptedKeyResolver extend
     public SecretKey engineLookupAndResolveSecretKey(
         Element element, String baseURI, StorageResolver storage
     ) {
-        if (log.isDebugEnabled()) {
-            log.debug("EncryptedKeyResolver - Can I resolve " + element.getTagName());
-        }
-
         if (element == null) {
             return null;
         }
 
+        if (log.isDebugEnabled()) {
+            log.debug("EncryptedKeyResolver - Can I resolve " + element.getTagName());
+        }
+
         SecretKey key = null;
         boolean isEncryptedKey =
             XMLUtils.elementIsInEncryptionSpace(element, EncryptionConstants._TAG_ENCRYPTEDKEY);

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/RSAKeyValueResolver.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/RSAKeyValueResolver.java?rev=1825365&r1=1825364&r2=1825365&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/RSAKeyValueResolver.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/RSAKeyValueResolver.java Mon Feb 26 12:32:47 2018
@@ -40,13 +40,14 @@ public class RSAKeyValueResolver extends
     public PublicKey engineLookupAndResolvePublicKey(
         Element element, String baseURI, StorageResolver storage
     ) {
-        if (log.isDebugEnabled()) {
-            log.debug("Can I resolve " + element.getTagName());
-        }
         if (element == null) {
             return null;
         }
 
+        if (log.isDebugEnabled()) {
+            log.debug("Can I resolve " + element.getTagName());
+        }
+
         boolean isKeyValue = XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_KEYVALUE);
         Element rsaKeyElement = null;
         if (isKeyValue) {