cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1058014 - in /cxf/trunk/tools/corba/src: main/java/org/apache/cxf/tools/corba/processors/idl/ConstVisitor.java test/resources/idl/Const.idl test/resources/idl/expected_Const.wsdl
Date Wed, 12 Jan 2011 07:59:28 GMT
Author: ffang
Date: Wed Jan 12 07:59:28 2011
New Revision: 1058014

URL: http://svn.apache.org/viewvc?rev=1058014&view=rev
Log:
[CXF-3239]idl2wsdl fails if invisible const char is defined in IDL

Modified:
    cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ConstVisitor.java
    cxf/trunk/tools/corba/src/test/resources/idl/Const.idl
    cxf/trunk/tools/corba/src/test/resources/idl/expected_Const.wsdl

Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ConstVisitor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ConstVisitor.java?rev=1058014&r1=1058013&r2=1058014&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ConstVisitor.java
(original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ConstVisitor.java
Wed Jan 12 07:59:28 2011
@@ -62,10 +62,17 @@ public class ConstVisitor extends Visito
         AST constTypeNode = constNode.getFirstChild();
         AST constNameNode = TypesUtils.getCorbaTypeNameNode(constTypeNode);
         AST constValueNode = constNameNode.getNextSibling();
-        
         // build value string
         String constValue = constValueNode.toString();
         constValueNode = constValueNode.getFirstChild();
+        if (constValue != null && constValue.length() == 1) {
+            // might be a control char
+            byte ch = (byte)constValue.charAt(0);
+            if (ch >= 0 && ch <= 31) {
+                // ascii code between 0 and 31 is invisible control code
+                constValue = "\\" + Integer.toOctalString(ch);
+            }
+        }
         while (constValueNode != null) {
             constValue = constValue + constValueNode.toString();
             constValueNode = constValueNode.getFirstChild();
@@ -100,4 +107,5 @@ public class ConstVisitor extends Visito
         
         typeMap.getStructOrExceptionOrUnion().add(corbaConst);
     }
+
 }

Modified: cxf/trunk/tools/corba/src/test/resources/idl/Const.idl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/test/resources/idl/Const.idl?rev=1058014&r1=1058013&r2=1058014&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/test/resources/idl/Const.idl (original)
+++ cxf/trunk/tools/corba/src/test/resources/idl/Const.idl Wed Jan 12 07:59:28 2011
@@ -32,6 +32,7 @@ const unsigned long      glob_unsignedlo
 const unsigned long long glob_unsignedlonglong = 123456789;
 
 const char               glob_char             = 'r';  
+const char               glob_char2             = '\2';
 const wchar              glob_wchar            = L'x';  
 
 const boolean            glob_boolean          = FALSE;  

Modified: cxf/trunk/tools/corba/src/test/resources/idl/expected_Const.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/test/resources/idl/expected_Const.wsdl?rev=1058014&r1=1058013&r2=1058014&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/test/resources/idl/expected_Const.wsdl (original)
+++ cxf/trunk/tools/corba/src/test/resources/idl/expected_Const.wsdl Wed Jan 12 07:59:28 2011
@@ -29,6 +29,7 @@
     <corba:const xmlns:xs="http://www.w3.org/2001/XMLSchema" value="4556" idltype="corba:ulong"
type="xs:unsignedInt" name="glob_unsignedlong" />
     <corba:const xmlns:xs="http://www.w3.org/2001/XMLSchema" value="123456789" idltype="corba:ulonglong"
type="xs:unsignedLong" name="glob_unsignedlonglong" />
     <corba:const xmlns:xs="http://www.w3.org/2001/XMLSchema" value="r" idltype="corba:char"
type="xs:byte" name="glob_char" />
+    <corba:const xmlns:xs="http://www.w3.org/2001/XMLSchema" value="\2" idltype="corba:char"
type="xs:byte" name="glob_char2" />
     <corba:const xmlns:xs="http://www.w3.org/2001/XMLSchema" value="x" idltype="corba:wchar"
type="xs:string" name="glob_wchar" />
     <corba:const xmlns:xs="http://www.w3.org/2001/XMLSchema" value="FALSE" idltype="corba:boolean"
type="xs:boolean" name="glob_boolean" />
     <corba:const xmlns:xs="http://www.w3.org/2001/XMLSchema" value="-67.9" idltype="corba:float"
type="xs:float" name="glob_float" />



Mime
View raw message