Hi Willem

If you swallow an exception, then its a good idea to tell in the log
message that this in on purpose and the exception is ignored.

Also it may get very verbose to log at INFO level, so I suggest to

- reduce logging to DEBUG
- add ". This exception is being ignored." to the log message.



On Tue, Mar 5, 2013 at 9:09 AM,  <ningji...@apache.org> wrote:
> Author: ningjiang
> Date: Tue Mar  5 08:09:33 2013
> New Revision: 1452689
>
> URL: http://svn.apache.org/r1452689
> Log:
> CAMEL-6128 try to use the InputStream if the StaxStreamReader is not working
>
> Modified:
>     
> camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java
>
> Modified: 
> camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java
> URL: 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java?rev=1452689&r1=1452688&r2=1452689&view=diff
> ==============================================================================
> --- 
> camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java
>  (original)
> +++ 
> camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java
>  Tue Mar  5 08:09:33 2013
> @@ -163,8 +163,13 @@ public class FallbackTypeConverter exten
>                  // we cannot filter the XMLStreamReader if necessary
>                  XMLStreamReader xmlReader = 
> parentTypeConverter.convertTo(XMLStreamReader.class, exchange, value);
>                  if (xmlReader != null) {
> -                    Object unmarshalled = unmarshal(unmarshaller, exchange, 
> xmlReader);
> -                    return type.cast(unmarshalled);
> +                    try {
> +                        Object unmarshalled = unmarshal(unmarshaller, 
> exchange, xmlReader);
> +                        return type.cast(unmarshalled);
> +                    } catch (Exception ex) {
> +                        // There is some issue on the StaxStreamReader to 
> CXFPayload message body with different namespaces
> +                        LOG.info("Cannot use StaxStreamReader to unmarshal 
> the message, due to {}", ex);
> +                    }
>                  }
>              }
>              InputStream inputStream = 
> parentTypeConverter.convertTo(InputStream.class, exchange, value);
>
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to