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

Gary D. Gregory commented on VFS-426:
-------------------------------------

I added the following test case to illustrate the issue:

org.apache.commons.vfs2.provider.http.test.HttpFilesCacheTestCase

Changing {{org.apache.commons.vfs2.provider.AbstractFileName#getKey(}} to:

{code:java}
    private String getKey()
    {
        if (key == null)
        {
            key = createURI();
        }
        return key;
    }
{code}


or better:

{code:java}
    private String getKey()
    {
        if (key == null)
        {
            key = getURI();
        }
        return key;
    }
{code}

does work for the new test case and no other test fails.

Note that this can make the {{key}} and the {{uri}} ivars the same depending on 
the implementation of {{createURI()}}.

*Does anyone see a problem with this?*

*I'll wait a day or so for comments before committing.*


                
> 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