Author: ema
Date: Mon Mar 11 07:58:53 2013
New Revision: 1455034
URL: http://svn.apache.org/r1455034
Log:
[CXF-4874]:Data types for Fields not correctly published in WSDL from Exception
classes;Apply patcdh from mustafa
Added:
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/ListException2.java
(with props)
Modified:
cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo2.java
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo2Impl.java
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/ListException.java
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
Modified:
cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java?rev=1455034&r1=1455033&r2=1455034&view=diff
==============================================================================
---
cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
(original)
+++
cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
Mon Mar 11 07:58:53 2013
@@ -535,6 +535,12 @@ class JAXBSchemaInitializer extends Serv
for (Field f : Utils.getFields(cls, accessType)) {
//map field
Type type = Utils.getFieldType(f);
+ //we want to return the right type for collections so if we get
null
+ //from the return type we check if it's ParameterizedType and get
the
+ //generic return type.
+ if ((type == null) && (f.getGenericType() instanceof
ParameterizedType)) {
+ type = f.getGenericType();
+ }
JAXBBeanInfo beanInfo = getBeanInfo(type);
if (beanInfo != null) {
addElement(schema, seq, beanInfo, new QName(namespace,
f.getName()), isArray(type));
Modified:
cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java?rev=1455034&r1=1455033&r2=1455034&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java
(original)
+++ cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java
Mon Mar 11 07:58:53 2013
@@ -205,6 +205,9 @@ final class Utils {
static Class<?> getFieldType(Field f) {
XmlJavaTypeAdapter adapter = getFieldXJTA(f);
+ if (adapter == null && f.getGenericType() instanceof
ParameterizedType) {
+ return null;
+ }
Class<?> adapterType = (Class<?>)getTypeFromXmlAdapter(adapter);
return adapterType != null ? adapterType : f.getType();
}
Modified:
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo2.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo2.java?rev=1455034&r1=1455033&r2=1455034&view=diff
==============================================================================
---
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo2.java
(original)
+++
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo2.java
Mon Mar 11 07:58:53 2013
@@ -23,4 +23,5 @@ import javax.jws.WebService;
@WebService(targetNamespace = "http://cxf.apache.org/test/ListService", name =
"ListService")
public interface Echo2 {
String echo(String request) throws ListException;
+ String echo2(String request) throws ListException2;
}
Modified:
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo2Impl.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo2Impl.java?rev=1455034&r1=1455033&r2=1455034&view=diff
==============================================================================
---
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo2Impl.java
(original)
+++
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo2Impl.java
Mon Mar 11 07:58:53 2013
@@ -28,5 +28,10 @@ public class Echo2Impl implements Echo2
return "Response";
}
+
+ public String echo2(String request) throws ListException2 {
+ return "Response";
+
+ }
}
Modified:
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/ListException.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/ListException.java?rev=1455034&r1=1455033&r2=1455034&view=diff
==============================================================================
---
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/ListException.java
(original)
+++
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/ListException.java
Mon Mar 11 07:58:53 2013
@@ -27,7 +27,6 @@ public class ListException extends Excep
private static final long serialVersionUID = 1L;
private List<MyData> names;
-
public List<MyData> getNames() {
return names;
}
Added:
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/ListException2.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/ListException2.java?rev=1455034&view=auto
==============================================================================
---
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/ListException2.java
(added)
+++
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/ListException2.java
Mon Mar 11 07:58:53 2013
@@ -0,0 +1,29 @@
+/**
+ * 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.tools.fortest.exception;
+
+import java.util.List;
+
+public class ListException2 extends Exception {
+
+ private static final long serialVersionUID = 1L;
+ //CHECKSTYLE:OFF
+ public List<MyData> address;
+ //CHECKSTYLE:ON
+}
Propchange:
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/ListException2.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/ListException2.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified:
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java?rev=1455034&r1=1455033&r2=1455034&view=diff
==============================================================================
---
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
(original)
+++
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
Mon Mar 11 07:58:53 2013
@@ -772,6 +772,9 @@ public class JavaToProcessorTest extends
int unboundIndex = wsdlContent
.indexOf("<xs:element maxOccurs=\"unbounded\" minOccurs=\"0\"
name=\"names\" type=\"tns:myData\"/>");
assertTrue(unboundIndex > -1);
+ unboundIndex = wsdlContent
+ .indexOf("<xs:element maxOccurs=\"unbounded\" minOccurs=\"0\"
name=\"address\" type=\"tns:myData\"/>");
+ assertTrue(unboundIndex > -1);
}
@Test