You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by pglebow <pg...@gmail.com> on 2012/08/08 23:33:42 UTC

Character set issue with File Consumer & FTP Publication

I'm struggling with a very odd issue with Camel 2.10 and I'm hoping someone
could explain why it's occurring.  I've attached a test case that
demonstrates the issue.  It is a very simple route - just take a file from a
local directory and FTP it to a server.  Here is the problem:

When I specify the character set in the file producer, Camel cannot rename
the file from the source directory to the .processed directory (.move
directory).  It is unable to acquire an exclusive file lock.

However, when I remove the charset=UTF-8 parameter, everything works
properly.  The file is FTPed and is moved to the .processed directory.

Why does the character encoding cause an issue with read locks?  Am I doing
something incorrect or is this a bug?  I'm using Camel 2.10 and Java
1.6.0_33 under Windows 7.

------------
- Test case
------------
package com.comp.test.camel.route.impl;

import junit.framework.Assert;

import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;

public class FileMoveTest extends CamelTestSupport {

    protected Log log = LogFactory.getLog(FileMoveTest.class);

    @Test
    public void testRoute() throws Exception {
        try {
            Thread.sleep(140000);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            Assert.fail(e.getMessage());
        }

    }

    /*
     * (non-Javadoc)
     * 
     * @see
org.apache.camel.test.junit4.CamelTestSupport#createRouteBuilder()
     */
    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {

            @Override
            public void configure() throws Exception {
                // Works
                //
from("file://c:/fileMoveTest/in?move=.processed&moveFailed=.failed&delay=5000&readLock=rename&include=.*\\.csv$").to(
                //
"ftp://anonymous@ftpTest/test?password=anonymous&delay=5000&throwExceptionOnConnectFailed=true");

                // Fails
               
from("file://c:/fileMoveTest/in?charset=UTF-8&move=.processed&moveFailed=.failed&delay=5000&readLock=rename&include=.*\\.csv$").to(
                       
"ftp://anonymous@ftpTest/test?password=anonymous&delay=5000&throwExceptionOnConnectFailed=true");
            }
        };
    }
}




--
View this message in context: http://camel.465427.n5.nabble.com/Character-set-issue-with-File-Consumer-FTP-Publication-tp5717025.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Character set issue with File Consumer & FTP Publication

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Aug 13, 2012 at 7:00 PM, pglebow <pg...@gmail.com> wrote:
> Hi Claus,
>
>   Thank you for the fix.  I used
> https://repository.apache.org/content/repositories/snapshots/org/apache/camel/apache-camel/2.11-SNAPSHOT/apache-camel-2.11-20120813.030929-58.zip
> and the test case passes.
>
>   Is there a plan to put this into a maintenance release for 2.10?  We
> have a big release coming up of our application in about 2 months time
> and a fix for this issue is critical for us.  If not, I could roll
> back to 2.9.1 but I would prefer to go forward if possible.  Thanks
> again!
>

Yes the bug should be fixed on 2.10 branch as well. As we backport the
bug fixes from trunk to the branches.

We usually do a patch release in a 6-12 weeks cycle. And especially
more frequent when its a brand new release, as eg 2.10.0 is.
To get bug fixes faster on that branch.



