ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1327176 - /webservices/wss4j/trunk/src/main/java/org/apache/ws/security/message/token/UsernameToken.java
Date Tue, 17 Apr 2012 16:36:26 GMT
Author: coheigea
Date: Tue Apr 17 16:36:26 2012
New Revision: 1327176

URL: http://svn.apache.org/viewvc?rev=1327176&view=rev
Log:
[WSS-385] - UsernameToken handles long strings badly

Modified:
    webservices/wss4j/trunk/src/main/java/org/apache/ws/security/message/token/UsernameToken.java

Modified: webservices/wss4j/trunk/src/main/java/org/apache/ws/security/message/token/UsernameToken.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/message/token/UsernameToken.java?rev=1327176&r1=1327175&r2=1327176&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/main/java/org/apache/ws/security/message/token/UsernameToken.java
(original)
+++ webservices/wss4j/trunk/src/main/java/org/apache/ws/security/message/token/UsernameToken.java
Tue Apr 17 16:36:26 2012
@@ -590,10 +590,21 @@ public class UsernameToken {
      */
     private String nodeString(Element e) {
         if (e != null) {
-            Text node = getFirstNode(e);
-            if (node != null) {
-                return node.getData();
+            Node node = e.getFirstChild();
+            StringBuilder builder = new StringBuilder();
+            boolean found = false;
+            while (node != null) {
+                if (Node.TEXT_NODE == node.getNodeType()) {
+                    found = true;
+                    builder.append(((Text)node).getData());
+                }
+                node = node.getNextSibling();
+            }
+            
+            if (!found) {
+                return null;
             }
+            return builder.toString();
         }
         return null;
     }



Mime
View raw message