cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r540828 - in /incubator/cxf/trunk: rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/ systests/src/test/java/org/apache/cxf/systest/handlers/
Date Wed, 23 May 2007 03:16:26 GMT
Author: jliu
Date: Tue May 22 20:16:25 2007
New Revision: 540828

URL: http://svn.apache.org/viewvc?view=rev&rev=540828
Log:
Fixed a NPE problem in logical handlers when client side infault interceptor chain is invoked

Modified:
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultInInterceptor.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultInInterceptor.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerFaultInInterceptor.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestHandler.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestSOAPHandler.java

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultInInterceptor.java?view=diff&rev=540828&r1=540827&r2=540828
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultInInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultInInterceptor.java
Tue May 22 20:16:25 2007
@@ -38,7 +38,7 @@
     
     public Soap11FaultInInterceptor() {
         super();
-        setPhase(Phase.READ);
+        setPhase(Phase.UNMARSHAL);
         addBefore(ClientFaultConverter.class.getName());
     }
 

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultInInterceptor.java?view=diff&rev=540828&r1=540827&r2=540828
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultInInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultInInterceptor.java
Tue May 22 20:16:25 2007
@@ -47,7 +47,7 @@
     
     public Soap12FaultInInterceptor() {
         super();
-        setPhase(Phase.READ);
+        setPhase(Phase.UNMARSHAL);
         addBefore(ClientFaultConverter.class.getName());
     }
 

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerFaultInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerFaultInInterceptor.java?view=diff&rev=540828&r1=540827&r2=540828
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerFaultInInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerFaultInInterceptor.java
Tue May 22 20:16:25 2007
@@ -23,6 +23,7 @@
 
 import org.apache.cxf.jaxws.handler.AbstractJAXWSHandlerInterceptor;
 import org.apache.cxf.jaxws.handler.HandlerChainInvoker;
+import org.apache.cxf.jaxws.handler.soap.SOAPHandlerFaultInInterceptor;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
 
