commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joerg Schaible (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (VFS-297) New instance of SftpFileSystem is created every time due to the bug in FileSystemOptions.compareTo()
Date Wed, 23 Sep 2015 07:15:05 GMT

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

Joerg Schaible edited comment on VFS-297 at 9/23/15 7:14 AM:
-------------------------------------------------------------

{noformat}
add -N /home/jos/src/Apache/Commons/Proper/vfs/core/src/test/java/org/apache/commons/vfs2/FileSystemOptionsTest.java
    A         /home/jos/src/Apache/Commons/Proper/vfs/core/src/test/java/org/apache/commons/vfs2/FileSystemOptionsTest.java
commit -m "VFS-297: Fix FileSystemOptions.compareTo(). Implement equals() and hashCode()."
-N /home/jos/src/Apache/Commons/Proper/vfs/core/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java
/home/jos/src/Apache/Commons/Proper/vfs/core/src/test/java/org/apache/commons/vfs2/FileSystemOptionsTest.java
    Sending        /home/jos/src/Apache/Commons/Proper/vfs/core/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java
    Adding         /home/jos/src/Apache/Commons/Proper/vfs/core/src/test/java/org/apache/commons/vfs2/FileSystemOptionsTest.java
    Transmitting file data ...
    Committed revision 1704617.
{noformat}


was (Author: joehni):
add -N /home/jos/src/Apache/Commons/Proper/vfs/core/src/test/java/org/apache/commons/vfs2/FileSystemOptionsTest.java
    A         /home/jos/src/Apache/Commons/Proper/vfs/core/src/test/java/org/apache/commons/vfs2/FileSystemOptionsTest.java
commit -m "VFS-297: Fix FileSystemOptions.compareTo(). Implement equals() and hashCode()."
-N /home/jos/src/Apache/Commons/Proper/vfs/core/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java
/home/jos/src/Apache/Commons/Proper/vfs/core/src/test/java/org/apache/commons/vfs2/FileSystemOptionsTest.java
    Sending        /home/jos/src/Apache/Commons/Proper/vfs/core/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java
    Adding         /home/jos/src/Apache/Commons/Proper/vfs/core/src/test/java/org/apache/commons/vfs2/FileSystemOptionsTest.java
    Transmitting file data ...
    Committed revision 1704617.


> 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
>            Assignee: Joerg Schaible
>             Fix For: 2.1
>
>
> 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