You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2011/01/11 06:15:57 UTC

svn commit: r1057488 - in /cxf/trunk/tools/corba/src: main/java/org/apache/cxf/tools/corba/processors/idl/StringVisitor.java test/resources/idl/String.idl test/resources/idl/expected_String_unbounded.wsdl

Author: ffang
Date: Tue Jan 11 05:15:56 2011
New Revision: 1057488

URL: http://svn.apache.org/viewvc?rev=1057488&view=rev
Log:
[CXF-3238]idl2wsdl fails when constant is used to define string lenght

Modified:
    cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/StringVisitor.java
    cxf/trunk/tools/corba/src/test/resources/idl/String.idl
    cxf/trunk/tools/corba/src/test/resources/idl/expected_String_unbounded.wsdl

Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/StringVisitor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/StringVisitor.java?rev=1057488&r1=1057487&r2=1057488&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/StringVisitor.java (original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/StringVisitor.java Tue Jan 11 05:15:56 2011
@@ -79,7 +79,15 @@ public class StringVisitor extends Visit
 
         stringNode = node;
         boundNode = stringNode.getFirstChild();
-
+        
+        //get chance to check if bound is symbol name which defined as const,
+        //if so, replace the symbol name with defined const
+        if (boundNode != null) {
+            String constValue = TypesUtils.getConstValueByName(boundNode, typeMap);
+            if (constValue != null) {
+                boundNode.setText(constValue);
+            }
+        }
         if (identifierNode == null) {
             stringScopedName = TypesUtils.generateAnonymousScopedName(getScope(), schema);
         } else {

Modified: cxf/trunk/tools/corba/src/test/resources/idl/String.idl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/test/resources/idl/String.idl?rev=1057488&r1=1057487&r2=1057488&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/test/resources/idl/String.idl (original)
+++ cxf/trunk/tools/corba/src/test/resources/idl/String.idl Tue Jan 11 05:15:56 2011
@@ -17,7 +17,8 @@
  * under the License.
 */ 
 
-typedef string<10> string10;
+const long NAME_LENGTH = 10;
+typedef string<NAME_LENGTH> string10;
 typedef wstring<20> wstring20;
 
 typedef string10  myString10;

Modified: cxf/trunk/tools/corba/src/test/resources/idl/expected_String_unbounded.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/test/resources/idl/expected_String_unbounded.wsdl?rev=1057488&r1=1057487&r2=1057488&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/test/resources/idl/expected_String_unbounded.wsdl (original)
+++ cxf/trunk/tools/corba/src/test/resources/idl/expected_String_unbounded.wsdl Tue Jan 11 05:15:56 2011
@@ -19,7 +19,8 @@
 -->
 <wsdl:definitions targetNamespace="http://cxf.apache.org/bindings/corba/idl/String" xmlns:tns="http://cxf.apache.org/bindings/corba/idl/String" xmlns:corba="http://cxf.apache.org/bindings/corba" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
   <corba:typeMapping targetNamespace="http://cxf.apache.org/bindings/corba/idl/String/typemap">
-    <corba:alias xmlns:xs="http://www.w3.org/2001/XMLSchema" basetype="corba:string" repositoryID="IDL:string10:1.0" type="xs:string" name="string10" />
+    <corba:const xmlns:xs="http://www.w3.org/2001/XMLSchema" value="10" idltype="corba:long" name="NAME_LENGTH" type="xs:int"/>
+    <corba:alias xmlns:xs="http://www.w3.org/2001/XMLSchema" basetype="corba:string" repositoryID="IDL:string10:1.0" name="string10" type="xs:string"/>
     <corba:alias xmlns:xs="http://www.w3.org/2001/XMLSchema" basetype="corba:wstring" repositoryID="IDL:wstring20:1.0" type="xs:string" name="wstring20" />
     <corba:alias xmlns="http://cxf.apache.org/bindings/corba/idl/String/typemap" basetype="string10" repositoryID="IDL:myString10:1.0" name="myString10" />
     <corba:alias xmlns="http://cxf.apache.org/bindings/corba/idl/String/typemap" basetype="wstring20" repositoryID="IDL:myWString20:1.0" name="myWString20" />