cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r745638 - in /cxf/trunk: rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/spring/ rt/bindings/soap/src/main/resources/META-INF/cxf/ tools/common/src/main/java/org/apache/cxf/tools/common/model/ tools/wsdlto/test/src/test/java/org/...
Date Wed, 18 Feb 2009 20:34:13 GMT
Author: dkulp
Date: Wed Feb 18 20:34:10 2009
New Revision: 745638

URL: http://svn.apache.org/viewvc?rev=745638&view=rev
Log:
[CXF-918] Make sure exception is thrown if parameter names match, but types are different
Another attempt to support spring 3.0 along with spring 2.0 and 2.5

Added:
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/spring/SoapVersionRegistrar.java
  (with props)
Modified:
    cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/cxf/cxf-extension-soap.xml
    cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaMethod.java
    cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/Messages.properties
    cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java

Added: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/spring/SoapVersionRegistrar.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/spring/SoapVersionRegistrar.java?rev=745638&view=auto
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/spring/SoapVersionRegistrar.java
(added)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/spring/SoapVersionRegistrar.java
Wed Feb 18 20:34:10 2009
@@ -0,0 +1,38 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.binding.soap.spring;
+
+import org.apache.cxf.binding.soap.SoapVersion;
+import org.apache.cxf.binding.soap.SoapVersionEditor;
+import org.springframework.beans.PropertyEditorRegistrar;
+import org.springframework.beans.PropertyEditorRegistry;
+
+/**
+ * 
+ */
+public class SoapVersionRegistrar implements PropertyEditorRegistrar {
+
+    /** {@inheritDoc}*/
+    public void registerCustomEditors(PropertyEditorRegistry registry) {
+        registry.registerCustomEditor(SoapVersion.class,
+                                      new SoapVersionEditor());
+    }
+
+}

Propchange: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/spring/SoapVersionRegistrar.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/spring/SoapVersionRegistrar.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/cxf/cxf-extension-soap.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/cxf/cxf-extension-soap.xml?rev=745638&r1=745637&r2=745638&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/cxf/cxf-extension-soap.xml (original)
+++ cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/cxf/cxf-extension-soap.xml Wed
Feb 18 20:34:10 2009
@@ -53,11 +53,10 @@
         
 	<bean id="org.apache.cxf.binding.soap.customEditorConfigurer"
 		class="org.springframework.beans.factory.config.CustomEditorConfigurer">
-		<property name="customEditors">
-			<map>
-				<entry key="org.apache.cxf.binding.soap.SoapVersion" 
-					value="org.apache.cxf.binding.soap.SoapVersionEditor"/>
-			</map>
+		<property name="propertyEditorRegistrars">
+			<list>
+				<bean class="org.apache.cxf.binding.soap.spring.SoapVersionRegistrar"/>
+			</list>
 		</property>
 	</bean>
 </beans>

Modified: cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaMethod.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaMethod.java?rev=745638&r1=745637&r2=745638&view=diff
==============================================================================
--- cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaMethod.java
(original)
+++ cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaMethod.java
Wed Feb 18 20:34:10 2009
@@ -35,6 +35,8 @@
 
 public class JavaMethod implements JavaAnnotatable {
     private static final Logger LOG = LogUtils.getL7dLogger(JavaMethod.class);
+    private static final Map<String, String> PRIMITIVE_MAP;
+    
     private String name;
     private String operationName;
     private String javaDoc;
@@ -54,6 +56,18 @@
 
     private boolean async;
     
+    static { 
+        PRIMITIVE_MAP = new HashMap<String, String>();
+        PRIMITIVE_MAP.put("java.lang.Character", "char");
+        PRIMITIVE_MAP.put("java.lang.Boolean", "boolean");
+        PRIMITIVE_MAP.put("java.lang.Integer", "int");
+        PRIMITIVE_MAP.put("java.lang.Long", "long");
+        PRIMITIVE_MAP.put("java.lang.Short", "short");
+        PRIMITIVE_MAP.put("java.lang.Byte", "byte");
+        PRIMITIVE_MAP.put("java.lang.Float", "float");
+        PRIMITIVE_MAP.put("java.lang.Double", "double");
+    }
+
     public JavaMethod() {
         this(new JavaInterface());
     }
@@ -138,15 +152,27 @@
         parameters.add(index, p2);
     }
 
+    private boolean isEquiv(String c1, String c2) {
+        //for the "in/out" params, we need to check if the 
+        //primitive in is being changed to an in/out
+        //which would no longer be primitive
+        String s = PRIMITIVE_MAP.get(c2);
+        if (s != null && c1.equals(s)) {
+            return true;
+        }
+        return c1.equals(c2);
+    }
     public void addParameter(JavaParameter param) {
         if (hasParameter(param.getName())) {
             JavaParameter paramInList = getParameter(param.getName());
-            if (paramInList.isIN() || paramInList.isINOUT()) {
+            if (isEquiv(paramInList.getClassName(), param.getClassName())
+                && paramInList.isIN() || paramInList.isINOUT()) {
                 //removeParameter(paramInList);
                 replaceParameter(paramInList, param);
                 return;
             } else {
-                Message message = new Message("PARAMETER_ALREADY_EXIST", LOG, param.getName());
+                Message message = new Message("PARAMETER_ALREADY_EXIST", LOG, param.getName(),

+                                              getName(), paramInList.getType(), param.getType());
                 throw new ToolException(message);
             }
         }

Modified: cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/Messages.properties?rev=745638&r1=745637&r2=745638&view=diff
==============================================================================
--- cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/Messages.properties
(original)
+++ cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/Messages.properties
Wed Feb 18 20:34:10 2009
@@ -18,7 +18,7 @@
 #    under the License.
 #
 #
-PARAMETER_ALREADY_EXIST = Parameter: {0} already exists in the wsdl model
+PARAMETER_ALREADY_EXIST = Parameter: {0} already exists for method {1} but of type {2} instead
of {3}.  Use a JAXWS/JAXB binding customization to rename the parameter.
 CREATE_JAXBRICONTEXT_EXCEPTION = Failed to create jaxbRIContext
 FAIL_TO_CREATE_WSDL_DEFINITION = Failed to create wsdl definition in WSDLModel
 FAIL_TO_CREATE_JAVA_PARAMETER = Failed to create java parameter for part [{0}] in method
[{1}] - this wsdl is invalid, please use the wsdlvalidator tool to validate this wsdl

Modified: cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=745638&r1=745637&r2=745638&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
(original)
+++ cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
Wed Feb 18 20:34:10 2009
@@ -706,10 +706,15 @@
     }
     @Test
     public void testNonWrapperStyleNameCollision() throws Exception {
-        env.put(ToolConstants.CFG_WSDLURL,
-                getLocation("/wsdl2java_wsdl/cxf918/bug2.wsdl"));
-        processor.setContext(env);
-        processor.execute();
+        try {
+            env.put(ToolConstants.CFG_WSDLURL,
+                    getLocation("/wsdl2java_wsdl/cxf918/bug2.wsdl"));
+            processor.setContext(env);
+            processor.execute();
+            fail("The cxf918/bug2.wsdl should not have generated code");
+        } catch (Exception e) {
+            assertTrue(e.getMessage(), e.getMessage().contains("theSameNameFieldDifferentDataType"));
+        } 
     }
 
     @Test



Mime
View raw message