You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2013/05/10 14:55:16 UTC

[jira] [Resolved] (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 ]

Claus Ibsen resolved CAMEL-5359.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 2.12.0
                   2.11.1
                   2.10.5

Thanks guys for the patches.

I modified the logic to use doStart/doStop. And also need to create the marshaller unmarshaller each time as its not thread safe.
                
> 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
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.10.5, 2.11.1, 2.12.0
>
>         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