Bug 971018 - Camel DefaultTypeConverter converts ByteArrayInputStream into StAXSource (RANDOMLY), which is not supported by provided jaxb implementation
Summary: Camel DefaultTypeConverter converts ByteArrayInputStream into StAXSource (RAN...
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: JBoss Fuse Service Works 6
Classification: JBoss
Component: Camel
Version: 6.0.0 GA
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ER6
: ---
Assignee: Tomohisa Igarashi
QA Contact: Matej Melko
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-06-05 13:21 UTC by Jiri Sedlacek
Modified: 2025-02-10 03:27 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-02-10 03:27:52 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Reproducer (12.39 KB, application/zip)
2014-12-02 16:46 UTC, Václav Chalupa
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker SWITCHYARD-2511 0 Major Open JAXB unmarshal fails with StAXSource produced by camel converter 2015-02-02 10:52:21 UTC

Description Jiri Sedlacek 2013-06-05 13:21:06 UTC
Problem background: 

Switchyard composite, WSDL interface as a service, inside bean component with java interface, between composite service and component service are autogenerated JAXB transformers.

Camel file binding is used.

When I put file in directory specified in file binding, it starts to process it and throws following exception:

Caught exception of type java.lang.IllegalArgumentException with message: null: java.lang.IllegalArgumentException
	at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:109) [jboss-jaxb-api_2.2_spec-1.0.4.Final-redhat-2.jar:1.0.4.Final-redhat-2]
	at org.switchyard.transform.jaxb.internal.JAXBUnmarshalTransformer.transform(JAXBUnmarshalTransformer.java:79) [switchyard-transform-0.8.1.Final.jar:0.8.1.Final]
	at org.switchyard.transform.jaxb.internal.JAXBUnmarshalTransformer.transform(JAXBUnmarshalTransformer.java:43) [switchyard-transform-0.8.1.Final.jar:0.8.1.Final]
	at org.switchyard.transform.TransformSequence.apply(TransformSequence.java:125) [switchyard-api-0.8.1.Final.jar:0.8.1.Final]
	at org.switchyard.transform.TransformSequence.applySequence(TransformSequence.java:213) [switchyard-api-0.8.1.Final.jar:0.8.1.Final]
	at org.switchyard.handlers.TransformHandler.handleMessage(TransformHandler.java:95) [switchyard-runtime-0.8.1.Final.jar:0.8.1.Final]
	at org.switchyard.bus.camel.processors.HandlerProcessor.process(HandlerProcessor.java:69) [switchyard-bus-camel-0.8.1.Final.jar:0.8.1.Final]
	at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) [camel-core-2.10.0.jar:2.10.0]
	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.0.jar:2.10.0]
	at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.10.0.jar:2.10.0]
.
.
.

After diging in the code, I realized, that javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:109) expects SAXSource, DOMSource or StreamSource, but there is passed StAXSource. It seems that problem is in camel DefaultTypeConverter, which transforms the the message content into StAXSource. 


After several restarts of server I realized, that method 

BaseTypeConverterRegistry.getOrFindTypeConverter(Class<?> toType, Object value)

sometimes returns DOMSource, sometimes StreamSource and sometimes problematic StAXSource. It probably depends on startup initialization of converter registry.

Comment 1 kconner 2013-11-07 19:48:36 UTC
Jiri, can you please retest this with the ER6 release?  Does the issue still exist?

Comment 3 Jiri Sedlacek 2013-11-13 13:03:56 UTC
I ran several times and no StaXSource passed anymore, just DOMSource, StreamSource and SAXSource, so I hope it's fixed.


Marking as verified in ER6.

Comment 4 Václav Chalupa 2014-05-22 09:15:08 UTC
This issue still occurs. I have found it for ftp inbound binding.

StAXSource is returned by java:java.io.ByteArrayInputStream -> java:javax.xml.transform.Source transformation and IllegalArgumentException is thrown in javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:109).

Comment 5 Rob Cernich 2014-10-14 15:30:29 UTC
Could you please attach a reproducer application?

Comment 6 Václav Chalupa 2014-12-02 16:46:49 UTC
Created attachment 963848 [details]
Reproducer

I could finally create a reproducer. You have to set dir, host, username, password to ftp bindings (service, reference).

Restart EAP many times, deploy and run the reproducer. You should see the issue.

Comment 7 Keith Babo 2015-01-28 13:33:15 UTC
I guess one option would be to add protective logic inside of JAXBUnmarshalTransformer to check for StAXSource and convert it directly to another acceptable Source type.

Comment 8 Tomohisa Igarashi 2015-02-02 10:52:21 UTC
It seems we need to avoid letting camel convert to Source as it has some issues. Instead, just converting it to StreamSource directly solves the problem. I tested many times with it and no failure so far.

Comment 14 Red Hat Bugzilla 2025-02-10 03:27:52 UTC
This product has been discontinued or is no longer tracked in Red Hat Bugzilla.


Note You need to log in before you can comment on or make changes to this bug.