> Phil
>
> On Mon, Aug 13, 2012 at 9:34 AM, Claus Ibsen-2 [via Camel]
> <ml...@n5.nabble.com> wrote:
>> On Mon, Aug 13, 2012 at 6:30 PM, pglebow <[hidden email]> wrote:
>>
>>> Hi Claus,
>>>
>>>   I tried with a snapshot and still encountered the error.  I've
>>> detailed my test procedure below between the
>>> ====s; the test case was the same one that I sent previously.
>>>
>>> Phil
>>> ====
>>> 1. Downloaded this snapshot:
>>>
>>> https://repository.apache.org/content/repositories/snapshots/org/apache/camel/apache-camel/2.10-SNAPSHOT/apache-camel-2.10-20120617.030556-150.zip
>>>
>>
>> Ah you need a 2.11 SNAPSHOT. That 2.10 is outdated.
>> https://repository.apache.org/content/repositories/snapshots/org/apache/camel/apache-camel/2.11-SNAPSHOT/
>>
>> I can see the link on the download page hasn't been updated. Let me fix
>> that.
>>
>>
>>> 2. Replaced these jars with snapshot versions:
>>>
>>> bindy, core, flatpack, ftp, http, jetty, jms, mail, quartz, spring,
>>> sql, test, test-spring
>>>
>>> 3. Reran the test under Windows 7
>>>
>>> 4. Encountered this error (more detail below as well):
>>>
>>> 31312 [Camel (camel-1) thread #0 - file://c:/fileMoveTest/in] WARN
>>> org.apache.camel.component.file.GenericFileOnCompletion - Caused by:
>>> [org.apache.camel.component.file.GenericFileOperationFailedException -
>>> Error renaming file from c:\fileMoveTest\in\test.csv to
>>> c:\fileMoveTest\in\.processed\test.csv]
>>> org.apache.camel.component.file.GenericFileOperationFailedException:
>>> Error renaming file from c:\fileMoveTest\in\test.csv to
>>> c:\fileMoveTest\in\.processed\test.csv
>>>         at
>>> org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:72)
>>>         at
>>> org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:107)
>>>         at
>>> org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.commit(GenericFileRenameProcessStrategy.java:86)
>>>         at
>>> org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:132)
>>>         at
>>> org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:82)
>>>         at
>>> org.apache.camel.component.file.GenericFileOnCompletion.onComplete(GenericFileOnCompletion.java:53)
>>>         at
>>> org.apache.camel.util.UnitOfWorkHelper.doneSynchronizations(UnitOfWorkHelper.java:55)
>>>         at
>>> org.apache.camel.impl.DefaultUnitOfWork.done(DefaultUnitOfWork.java:226)
>>>
>>> Caused by: java.io.IOException: Renaming file from:
>>> c:\fileMoveTest\in\test.csv to: c:\fileMoveTest\in\.processed\test.csv
>>> failed due cannot delete from file: c:\fileMoveTest\in\test.csv after
>>> copy succeeded
>>>         at org.apache.camel.util.FileUtil.renameFile(FileUtil.java:362)
>>>         at
>>> org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:70)
>>>         ... 41 more
>>> ===
>>>
>>> On Mon, Aug 13, 2012 at 4:37 AM, Claus Ibsen-2 [via Camel]
>>> <[hidden email]> wrote:
>>>> Hi
>>>>
>>>> Maybe its related to
>>>> https://issues.apache.org/jira/browse/CAMEL-5461
>>>>
>>>> That on windows a stream is open on the file, and thus cannot move the
>>>> file afterwards.
>>>>
>>>> Can you try with SNAPSHOT code?
>>>>
>>>> On Wed, Aug 8, 2012 at 11:33 PM, pglebow <[hidden email]> wrote:
>>>>
>>>>> I'm struggling with a very odd issue with Camel 2.10 and I'm hoping
>>>>> someone
>>>>> could explain why it's occurring.  I've attached a test case that
>>>>> demonstrates the issue.  It is a very simple route - just take a file
>>>>> from
>>>>> a
>>>>> local directory and FTP it to a server.  Here is the problem:
>>>>>
>>>>> When I specify the character set in the file producer, Camel cannot
>>>>> rename
>>>>> the file from the source directory to the .processed directory (.move
>>>>> directory).  It is unable to acquire an exclusive file lock.
>>>>>
>>>>> However, when I remove the charset=UTF-8 parameter, everything works
>>>>> properly.  The file is FTPed and is moved to the .processed directory.
>>>>>
>>>>> Why does the character encoding cause an issue with read locks?  Am I
>>>>> doing
>>>>> something incorrect or is this a bug?  I'm using Camel 2.10 and Java
>>>>> 1.6.0_33 under Windows 7.
>>>>>
>>>>> ------------
>>>>> - Test case
>>>>> ------------
>>>>> package com.comp.test.camel.route.impl;
>>>>>
>>>>> import junit.framework.Assert;
>>>>>
>>>>> import org.apache.camel.builder.RouteBuilder;
>>>>> import org.apache.camel.test.junit4.CamelTestSupport;
>>>>> import org.apache.commons.logging.Log;
>>>>> import org.apache.commons.logging.LogFactory;
>>>>> import org.junit.Test;
>>>>>
>>>>> public class FileMoveTest extends CamelTestSupport {
>>>>>
>>>>>     protected Log log = LogFactory.getLog(FileMoveTest.class);
>>>>>
>>>>>     @Test
>>>>>     public void testRoute() throws Exception {
>>>>>         try {
>>>>>             Thread.sleep(140000);
>>>>>         } catch (Exception e) {
>>>>>             log.error(e.getMessage(), e);
>>>>>             Assert.fail(e.getMessage());
>>>>>         }
>>>>>
>>>>>     }
>>>>>
>>>>>     /*
>>>>>      * (non-Javadoc)
>>>>>      *
>>>>>      * @see
>>>>> org.apache.camel.test.junit4.CamelTestSupport#createRouteBuilder()
>>>>>      */
>>>>>     @Override
>>>>>     protected RouteBuilder createRouteBuilder() throws Exception {
>>>>>         return new RouteBuilder() {
>>>>>
>>>>>             @Override
>>>>>             public void configure() throws Exception {
>>>>>                 // Works
>>>>>                 //
>>>>>
>>>>>
>>>>> from("file://c:/fileMoveTest/in?move=.processed&moveFailed=.failed&delay=5000&readLock=rename&include=.*\\.csv$").to(
>>>>>                 //
>>>>>
>>>>>
>>>>> "ftp://anonymous@ftpTest/test?password=anonymous&delay=5000&throwExceptionOnConnectFailed=true");
>>>>>
>>>>>                 // Fails
>>>>>
>>>>>
>>>>>
>>>>> from("file://c:/fileMoveTest/in?charset=UTF-8&move=.processed&moveFailed=.failed&delay=5000&readLock=rename&include=.*\\.csv$").to(
>>>>>
>>>>>
>>>>>
>>>>> "ftp://anonymous@ftpTest/test?password=anonymous&delay=5000&throwExceptionOnConnectFailed=true");
>>>>>             }
>>>>>         };
>>>>>     }
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>>
>>>>> http://camel.465427.n5.nabble.com/Character-set-issue-with-File-Consumer-FTP-Publication-tp5717025.html
>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>>
>>>> --
>>>> Claus Ibsen
>>>> -----------------
>>>> FuseSource
>>>> Email: [hidden email]
>>>> Web: http://fusesource.com
>>>> Twitter: davsclaus, fusenews
>>>> Blog: http://davsclaus.com
>>>> Author of Camel in Action: http://www.manning.com/ibsen
>>>>
>>>>
>>>> ________________________________
>>>> If you reply to this email, your message will be added to the discussion
>>>> below:
>>>>
>>>> http://camel.465427.n5.nabble.com/Character-set-issue-with-File-Consumer-FTP-Publication-tp5717025p5717229.html
>>>> To unsubscribe from Character set issue with File Consumer & FTP
>>>> Publication, click here.
>>>> NAML
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://camel.465427.n5.nabble.com/Character-set-issue-with-File-Consumer-FTP-Publication-tp5717025p5717256.html
>>
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> FuseSource
>> Email: [hidden email]
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>>
>>
>> ________________________________
>> If you reply to this email, your message will be added to the discussion
>> below:
>> http://camel.465427.n5.nabble.com/Character-set-issue-with-File-Consumer-FTP-Publication-tp5717025p5717257.html
>> To unsubscribe from Character set issue with File Consumer & FTP
>> Publication, click here.
>> NAML
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Character-set-issue-with-File-Consumer-FTP-Publication-tp5717025p5717259.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Character set issue with File Consumer & FTP Publication

Posted by pglebow <pg...@gmail.com>.
Hi Claus,

  Thank you for the fix.  I used
https://repository.apache.org/content/repositories/snapshots/org/apache/camel/apache-camel/2.11-SNAPSHOT/apache-camel-2.11-20120813.030929-58.zip
and the test case passes.

  Is there a plan to put this into a maintenance release for 2.10?  We
have a big release coming up of our application in about 2 months time
and a fix for this issue is critical for us.  If not, I could roll
back to 2.9.1 but I would prefer to go forward if possible.  Thanks
again!

Phil

On Mon, Aug 13, 2012 at 9:34 AM, Claus Ibsen-2 [via Camel]
<ml...@n5.nabble.com> wrote:
> On Mon, Aug 13, 2012 at 6:30 PM, pglebow <[hidden email]> wrote:
>
>> Hi Claus,
>>
>>   I tried with a snapshot and still encountered the error.  I've
>> detailed my test procedure below between the
>> ====s; the test case was the same one that I sent previously.
>>
>> Phil
>> ====
>> 1. Downloaded this snapshot:
>>
>> https://repository.apache.org/content/repositories/snapshots/org/apache/camel/apache-camel/2.10-SNAPSHOT/apache-camel-2.10-20120617.030556-150.zip
>>
>
> Ah you need a 2.11 SNAPSHOT. That 2.10 is outdated.
> https://repository.apache.org/content/repositories/snapshots/org/apache/camel/apache-camel/2.11-SNAPSHOT/
>
> I can see the link on the download page hasn't been updated. Let me fix
> that.
>
>
>> 2. Replaced these jars with snapshot versions:
>>
>> bindy, core, flatpack, ftp, http, jetty, jms, mail, quartz, spring,
>> sql, test, test-spring
>>
>> 3. Reran the test under Windows 7
>>
>> 4. Encountered this error (more detail below as well):
>>
>> 31312 [Camel (camel-1) thread #0 - file://c:/fileMoveTest/in] WARN
>> org.apache.camel.component.file.GenericFileOnCompletion - Caused by:
>> [org.apache.camel.component.file.GenericFileOperationFailedException -
>> Error renaming file from c:\fileMoveTest\in\test.csv to
>> c:\fileMoveTest\in\.processed\test.csv]
>> org.apache.camel.component.file.GenericFileOperationFailedException:
>> Error renaming file from c:\fileMoveTest\in\test.csv to
>> c:\fileMoveTest\in\.processed\test.csv
>>         at
>> org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:72)
>>         at
>> org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:107)
>>         at
>> org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.commit(GenericFileRenameProcessStrategy.java:86)
>>         at
>> org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:132)
>>         at
>> org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:82)
>>         at
>> org.apache.camel.component.file.GenericFileOnCompletion.onComplete(GenericFileOnCompletion.java:53)
>>         at
>> org.apache.camel.util.UnitOfWorkHelper.doneSynchronizations(UnitOfWorkHelper.java:55)
>>         at
>> org.apache.camel.impl.DefaultUnitOfWork.done(DefaultUnitOfWork.java:226)
>>
>> Caused by: java.io.IOException: Renaming file from:
>> c:\fileMoveTest\in\test.csv to: c:\fileMoveTest\in\.processed\test.csv
>> failed due cannot delete from file: c:\fileMoveTest\in\test.csv after
>> copy succeeded
>>         at org.apache.camel.util.FileUtil.renameFile(FileUtil.java:362)
>>         at
>> org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:70)
>>         ... 41 more
>> ===
>>
>> On Mon, Aug 13, 2012 at 4:37 AM, Claus Ibsen-2 [via Camel]
>> <[hidden email]> wrote:
>>> Hi
>>>
>>> Maybe its related to
>>> https://issues.apache.org/jira/browse/CAMEL-5461
>>>
>>> That on windows a stream is open on the file, and thus cannot move the
>>> file afterwards.
>>>
>>> Can you try with SNAPSHOT code?
>>>
>>> On Wed, Aug 8, 2012 at 11:33 PM, pglebow <[hidden email]> wrote:
>>>
>>>> I'm struggling with a very odd issue with Camel 2.10 and I'm hoping
>>>> someone
>>>> could explain why it's occurring.  I've attached a test case that
>>>> demonstrates the issue.  It is a very simple route - just take a file
>>>> from
>>>> a
>>>> local directory and FTP it to a server.  Here is the problem:
>>>>
>>>> When I specify the character set in the file producer, Camel cannot
>>>> rename
>>>> the file from the source directory to the .processed directory (.move
>>>> directory).  It is unable to acquire an exclusive file lock.
>>>>
>>>> However, when I remove the charset=UTF-8 parameter, everything works
>>>> properly.  The file is FTPed and is moved to the .processed directory.
>>>>
>>>> Why does the character encoding cause an issue with read locks?  Am I
>>>> doing
>>>> something incorrect or is this a bug?  I'm using Camel 2.10 and Java
>>>> 1.6.0_33 under Windows 7.
>>>>
>>>> ------------
>>>> - Test case
>>>> ------------
>>>> package com.comp.test.camel.route.impl;
>>>>
>>>> import junit.framework.Assert;
>>>>
>>>> import org.apache.camel.builder.RouteBuilder;
>>>> import org.apache.camel.test.junit4.CamelTestSupport;
>>>> import org.apache.commons.logging.Log;
>>>> import org.apache.commons.logging.LogFactory;
>>>> import org.junit.Test;
>>>>
>>>> public class FileMoveTest extends CamelTestSupport {
>>>>
>>>>     protected Log log = LogFactory.getLog(FileMoveTest.class);
>>>>
>>>>     @Test
>>>>     public void testRoute() throws Exception {
>>>>         try {
>>>>             Thread.sleep(140000);
>>>>         } catch (Exception e) {
>>>>             log.error(e.getMessage(), e);
>>>>             Assert.fail(e.getMessage());
>>>>         }
>>>>
>>>>     }
>>>>
>>>>     /*
>>>>      * (non-Javadoc)
>>>>      *
>>>>      * @see
>>>> org.apache.camel.test.junit4.CamelTestSupport#createRouteBuilder()
>>>>      */
>>>>     @Override
>>>>     protected RouteBuilder createRouteBuilder() throws Exception {
>>>>         return new RouteBuilder() {
>>>>
>>>>             @Override
>>>>             public void configure() throws Exception {
>>>>                 // Works
>>>>                 //
>>>>
>>>>
>>>> from("file://c:/fileMoveTest/in?move=.processed&moveFailed=.failed&delay=5000&readLock=rename&include=.*\\.csv$").to(
>>>>                 //
>>>>
>>>>
>>>> "ftp://anonymous@ftpTest/test?password=anonymous&delay=5000&throwExceptionOnConnectFailed=true");
>>>>
>>>>                 // Fails
>>>>
>>>>
>>>>
>>>> from("file://c:/fileMoveTest/in?charset=UTF-8&move=.processed&moveFailed=.failed&delay=5000&readLock=rename&include=.*\\.csv$").to(
>>>>
>>>>
>>>>
>>>> "ftp://anonymous@ftpTest/test?password=anonymous&delay=5000&throwExceptionOnConnectFailed=true");
>>>>             }
>>>>         };
>>>>     }
>>>> }
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>>
>>>> http://camel.465427.n5.nabble.com/Character-set-issue-with-File-Consumer-FTP-Publication-tp5717025.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> -----------------
>>> FuseSource
>>> Email: [hidden email]
>>> Web: http://fusesource.com
>>> Twitter: davsclaus, fusenews
>>> Blog: http://davsclaus.com
>>> Author of Camel in Action: http://www.manning.com/ibsen
>>>
>>>
>>> ________________________________
>>> If you reply to this email, your message will be added to the discussion
>>> below:
>>>
>>> http://camel.465427.n5.nabble.com/Character-set-issue-with-File-Consumer-FTP-Publication-tp5717025p5717229.html
>>> To unsubscribe from Character set issue with File Consumer & FTP
>>> Publication, click here.
>>> NAML
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Character-set-issue-with-File-Consumer-FTP-Publication-tp5717025p5717256.html
>
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: [hidden email]
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/Character-set-issue-with-File-Consumer-FTP-Publication-tp5717025p5717257.html
> To unsubscribe from Character set issue with File Consumer & FTP
> Publication, click here.
> NAML




--
View this message in context: http://camel.465427.n5.nabble.com/Character-set-issue-with-File-Consumer-FTP-Publication-tp5717025p5717259.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Character set issue with File Consumer & FTP Publication

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Aug 13, 2012 at 6:30 PM, pglebow <pg...@gmail.com> wrote:
> Hi Claus,
>
>   I tried with a snapshot and still encountered the error.  I've
> detailed my test procedure below between the
> ====s; the test case was the same one that I sent previously.
>
> Phil
> ====
> 1. Downloaded this snapshot:
> https://repository.apache.org/content/repositories/snapshots/org/apache/camel/apache-camel/2.10-SNAPSHOT/apache-camel-2.10-20120617.030556-150.zip
>

Ah you need a 2.11 SNAPSHOT. That 2.10 is outdated.
https://repository.apache.org/content/repositories/snapshots/org/apache/camel/apache-camel/2.11-SNAPSHOT/

I can see the link on the download page hasn't been updated. Let me fix that.


> 2. Replaced these jars with snapshot versions:
>
> bindy, core, flatpack, ftp, http, jetty, jms, mail, quartz, spring,
> sql, test, test-spring
>
> 3. Reran the test under Windows 7
>
> 4. Encountered this error (more detail below as well):
>
> 31312 [Camel (camel-1) thread #0 - file://c:/fileMoveTest/in] WARN
> org.apache.camel.component.file.GenericFileOnCompletion - Caused by:
> [org.apache.camel.component.file.GenericFileOperationFailedException -
> Error renaming file from c:\fileMoveTest\in\test.csv to
> c:\fileMoveTest\in\.processed\test.csv]
> org.apache.camel.component.file.GenericFileOperationFailedException:
> Error renaming file from c:\fileMoveTest\in\test.csv to
> c:\fileMoveTest\in\.processed\test.csv
>         at org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:72)
>         at org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:107)
>         at org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.commit(GenericFileRenameProcessStrategy.java:86)
>         at org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:132)
>         at org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:82)
>         at org.apache.camel.component.file.GenericFileOnCompletion.onComplete(GenericFileOnCompletion.java:53)
>         at org.apache.camel.util.UnitOfWorkHelper.doneSynchronizations(UnitOfWorkHelper.java:55)
>         at org.apache.camel.impl.DefaultUnitOfWork.done(DefaultUnitOfWork.java:226)
>
> Caused by: java.io.IOException: Renaming file from:
> c:\fileMoveTest\in\test.csv to: c:\fileMoveTest\in\.processed\test.csv
> failed due cannot delete from file: c:\fileMoveTest\in\test.csv after
> copy succeeded
>         at org.apache.camel.util.FileUtil.renameFile(FileUtil.java:362)
>         at org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:70)
>         ... 41 more
> ===
>
> On Mon, Aug 13, 2012 at 4:37 AM, Claus Ibsen-2 [via Camel]
> <ml...@n5.nabble.com> wrote:
>> Hi
>>
>> Maybe its related to
>> https://issues.apache.org/jira/browse/CAMEL-5461
>>
>> That on windows a stream is open on the file, and thus cannot move the
>> file afterwards.
>>
>> Can you try with SNAPSHOT code?
>>
>> On Wed, Aug 8, 2012 at 11:33 PM, pglebow <[hidden email]> wrote:
>>
>>> I'm struggling with a very odd issue with Camel 2.10 and I'm hoping
>>> someone
>>> could explain why it's occurring.  I've attached a test case that
>>> demonstrates the issue.  It is a very simple route - just take a file from
>>> a
>>> local directory and FTP it to a server.  Here is the problem:
>>>
>>> When I specify the character set in the file producer, Camel cannot rename
>>> the file from the source directory to the .processed directory (.move
>>> directory).  It is unable to acquire an exclusive file lock.
>>>
>>> However, when I remove the charset=UTF-8 parameter, everything works
>>> properly.  The file is FTPed and is moved to the .processed directory.
>>>
>>> Why does the character encoding cause an issue with read locks?  Am I
>>> doing
>>> something incorrect or is this a bug?  I'm using Camel 2.10 and Java
>>> 1.6.0_33 under Windows 7.
>>>
>>> ------------
>>> - Test case
>>> ------------
>>> package com.comp.test.camel.route.impl;
>>>
>>> import junit.framework.Assert;
>>>
>>> import org.apache.camel.builder.RouteBuilder;
>>> import org.apache.camel.test.junit4.CamelTestSupport;
>>> import org.apache.commons.logging.Log;
>>> import org.apache.commons.logging.LogFactory;
>>> import org.junit.Test;
>>>
>>> public class FileMoveTest extends CamelTestSupport {
>>>
>>>     protected Log log = LogFactory.getLog(FileMoveTest.class);
>>>
>>>     @Test
>>>     public void testRoute() throws Exception {
>>>         try {
>>>             Thread.sleep(140000);
>>>         } catch (Exception e) {
>>>             log.error(e.getMessage(), e);
>>>             Assert.fail(e.getMessage());
>>>         }
>>>
>>>     }
>>>
>>>     /*
>>>      * (non-Javadoc)
>>>      *
>>>      * @see
>>> org.apache.camel.test.junit4.CamelTestSupport#createRouteBuilder()
>>>      */
>>>     @Override
>>>     protected RouteBuilder createRouteBuilder() throws Exception {
>>>         return new RouteBuilder() {
>>>
>>>             @Override
>>>             public void configure() throws Exception {
>>>                 // Works
>>>                 //
>>>
>>> from("file://c:/fileMoveTest/in?move=.processed&moveFailed=.failed&delay=5000&readLock=rename&include=.*\\.csv$").to(
>>>                 //
>>>
>>> "ftp://anonymous@ftpTest/test?password=anonymous&delay=5000&throwExceptionOnConnectFailed=true");
>>>
>>>                 // Fails
>>>
>>>
>>> from("file://c:/fileMoveTest/in?charset=UTF-8&move=.processed&moveFailed=.failed&delay=5000&readLock=rename&include=.*\\.csv$").to(
>>>
>>>
>>> "ftp://anonymous@ftpTest/test?password=anonymous&delay=5000&throwExceptionOnConnectFailed=true");
>>>             }
>>>         };
>>>     }
>>> }
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://camel.465427.n5.nabble.com/Character-set-issue-with-File-Consumer-FTP-Publication-tp5717025.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> FuseSource
>> Email: [hidden email]
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>>
>>
>> ________________________________
>> If you reply to this email, your message will be added to the discussion
>> below:
>> http://camel.465427.n5.nabble.com/Character-set-issue-with-File-Consumer-FTP-Publication-tp5717025p5717229.html
>> To unsubscribe from Character set issue with File Consumer & FTP
>> Publication, click here.
>> NAML
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Character-set-issue-with-File-Consumer-FTP-Publication-tp5717025p5717256.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Character set issue with File Consumer & FTP Publication

Posted by pglebow <pg...@gmail.com>.
Hi Claus,

  I tried with a snapshot and still encountered the error.  I've
detailed my test procedure below between the
====s; the test case was the same one that I sent previously.

Phil
====
1. Downloaded this snapshot:
https://repository.apache.org/content/repositories/snapshots/org/apache/camel/apache-camel/2.10-SNAPSHOT/apache-camel-2.10-20120617.030556-150.zip

2. Replaced these jars with snapshot versions:

bindy, core, flatpack, ftp, http, jetty, jms, mail, quartz, spring,
sql, test, test-spring

3. Reran the test under Windows 7

4. Encountered this error (more detail below as well):

31312 [Camel (camel-1) thread #0 - file://c:/fileMoveTest/in] WARN
org.apache.camel.component.file.GenericFileOnCompletion - Caused by:
[org.apache.camel.component.file.GenericFileOperationFailedException -
Error renaming file from c:\fileMoveTest\in\test.csv to
c:\fileMoveTest\in\.processed\test.csv]
org.apache.camel.component.file.GenericFileOperationFailedException:
Error renaming file from c:\fileMoveTest\in\test.csv to
c:\fileMoveTest\in\.processed\test.csv
	at org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:72)
	at org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:107)
	at org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.commit(GenericFileRenameProcessStrategy.java:86)
	at org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:132)
	at org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:82)
	at org.apache.camel.component.file.GenericFileOnCompletion.onComplete(GenericFileOnCompletion.java:53)
	at org.apache.camel.util.UnitOfWorkHelper.doneSynchronizations(UnitOfWorkHelper.java:55)
	at org.apache.camel.impl.DefaultUnitOfWork.done(DefaultUnitOfWork.java:226)

Caused by: java.io.IOException: Renaming file from:
c:\fileMoveTest\in\test.csv to: c:\fileMoveTest\in\.processed\test.csv
failed due cannot delete from file: c:\fileMoveTest\in\test.csv after
copy succeeded
	at org.apache.camel.util.FileUtil.renameFile(FileUtil.java:362)
	at org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:70)
	... 41 more
===

On Mon, Aug 13, 2012 at 4:37 AM, Claus Ibsen-2 [via Camel]
<ml...@n5.nabble.com> wrote:
> Hi
>
> Maybe its related to
> https://issues.apache.org/jira/browse/CAMEL-5461
>
> That on windows a stream is open on the file, and thus cannot move the
> file afterwards.
>
> Can you try with SNAPSHOT code?
>
> On Wed, Aug 8, 2012 at 11:33 PM, pglebow <[hidden email]> wrote:
>
>> I'm struggling with a very odd issue with Camel 2.10 and I'm hoping
>> someone
>> could explain why it's occurring.  I've attached a test case that
>> demonstrates the issue.  It is a very simple route - just take a file from
>> a
>> local directory and FTP it to a server.  Here is the problem:
>>
>> When I specify the character set in the file producer, Camel cannot rename
>> the file from the source directory to the .processed directory (.move
>> directory).  It is unable to acquire an exclusive file lock.
>>
>> However, when I remove the charset=UTF-8 parameter, everything works
>> properly.  The file is FTPed and is moved to the .processed directory.
>>
>> Why does the character encoding cause an issue with read locks?  Am I
>> doing
>> something incorrect or is this a bug?  I'm using Camel 2.10 and Java
>> 1.6.0_33 under Windows 7.
>>
>> ------------
>> - Test case
>> ------------
>> package com.comp.test.camel.route.impl;
>>
>> import junit.framework.Assert;
>>
>> import org.apache.camel.builder.RouteBuilder;
>> import org.apache.camel.test.junit4.CamelTestSupport;
>> import org.apache.commons.logging.Log;
>> import org.apache.commons.logging.LogFactory;
>> import org.junit.Test;
>>
>> public class FileMoveTest extends CamelTestSupport {
>>
>>     protected Log log = LogFactory.getLog(FileMoveTest.class);
>>
>>     @Test
>>     public void testRoute() throws Exception {
>>         try {
>>             Thread.sleep(140000);
>>         } catch (Exception e) {
>>             log.error(e.getMessage(), e);
>>             Assert.fail(e.getMessage());
>>         }
>>
>>     }
>>
>>     /*
>>      * (non-Javadoc)
>>      *
>>      * @see
>> org.apache.camel.test.junit4.CamelTestSupport#createRouteBuilder()
>>      */
>>     @Override
>>     protected RouteBuilder createRouteBuilder() throws Exception {
>>         return new RouteBuilder() {
>>
>>             @Override
>>             public void configure() throws Exception {
>>                 // Works
>>                 //
>>
>> from("file://c:/fileMoveTest/in?move=.processed&moveFailed=.failed&delay=5000&readLock=rename&include=.*\\.csv$").to(
>>                 //
>>
>> "ftp://anonymous@ftpTest/test?password=anonymous&delay=5000&throwExceptionOnConnectFailed=true");
>>
>>                 // Fails
>>
>>
>> from("file://c:/fileMoveTest/in?charset=UTF-8&move=.processed&moveFailed=.failed&delay=5000&readLock=rename&include=.*\\.csv$").to(
>>
>>
>> "ftp://anonymous@ftpTest/test?password=anonymous&delay=5000&throwExceptionOnConnectFailed=true");
>>             }
>>         };
>>     }
>> }
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Character-set-issue-with-File-Consumer-FTP-Publication-tp5717025.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: [hidden email]
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/Character-set-issue-with-File-Consumer-FTP-Publication-tp5717025p5717229.html
> To unsubscribe from Character set issue with File Consumer & FTP
> Publication, click here.
> NAML




--
View this message in context: http://camel.465427.n5.nabble.com/Character-set-issue-with-File-Consumer-FTP-Publication-tp5717025p5717256.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Character set issue with File Consumer & FTP Publication

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Maybe its related to
https://issues.apache.org/jira/browse/CAMEL-5461

That on windows a stream is open on the file, and thus cannot move the
file afterwards.

Can you try with SNAPSHOT code?

On Wed, Aug 8, 2012 at 11:33 PM, pglebow <pg...@gmail.com> wrote:
> I'm struggling with a very odd issue with Camel 2.10 and I'm hoping someone
> could explain why it's occurring.  I've attached a test case that
> demonstrates the issue.  It is a very simple route - just take a file from a
> local directory and FTP it to a server.  Here is the problem:
>
> When I specify the character set in the file producer, Camel cannot rename
> the file from the source directory to the .processed directory (.move
> directory).  It is unable to acquire an exclusive file lock.
>
> However, when I remove the charset=UTF-8 parameter, everything works
> properly.  The file is FTPed and is moved to the .processed directory.
>
> Why does the character encoding cause an issue with read locks?  Am I doing
> something incorrect or is this a bug?  I'm using Camel 2.10 and Java
> 1.6.0_33 under Windows 7.
>
> ------------
> - Test case
> ------------
> package com.comp.test.camel.route.impl;
>
> import junit.framework.Assert;
>
> import org.apache.camel.builder.RouteBuilder;
> import org.apache.camel.test.junit4.CamelTestSupport;
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
> import org.junit.Test;
>
> public class FileMoveTest extends CamelTestSupport {
>
>     protected Log log = LogFactory.getLog(FileMoveTest.class);
>
>     @Test
>     public void testRoute() throws Exception {
>         try {
>             Thread.sleep(140000);
>         } catch (Exception e) {
>             log.error(e.getMessage(), e);
>             Assert.fail(e.getMessage());
>         }
>
>     }
>
>     /*
>      * (non-Javadoc)
>      *
>      * @see
> org.apache.camel.test.junit4.CamelTestSupport#createRouteBuilder()
>      */
>     @Override
>     protected RouteBuilder createRouteBuilder() throws Exception {
>         return new RouteBuilder() {
>
>             @Override
>             public void configure() throws Exception {
>                 // Works
>                 //
> from("file://c:/fileMoveTest/in?move=.processed&moveFailed=.failed&delay=5000&readLock=rename&include=.*\\.csv$").to(
>                 //
> "ftp://anonymous@ftpTest/test?password=anonymous&delay=5000&throwExceptionOnConnectFailed=true");
>
>                 // Fails
>
> from("file://c:/fileMoveTest/in?charset=UTF-8&move=.processed&moveFailed=.failed&delay=5000&readLock=rename&include=.*\\.csv$").to(
>
> "ftp://anonymous@ftpTest/test?password=anonymous&delay=5000&throwExceptionOnConnectFailed=true");
>             }
>         };
>     }
> }
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Character-set-issue-with-File-Consumer-FTP-Publication-tp5717025.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Character set issue with File Consumer & FTP Publication

Posted by pglebow <pg...@gmail.com>.
Hi Raul,

  I've attached the test file that I used as well as the log from the
test in my prior message.  I pasted the exception as well in case you
have difficulty with the attachments.

  This is a 2.10 problem - I ran the exact same test with 2.9.1 and
both routes in the test succeeded.  What changed in 2.10 from 2.9.1?

Phil
====
120 [main] INFO com.bglobal.etf.dixie.camel.route.impl.FileMoveTest -
********************************************************************************
130 [main] INFO com.bglobal.etf.dixie.camel.route.impl.FileMoveTest -
Testing: testRoute(com.bglobal.etf.dixie.camel.route.impl.FileMoveTest)
130 [main] INFO com.bglobal.etf.dixie.camel.route.impl.FileMoveTest -
********************************************************************************
381 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache
Camel 2.10.0 (CamelContext: camel-1) is starting
381 [main] INFO org.apache.camel.management.ManagementStrategyFactory
- JMX is disabled.
601 [main] INFO org.apache.camel.impl.converter.DefaultTypeConverter -
Loaded 186 type converters
831 [main] INFO org.apache.camel.impl.DefaultCamelContext - Route:
route1 started and consuming from:
Endpoint[file://c:/fileMoveTest/in?charset=UTF-8&delay=5000&include=.*%5C.csv%24&move=.processed&moveFailed=.failed&readLock=rename]
831 [main] INFO org.apache.camel.impl.DefaultCamelContext - Total 1
routes, of which 1 is started.
831 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache
Camel 2.10.0 (CamelContext: camel-1) started in 0.450 seconds
52077 [Camel (camel-1) thread #0 - file://c:/fileMoveTest/in] INFO
org.apache.camel.component.file.remote.RemoteFileProducer - Connected
and logged in to:
Endpoint[ftp://anonymous@ftpTest/test?delay=5000&password=******&throwExceptionOnConnectFailed=true]
56596 [Camel (camel-1) thread #0 - file://c:/fileMoveTest/in] WARN
org.apache.camel.component.file.GenericFileOnCompletion - Caused by:
[org.apache.camel.component.file.GenericFileOperationFailedException -
Error renaming file from c:\fileMoveTest\in\test.csv to
c:\fileMoveTest\in\.processed\test.csv]
org.apache.camel.component.file.GenericFileOperationFailedException:
Error renaming file from c:\fileMoveTest\in\test.csv to
c:\fileMoveTest\in\.processed\test.csv
	at org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:72)
	at org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:107)
	at org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.commit(GenericFileRenameProcessStrategy.java:86)
	at org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:132)
	at org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:82)
	at org.apache.camel.component.file.GenericFileOnCompletion.onComplete(GenericFileOnCompletion.java:53)
	at org.apache.camel.util.UnitOfWorkHelper.doneSynchronizations(UnitOfWorkHelper.java:55)
	at org.apache.camel.impl.DefaultUnitOfWork.done(DefaultUnitOfWork.java:226)
	at org.apache.camel.processor.UnitOfWorkProcessor.doneUow(UnitOfWorkProcessor.java:199)
	at org.apache.camel.processor.UnitOfWorkProcessor.access$000(UnitOfWorkProcessor.java:37)
	at org.apache.camel.processor.UnitOfWorkProcessor$1.done(UnitOfWorkProcessor.java:157)
	at org.apache.camel.processor.RouteContextProcessor$1.done(RouteContextProcessor.java:56)
	at org.apache.camel.processor.RouteContextProcessor$1.done(RouteContextProcessor.java:56)
	at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:361)
	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:220)
	at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
	at org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)
	at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
	at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)
	at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)
	at org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48)
	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
	at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)
	at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:336)
	at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:189)
	at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:155)
	at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:139)
	at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:91)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
	at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)
Caused by: java.io.IOException: Renaming file from:
c:\fileMoveTest\in\test.csv to: c:\fileMoveTest\in\.processed\test.csv
failed due cannot delete from file: c:\fileMoveTest\in\test.csv after
copy succeeded
	at org.apache.camel.util.FileUtil.renameFile(FileUtil.java:362)
	at org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:70)
	... 41 more


On Thu, Aug 9, 2012 at 4:57 AM, Raul Kripalani [via Camel]
<ml...@n5.nabble.com> wrote:
> What's the name of the file and what exception do you see?
>
> Regards,
>
> *Raúl Kripalani*
> *Principal Consultant | FuseSource Corp.
> [hidden email] | fusesource.com <http://www.fusesource.com/>
> skype: raul.fuse | twitter: @raulvk <http://twitter.com/raulvk>,
> @fusenews<http://twitter.com/fusenews>
> *
> blog: F3 - Flashes From the
> Field<http://blog.raulkr.net/?utm_source=fusesourceemail&utm_medium=email&utm_campaign=fusesourcemail>
>  | aboutme: http://about.me/raulkripalani
>
> <http://twitter.com/fusenews>
>
> On 8 August 2012 22:33, pglebow <[hidden email]> wrote:
>
>> I'm struggling with a very odd issue with Camel 2.10 and I'm hoping
>> someone
>> could explain why it's occurring.  I've attached a test case that
>> demonstrates the issue.  It is a very simple route - just take a file from
>> a
>> local directory and FTP it to a server.  Here is the problem:
>>
>> When I specify the character set in the file producer, Camel cannot rename
>> the file from the source directory to the .processed directory (.move
>> directory).  It is unable to acquire an exclusive file lock.
>>
>> However, when I remove the charset=UTF-8 parameter, everything works
>> properly.  The file is FTPed and is moved to the .processed directory.
>>
>> Why does the character encoding cause an issue with read locks?  Am I
>> doing
>> something incorrect or is this a bug?  I'm using Camel 2.10 and Java
>> 1.6.0_33 under Windows 7.
>>
>> ------------
>> - Test case
>> ------------
>> package com.comp.test.camel.route.impl;
>>
>> import junit.framework.Assert;
>>
>> import org.apache.camel.builder.RouteBuilder;
>> import org.apache.camel.test.junit4.CamelTestSupport;
>> import org.apache.commons.logging.Log;
>> import org.apache.commons.logging.LogFactory;
>> import org.junit.Test;
>>
>> public class FileMoveTest extends CamelTestSupport {
>>
>>     protected Log log = LogFactory.getLog(FileMoveTest.class);
>>
>>     @Test
>>     public void testRoute() throws Exception {
>>         try {
>>             Thread.sleep(140000);
>>         } catch (Exception e) {
>>             log.error(e.getMessage(), e);
>>             Assert.fail(e.getMessage());
>>         }
>>
>>     }
>>
>>     /*
>>      * (non-Javadoc)
>>      *
>>      * @see
>> org.apache.camel.test.junit4.CamelTestSupport#createRouteBuilder()
>>      */
>>     @Override
>>     protected RouteBuilder createRouteBuilder() throws Exception {
>>         return new RouteBuilder() {
>>
>>             @Override
>>             public void configure() throws Exception {
>>                 // Works
>>                 //
>>
>>
>> from("file://c:/fileMoveTest/in?move=.processed&moveFailed=.failed&delay=5000&readLock=rename&include=.*\\.csv$").to(
>>                 //
>> "ftp://anonymous@ftpTest
>> /test?password=anonymous&delay=5000&throwExceptionOnConnectFailed=true");
>>
>>                 // Fails
>>
>>
>>
>> from("file://c:/fileMoveTest/in?charset=UTF-8&move=.processed&moveFailed=.failed&delay=5000&readLock=rename&include=.*\\.csv$").to(
>>
>> "ftp://anonymous@ftpTest
>> /test?password=anonymous&delay=5000&throwExceptionOnConnectFailed=true");
>>             }
>>         };
>>     }
>> }
>>
>>
>>
>>
>> --
>> View this message in context:
>>
>> http://camel.465427.n5.nabble.com/Character-set-issue-with-File-Consumer-FTP-Publication-tp5717025.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/Character-set-issue-with-File-Consumer-FTP-Publication-tp5717025p5717061.html
> To unsubscribe from Character set issue with File Consumer & FTP
> Publication, click here.
> NAML




--
View this message in context: http://camel.465427.n5.nabble.com/Character-set-issue-with-File-Consumer-FTP-Publication-tp5717025p5717077.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Character set issue with File Consumer & FTP Publication

Posted by pglebow <pg...@gmail.com>.
It looks like the files are only available on Nabble.  The name of the
file was "test.csv" and it contained one line of text: "This is a test
text file.".

Phil

On Thu, Aug 9, 2012 at 8:33 AM, Philip Glebow <pg...@gmail.com> wrote:
> Hi Raul,
>
>   I've attached the test file that I used as well as the log from the
> test in my prior message.  I pasted the exception as well in case you
> have difficulty with the attachments.
>
>   This is a 2.10 problem - I ran the exact same test with 2.9.1 and
> both routes in the test succeeded.  What changed in 2.10 from 2.9.1?
>
> Phil
> ====
> 120 [main] INFO com.bglobal.etf.dixie.camel.route.impl.FileMoveTest -
> ********************************************************************************
> 130 [main] INFO com.bglobal.etf.dixie.camel.route.impl.FileMoveTest -
> Testing: testRoute(com.bglobal.etf.dixie.camel.route.impl.FileMoveTest)
> 130 [main] INFO com.bglobal.etf.dixie.camel.route.impl.FileMoveTest -
> ********************************************************************************
> 381 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache
> Camel 2.10.0 (CamelContext: camel-1) is starting
> 381 [main] INFO org.apache.camel.management.ManagementStrategyFactory
> - JMX is disabled.
> 601 [main] INFO org.apache.camel.impl.converter.DefaultTypeConverter -
> Loaded 186 type converters
> 831 [main] INFO org.apache.camel.impl.DefaultCamelContext - Route:
> route1 started and consuming from:
> Endpoint[file://c:/fileMoveTest/in?charset=UTF-8&delay=5000&include=.*%5C.csv%24&move=.processed&moveFailed=.failed&readLock=rename]
> 831 [main] INFO org.apache.camel.impl.DefaultCamelContext - Total 1
> routes, of which 1 is started.
> 831 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache
> Camel 2.10.0 (CamelContext: camel-1) started in 0.450 seconds
> 52077 [Camel (camel-1) thread #0 - file://c:/fileMoveTest/in] INFO
> org.apache.camel.component.file.remote.RemoteFileProducer - Connected
> and logged in to:
> Endpoint[ftp://anonymous@ftpTest/test?delay=5000&password=******&throwExceptionOnConnectFailed=true]
> 56596 [Camel (camel-1) thread #0 - file://c:/fileMoveTest/in] WARN
> org.apache.camel.component.file.GenericFileOnCompletion - Caused by:
> [org.apache.camel.component.file.GenericFileOperationFailedException -
> Error renaming file from c:\fileMoveTest\in\test.csv to
> c:\fileMoveTest\in\.processed\test.csv]
> org.apache.camel.component.file.GenericFileOperationFailedException:
> Error renaming file from c:\fileMoveTest\in\test.csv to
> c:\fileMoveTest\in\.processed\test.csv
>         at org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:72)
>         at org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:107)
>         at org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.commit(GenericFileRenameProcessStrategy.java:86)
>         at org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:132)
>         at org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:82)
>         at org.apache.camel.component.file.GenericFileOnCompletion.onComplete(GenericFileOnCompletion.java:53)
>         at org.apache.camel.util.UnitOfWorkHelper.doneSynchronizations(UnitOfWorkHelper.java:55)
>         at org.apache.camel.impl.DefaultUnitOfWork.done(DefaultUnitOfWork.java:226)
>         at org.apache.camel.processor.UnitOfWorkProcessor.doneUow(UnitOfWorkProcessor.java:199)
>         at org.apache.camel.processor.UnitOfWorkProcessor.access$000(UnitOfWorkProcessor.java:37)
>         at org.apache.camel.processor.UnitOfWorkProcessor$1.done(UnitOfWorkProcessor.java:157)
>         at org.apache.camel.processor.RouteContextProcessor$1.done(RouteContextProcessor.java:56)
>         at org.apache.camel.processor.RouteContextProcessor$1.done(RouteContextProcessor.java:56)
>         at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:361)
>         at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:220)
>         at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
>         at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)
>         at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
>         at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)
>         at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)
>         at org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48)
>         at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>         at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
>         at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)
>         at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:336)
>         at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:189)
>         at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:155)
>         at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:139)
>         at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:91)
>         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
>         at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
>         at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
>         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
>         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
>         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>         at java.lang.Thread.run(Thread.java:662)
> Caused by: java.io.IOException: Renaming file from:
> c:\fileMoveTest\in\test.csv to: c:\fileMoveTest\in\.processed\test.csv
> failed due cannot delete from file: c:\fileMoveTest\in\test.csv after
> copy succeeded
>         at org.apache.camel.util.FileUtil.renameFile(FileUtil.java:362)
>         at org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:70)
>         ... 41 more
>
>
> On Thu, Aug 9, 2012 at 4:57 AM, Raul Kripalani [via Camel]
> <ml...@n5.nabble.com> wrote:
>> What's the name of the file and what exception do you see?
>>
>> Regards,
>>
>> *Raúl Kripalani*
>> *Principal Consultant | FuseSource Corp.
>> [hidden email] | fusesource.com <http://www.fusesource.com/>
>> skype: raul.fuse | twitter: @raulvk <http://twitter.com/raulvk>,
>> @fusenews<http://twitter.com/fusenews>
>> *
>> blog: F3 - Flashes From the
>> Field<http://blog.raulkr.net/?utm_source=fusesourceemail&utm_medium=email&utm_campaign=fusesourcemail>
>>  | aboutme: http://about.me/raulkripalani
>>
>> <http://twitter.com/fusenews>
>>
>> On 8 August 2012 22:33, pglebow <[hidden email]> wrote:
>>
>>> I'm struggling with a very odd issue with Camel 2.10 and I'm hoping
>>> someone
>>> could explain why it's occurring.  I've attached a test case that
>>> demonstrates the issue.  It is a very simple route - just take a file from
>>> a
>>> local directory and FTP it to a server.  Here is the problem:
>>>
>>> When I specify the character set in the file producer, Camel cannot rename
>>> the file from the source directory to the .processed directory (.move
>>> directory).  It is unable to acquire an exclusive file lock.
>>>
>>> However, when I remove the charset=UTF-8 parameter, everything works
>>> properly.  The file is FTPed and is moved to the .processed directory.
>>>
>>> Why does the character encoding cause an issue with read locks?  Am I
>>> doing
>>> something incorrect or is this a bug?  I'm using Camel 2.10 and Java
>>> 1.6.0_33 under Windows 7.
>>>
>>> ------------
>>> - Test case
>>> ------------
>>> package com.comp.test.camel.route.impl;
>>>
>>> import junit.framework.Assert;
>>>
>>> import org.apache.camel.builder.RouteBuilder;
>>> import org.apache.camel.test.junit4.CamelTestSupport;
>>> import org.apache.commons.logging.Log;
>>> import org.apache.commons.logging.LogFactory;
>>> import org.junit.Test;
>>>
>>> public class FileMoveTest extends CamelTestSupport {
>>>
>>>     protected Log log = LogFactory.getLog(FileMoveTest.class);
>>>
>>>     @Test
>>>     public void testRoute() throws Exception {
>>>         try {
>>>             Thread.sleep(140000);
>>>         } catch (Exception e) {
>>>             log.error(e.getMessage(), e);
>>>             Assert.fail(e.getMessage());
>>>         }
>>>
>>>     }
>>>
>>>     /*
>>>      * (non-Javadoc)
>>>      *
>>>      * @see
>>> org.apache.camel.test.junit4.CamelTestSupport#createRouteBuilder()
>>>      */
>>>     @Override
>>>     protected RouteBuilder createRouteBuilder() throws Exception {
>>>         return new RouteBuilder() {
>>>
>>>             @Override
>>>             public void configure() throws Exception {
>>>                 // Works
>>>                 //
>>>
>>>
>>> from("file://c:/fileMoveTest/in?move=.processed&moveFailed=.failed&delay=5000&readLock=rename&include=.*\\.csv$").to(
>>>                 //
>>> "ftp://anonymous@ftpTest
>>> /test?password=anonymous&delay=5000&throwExceptionOnConnectFailed=true");
>>>
>>>                 // Fails
>>>
>>>
>>>
>>> from("file://c:/fileMoveTest/in?charset=UTF-8&move=.processed&moveFailed=.failed&delay=5000&readLock=rename&include=.*\\.csv$").to(
>>>
>>> "ftp://anonymous@ftpTest
>>> /test?password=anonymous&delay=5000&throwExceptionOnConnectFailed=true");
>>>             }
>>>         };
>>>     }
>>> }
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>>
>>> http://camel.465427.n5.nabble.com/Character-set-issue-with-File-Consumer-FTP-Publication-tp5717025.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>
>>
>> ________________________________
>> If you reply to this email, your message will be added to the discussion
>> below:
>> http://camel.465427.n5.nabble.com/Character-set-issue-with-File-Consumer-FTP-Publication-tp5717025p5717061.html
>> To unsubscribe from Character set issue with File Consumer & FTP
>> Publication, click here.
>> NAML




--
View this message in context: http://camel.465427.n5.nabble.com/Character-set-issue-with-File-Consumer-FTP-Publication-tp5717025p5717080.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Character set issue with File Consumer & FTP Publication

Posted by Raul Kripalani <ra...@fusesource.com>.
What's the name of the file and what exception do you see?

Regards,

*Raúl Kripalani*
*Principal Consultant | FuseSource Corp.
raul@fusesource.com | fusesource.com <http://www.fusesource.com/>
skype: raul.fuse | twitter: @raulvk <http://twitter.com/raulvk>,
@fusenews<http://twitter.com/fusenews>
*
blog: F3 - Flashes From the
Field<http://blog.raulkr.net/?utm_source=fusesourceemail&utm_medium=email&utm_campaign=fusesourcemail>
 | aboutme: http://about.me/raulkripalani

<http://twitter.com/fusenews>

On 8 August 2012 22:33, pglebow <pg...@gmail.com> wrote:

> I'm struggling with a very odd issue with Camel 2.10 and I'm hoping someone
> could explain why it's occurring.  I've attached a test case that
> demonstrates the issue.  It is a very simple route - just take a file from
> a
> local directory and FTP it to a server.  Here is the problem:
>
> When I specify the character set in the file producer, Camel cannot rename
> the file from the source directory to the .processed directory (.move
> directory).  It is unable to acquire an exclusive file lock.
>
> However, when I remove the charset=UTF-8 parameter, everything works
> properly.  The file is FTPed and is moved to the .processed directory.
>
> Why does the character encoding cause an issue with read locks?  Am I doing
> something incorrect or is this a bug?  I'm using Camel 2.10 and Java
> 1.6.0_33 under Windows 7.
>
> ------------
> - Test case
> ------------
> package com.comp.test.camel.route.impl;
>
> import junit.framework.Assert;
>
> import org.apache.camel.builder.RouteBuilder;
> import org.apache.camel.test.junit4.CamelTestSupport;
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
> import org.junit.Test;
>
> public class FileMoveTest extends CamelTestSupport {
>
>     protected Log log = LogFactory.getLog(FileMoveTest.class);
>
>     @Test
>     public void testRoute() throws Exception {
>         try {
>             Thread.sleep(140000);
>         } catch (Exception e) {
>             log.error(e.getMessage(), e);
>             Assert.fail(e.getMessage());
>         }
>
>     }
>
>     /*
>      * (non-Javadoc)
>      *
>      * @see
> org.apache.camel.test.junit4.CamelTestSupport#createRouteBuilder()
>      */
>     @Override
>     protected RouteBuilder createRouteBuilder() throws Exception {
>         return new RouteBuilder() {
>
>             @Override
>             public void configure() throws Exception {
>                 // Works
>                 //
>
> from("file://c:/fileMoveTest/in?move=.processed&moveFailed=.failed&delay=5000&readLock=rename&include=.*\\.csv$").to(
>                 //
> "ftp://anonymous@ftpTest
> /test?password=anonymous&delay=5000&throwExceptionOnConnectFailed=true");
>
>                 // Fails
>
>
> from("file://c:/fileMoveTest/in?charset=UTF-8&move=.processed&moveFailed=.failed&delay=5000&readLock=rename&include=.*\\.csv$").to(
>
> "ftp://anonymous@ftpTest
> /test?password=anonymous&delay=5000&throwExceptionOnConnectFailed=true");
>             }
>         };
>     }
> }
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Character-set-issue-with-File-Consumer-FTP-Publication-tp5717025.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>