cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r594154 - in /incubator/cxf/branches/2.0.x-fixes: ./ tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/ tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/
Date Mon, 12 Nov 2007 14:13:23 GMT
Author: dkulp
Date: Mon Nov 12 06:13:22 2007
New Revision: 594154

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

........
  r594076 | mmao | 2007-11-12 05:30:25 -0500 (Mon, 12 Nov 2007) | 4 lines
  
  CXF-1200
    wsdltojava accepts targetnamespace with ':' in the name but generate code that does not
compile
........

Added:
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/wrong_tns.wsdl
      - copied unchanged from r594076, incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/wrong_tns.wsdl
Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java

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

Modified: incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java?rev=594154&r1=594153&r2=594154&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
Mon Nov 12 06:13:22 2007
@@ -19,7 +19,9 @@
 
 package org.apache.cxf.tools.validator.internal;
 
+import java.net.MalformedURLException;
 import java.net.URISyntaxException;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -120,13 +122,25 @@
 
         try {
             schemas.add(ValidatorUtil.getSchema(this.definition));
+            checkTargetNamespace(this.definition.getTargetNamespace());
             if (importedDefinitions != null) {
                 for (Definition d : importedDefinitions) {
+                    checkTargetNamespace(d.getTargetNamespace());
                     schemas.add(ValidatorUtil.getSchema(d));
                 }
             }
         } catch (Exception ex) {
             throw new ToolException(ex);
+        }
+    }
+
+    private void checkTargetNamespace(String path) {
+        try {
+            if (new URL(path).getPath().indexOf(":") != -1) {
+                throw new ToolException(": is not a valid char in the targetNamespace");
+            }
+        } catch (MalformedURLException e) {
+            // do nothing
         }
     }
 

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java?rev=594154&r1=594153&r2=594154&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
Mon Nov 12 06:13:22 2007
@@ -1121,4 +1121,16 @@
         assertTrue(contents.indexOf("SOAPBinding.ParameterStyle.BARE") != -1);
         assertTrue(contents.indexOf("@ResponseWrapper") == -1);
     }
+
+    @Test
+    public void testWrongTNS() {
+        try {
+            env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/wrong_tns.wsdl"));
+            processor.setContext(env);
+            processor.execute();
+            fail("The targetNamespce is not valid");
+        } catch (Exception e) {
+            assertTrue(e.getMessage().indexOf(": is not a valid char in the targetNamespace")
!= -1);
+        }
+    }
 }



Mime
View raw message