Ah yeah, well spotted. Its like the the big or little endian problem
http://en.wikipedia.org/wiki/Endianness

Thanks for fixing.

On Tue, Sep 28, 2010 at 7:41 PM,  <[email protected]> wrote:
> Author: janstey
> Date: Tue Sep 28 17:41:32 2010
> New Revision: 1002290
>
> URL: http://svn.apache.org/viewvc?rev=1002290&view=rev
> Log:
> fix related to FTP password shorthand username:passw...@server
>
> Modified:
>    
> camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConfiguration.java
>    
> camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDeleteFileScottTigerTest.java
>    
> camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/UriConfigurationTest.java
>
> Modified: 
> camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConfiguration.java
> URL: 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConfiguration.java?rev=1002290&r1=1002289&r2=1002290&view=diff
> ==============================================================================
> --- 
> camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConfiguration.java
>  (original)
> +++ 
> camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConfiguration.java
>  Tue Sep 28 17:41:32 2010
> @@ -56,13 +56,13 @@ public abstract class RemoteFileConfigur
>         setProtocol(uri.getScheme());
>         setDefaultPort();
>
> -        // UserInfo can contain both username and password as: 
> pwd:u...@ftpserver
> +        // UserInfo can contain both username and password as: 
> user:p...@ftpserver
>         // see: http://en.wikipedia.org/wiki/URI_scheme
>         String username = uri.getUserInfo();
>         String pw = null;
>         if (username != null && username.contains(":")) {
> -            pw = ObjectHelper.before(username, ":");
> -            username = ObjectHelper.after(username, ":");
> +            pw = ObjectHelper.after(username, ":");
> +            username = ObjectHelper.before(username, ":");
>         }
>         if (username != null) {
>             setUsername(username);
>
> Modified: 
> camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDeleteFileScottTigerTest.java
> URL: 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDeleteFileScottTigerTest.java?rev=1002290&r1=1002289&r2=1002290&view=diff
> ==============================================================================
> --- 
> camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDeleteFileScottTigerTest.java
>  (original)
> +++ 
> camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDeleteFileScottTigerTest.java
>  Tue Sep 28 17:41:32 2010
> @@ -23,7 +23,7 @@ public class FromFtpDeleteFileScottTiger
>
>     @Override
>     protected String getFtpUrl() {
> -        return "ftp://tiger:sc...@localhost:"; + getPort() + 
> "/deletefile?binary=false&delete=true";
> +        return "ftp://scott:ti...@localhost:"; + getPort() + 
> "/deletefile?binary=false&delete=true";
>     }
>
>  }
> \ No newline at end of file
>
> Modified: 
> camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/UriConfigurationTest.java
> URL: 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/UriConfigurationTest.java?rev=1002290&r1=1002289&r2=1002290&view=diff
> ==============================================================================
> --- 
> camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/UriConfigurationTest.java
>  (original)
> +++ 
> camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/UriConfigurationTest.java
>  Tue Sep 28 17:41:32 2010
> @@ -198,6 +198,20 @@ public class UriConfigurationTest extend
>     }
>
>     @Test
> +    public void testPasswordInContextPathConfiguration() {
> +        Endpoint endpoint = 
> context.getEndpoint("ftp://user:sec...@hostname:1021/some/file";);
> +        assertIsInstanceOf(FtpEndpoint.class, endpoint);
> +        FtpEndpoint ftpEndpoint = (FtpEndpoint) endpoint;
> +        RemoteFileConfiguration config = (RemoteFileConfiguration) 
> ftpEndpoint.getConfiguration();
> +
> +        assertEquals("ftp", config.getProtocol());
> +        assertEquals("hostname", config.getHost());
> +        assertEquals(1021, config.getPort());
> +        assertEquals("user", config.getUsername());
> +        assertEquals("secret", config.getPassword());
> +    }
> +
> +   �...@test
>     public void testStartingDirectoryWithDot() throws Exception {
>         Endpoint endpoint = 
> context.getEndpoint("ftp://u...@hostname?password=secret";);
>         FtpEndpoint ftpEndpoint = assertIsInstanceOf(FtpEndpoint.class, 
> endpoint);
>
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to