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 97F62172CC for ; Mon, 6 Apr 2015 09:29:12 +0000 (UTC) Received: (qmail 48002 invoked by uid 500); 6 Apr 2015 09:29:12 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 47959 invoked by uid 500); 6 Apr 2015 09:29:12 -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 47950 invoked by uid 99); 6 Apr 2015 09:29:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Apr 2015 09:29:12 +0000 Date: Mon, 6 Apr 2015 09:29:12 +0000 (UTC) From: "Sergey Zolotaryov (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CAMEL-8586) File component optimization required for file response body 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-8586?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14481072#comment-14481072 ] Sergey Zolotaryov commented on CAMEL-8586: ------------------------------------------ An example: FileChangedReadLockMinAgeTest runs ok from Eclipse, but from console it always produces an error: {code} FileChangedReadLockMinAgeTest>TestSupport.runBare:58->testChangedReadLockMinAge:53->ContextTestSupport.assertMockEndpointsSatisfied:343 Assertion error at index 0 on mock mock://result with predicate: exchangeProperty(CamelReceivedTimestamp) > 1428312322038 evaluated as: 1428312321042 > 1428312322038 on Exchange[slowfile.dat] {code} > File component optimization required for file response body > ----------------------------------------------------------- > > Key: CAMEL-8586 > URL: https://issues.apache.org/jira/browse/CAMEL-8586 > Project: Camel > Issue Type: Improvement > Components: camel-core > Affects Versions: 2.14.1 > Reporter: Sergey Zolotaryov > Priority: Minor > Fix For: 2.16.0 > > Attachments: 0001-CAMEL-8586.patch > > > I have a producer which makes files (writes data to a temp file) and sets it as output message body. I was expecting Camel file component to just rename the resulting file. But instead it copies the file leaving the temporary file intact. Here's a snippet from the FileOperations class which raised my concern: > {code} > // we can optimize and use file based if no charset must be used, and the input body is a file > File source = null; > boolean fileBased = false; > if (charset == null) { > // if no charset, then we can try using file directly (optimized) > Object body = exchange.getIn().getBody(); > if (body instanceof WrappedFile) { > body = ((WrappedFile) body).getFile(); > fileBased = true; > } > if (body instanceof File) { > source = (File) body; > } > } > if (fileBased) { > // okay we know the body is a file based > {code} > So the fileBased is only assumed if we are using a proprietary WrappedFile body, whereas normal file is not considered a fileBased body. Am I missing something? > We could just treat files the same way as WrappedFile, or have an endpoint option to treat them as such, what do you think? -- This message was sent by Atlassian JIRA (v6.3.4#6332)