You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by em...@apache.org on 2013/08/23 11:25:14 UTC

svn commit: r1516776 - in /cxf/branches/2.5.x-fixes: ./ rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/ tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/ tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/

Author: ema
Date: Fri Aug 23 09:25:14 2013
New Revision: 1516776

URL: http://svn.apache.org/r1516776
Log:
Merged revisions 1516769 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes

................
  r1516769 | ema | 2013-08-23 17:18:27 +0800 (Fri, 23 Aug 2013) | 28 lines
  
  Merged revisions 1516766 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes
  
  ................
    r1516766 | ema | 2013-08-23 17:12:57 +0800 (Fri, 23 Aug 2013) | 21 lines
    
    Merged revisions 1516724,1516735,1516754,1516760 via svnmerge from 
    https://svn.apache.org/repos/asf/cxf/trunk
    
    ........
      r1516724 | ema | 2013-08-23 15:53:23 +0800 (Fri, 23 Aug 2013) | 1 line
      
      [CXF-5230]:Message element is not generated for exception class which extends Exception
    ........
      r1516735 | ema | 2013-08-23 16:14:28 +0800 (Fri, 23 Aug 2013) | 1 line
      
      [CXF-5230]:Message element is not generated for exception class which extends Exception
    ........
      r1516754 | ema | 2013-08-23 16:57:48 +0800 (Fri, 23 Aug 2013) | 1 line
      
      [CXF-5219]:Apply patch from Kyle and add testcase
    ........
      r1516760 | ema | 2013-08-23 17:07:11 +0800 (Fri, 23 Aug 2013) | 1 line
      
      [CXF-5219]:Add missing files in previous commit
    ........
  ................
................

Added:
    cxf/branches/2.5.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Cl1ToCl2Adapter.java
      - copied unchanged from r1516769, cxf/branches/2.6.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Cl1ToCl2Adapter.java
    cxf/branches/2.5.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/MyClass1.java
      - copied unchanged from r1516769, cxf/branches/2.6.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/MyClass1.java
    cxf/branches/2.5.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/MyClass2.java
      - copied unchanged from r1516769, cxf/branches/2.6.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/MyClass2.java
    cxf/branches/2.5.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/TypeAdapterEcho.java
      - copied unchanged from r1516769, cxf/branches/2.6.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/TypeAdapterEcho.java
    cxf/branches/2.5.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/TypeAdapterException.java
      - copied unchanged from r1516769, cxf/branches/2.6.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/TypeAdapterException.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/JAXBContextInitializer.java
    cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
    cxf/branches/2.5.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/MyException.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:r1516766
  Merged /cxf/trunk:r1516724-1516735,1516754-1516760
  Merged /cxf/branches/2.6.x-fixes:r1516769

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/JAXBContextInitializer.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java?rev=1516776&r1=1516775&r2=1516776&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java (original)
+++ cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java Fri Aug 23 09:25:14 2013
@@ -358,6 +358,14 @@ class JAXBContextInitializer extends Ser
             Field fields[] = ReflectionUtil.getDeclaredFields(cls); 
             for (Field f : fields) {
                 if (isFieldAccepted(f, accessType)) {
+                    XmlJavaTypeAdapter xjta = Utils.getFieldXJTA(f);
+                    if (xjta != null) {
+                        Type t = Utils.getTypeFromXmlAdapter(xjta);
+                        if (t != null) {
+                            addType(t);
+                            continue;
+                        }
+                    }
                     addType(f.getGenericType());
                 }
             }
@@ -368,6 +376,14 @@ class JAXBContextInitializer extends Ser
             Method methods[] = ReflectionUtil.getDeclaredMethods(cls); 
             for (Method m : methods) {
                 if (isMethodAccepted(m, accessType)) {
+                    XmlJavaTypeAdapter xjta = Utils.getMethodXJTA(m);
+                    if (xjta != null) {
+                        Type t = Utils.getTypeFromXmlAdapter(xjta);
+                        if (t != null) {
+                            addType(t);
+                            continue;
+                        }
+                    }
                     addType(m.getGenericReturnType());
                     for (Type t : m.getGenericParameterTypes()) {
                         addType(t);

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=1516776&r1=1516775&r2=1516776&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 Fri Aug 23 09:25:14 2013
@@ -560,7 +560,7 @@ class JAXBSchemaInitializer extends Serv
             }
         }
         // Create element in xsd:sequence for Exception.class
-        if (cls.equals(Exception.class)) {
+        if (Exception.class.isAssignableFrom(cls)) {
             JAXBBeanInfo beanInfo = getBeanInfo(java.lang.String.class);
             XmlSchemaElement exEle = new XmlSchemaElement(schema, false);
             exEle.setName("message");

Modified: cxf/branches/2.5.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/MyException.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/MyException.java?rev=1516776&r1=1516775&r2=1516776&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/MyException.java (original)
+++ cxf/branches/2.5.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/MyException.java Fri Aug 23 09:25:14 2013
@@ -23,7 +23,7 @@ import javax.xml.bind.annotation.XmlType
 @javax.xml.ws.WebFault
 @XmlType(namespace = "http://cxf.apache.org/test/HelloService",
          name = "MyException", 
-         propOrder = { "summary", "from", "id" })
+         propOrder = { "summary", "from", "id", "message" })
 public class MyException extends SuperException {
     private static final long serialVersionUID = 8575109064272599936L;
     private String summary;

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=1516776&r1=1516775&r2=1516776&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 Fri Aug 23 09:25:14 2013
@@ -707,6 +707,7 @@ public class JavaToProcessorTest extends
     @Test
     public void testPropOrderInException() throws Exception {
         env.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() + "/exception_prop_order.wsdl");
+        //env.put(ToolConstants.CFG_OUTPUTFILE, "/x1/tmp/exception_prop_order.wsdl");
         env.put(ToolConstants.CFG_CLASSNAME, "org.apache.cxf.tools.fortest.exception.EchoImpl");
         env.put(ToolConstants.CFG_VERBOSE, ToolConstants.CFG_VERBOSE);
         try {
@@ -797,6 +798,28 @@ public class JavaToProcessorTest extends
 
     }
     
+    @Test
+    public void testExceptionTypeAdapter() throws Exception {
+        env.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() + "/exception-type-adapter.wsdl");
+        env.put(ToolConstants.CFG_CLASSNAME, "org.apache.cxf.tools.fortest.exception.TypeAdapterEcho");
+        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-type-adapter.wsdl");
+        assertTrue(wsdlFile.exists());
+        String wsdlContent = getStringFromFile(wsdlFile).replaceAll("  ", " ");
+        int class2Element = wsdlContent.indexOf("<xs:complexType name=\"myClass2\">");
+        assertTrue(class2Element > -1);
+        int refElement = wsdlContent.indexOf("<xs:element name=\"adapted\" nillable=\"true\" type=\"tns:myClass2\"/>");
+        assertTrue(refElement > -1);
+
+    }
+    
     
     @Test
     public void testCXF4877() throws Exception {