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

Paddy Daly commented on CAMEL-1428:
-----------------------------------

{code}
         <camelContext xmlns="http://camel.apache.org/schema/spring";>
            <package>com.xxx.xxx.router</package>    
            <!-- use myFilter as filter to allow setting ANT paths for which 
files to scan for -->
            <endpoint id="sftpEndPoint" 
uri="sftp://${sftpuserna...@${ipaddress}?password=pass&amp;readLock=rename&amp;binary=true&amp;recursive=true&amp;delay=10000&amp;initialDelay=2000&amp;move=${file:parent}/.done/${file:name}&amp;knownHostsFile=c://known_host&amp;filter=#myAntFilter"/>
       
            <endpoint id="fileRepository" uri="file://c://fileserver"/>
         </camelContext>

        <!-- we use the AntPathMatcherRemoteFileFilter to use ant paths for 
includes and exlucde -->    
        <bean id="myAntFilter" 
class="org.apache.camel.component.file.AntPathMatcherGenericFileFilter">    
            <property name="includes" value="**/incoming/*"/>
            <property name="excludes" value="**/outgoing/*"/>
        </bean>
{code}

{code}
        from(getSftpEndPoint())
                
                .process(new Processor() {
                        public void process(final Exchange exchange) throws 
Exception {
                                Message message =  exchange.getIn();
                                log.info("message " + message);
                                String filename = 
message.getHeader(Exchange.FILE_NAME_ONLY, String.class);
                                log.info("filename " + filename);
                                exchange.getOut().setHeader(
                                                                
Exchange.FILE_NAME,
                                                                filename);
                        }
                }). 
                to(getFileRepository())
                .setHeader(
                                "filename", 
groovy("in.headers.filename")).setBody(constant(null)).to("activemq:queue:print");
                                
{code}

> SftpConsumer : GenericFileRenameProcessStrategy - String index out of bounds
> ----------------------------------------------------------------------------
>
>                 Key: CAMEL-1428
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1428
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-ftp
>    Affects Versions: 2.0.0
>         Environment: Windows XP
>            Reporter: Paddy Daly
>            Assignee: Claus Ibsen
>             Fix For: 2.0-M1
>
>         Attachments: camel-error.txt, camel-error2.txt, camel-error3.txt, 
> camel-error4.txt
>
>
> While trying to consume a file via SFTP and using the moveExpression to move 
> the file into a done folder a renameException is thrown.
> In GenericFile the relativeFileName reads something like the following.   
> /incoming/test/file1.txt
> When it tries to call this code and exception is thrown because 
> File.separator is '\' in a windows environment.
> String relative = relativeFileName.substring(0, 
> relativeFileName.lastIndexOf(File.separator));

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to