You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by am...@apache.org on 2008/01/17 07:21:52 UTC

svn commit: r612727 - /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java

Author: amilas
Date: Wed Jan 16 22:21:44 2008
New Revision: 612727

URL: http://svn.apache.org/viewvc?rev=612727&view=rev
Log:
fixed a namesapce adding logic. here we have to think that at the 
axis2 service namesapce context it may have associate a different namesapce prefix
for a targetnamespace other than we expect.
better thing is to check for targetnamesapce and add it with a unique prefix
if it does not exists.

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java?rev=612727&r1=612726&r2=612727&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java Wed Jan 16 22:21:44 2008
@@ -2036,24 +2036,19 @@
         String targetNameSpace = schema.getTargetNamespace();
         String prefix = schema.getNamespaceContext().getPrefix(targetNameSpace);
 
-        boolean found = false;
-        if (namespaceMap != null && namespaceMap.size() > 0) {
-            Iterator itr = namespaceMap.values().iterator();
-            Set keys = namespaceMap.keySet();
-            while (itr.hasNext()) {
-                String value = (String) itr.next();
-                if (value.equals(targetNameSpace) && keys.contains(prefix)) {
-                    found = true;
-                }
-            }
-        }
         if (namespaceMap == null) {
             namespaceMap = new NamespaceMap();
         }
-        if (!found) {
-            namespaceMap.put("ns" + nsCount, targetNameSpace);
-            nsCount++;
+
+        if (!namespaceMap.values().contains(targetNameSpace)){
+            // i.e this target namespace not exists in the namesapce map
+            // find a non exists prefix to add this target namesapce
+            while (namespaceMap.keySet().contains(prefix)){
+                prefix = "ns" + nsCount++;
+            }
+            namespaceMap.put(prefix,targetNameSpace);
         }
+
     }
 
     public Map populateSchemaMappings(){



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org