Author: gnodet
Date: Sat Dec  2 01:33:54 2006
New Revision: 481529

URL: http://svn.apache.org/viewvc?view=rev&rev=481529
Log:
SM-757: Pipeline throws NPE when configured in synchronous mode and an exchange 
in ERROR status is received

Modified:
    
incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/main/java/org/apache/servicemix/eip/patterns/Pipeline.java

Modified: 
incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/main/java/org/apache/servicemix/eip/patterns/Pipeline.java
URL: 
http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/main/java/org/apache/servicemix/eip/patterns/Pipeline.java?view=diff&rev=481529&r1=481528&r2=481529
==============================================================================
--- 
incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/main/java/org/apache/servicemix/eip/patterns/Pipeline.java
 (original)
+++ 
incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/main/java/org/apache/servicemix/eip/patterns/Pipeline.java
 Sat Dec  2 01:33:54 2006
@@ -162,36 +162,36 @@
                 done(tme);
                 sendSync(exchange);
             }
-        }
         // This should not happen
-        else if (tme.getOutMessage() == null) {
+        } else if (tme.getOutMessage() == null) {
             throw new IllegalStateException("Exchange status is " + 
ExchangeStatus.ACTIVE + " but has no correlation set");
-        }
         // This is the answer from the transformer
-        MessageExchange me = 
exchangeFactory.createExchange(exchange.getPattern());
-        target.configureTarget(me, getContext());
-        MessageUtil.transferOutToIn(tme, me);
-        sendSync(me);
-        done(tme);
-        if (me.getStatus() == ExchangeStatus.DONE) {
-            done(exchange);
-        } else if (me.getStatus() == ExchangeStatus.ERROR) {
-            fail(exchange, me.getError());
-        } else if (me.getFault() != null) {
-            if (exchange instanceof InOnly) {
-                // Do not use the fault has it may contain streams
-                // So just transform it to a string and send an error
-                String fault = new 
SourceTransformer().contentToString(me.getFault());
-                done(me);
-                fail(exchange, new FaultException(fault, null, null));
+        } else {
+            MessageExchange me = 
exchangeFactory.createExchange(exchange.getPattern());
+            target.configureTarget(me, getContext());
+            MessageUtil.transferOutToIn(tme, me);
+            sendSync(me);
+            done(tme);
+            if (me.getStatus() == ExchangeStatus.DONE) {
+                done(exchange);
+            } else if (me.getStatus() == ExchangeStatus.ERROR) {
+                fail(exchange, me.getError());
+            } else if (me.getFault() != null) {
+                if (exchange instanceof InOnly) {
+                    // Do not use the fault has it may contain streams
+                    // So just transform it to a string and send an error
+                    String fault = new 
SourceTransformer().contentToString(me.getFault());
+                    done(me);
+                    fail(exchange, new FaultException(fault, null, null));
+                } else {
+                    Fault fault = MessageUtil.copyFault(me);
+                    MessageUtil.transferToFault(fault, exchange);
+                    done(me);
+                    sendSync(exchange);
+                }
             } else {
-                Fault fault = MessageUtil.copyFault(me);
-                MessageUtil.transferToFault(fault, exchange);
-                done(me);
-                sendSync(exchange);
+                throw new IllegalStateException("Exchange status is " + 
ExchangeStatus.ACTIVE + " but has no correlation set");
             }
-        } else {
-            throw new IllegalStateException("Exchange status is " + 
ExchangeStatus.ACTIVE + " but has no correlation set");
         }
     }
 


Reply via email to