You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Chesnay Schepler (JIRA)" <ji...@apache.org> on 2018/06/05 08:52:00 UTC

[jira] [Updated] (FLINK-9527) Paths initialized with URI are not normalized

     [ https://issues.apache.org/jira/browse/FLINK-9527?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chesnay Schepler updated FLINK-9527:
------------------------------------
    Summary: Paths initialized with URI are not normalized  (was: Paths initialize with URI are not normalized)

> Paths initialized with URI are not normalized
> ---------------------------------------------
>
>                 Key: FLINK-9527
>                 URL: https://issues.apache.org/jira/browse/FLINK-9527
>             Project: Flink
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.0.3, 1.1.4, 1.2.1, 1.3.3, 1.5.0, 1.4.2, 1.6.0
>            Reporter: Chesnay Schepler
>            Priority: Major
>
> The {{Path}} class has a lot of logic to normalize paths, like removing trailing slashes.
> However, all this normalization can be circumvented by passing in a {{URI}}, where no normalization is done. I guess this was done on the assumption that the normalization was compatible with {{URI}}, but it turns out that this is not the case in the case of trailing slashes.
> An {{URI}} may have a trailing slash for directories, whereas a normalized {{Path}} does not.
> Unfortunately this breaks some assumptions made in the {{Path}} class, in particular {{Path#getParent()}} does not properly handle this case.
> Both assertions in the code below will fail.
> {code}
> public void testPathNormalization() {
> 		String path = "C:/Users/Zento/AppData/Local/Temp/test/";
> 		URI uri = URI.create(path);
> 		Path normalizedPath = new Path(path);
> 		Path uriPath = new Path(uri);
> 		Assert.assertEquals(normalizedPath.toString(), uriPath.toString());
> 		Assert.assertEquals("C:/Users/Zento/AppData/Local/Temp", uriPath.getParent().getPath());
> 	}
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)