@@ -32,7 +33,8 @@
 
     public LogicalHandlerFaultInInterceptor(Binding binding) {
         super(binding);
-        setPhase(Phase.PRE_LOGICAL);
+        setPhase(Phase.PRE_PROTOCOL);
+        addAfter(SOAPHandlerFaultInInterceptor.class.getName());       
     }
 
     public void handleMessage(T message) {

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java?view=diff&rev=540828&r1=540827&r2=540828
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
Tue May 22 20:16:25 2007
@@ -29,6 +29,7 @@
 import javax.xml.namespace.QName;
 import javax.xml.soap.MessageFactory;
 import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.Source;
 import javax.xml.ws.BindingProvider;
 import javax.xml.ws.Dispatch;
 import javax.xml.ws.LogicalMessage;
@@ -48,6 +49,7 @@
 
 import org.apache.cxf.BusException;
 import org.apache.cxf.common.util.PackageUtils;
+import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.handler_test.HandlerTest;
 import org.apache.handler_test.HandlerTestService;
@@ -132,7 +134,24 @@
     @Test
     public void testSOAPHandlerHandleMessageReturnTrueClient() throws Exception {
         TestHandler<LogicalMessageContext> handler1 = new TestHandler<LogicalMessageContext>(false);
-        TestHandler<LogicalMessageContext> handler2 = new TestHandler<LogicalMessageContext>(false);
+        TestHandler<LogicalMessageContext> handler2 = new TestHandler<LogicalMessageContext>(false)
{
+            public boolean handleMessage(LogicalMessageContext ctx) {
+                super.handleMessage(ctx);
+                try {
+                    Boolean outbound = (Boolean)ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+                    if (!outbound) {
+                        LogicalMessage msg = ctx.getMessage();
+                        Source source = msg.getPayload();
+                        assertNotNull(source);
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    fail(e.toString());
+                }
+                return true;
+            }
+        };
+       
         TestSOAPHandler soapHandler1 = new TestSOAPHandler(false);
         TestSOAPHandler soapHandler2 = new TestSOAPHandler(false);
 
@@ -837,9 +856,43 @@
     @Test   
     public void testServerSOAPInboundHandlerThrowsSOAPFaultToClientHandlers() throws Exception
{
         TestHandler<LogicalMessageContext> handler1 = new TestHandler<LogicalMessageContext>(false);
-        TestHandler<LogicalMessageContext> handler2 = new TestHandler<LogicalMessageContext>(false);
+        TestHandler<LogicalMessageContext> handler2 = new TestHandler<LogicalMessageContext>(false)
{
+            public boolean handleFault(LogicalMessageContext ctx) {
+                super.handleFault(ctx);
+                try {
+                    Boolean outbound = (Boolean)ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+                    if (!outbound) {
+                        LogicalMessage msg = ctx.getMessage();
+                        Source source = msg.getPayload();
+                        System.out.println("dddd " + source);
+                        XMLUtils.writeTo(source, System.out);
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    fail(e.toString());
+                }
+                return true;
+            }
+        };
+    
+    
         TestSOAPHandler soapHandler1 = new TestSOAPHandler(false);
-        TestSOAPHandler soapHandler2 = new TestSOAPHandler(false);
+        TestSOAPHandler soapHandler2 = new TestSOAPHandler(false) {
+            public boolean handleFault(SOAPMessageContext ctx) {
+                super.handleFault(ctx);
+                Boolean outbound = (Boolean)ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+                if (!outbound) {
+                    try {
+                        SOAPMessage msg = ctx.getMessage();
+                        msg.writeTo(System.out);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                        fail(e.toString());
+                    }
+                }
+                return true;
+            }
+        };
         
         addHandlersToChain((BindingProvider)handlerTest, handler1, handler2, soapHandler1,
soapHandler2);
 
@@ -847,8 +900,8 @@
             handlerTest.pingWithArgs("soapHandler3 inbound throw SOAPFaultException");
             fail("did not get expected SOAPFaultException");
         } catch (SOAPFaultException e) {
-/*            //e.printStackTrace();            
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            //e.printStackTrace();            
+/*            ByteArrayOutputStream baos = new ByteArrayOutputStream();
             PrintStream ps = new PrintStream(baos, true);
             e.printStackTrace(ps);
             assertTrue("Did not get expected exception message",  baos.toString()

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestHandler.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestHandler.java?view=diff&rev=540828&r1=540827&r2=540828
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestHandler.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestHandler.java
Tue May 22 20:16:25 2007
@@ -188,7 +188,7 @@
         }
     }
 
-    public final boolean handleFault(T ctx) {
+    public boolean handleFault(T ctx) {
         methodCalled("handleFault"); 
         printHandlerInfo("handleFault", isOutbound(ctx));
 

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestSOAPHandler.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestSOAPHandler.java?view=diff&rev=540828&r1=540827&r2=540828
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestSOAPHandler.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestSOAPHandler.java
Tue May 22 20:16:25 2007
@@ -70,7 +70,7 @@
         return "soapHandler" + getId();
     }
     
-    public boolean handleMessage(T ctx) {
+    public boolean handleMessage(SOAPMessageContext ctx) {
 
         boolean continueProcessing = true; 
 
@@ -119,7 +119,7 @@
         return continueProcessing;
     }
 
-    public final boolean handleFault(T ctx) {
+    public boolean handleFault(SOAPMessageContext ctx) {
         methodCalled("handleFault"); 
         printHandlerInfo("handleFault", isOutbound(ctx));
 
@@ -159,7 +159,7 @@
         methodCalled("close"); 
     }
 
-    private boolean getReturnValue(boolean outbound, T ctx) { 
+    private boolean getReturnValue(boolean outbound, SOAPMessageContext ctx) { 
         boolean ret = true;
         try {
             SOAPMessage msg  = ctx.getMessage(); 



Mime
View raw message