You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Joshua Ecklund (JIRA)" <ji...@apache.org> on 2013/05/03 23:34:15 UTC

[jira] [Updated] (CAMEL-5359) camel-castor does not use mapping file to convert XML to Java

     [ https://issues.apache.org/jira/browse/CAMEL-5359?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joshua Ecklund updated CAMEL-5359:
----------------------------------

    Attachment: PATCH-CAMEL-5359.patch

Updated patch to remove the fixes for other issues -- this patch only updates AbstractCastorDataFormat to use getMarshaller().marshal() instead of the static Marshaller.marshal() call. All other fixes have been removed.
                
> camel-castor does not use mapping file to convert XML to Java
> -------------------------------------------------------------
>
>                 Key: CAMEL-5359
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5359
>             Project: Camel
>          Issue Type: Improvement
>          Components: osgi
>    Affects Versions: 2.8.5, 2.9.2
>         Environment: Apache Service Mix: MacOS, Linux, Windows
>            Reporter: jacob vandergoot
>            Priority: Minor
>         Attachments: PATCH-CAMEL-5359.patch, PATCH-CAMEL-5359.txt
>
>
> The camel-castor using the static marshal() method to convert the java object into an XML document.  This static method will not leverage the castor mapping XML file defined.  Instead the XMLContext should be used to get an instance of a Marshaller that understands the castor mapping XML file.
> The following change in AbstractCastorDataFormat seemed to resolve the problem.
>  public void marshal(Exchange exchange, Object body, OutputStream outputStream) throws Exception {
>         Writer writer = new OutputStreamWriter(outputStream, encoding);
>         Marshaller marshaller = getXmlContext(
>         		exchange.getContext().getClassResolver())
>         			.createMarshaller();
>         marshaller.setWriter(writer);
>         marshaller.marshal(body);
>     }
> Also there may be a concurrency concern with how the unmarshaller is called.
> There is only one instance of an unmarshaller that is used by the DataFormat and for concurrent requests, that one instance may be converting multiple requests.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira