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

Daniel Bergholm commented on VFS-426:
-------------------------------------

My workaround is to use a FileSystemManager with a NullFilesCache (Spring bean 
declaration):
{code:xml}<bean id="fileSystemManager" 
class="org.apache.commons.vfs2.impl.StandardFileSystemManager" 
init-method="init" destroy-method="close">
        <property name="filesCache">
            <bean class="org.apache.commons.vfs2.cache.NullFilesCache"/>
        </property>
</bean>{code}
Of course this workaround might not be good enough in cases where the 
performance hit of not using a cache is a problem. 


I think a fix for this bug would be to use 
{{org.apache.commons.vfs2.provider.AbstractFileName#createURI}} (which is then 
overriden in this case by 
{{org.apache.commons.vfs2.provider.URLFileName#createURI()}}) when creating the 
key in {{org.apache.commons.vfs2.provider.AbstractFileName#getKey()}}, since 
the key is then used in 
{{org.apache.commons.vfs2.provider.AbstractFileName#equals(Object o)}} and 
{{org.apache.commons.vfs2.provider.AbstractFileName#hashCode()}}, which are 
then used in cache implementations (such as HashMaps)
                
> HTTP URL query string not part of cache key
> -------------------------------------------
>
>                 Key: VFS-426
>                 URL: https://issues.apache.org/jira/browse/VFS-426
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 2.0
>            Reporter: Daniel Bergholm
>
> I am using commons-vfs amongst other things to download http files. When 
> resolving different URLs where only the query string differs, the default 
> cache returns the wrong URL sometimes (returning a previously accessed URL 
> where only the query string differs).
> I think this is because the key property of URLFileName does not include the 
> query string. The {code:java}createURI(){code} method of URLFileName does 
> include it, but when constructing the key the {code:java}createURI(boolean 
> useAbsolutePath, boolean usePassword){code} method of AbstractFileName is 
> used. This method only includes the path. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to