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 20:00:20 UTC

[jira] [Comment Edited] (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=13648627#comment-13648627 ] 

Joshua Ecklund edited comment on CAMEL-5359 at 5/3/13 5:58 PM:
---------------------------------------------------------------

Are there any plans to fix this?  I am trying to use Castor to marshal some POJOs using my castor mapping XML, but when marshal is called I get this in my logs:

{quote}
org.exolab.castor.xml.Marshaller - Marshaller called using one of the *static*  marshal(Object, \*) methods. This will ignore any  mapping files as specified. Please consider switching to  using Marshaller instances and calling one of the marshal\* methods.
{quote}

The marshal call results in XML being produced using introspection and not the mappings I have configured.  This is a fairly major issue in my opinion.  Also, I would not call this an improvement -- the basic functionality of the Castor marshaller does not work, which I would call a major bug.

                
      was (Author: mprowler):
    Are there any plans to fix this?  I am trying to use Castor to marshal some POJOs using my castor mapping XML, but when marshal is called I get this in my logs:

{quote}
org.exolab.castor.xml.Marshaller - Marshaller called using one of the *static*  marshal(Object, \*) methods. This will ignore any  mapping files as specified. Please consider switching to  using Marshaller instances and calling one of the marshal\* methods.
{quote}

The marshal call results in XML being produced using introspection and not the mappings I have configured.  This is a fairly major issue in my opinion.

                  
> 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.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