cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1295714 - in /cxf/trunk/api/src: main/java/org/apache/cxf/staxutils/transform/ test/java/org/apache/cxf/staxutils/resources/ test/java/org/apache/cxf/staxutils/transform/
Date Thu, 01 Mar 2012 17:58:19 GMT
Author: ay
Date: Thu Mar  1 17:58:19 2012
New Revision: 1295714

URL: http://svn.apache.org/viewvc?rev=1295714&view=rev
Log:
[CXF-4150] Transform feature's OutTransformWriter may not correctly generate namespace declarations

Added:
    cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/resources/wstrustReqSTRC.xml   (with
props)
    cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/resources/wstrustReqSTRCIn1.xml 
 (with props)
Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/transform/OutTransformWriter.java
    cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/transform/InTransformReaderTest.java
    cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/transform/OutTransformWriterTest.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/transform/OutTransformWriter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/transform/OutTransformWriter.java?rev=1295714&r1=1295713&r2=1295714&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/transform/OutTransformWriter.java
(original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/transform/OutTransformWriter.java
Thu Mar  1 17:58:19 2012
@@ -20,8 +20,6 @@ package org.apache.cxf.staxutils.transfo
 
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -43,7 +41,6 @@ public class OutTransformWriter extends 
     private QNamesMap attributesMap;
     private Map<QName, ElementProperty> appendMap = new HashMap<QName, ElementProperty>(5);
     private Map<String, String> nsMap = new HashMap<String, String>(5);
-    private List<Set<String>> writtenUris = new LinkedList<Set<String>>();
     
     private Set<QName> dropElements;
     private Stack<List<ParsingEvent>> pushedAheadEvents = new Stack<List<ParsingEvent>>();
@@ -96,7 +93,7 @@ public class OutTransformWriter extends 
         
         uri = value != null ? value : uri;
         
-        if (writtenUris.get(0).contains(uri)) {
+        if (prefix.equals(getPrefix(uri))) {
             return;
         }
         
@@ -108,7 +105,6 @@ public class OutTransformWriter extends 
             }
             super.writeNamespace(prefix, uri);
         }
-        writtenUris.get(0).add(uri);
     }
     
     @Override
@@ -117,13 +113,6 @@ public class OutTransformWriter extends 
         if (matchesDropped(false)) {
             return;
         }
-        Set<String> s;
-        if (writtenUris.isEmpty()) {
-            s = new HashSet<String>();
-        } else {
-            s = new HashSet<String>(writtenUris.get(0));
-        }
-        writtenUris.add(0, s);
         
         final QName theName = new QName(uri, local, prefix);
         final ElementProperty appendProp = appendMap.remove(theName);
@@ -243,9 +232,7 @@ public class OutTransformWriter extends 
         } else if (dropDepth > 0) {
             dropDepth = 0;
         }
-        if (!writtenUris.isEmpty()) {
-            writtenUris.remove(0);
-        }
+
         QName theName = elementsStack.pop();
         final boolean dropped = dropElements.contains(theName);
         if (!dropped) {

Added: cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/resources/wstrustReqSTRC.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/resources/wstrustReqSTRC.xml?rev=1295714&view=auto
==============================================================================
Binary file - no diff available.

Propchange: cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/resources/wstrustReqSTRC.xml
------------------------------------------------------------------------------
    svn:mime-type = application/xml

Added: cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/resources/wstrustReqSTRCIn1.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/resources/wstrustReqSTRCIn1.xml?rev=1295714&view=auto
==============================================================================
Binary file - no diff available.

Propchange: cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/resources/wstrustReqSTRCIn1.xml
------------------------------------------------------------------------------
    svn:mime-type = application/xml

Modified: cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/transform/InTransformReaderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/transform/InTransformReaderTest.java?rev=1295714&r1=1295713&r2=1295714&view=diff
==============================================================================
--- cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/transform/InTransformReaderTest.java
(original)
+++ cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/transform/InTransformReaderTest.java
Thu Mar  1 17:58:19 2012
@@ -424,4 +424,18 @@ public class InTransformReaderTest exten
         
     }
 
+    @Test
+    public void testOldSTSTransform() throws Exception {
+        Map<String, String> transformElements = new HashMap<String, String>();
+
+        transformElements.put("{http://docs.oasis-open.org/ws-sx/ws-trust/200512}*",
+                              "{http://schemas.xmlsoap.org/ws/2005/02/trust}*");
+        
+
+        TransformTestUtils.transformInStreamAndCompare("../resources/wstrustReqSTRCIn1.xml",

+                                                     "../resources/wstrustReqSTRC.xml",
+                                  transformElements, null, null, null, null);
+        
+    }
+
 }

Modified: cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/transform/OutTransformWriterTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/transform/OutTransformWriterTest.java?rev=1295714&r1=1295713&r2=1295714&view=diff
==============================================================================
--- cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/transform/OutTransformWriterTest.java
(original)
+++ cxf/trunk/api/src/test/java/org/apache/cxf/staxutils/transform/OutTransformWriterTest.java
Thu Mar  1 17:58:19 2012
@@ -396,4 +396,14 @@ public class OutTransformWriterTest exte
         
     }
     
+    @Test
+    public void testOldSTSTransform() throws Exception {
+        Map<String, String> transformElements = new HashMap<String, String>();
+        transformElements.put("{http://docs.oasis-open.org/ws-sx/ws-trust/200512}*",
+                              "{http://schemas.xmlsoap.org/ws/2005/02/trust}*");
+
+        TransformTestUtils.transformOutStreamAndCompare("../resources/wstrustReqSTRCIn1.xml",

+                                                     "../resources/wstrustReqSTRC.xml",
+                                  transformElements, null, null, null, null);
+    }
 }



Mime
View raw message