cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r704584 - in /cxf/trunk/rt: bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/ frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/
Date Tue, 14 Oct 2008 17:19:29 GMT
Author: dkulp
Date: Tue Oct 14 10:19:29 2008
New Revision: 704584

URL: http://svn.apache.org/viewvc?rev=704584&view=rev
Log:
[CXF-1864] Fix parsing of namespaces/qnames in the soap 12 fault processing

Added:
    cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/cxf1864.xml
  (with props)
Modified:
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultInInterceptor.java
    cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/SoapFaultSerializerTest.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java

Modified: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultInInterceptor.java?rev=704584&r1=704583&r2=704584&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultInInterceptor.java
(original)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultInInterceptor.java
Tue Oct 14 10:19:29 2008
@@ -34,7 +34,6 @@
 import org.apache.cxf.binding.soap.Soap12;
 import org.apache.cxf.binding.soap.SoapFault;
 import org.apache.cxf.binding.soap.SoapMessage;
-import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.helpers.XPathUtils;
 import org.apache.cxf.interceptor.ClientFaultConverter;
@@ -65,17 +64,18 @@
         
         try {
             Document fault = StaxUtils.read(new FragmentStreamReader(reader));
-            String faultCodeString = (String) xu.getValue("//s:Fault/s:Code/s:Value/text()",

-                                                        fault, 
-                                                        XPathConstants.STRING);
-            
-            faultCode = XMLUtils.getQName(faultCodeString, fault);
+            Element el = (Element)xu.getValue("//s:Fault/s:Code/s:Value", 
+                                      fault, 
+                                      XPathConstants.NODE);
+            if (el != null) {
+                faultCode = XMLUtils.getQName(el.getTextContent(), el);
+            }
             
-            String subCodeString = (String) xu.getValue("//s:Fault/s:Code/s:Subcode/s:Value/text()",

-                                                        fault,
-                                                        XPathConstants.STRING);
-            if (StringUtils.isEmpty(subCodeString)) {
-                subCode = XMLUtils.getQName(subCodeString, fault);
+            el = (Element)xu.getValue("//s:Fault/s:Code/s:Subcode/s:Value", 
+                                      fault, 
+                                      XPathConstants.NODE);
+            if (el != null) {
+                subCode = XMLUtils.getQName(el.getTextContent(), el);
             }
             
             exMessage = (String) xu.getValue("//s:Fault/s:Reason/s:Text/text()", 

Modified: cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/SoapFaultSerializerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/SoapFaultSerializerTest.java?rev=704584&r1=704583&r2=704584&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/SoapFaultSerializerTest.java
(original)
+++ cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/SoapFaultSerializerTest.java
Tue Oct 14 10:19:29 2008
@@ -154,4 +154,27 @@
         assertEquals(Soap12.getInstance().getReceiver(), sf.getFaultCode());
         
     }
+    
+    
+    @Test
+    public void testCXF1864() throws Exception {
+
+        SoapMessage m = new SoapMessage(new MessageImpl());
+        m.setVersion(Soap12.getInstance());        
+
+
+        XMLStreamReader reader = StaxUtils.createXMLStreamReader(this.getClass()
+                                                                 .getResourceAsStream("cxf1864.xml"));
+        m.setContent(XMLStreamReader.class, reader);
+
+        reader.nextTag();
+
+        Soap12FaultInInterceptor inInterceptor = new Soap12FaultInInterceptor();
+        inInterceptor.handleMessage(m);
+
+        SoapFault fault2 = (SoapFault)m.getContent(Exception.class);
+        assertNotNull(fault2);
+        assertEquals(Soap12.getInstance().getReceiver(), fault2.getFaultCode());
+    }
+
 }

Added: cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/cxf1864.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/cxf1864.xml?rev=704584&view=auto
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/cxf1864.xml
(added)
+++ cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/cxf1864.xml
Tue Oct 14 10:19:29 2008
@@ -0,0 +1,6 @@
+<env:Fault xmlns:env='http://www.w3.org/2003/05/soap-envelope'>
+<env:Code xmlns:env='http://www.w3.org/2003/05/soap-envelope'>
+	<env:Value xmlns:codeNS='http://www.w3.org/2003/05/soap-envelope'
+		 xmlns:env='http://www.w3.org/2003/05/soap-envelope'>codeNS:Receiver</env:Value>
+</env:Code>
+<env:Reason xmlns:env='http://www.w3.org/2003/05/soap-envelope'><env:Text xml:lang='en-US'
xmlns:env='http://www.w3.org/2003/05/soap-envelope'>Some Reason</env:Text></env:Reason><env:Detail
xmlns:env='http://www.w3.org/2003/05/soap-envelope'><Error><ErrorType>General</ErrorType><ErrorCode>201</ErrorCode><ErrorMessage>Person
with that pid already exists!</ErrorMessage><ErrorSource>Create</ErrorSource></Error></env:Detail></env:Fault>
\ No newline at end of file

Propchange: cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/cxf1864.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/cxf1864.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/cxf1864.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java?rev=704584&r1=704583&r2=704584&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
Tue Oct 14 10:19:29 2008
@@ -168,7 +168,6 @@
         return objectFactoryForClass(InjectionUtils.getActualType(genericType));
     }
     
-    @SuppressWarnings("deprecation")
     protected Unmarshaller createUnmarshaller(Class<?> cls, Type genericType) 
         throws JAXBException {
         JAXBContext context = getJAXBContext(cls, genericType);



Mime
View raw message