cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject git commit: Fix how a "default" prefix is added to the provider to avoid two namespaces with the same prefix
Date Fri, 30 May 2014 16:43:01 GMT
Repository: cxf
Updated Branches:
  refs/heads/master e7b4edb1f -> adf3cf437


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/adf3cf43
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/adf3cf43
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/adf3cf43

Branch: refs/heads/master
Commit: adf3cf437d25222533455012005f86f5e92a5f78
Parents: e7b4edb
Author: Daniel Kulp <dkulp@apache.org>
Authored: Fri May 30 12:42:35 2014 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Fri May 30 12:42:35 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/adf3cf43/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