camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Willem Jiang (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CAMEL-3131) FileOperations should expect body to be convertible to File
Date Sun, 19 Sep 2010 10:16:42 GMT

    [ https://issues.apache.org/activemq/browse/CAMEL-3131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61917#action_61917
] 

Willem Jiang commented on CAMEL-3131:
-------------------------------------

@Claus
I only find the code of camel-jms in the jmsBinding.getJMSMessageTypeForBody() like this,
 do you mean that ?
{code}
protected JmsMessageType getJMSMessageTypeForBody(Exchange exchange, Object body, Map<String,
Object> headers, Session session, CamelContext context) {
    JmsMessageType type = null;

        // let body determine the type
        if (body instanceof Node || body instanceof String) {
            type = Text;
        } else if (body instanceof byte[] || body instanceof GenericFile || body instanceof
File || body instanceof Reader
                || body instanceof InputStream || body instanceof ByteBuffer || body instanceof
StreamCache) {
            type = Bytes;
        }
{code}

> FileOperations should expect body to be convertible to File
> -----------------------------------------------------------
>
>                 Key: CAMEL-3131
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3131
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>            Reporter: Bruno Borges
>            Assignee: Willem Jiang
>
> The FileOperations class used by FileComponent and others related to file management
and processing, should expect that body message is convertible to a File object.
> In lines 170, the class tests the body to be either instance of File or GenericFile,
but some custom-user messages might have wrapped the File object and written a Converter (our
case).
> I suggest to modify the referenced code to test if converted result for File.class is
not null than compare instanceof.
>             // is the body file based
>             File source = exchange.getIn().getBody(File.class);
>             // if (exchange.getIn().getBody(File.class) instanceof File || exchange.getIn().getBody()
instanceof GenericFile) {
>             //     source = exchange.getIn().getBody(File.class);
>             // }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message