You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Bernd Eckenfels (JIRA)" <ji...@apache.org> on 2013/09/18 05:03:52 UTC
[jira] [Created] (VFS-493) fileSystem cache key of
TemporaryFileProvider compares only by hashcode
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