You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by th...@apache.org on 2011/09/29 13:10:25 UTC

svn commit: r1177261 - in /axis/axis2/java/rampart/branches/1_6: ./ modules/rampart-core/src/main/java/org/apache/rampart/util/Axis2Util.java

Author: thilinamb
Date: Thu Sep 29 11:10:24 2011
New Revision: 1177261

URL: http://svn.apache.org/viewvc?rev=1177261&view=rev
Log:
Committing the patch provided by AmilaJ for RAMPART-336.

Modified:
    axis/axis2/java/rampart/branches/1_6/   (props changed)
    axis/axis2/java/rampart/branches/1_6/modules/rampart-core/src/main/java/org/apache/rampart/util/Axis2Util.java

Propchange: axis/axis2/java/rampart/branches/1_6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Sep 29 11:10:24 2011
@@ -1 +1 @@
-/axis/axis2/java/rampart/trunk:1072266-1072267,1072300,1072313-1072314,1072316,1072321,1072324,1073746,1074043,1074447,1074534,1075676,1075683-1075684,1083686,1087998,1088013,1088558,1088571,1089599,1129515,1129552,1130570,1131278,1132548,1132564,1134446,1134683,1137396,1144616,1157613,1157670,1157672,1157674,1157724,1157731,1172842,1175271,1175324
+/axis/axis2/java/rampart/trunk:1072266-1072267,1072300,1072313-1072314,1072316,1072321,1072324,1073746,1074043,1074447,1074534,1075676,1075683-1075684,1083686,1087998,1088013,1088558,1088571,1089599,1129515,1129552,1130570,1131278,1132548,1132564,1134446,1134683,1137396,1144616,1157613,1157670,1157672,1157674,1157724,1157731,1172842,1175271,1175324,1177260

Modified: axis/axis2/java/rampart/branches/1_6/modules/rampart-core/src/main/java/org/apache/rampart/util/Axis2Util.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/1_6/modules/rampart-core/src/main/java/org/apache/rampart/util/Axis2Util.java?rev=1177261&r1=1177260&r2=1177261&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/1_6/modules/rampart-core/src/main/java/org/apache/rampart/util/Axis2Util.java (original)
+++ axis/axis2/java/rampart/branches/1_6/modules/rampart-core/src/main/java/org/apache/rampart/util/Axis2Util.java Thu Sep 29 11:10:24 2011
@@ -195,6 +195,10 @@ public class Axis2Util {
                         // it is a header we have added in rampart eg. EncryptedHeader and should
                         // be converted to SOAPHeaderBlock for processing
                     	} else {
+                            // First detach element from soap header
+                            element.detach();
+
+                            // add new element
                     		header = soapHeader.addHeaderBlock(element.getLocalName(), element.getNamespace());
                     		Iterator attrIter = element.getAllAttributes();
                     		while (attrIter.hasNext()) {
@@ -209,14 +213,17 @@ public class Axis2Util {
                     		// retrieve all child nodes (including any text nodes)
                     		// and re-attach to header block
                     		Iterator children = element.getChildren();
-                    		while (children.hasNext()) {
+
+                            // Element is a composite element, in which it has many siblings.
+                            // All siblings will be added when we add a single node.
+                            // See ParentNode.insertBefore(Node newChild, Node refChild) for
+                            // more information.
+                    		if (children.hasNext()) {
                     			OMNode child = (OMNode)children.next();
                     			children.remove();
                     			header.addChild(child);
                     		}
-                    		
-                    		element.detach();
-                    		
+
                     		soapHeader.build();
                     		
                     		header.setProcessed();