You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2013/10/24 20:33:35 UTC

svn commit: r1535486 - in /cxf/trunk/tools/corba/src: main/generated/org/apache/cxf/tools/corba/processors/idl/ main/java/org/apache/cxf/tools/corba/processors/idl/ test/java/org/apache/cxf/tools/corba/ test/resources/idl/

Author: dkulp
Date: Thu Oct 24 18:33:34 2013
New Revision: 1535486

URL: http://svn.apache.org/r1535486
Log:
[CXF-5340] - Handling quoted literals and exception members

"local" literal was incorrectly treated as literal.
exception members' types where not identified correctly - "unsigned
long" was treated as "unsigned" type with name "long"

Patch from Grzegorz Grzybek applied

Added:
    cxf/trunk/tools/corba/src/test/resources/idl/CXF5340.idl
Modified:
    cxf/trunk/tools/corba/src/main/generated/org/apache/cxf/tools/corba/processors/idl/IDLLexer.java
    cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ExceptionVisitor.java
    cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/idl.g
    cxf/trunk/tools/corba/src/test/java/org/apache/cxf/tools/corba/IDLToWSDLTest.java

Modified: cxf/trunk/tools/corba/src/main/generated/org/apache/cxf/tools/corba/processors/idl/IDLLexer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/generated/org/apache/cxf/tools/corba/processors/idl/IDLLexer.java?rev=1535486&r1=1535485&r2=1535486&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/generated/org/apache/cxf/tools/corba/processors/idl/IDLLexer.java (original)
+++ cxf/trunk/tools/corba/src/main/generated/org/apache/cxf/tools/corba/processors/idl/IDLLexer.java Thu Oct 24 18:33:34 2013
@@ -348,7 +348,6 @@ tryAgain:
 				}
 				if ( _returnToken==null ) continue tryAgain; // found SKIP token
 				_ttype = _returnToken.getType();
-				_ttype = testLiteralsTable(_ttype);
 				_returnToken.setType(_ttype);
 				return _returnToken;
 			}

Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ExceptionVisitor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ExceptionVisitor.java?rev=1535486&r1=1535485&r2=1535486&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ExceptionVisitor.java (original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ExceptionVisitor.java Thu Oct 24 18:33:34 2013
@@ -99,7 +99,7 @@ public class ExceptionVisitor extends Vi
         // exception members
         AST memberTypeNode = identifierNode.getNextSibling();
         while (memberTypeNode != null) {
-            AST memberNode = memberTypeNode.getNextSibling();
+            AST memberNode = TypesUtils.getCorbaTypeNameNode(memberTypeNode);
 
             TypesVisitor visitor = new TypesVisitor(exceptionScope,
                                                     definition,

Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/idl.g
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/idl.g?rev=1535486&r1=1535485&r2=1535486&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/idl.g (original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/idl.g Thu Oct 24 18:33:34 2013
@@ -954,6 +954,7 @@ options {
 	exportVocab=IDL;
 	charVocabulary='\u0000'..'\uFFFE';
 	k=4;
+	testLiterals=false;
 }
 
 SEMI

Modified: cxf/trunk/tools/corba/src/test/java/org/apache/cxf/tools/corba/IDLToWSDLTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/test/java/org/apache/cxf/tools/corba/IDLToWSDLTest.java?rev=1535486&r1=1535485&r2=1535486&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/test/java/org/apache/cxf/tools/corba/IDLToWSDLTest.java (original)
+++ cxf/trunk/tools/corba/src/test/java/org/apache/cxf/tools/corba/IDLToWSDLTest.java Thu Oct 24 18:33:34 2013
@@ -435,4 +435,39 @@ public class IDLToWSDLTest extends ToolT
         String s = StaxUtils.toString(doc.getDocumentElement());
         assertTrue(s.contains("name=\"myStruct\""));
     }
+
+    public void testCXF5340() throws Exception {
+        File input = new File(getClass().getResource("/idl/CXF5340.idl").toURI());
+        String[] args = new String[] {
+            "-o", output.toString(),
+            "-verbose", "-qualified",
+            input.toString()
+        };
+        IDLToWSDL.run(args);
+        File fs = new File(output, "CXF5340.wsdl");
+        assertTrue(fs.getName() + " was not created.", fs.exists());
+
+        String corbaNs = "http://cxf.apache.org/bindings/corba";
+        Document doc = StaxUtils.read(new FileInputStream(fs));
+
+        // const with value "local"
+        NodeList nl = doc.getDocumentElement().getElementsByTagNameNS(corbaNs, "const");
+        assertEquals(1, nl.getLength());
+        Element c = (Element)nl.item(0);
+        assertEquals("repro.NOT_CONN_LOCAL", c.getAttribute("name"));
+        assertEquals("local", c.getAttribute("value"));
+
+        // unsigned long case
+        nl = doc.getDocumentElement().getElementsByTagNameNS(corbaNs, "exception");
+        assertEquals(1, nl.getLength());
+        Element exception = (Element)nl.item(0);
+        nl = exception.getElementsByTagNameNS(corbaNs, "member");
+        assertEquals(2, nl.getLength());
+        Element number = (Element)nl.item(0);
+        assertEquals("ulong", number.getAttribute("idltype").split(":")[1]);
+        assertEquals("m_number", number.getAttribute("name"));
+        Element message = (Element)nl.item(1);
+        assertEquals("string", message.getAttribute("idltype").split(":")[1]);
+        assertEquals("m_message", message.getAttribute("name"));
+    }
 }

Added: cxf/trunk/tools/corba/src/test/resources/idl/CXF5340.idl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/test/resources/idl/CXF5340.idl?rev=1535486&view=auto
==============================================================================
--- cxf/trunk/tools/corba/src/test/resources/idl/CXF5340.idl (added)
+++ cxf/trunk/tools/corba/src/test/resources/idl/CXF5340.idl Thu Oct 24 18:33:34 2013
@@ -0,0 +1,26 @@
+module repro {
+
+	const string NOT_CONN_LOCAL = "local";
+
+	// Exceptions of this type may be thrown by the following interfaces
+	exception msgError {
+		unsigned long	m_number;		// error number
+		string			m_message;		// error text
+	};
+
+	enum Reply {
+			positive	// i.e. Ok or Yes
+		,	negative	// i.e. No or Cancel
+		,	_dont_use_3	// don't use, align to hbMsg.h
+		,	_dont_use_4	// don't use, align to hbMsg.h
+		,	_dont_use_5	// don't use, align to hbMsg.h
+		,	errTimeout	// i.e. there was a timeout in a timed request
+		,	errError	// i.e. there was an error during the request
+		,	cancelled	// i.e. some person or some process cancelled the request
+	};
+
+	interface Service {
+		Reply getFirst( in Reply rep, out Reply reply ) raises (msgError);
+	};
+
+};