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 2012/06/12 16:21:27 UTC

[jira] [Commented] (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:comment-tabpanel&focusedCommentId=13293652#comment-13293652 ] 

Claus Ibsen commented on CAMEL-5359:
------------------------------------

Can you work on patches, thats generally better to get changes accepted. We cannot accept comments in a JIRA ticket, as ASF must have the license of the code.

You can read here about how to contribute to ASF projects and Camel
http://camel.apache.org/contributing.html
                
> 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
>
> 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira