camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-11454) Camel ZipFile does cannot move file after succesful processing
Date Mon, 26 Jun 2017 10:45:00 GMT

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

ASF GitHub Bot commented on CAMEL-11454:
----------------------------------------

GitHub user adioss opened a pull request:

    https://github.com/apache/camel/pull/1785

    CAMEL-11454 use provided input stream when unmarshalling instead of creating a new one

    see JIRA ticket for more information (investigation part)

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/adioss/camel CAMEL-11454

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/camel/pull/1785.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1785
    
----
commit e1e07cf886c4bea71b94a3f6c7170e7ad7ddb3b3
Author: Adrien PAILHES <apailhes@axway.com>
Date:   2017-06-26T10:43:12Z

    CAMEL-11454 use provided input stream when unmarshalling instead of creating a new one

----


> Camel ZipFile does cannot move file after succesful processing
> --------------------------------------------------------------
>
>                 Key: CAMEL-11454
>                 URL: https://issues.apache.org/jira/browse/CAMEL-11454
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-zipfile
>    Affects Versions: 2.18.3
>         Environment: Windows 7 x64
>            Reporter: Adrien PAILHES
>            Assignee: onder sezgin
>            Priority: Minor
>
> When creating a route as follows:
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/spring"
>   xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util"
>   xsi:schemaLocation="
>           http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
>           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd
>           http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
>           http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd">
>   <bean id="zipFileDataFormat" class="org.apache.camel.dataformat.zipfile.ZipFileDataFormat">
>     <property name="usingIterator" value="true" />
>   </bean>
>   <camelContext xmlns="http://camel.apache.org/schema/spring" streamCache="true">
>     <route>
>       <from uri="file:C:/camelTest/in" />
>       <unmarshal ref="zipFileDataFormat" />
>       <split streaming="true">
>         <simple>${body}</simple>
>         <log loggingLevel="INFO" message="$simple{header.zipFileName}" />
>         <to uri="file:C:/camelTest/xml" />
>       </split>
>       <log loggingLevel="INFO" message="$simple{file:name} Succesful processed" />
>     </route>
>   </camelContext>
> </beans>
> {code}
> the renaming of the file fails with 
> {code}
> Renaming file from 'C:\camelTest\in\20161201T0030Z_1D_BE00_EQ.zip' to 'C:\camelTest\in\.camel\20161201T0030Z_1D_BE00_EQ.zip'
failed: Cannot delete file 'C:\camelTest\in\20161201T0030Z_1D_BE00_EQ.zip' after copy succeeded
> {code}
> The file stays in input folder and gets processed over and over again.
> h2. Investigation
> Problem only occurs if:
> * you try to move the file at the end of the exchange (not with noop but with delete,
for example)
> * if ZipFile dataformat is used (not with ZipSplitter)
> * if usingIterator is true (not if false and Zip file with 1 entry)
> It's because in org.apache.camel.dataformat.zipfile.ZipIterator constructor:
> {code}
>         InputStream inputStream = inputMessage.getBody(InputStream.class);
> {code}
> will create a new input stream instead of using the one already opened: inputStream parameter
when using org.apache.camel.dataformat.zipfile.ZipFileDataFormat#unmarshal.
> This one won't be closed and you won't be able to release the resource unless you kill
the process.
> So, two solutions:
> * close the inputStream parameter in org.apache.camel.dataformat.zipfile.ZipFileDataFormat#unmarshal
before using ZipIterator constructor
> * use inputStream parameter instead of creating a new one when using dataformat (that's
the implementation provided in the pull request)



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message