cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [4/7] git commit: Fix how a "default" prefix is added to the provider to avoid two namespaces with the same prefix
Date Wed, 04 Jun 2014 15:11:03 GMT
Fix how a "default" prefix is added to the provider to avoid two namespaces with the same prefix


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/63461405
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/63461405
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/63461405

Branch: refs/heads/2.7.x-fixes
Commit: 63461405e88c07d2df784706183fcff2e3ebaa42
Parents: aa7d417
Author: Daniel Kulp <dkulp@apache.org>
Authored: Fri May 30 12:42:35 2014 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Wed Jun 4 10:49:53 2014 -0400

----------------------------------------------------------------------
 .../apache/cxf/jaxrs/provider/aegis/AegisJSONProvider.java   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/63461405/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/aegis/AegisJSONProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/aegis/AegisJSONProvider.java
b/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/aegis/AegisJSONProvider.java
index 5f82c5c..332f60e 100644
--- a/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/aegis/AegisJSONProvider.java
+++ b/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/aegis/AegisJSONProvider.java
@@ -144,7 +144,13 @@ public final class AegisJSONProvider<T> extends AegisElementProvider<T>
{
         // the namespace map. Oh, the namespace map.
         // This is wrong, but might make unit tests pass until we redesign.
         if (typeToRead != null) {
-            namespaceMap.putIfAbsent(typeToRead.getSchemaType().getNamespaceURI(), "ns1");
+            String pfx = "ns1";
+            int count = 1;
+            while (namespaceMap.containsValue(pfx)) {
+                count++;
+                pfx = "ns" + count;
+            }
+            namespaceMap.putIfAbsent(typeToRead.getSchemaType().getNamespaceURI(), pfx);
         }
         return JSONUtils.createStreamReader(is, readXsiType, namespaceMap);
     }


Mime
View raw message