Hi Bela

I have committed a fix in camel-ftp.
http://svn.apache.org/viewvc?view=rev&revision=679979

Could you try the latest code from trunk?
Or jump on 1.5-SNAPSHOT if you are using maven.


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: Claus Ibsen [mailto:[EMAIL PROTECTED] 
Sent: 25. juli 2008 09:40
To: [email protected]
Subject: RE: SftpProducer bug

Hi Bela

Glad you enjoy riding the Camel.

Thanks for reporting the issue. I have created a ticket in JIRA: 
https://issues.apache.org/activemq/browse/CAMEL-758

Lets see if there is a existDir or similar method on the client so we will only 
try to build the folder if it doesn't exists.

Patches is much appreciated. Just remember to grant the Apache License when 
attaching the file. 

As we haven't a mock SFTP Server for unit testing we would appreciate if you 
can verify the fix when we get it committed to the trunk.


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: Bela [mailto:[EMAIL PROTECTED] 
Sent: 24. juli 2008 23:07
To: [email protected]
Subject: SftpProducer bug


Hi,

First let me say it's been a huge fun working with Camel! Keep up the good
work!

I have just built 1.5 from the trunk and it seems there's a bug in the
SftpProducer. I know this is not the way to report it, but for now I'm
swamped ... I promise I'll submit patches later. 

The problem is that the mkdir in the buildDirectory throws an exception when
the folder exists and it's not caught. With the current code you can only
send files to the "." (i.e. without specifying a folder).

Here is my humble change:

    protected static boolean buildDirectory(ChannelSftp sftpClient, String
dirName)
        throws IOException, SftpException {

        boolean atLeastOneSuccess = false;
        final StringBuilder sb = new StringBuilder(dirName.length());
        final String[] dirs = dirName.split("\\/");
        for (String dir : dirs) {
            sb.append(dir).append('/');
            String directory = sb.toString();

            if (LOG.isDebugEnabled()) {
                LOG.debug("Trying to build directory: " + directory);
            }
            
            try {
                sftpClient.mkdir(directory);
                atLeastOneSuccess = true;
            }
            catch ( SftpException e ) {
                // Nothing. Keep trying ..
            }
        }

        return atLeastOneSuccess;
    }

Thanks,
Bela
-- 
View this message in context: 
http://www.nabble.com/SftpProducer-bug-tp18640519s22882p18640519.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to