Author: ema Date: Tue Mar 5 07:47:50 2013 New Revision: 1452683 URL: http://svn.apache.org/r1452683 Log: Merged revisions 1452682 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes
................ r1452682 | ema | 2013-03-05 15:40:59 +0800 (Tue, 05 Mar 2013) | 16 lines Merged revisions 1452681 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes ................ r1452681 | ema | 2013-03-05 15:37:24 +0800 (Tue, 05 Mar 2013) | 9 lines Merged revisions 1452679 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1452679 | ema | 2013-03-05 15:26:00 +0800 (Tue, 05 Mar 2013) | 1 line [CXF-4847]:Data types not correctly published in WSDL from Exception classes;Apply patch from mustafa ........ ................ ................ Added: cxf/branches/2.5.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo2.java - copied unchanged from r1452682, cxf/branches/2.6.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo2.java cxf/branches/2.5.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo2Impl.java - copied unchanged from r1452682, cxf/branches/2.6.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo2Impl.java cxf/branches/2.5.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/ListException.java - copied unchanged from r1452682, cxf/branches/2.6.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/ListException.java cxf/branches/2.5.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/MyData.java - copied unchanged from r1452682, cxf/branches/2.6.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/MyData.java Modified: cxf/branches/2.5.x-fixes/ (props changed) cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java cxf/branches/2.5.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java Propchange: cxf/branches/2.5.x-fixes/ ------------------------------------------------------------------------------ Merged /cxf/branches/2.7.x-fixes:r1452681 Merged /cxf/trunk:r1452679 Merged /cxf/branches/2.6.x-fixes:r1452682 Propchange: cxf/branches/2.5.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java?rev=1452683&r1=1452682&r2=1452683&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java (original) +++ cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java Tue Mar 5 07:47:50 2013 @@ -539,6 +539,12 @@ class JAXBSchemaInitializer extends Serv for (Method m : Utils.getGetters(cls, accessType)) { //map method Type type = Utils.getMethodReturnType(m); + // 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) && (m.getGenericReturnType() instanceof ParameterizedType)) { + type = m.getGenericReturnType(); + } JAXBBeanInfo beanInfo = getBeanInfo(type); if (beanInfo != null) { int idx = m.getName().startsWith("get") ? 3 : 2; Modified: cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java?rev=1452683&r1=1452682&r2=1452683&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java (original) +++ cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java Tue Mar 5 07:47:50 2013 @@ -211,8 +211,14 @@ final class Utils { static Class<?> getMethodReturnType(Method m) { XmlJavaTypeAdapter adapter = getMethodXJTA(m); + // if there is no adapter, yet we have a collection make sure + // we return the Generic type; if there is an annotation let the + // adapter handle what gets populated + if (adapter == null && m.getGenericReturnType() instanceof ParameterizedType) { + return null; + } Class<?> adapterType = (Class<?>)getTypeFromXmlAdapter(adapter); - return adapterType != null ? adapterType : m.getReturnType(); + return adapterType != null ? adapterType : m.getReturnType(); } @SuppressWarnings({ "rawtypes", "unchecked" }) Modified: cxf/branches/2.5.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java?rev=1452683&r1=1452682&r2=1452683&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java (original) +++ cxf/branches/2.5.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java Tue Mar 5 07:47:50 2013 @@ -752,5 +752,26 @@ public class JavaToProcessorTest extends assertTrue(summaryIndex > idIndex && idIndex > fromIndex); } + @Test + public void testExceptionList() throws Exception { + env.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() + "/exception_list.wsdl"); + env.put(ToolConstants.CFG_CLASSNAME, "org.apache.cxf.tools.fortest.exception.Echo2Impl"); + env.put(ToolConstants.CFG_VERBOSE, ToolConstants.CFG_VERBOSE); + try { + processor.setEnvironment(env); + processor.process(); + } catch (Exception e) { + e.printStackTrace(); + } + + File wsdlFile = new File(output, "exception_list.wsdl"); + assertTrue(wsdlFile.exists()); + String wsdlContent = getStringFromFile(wsdlFile).replaceAll(" ", " "); + int unboundIndex = wsdlContent + .indexOf("<xs:element maxOccurs=\"unbounded\" minOccurs=\"0\" name=\"names\" type=\"tns:myData\"/>"); + assertTrue(unboundIndex > -1); + } + + }
