You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by co...@apache.org on 2019/02/14 16:27:18 UTC

svn commit: r1853591 - /webservices/wss4j/branches/2_2_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/EncryptionUtils.java

Author: coheigea
Date: Thu Feb 14 16:27:18 2019
New Revision: 1853591

URL: http://svn.apache.org/viewvc?rev=1853591&view=rev
Log:
WSS-644 - Error when a SOAP-Fault is thrown with MTOM enabled

Modified:
    webservices/wss4j/branches/2_2_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/EncryptionUtils.java

Modified: webservices/wss4j/branches/2_2_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/EncryptionUtils.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_2_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/EncryptionUtils.java?rev=1853591&r1=1853590&r2=1853591&view=diff
==============================================================================
--- webservices/wss4j/branches/2_2_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/EncryptionUtils.java (original)
+++ webservices/wss4j/branches/2_2_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/EncryptionUtils.java Thu Feb 14 16:27:18 2019
@@ -398,14 +398,9 @@ public final class EncryptionUtils {
         try {
             document = db.parse(new ByteArrayInputStream(bytes));
         } catch (SAXException ex) {
-            // See if a prefix was not bound. Try to fix the DOM Element in this case.
-            if (ex.getMessage() != null && ex.getMessage().startsWith("The prefix")
-                && ex.getMessage().endsWith("is not bound.")) {
-                String fixedElementStr = setParentPrefixes(encData, new String(bytes));
-                document = db.parse(new ByteArrayInputStream(fixedElementStr.getBytes()));
-            } else {
-                throw ex;
-            }
+            // A prefix may not have been bound, try to fix the DOM Element in this case.
+            String fixedElementStr = setParentPrefixes(encData, new String(bytes));
+            document = db.parse(new ByteArrayInputStream(fixedElementStr.getBytes()));
         }
 
         Node decryptedNode =