[
https://issues.apache.org/jira/browse/VFS-523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14000273#comment-14000273
]
Bernd Eckenfels commented on VFS-523:
-------------------------------------
BTW: there is also a test which tests if equal works for the positive case. I
guess the negative case would be a bit more complicated if you actually want to
test a second hdfs instance.
Anyway, this change here make the test a bit more complete:
{code}
public void testEquals() throws Exception
{
final FileObject dir = manager.resolveFile(TEST_DIR1);
Assert.assertNotNull(dir);
Assert.assertFalse(dir.exists());
// Create the test file
final FileObject file1 = createTestFile(hdfs);
Assert.assertTrue(file1.exists());
Assert.assertTrue(dir.exists());
// Get a handle to the same file and ensure its equal
final FileObject file2 = manager.resolveFile(TEST_FILE1);
Assert.assertEquals(file1, file2);
// Ensure different files on same filesystem are not equal
Assert.assertNotEquals(dir, file1);
Assert.assertNotEquals(dir, file2);
}
{code}
> HdfsFileObject equals method returns true for the same path on different hosts
> ------------------------------------------------------------------------------
>
> Key: VFS-523
> URL: https://issues.apache.org/jira/browse/VFS-523
> Project: Commons VFS
> Issue Type: Bug
> Affects Versions: 2.1
> Environment: Windows 7
> Reporter: Roger Whitcomb
> Priority: Minor
> Labels: hdfs
> Fix For: 2.1
>
> Attachments: hdfsequal.diff
>
>
> If I construct two HdfsFileObject referring to the same path (for instance,
> "/") but on different hosts, the "equals" method will consider them equal
> (and the "hashCode" method will give the same results for both) even though
> they clearly refer to different files since they are on different hosts.
> These two methods should also factor in the HdfsFileSystem to the equation.
--
This message was sent by Atlassian JIRA
(v6.2#6252)