Bernd Eckenfels created VFS-493:
-----------------------------------

             Summary: fileSystem cache key of TemporaryFileProvider compares 
only by hashcode
                 Key: VFS-493
                 URL: https://issues.apache.org/jira/browse/VFS-493
             Project: Commons VFS
          Issue Type: Bug
    Affects Versions: 2.1
            Reporter: Bernd Eckenfels
            Priority: Minor


The TemporaryFileProvider puts instances of itself in the 
AbstractFileProvider#fileSystems TreeMap. For this it implements a comparator 
which solely based on the hashcode of the objects does the compare.

I think the fact that two instances have the same hashcode is not a reliable 
mean to "return 0" i.e. to state match. This is especially a problem as all 
other objects typically put string-typed keys.

I dont have a reproducer as I just stumbled across this by inspection. It looks 
like it should be documented a bit better what type of keys are allowed. Most 
use the rootUri, but TemporaryFileProvider uses a "instance" and 
URLFileProvider generates a synthetic key string containing the classname as 
well as a uri part.

Maybe the solution would be to generally use strings?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to