commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jimmy Praet (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (VFS-297) New instance of SftpFileSystem is created every time due to the bug in FileSystemOptions.compareTo()
Date Tue, 22 Sep 2015 07:40:04 GMT

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

Jimmy Praet commented on VFS-297:
---------------------------------

{code:java}
FileSystemOptions options1 = new FileSystemOptions();
SftpFileSystemConfigBuilder.getInstance().setIdentities(options1, new File[] { new File("privatekey")
});
FileSystemOptions options2 = new FileSystemOptions();
SftpFileSystemConfigBuilder.getInstance().setIdentities(options2, new File[] { new File("privatekey")
});

assertEquals(0, options1.compareTo(options2));
{code}

> New instance of SftpFileSystem is created every time due to the bug in FileSystemOptions.compareTo()
> ----------------------------------------------------------------------------------------------------
>
>                 Key: VFS-297
>                 URL: https://issues.apache.org/jira/browse/VFS-297
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 2.0
>            Reporter: Kirill Safonov
>
> FileSystemOptions.compareTo() uses TreeMap's hashcode. This is not appropriate if map
contains array instances since Array's equals() merely checks ==  (so that {{new Array[0].equals(new
Array[0])}} is false).
> So when I configure FileSystemOptions like {{SftpFileSystemConfigBuilder.getInstance().setIdentities(options,
new File[]{new File(privateKeyFile)})}} I never get filesystem instance reused.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message