camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ashwin Karpe (JIRA)" <>
Subject [jira] [Resolved] (CAMEL-6499) Copy of GenericFileMessage returns NULL from toString
Date Tue, 02 Jul 2013 03:49:20 GMT


Ashwin Karpe resolved CAMEL-6499.

       Resolution: Fixed
    Fix Version/s: 2.12.0

Fixed issue, added unit test, verified against checkstyle and committed in Git trunk as commit
id  7b002c732f021f624eb404965f54ac313afd82a3

> Copy of GenericFileMessage returns NULL from toString
> -----------------------------------------------------
>                 Key: CAMEL-6499
>                 URL:
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.11.0
>            Reporter: Ales Dolecek
>            Assignee: Ashwin Karpe
>             Fix For: 2.12.0
> CAMEL-3060 changed GenericFileMessage#toString to output just file name instead of it's
content. However copies of message do not have file field set and thus return null from toString
method. In my application actually all routed messages are copies and thus I see just "null"
in my logs files.
> The copies are created by constructor: org.apache.camel.impl.DefaultUnitOfWork.DefaultUnitOfWork(Exchange
exchange, Logger logger). The code seems like "dirty hack" in sense that it treats JmsMessage
specially and all other messages handle by:
> this.originalInMessage = exchange.getIn().copy();
> There is no override of copy() method (provided by MessageSupport) in GenericFileMessage.
This leads to lose of value of the internal file property.
> ---
> I'm not sure if the problem missing override of copy() method or if it is pretty "legal"
to have GenericFileMessage without file.
> I'm, on the other hand, pretty sure that returning NULL from toString() is BAD practise.
The method should stick to java.lang.Object behavior if it does not know what to print:
>     @Override
>     public String toString() {
>         // only output the filename as body can be big
>         if (file != null) {
>             return file.getFileName();
>         }
>         return getClass().getName() + "@" + Integer.toHexString(hashCode());
>     }
> Ales

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:

View raw message