cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1295952 - /cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/transform/OutTransformWriter.java
Date Thu, 01 Mar 2012 22:28:52 GMT
Author: ay
Date: Thu Mar  1 22:28:52 2012
New Revision: 1295952

URL: http://svn.apache.org/viewvc?rev=1295952&view=rev
Log:
[CXF-4150] modified the previous fix to avoid jaxrs systests regression erros

Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/transform/OutTransformWriter.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=1295952&r1=1295951&r2=1295952&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 22:28:52 2012
@@ -20,6 +20,8 @@ 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;
@@ -41,6 +43,7 @@ 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>>();
@@ -93,7 +96,8 @@ public class OutTransformWriter extends 
         
         uri = value != null ? value : uri;
         
-        if (prefix.equals(getPrefix(uri))) {
+        if (writtenUris.get(0).contains(uri) 
+            && (prefix.length() == 0 || prefix.equals(getPrefix(uri)))) {
             return;
         }
         
@@ -105,6 +109,7 @@ public class OutTransformWriter extends 
             }
             super.writeNamespace(prefix, uri);
         }
+        writtenUris.get(0).add(uri);
     }
     
     @Override
@@ -113,6 +118,13 @@ 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);
@@ -232,7 +244,9 @@ 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) {



Mime
View raw message