Return-Path: X-Original-To: apmail-camel-issues-archive@minotaur.apache.org Delivered-To: apmail-camel-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5A1E610797 for ; Tue, 2 Jul 2013 03:49:23 +0000 (UTC) Received: (qmail 88078 invoked by uid 500); 2 Jul 2013 03:49:23 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 87952 invoked by uid 500); 2 Jul 2013 03:49:21 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 87925 invoked by uid 99); 2 Jul 2013 03:49:20 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Jul 2013 03:49:20 +0000 Date: Tue, 2 Jul 2013 03:49:20 +0000 (UTC) From: "Ashwin Karpe (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (CAMEL-6499) Copy of GenericFileMessage returns NULL from toString MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CAMEL-6499?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] 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: https://issues.apache.org/jira/browse/CAMEL-6499 > 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: http://www.atlassian.com/software/jira