camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: svn commit: r832981 - /camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java
Date Thu, 05 Nov 2009 05:16:30 GMT
Hi Claus,

I was trying to use new IOException("xxx", ex), but it is new to JDK 
1.6. So thanks for point that out, I will update the code to using the 
util method in the IOHelper.

Cheers,

Willem

Claus Ibsen wrote:
> Hi
> 
> There is some code in Camel uitl to set the init cause when throwing
> an IOException so it has the correct stacktrace.
> What you do is just adding one giant big message.
> 
> It should be something like this
> 
> IOException cause = new IOException("xxxx"):
> cause.initCause(e);
> throw cause;
> 
> 
> 
> On Thu, Nov 5, 2009 at 4:17 AM,  <ningjiang@apache.org> wrote:
>> Author: ningjiang
>> Date: Thu Nov  5 03:17:43 2009
>> New Revision: 832981
>>
>> URL: http://svn.apache.org/viewvc?rev=832981&view=rev
>> Log:
>> CAMEL-2129 throw the exception of camel ProduceTemplate in CamelConduit
>>
>> Modified:
>>    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java
>>
>> Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java
>> URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java?rev=832981&r1=832980&r2=832981&view=diff
>> ==============================================================================
>> --- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java
(original)
>> +++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java
Thu Nov  5 03:17:43 2009
>> @@ -17,12 +17,14 @@
>>  package org.apache.camel.component.cxf.transport;
>>
>>  import java.io.IOException;
>> +import java.io.InputStream;
>>  import java.io.OutputStream;
>>  import java.util.logging.Level;
>>  import java.util.logging.Logger;
>>
>>  import org.apache.camel.CamelContext;
>>  import org.apache.camel.ExchangePattern;
>> +import org.apache.camel.InvalidPayloadException;
>>  import org.apache.camel.Processor;
>>  import org.apache.camel.ProducerTemplate;
>>  import org.apache.camel.component.cxf.CxfConstants;
>> @@ -158,7 +160,7 @@
>>         }
>>
>>
>> -        private void commitOutputMessage() {
>> +        private void commitOutputMessage() throws IOException {
>>             ExchangePattern pattern;
>>             if (isOneWay) {
>>                 pattern = ExchangePattern.InOnly;
>> @@ -179,15 +181,25 @@
>>                 }
>>             });
>>             exchange.setProperty(CxfConstants.CXF_EXCHANGE, outMessage.getExchange());
>> +            // Throw the exception that the template get
>> +            if (exchange.getException() != null) {
>> +                throw new IOException("Can't get the response message. Caused by
" + exchange.getException());
>> +            }
>>             if (!isOneWay) {
>>                 handleResponse(exchange);
>>             }
>>
>>         }
>>
>> -        private void handleResponse(org.apache.camel.Exchange exchange) {
>> -            org.apache.cxf.message.Message inMessage = CxfSoapBinding.getCxfInMessage(headerFilterStrategy,
>> +        private void handleResponse(org.apache.camel.Exchange exchange) throws IOException
{
>> +            org.apache.cxf.message.Message inMessage = null;
>> +            try {
>> +                inMessage = CxfSoapBinding.getCxfInMessage(headerFilterStrategy,
>>                     exchange, true);
>> +            } catch (Exception ex) {
>> +                // Throw IOException here
>> +                throw new IOException("Can't get the response message. Caused by:
" + ex);
>> +            }
>>             incomingObserver.onMessage(inMessage);
>>         }
>>     }
>>
>>
>>
> 
> 
> 


Mime
View raw message