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 na...@apache.org on 2006/07/08 13:39:14 UTC

svn commit: r420099 - /webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.java

Author: nadiramra
Date: Sat Jul  8 04:39:12 2006
New Revision: 420099

URL: http://svn.apache.org/viewvc?rev=420099&view=rev
Log:
Stage 1: Infrastructure to handle generation of unique names in order to better handle the
generation of anonymous type - i.e. the generation of names that do not include the parent. 
Basically instead of generation __Type1_Ident type, we would simply generate Ident type.
The code in this commit has a routine that ensures names are unique. 

Modified:
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.java

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.java?rev=420099&r1=420098&r2=420099&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.java Sat Jul  8 04:39:12 2006
@@ -1084,6 +1084,8 @@
      */
     public static String getUniqueName(String oldName)
     {
+        int i;
+        
         // Should never happen, but just in case.
         if (oldName == null)
             return oldName;
@@ -1093,16 +1095,17 @@
         
         // If name was not in hash table, generate one, store in hash table.
         if (newName == null)
-        {
-            newName = oldName;
-            
-            // get name after last '>'
-            int anonCharIndex = oldName.lastIndexOf(SymbolTable.ANON_TOKEN);
-            if (anonCharIndex != -1)
-                newName = oldName.substring(anonCharIndex+1);
+        {            
+            // Anonymous names start with '>'. For example, '>Type'. However, if it was 
+            // nested, then it would be something like '>>Type>Type2'. 
+            // We should really be nice and get the name after last '>', but at this 
+            // time we will simply by-pass starting '>' and start with the first 
+            // character not equal to '>'.          
+            for (i=0; oldName.charAt(i) == SymbolTable.ANON_TOKEN; ++i);
+            newName = oldName.substring(i);
             
             // Ensure invalid characters are replaced
-            for( int i=0; i < Array.getLength(invalidCChars); i++)
+            for(i=0; i < Array.getLength(invalidCChars); i++)
                 newName = newName.replace((char)invalidCChars[i], '_');             
             
             // Ensure name does not conflict with language constructs



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