ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sam...@apache.org
Subject cvs commit: ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info Type.java
Date Tue, 10 Aug 2004 06:54:43 GMT
samisa      2004/08/09 23:54:43

  Modified:    c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info Type.java
  Log:
  Keyword conflicts and use of ANON_TOKEN problems solved
  
  Revision  Changes    Path
  1.17      +34 -9     ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/Type.java
  
  Index: Type.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/Type.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Type.java	6 Aug 2004 14:44:45 -0000	1.16
  +++ Type.java	10 Aug 2004 06:54:43 -0000	1.17
  @@ -34,6 +34,7 @@
   import org.apache.axis.wsdl.wsdl2ws.WrapperConstants;
   import org.apache.axis.wsdl.wsdl2ws.WrapperUtils;
   import org.apache.axis.wsdl.wsdl2ws.CUtils;
  +import org.apache.axis.wsdl.symbolTable.SymbolTable;
   
   public class Type {
       /* max no of attribs expected in a type */
  @@ -153,12 +154,22 @@
    * they will convert to "name"  Is that acceptable ....  
    */
       public void setTypeForAttributeName(String attribName, Type type) {
  -		attribName = TypeMap.resoleveWSDL2LanguageNameClashes(attribName,this.language);
  +	//Samisa:	
  +        // Check to see if this is an anonymous type,
  +        // if it is, replace Axis' ANON_TOKEN with
  +        // an underscore to make sure we don't run
  +        // into name collisions with similarly named
  +        // non-anonymous types
  +        StringBuffer sb = new StringBuffer(attribName);
  +        int aidx = -1;
   
  -	        if (attribName.lastIndexOf('>') > 1 )
  -		{
  -		    attribName =attribName.substring(attribName.lastIndexOf('>')+1,attribName.length());
  -                }	 
  +        while ((aidx = sb.toString().indexOf(SymbolTable.ANON_TOKEN)) > -1) {
  +            sb.replace(aidx, aidx + SymbolTable.ANON_TOKEN.length(), "_");
  +        }
  +
  +        attribName = sb.toString();
  +
  +        attribName = TypeMap.resoleveWSDL2LanguageNameClashes(attribName,this.language);
   
           if (hasOrder)
               this.attribOrder.add(attribName);
  @@ -183,10 +194,24 @@
   	public void setTypeNameForElementName(ElementInfo element) {
   		String attribName = TypeMap.resoleveWSDL2LanguageNameClashes(element.getName().getLocalPart(),this.language);
   
  -		if (attribName.lastIndexOf('>') > 1 )
  -            	{
  - 		    attribName =attribName.substring(attribName.lastIndexOf('>')+1,attribName.length());

  -		}                		
  +        	//Samisa:	
  +        	// Check to see if this is an anonymous type,
  +	        // if it is, replace Axis' ANON_TOKEN with
  +        	// an underscore to make sure we don't run
  +	        // into name collisions with similarly named
  +        	// non-anonymous types
  +	        StringBuffer sb = new StringBuffer(attribName);
  +        	int aidx = -1;
  +
  +	        while ((aidx = sb.toString().indexOf(SymbolTable.ANON_TOKEN)) > -1) {
  +        	    sb.replace(aidx, aidx + SymbolTable.ANON_TOKEN.length(), "_");
  +	        }
  +
  +        	attribName = sb.toString();
  +		
  +		// Samisa: This second call to TypeMap.resoleveWSDL2LanguageNameClashes
  +		// is made to make sure after replacinf ANON_TOKEN it is still not a keyword
  +	        attribName = TypeMap.resoleveWSDL2LanguageNameClashes(attribName,this.language);
   
   		if (hasOrder)
   			this.attribOrder.add(attribName);
  
  
  

Mime
View raw message