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 2015/06/03 17:04:06 UTC

svn commit: r1683359 - /santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/XMLCipher.java

Author: coheigea
Date: Wed Jun  3 15:04:05 2015
New Revision: 1683359

URL: http://svn.apache.org/r1683359
Log:
Avoid potential NPE in XMLCipher

Modified:
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/XMLCipher.java

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/XMLCipher.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/XMLCipher.java?rev=1683359&r1=1683358&r2=1683359&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/XMLCipher.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/XMLCipher.java Wed Jun  3 15:04:05 2015
@@ -3645,8 +3645,12 @@ public class XMLCipher {
                     new javax.xml.transform.stream.StreamSource(
                             new java.io.ByteArrayInputStream(xml.getBytes("UTF-8"))), domResult);
 
-            final boolean result = "http://www.w3.org/2000/xmlns/".equals(
+            boolean result = false;
+            if (domResult.getNode().getFirstChild().getFirstChild().hasAttributes()
+                && domResult.getNode().getFirstChild().getFirstChild().getAttributes().getLength() >= 1) {
+                result = "http://www.w3.org/2000/xmlns/".equals(
                     domResult.getNode().getFirstChild().getFirstChild().getAttributes().item(1).getNamespaceURI());
+            }
             log.debug("Have functional IdentityTransformer: " + result);
             return result;