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/02/15 09:30:41 UTC

svn commit: r1070806 - in /cxf/branches/2.3.x-fixes: ./ tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ tools/corba/src/test/java/org/apache/cxf/tools/corba/ tools/corba/src/test/resources/idl/

Author: ffang
Date: Tue Feb 15 08:30:41 2011
New Revision: 1070806

URL: http://svn.apache.org/viewvc?rev=1070806&view=rev
Log:
Merged revisions 1070799 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1070799 | ffang | 2011-02-15 16:04:04 +0800 (二, 15  2 2011) | 1 line
  
  [CXF-3303]idl2wsdl fails with NPE if a type cannot be resolved
........

Added:
    cxf/branches/2.3.x-fixes/tools/corba/src/test/resources/idl/ReferUndefinedType.idl
      - copied unchanged from r1070799, cxf/trunk/tools/corba/src/test/resources/idl/ReferUndefinedType.idl
Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ConstVisitor.java
    cxf/branches/2.3.x-fixes/tools/corba/src/test/java/org/apache/cxf/tools/corba/IDLToWSDLTest.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ConstVisitor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ConstVisitor.java?rev=1070806&r1=1070805&r2=1070806&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ConstVisitor.java (original)
+++ cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ConstVisitor.java Tue Feb 15 08:30:41 2011
@@ -93,7 +93,9 @@ public class ConstVisitor extends Visito
         } else if (ScopedNameVisitor.accept(getScope(), definition, schema, constTypeNode, wsdlVisitor)) {
             visitor = new ScopedNameVisitor(getScope(), definition, schema, wsdlVisitor);            
         }
-        
+        if (visitor == null) {
+            throw new RuntimeException("can't resolve type for const " + constNameNode.getText());
+        }
         visitor.visit(constTypeNode);                
         XmlSchemaType constSchemaType = visitor.getSchemaType();
         CorbaTypeImpl constCorbaType = visitor.getCorbaType();        

Modified: cxf/branches/2.3.x-fixes/tools/corba/src/test/java/org/apache/cxf/tools/corba/IDLToWSDLTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/tools/corba/src/test/java/org/apache/cxf/tools/corba/IDLToWSDLTest.java?rev=1070806&r1=1070805&r2=1070806&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/tools/corba/src/test/java/org/apache/cxf/tools/corba/IDLToWSDLTest.java (original)
+++ cxf/branches/2.3.x-fixes/tools/corba/src/test/java/org/apache/cxf/tools/corba/IDLToWSDLTest.java Tue Feb 15 08:30:41 2011
@@ -380,5 +380,21 @@ public class IDLToWSDLTest extends ToolT
         doTestGeneratedWsdl(expected, actual);
     }
 
-    
+    public void testUndefinedTypeRef() throws Exception {
+        File input = new File(getClass().getResource("/idl/ReferUndefinedType.idl").toURI());
+        File include1Dir = new File(getClass().getResource("/idl").toURI());
+               
+        String[] args = new String[] {"-ow", "ExternalInterfaceRef.wsdl",
+                                      "-o", output.toString(),
+                                      "-I", include1Dir.toString(),
+                                      "-verbose",
+                                      input.toString()
+        };
+        try {
+            IDLToWSDL.run(args);
+            fail("should throw a RuntimeException");
+        } catch (Exception e) {
+            assertTrue(e.getMessage().indexOf("can't resolve type for const myConst") >= 0);
+        }
+    }
 }