commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernd Eckenfels (JIRA)" <>
Subject [jira] [Commented] (VFS-503) Equals on URLFileName should use the complete URL
Date Wed, 19 Aug 2015 08:55:45 GMT


Bernd Eckenfels commented on VFS-503:

I think the following should be a possible unit test, it can be added to
but I guess creating a new would be better (or renaming it to

    public void testParseUriParamEquals() throws FileSystemException
        // anchors will be ignored
        final URLFileNameParser urlParser = new URLFileNameParser(80);
        final FileName name1a = urlParser.parseUri(null, null, "http://host/path?query1#a");
        final FileName nameNo1 = urlParser.parseUri(null, null, "http://host/path#no");
        final FileName nameNo2 = urlParser.parseUri(null, null, "http://host/path");

        // assert it has been correctly parsed
        assertEquals(URLFileName.class.getName(), name1a.getClass().getName());
        assertEquals("query1", ((URLFileName)name1a).getPathQuery());

        final FileName name1b = urlParser.parseUri(null, null, "http://host/path?query1#b");
        final FileName name2  = urlParser.parseUri(null, null, "http://host/path?query2");

        assertEquals(name1a, name1b);
        assertNotEquals(name1a, name2);
        assertNotEquals(name1b, name2);
        assertNotEquals(name1a, nameNo1);
        assertNotEquals(name2, nameNo1);
        assertNotEquals(name1b, nameNo2);
        assertNotEquals(name2, nameNo2);

> Equals on URLFileName should use the complete URL
> -------------------------------------------------
>                 Key: VFS-503
>                 URL:
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 2.0
>            Reporter: Dominique Jean-Prost
>            Priority: Critical
>              Labels: patch
>         Attachments: patch.txt,
> Hello,
> When using http url that uses query parameters, the method resolveFile doesn not work
> Problem is caused by the fact that equals on org.apache.commons.vfs2.provider.URLFileName
does not use the query string.
> The consequence of this bug is that if you use 2 FileObject that use 2 differents URLS,
that denote 2 different contents, you would use twice the same content when using copyForm
for instance (see attached maven project)

This message was sent by Atlassian JIRA

View raw message