You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Hudson (JIRA)" <ji...@apache.org> on 2018/06/06 04:20:00 UTC
[jira] [Commented] (HADOOP-15217) FsUrlConnection does not handle
paths with spaces
[ https://issues.apache.org/jira/browse/HADOOP-15217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16502808#comment-16502808 ]
Hudson commented on HADOOP-15217:
---------------------------------
FAILURE: Integrated in Jenkins build Hadoop-trunk-Commit #14369 (See [https://builds.apache.org/job/Hadoop-trunk-Commit/14369/])
HADOOP-15217. FsUrlConnection does not handle paths with spaces. (xiao: rev ba4011d64fadef3bee5920ccedbcdac01794cc23)
* (edit) hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/fs/TestUrlStreamHandlerFactory.java
* (edit) hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FsUrlConnection.java
> FsUrlConnection does not handle paths with spaces
> -------------------------------------------------
>
> Key: HADOOP-15217
> URL: https://issues.apache.org/jira/browse/HADOOP-15217
> Project: Hadoop Common
> Issue Type: Bug
> Components: fs
> Affects Versions: 3.0.0
> Reporter: Joseph Fourny
> Assignee: Zsolt Venczel
> Priority: Major
> Attachments: HADOOP-15217.01.patch, HADOOP-15217.02.patch, HADOOP-15217.03.patch, HADOOP-15217.04.patch, HADOOP-15217.05.patch, HADOOP-15217.06.patch, TestCase.java
>
>
> When _FsUrlStreamHandlerFactory_ is registered with _java.net.URL_ (ex: when Spark is initialized), it breaks URLs with spaces (even though they are properly URI-encoded). I traced the problem down to _FSUrlConnection.connect()_ method. It naively gets the path from the URL, which contains encoded spaces, and pases it to _org.apache.hadoop.fs.Path(String)_ constructor. This is not correct, because the docs clearly say that the string must NOT be encoded. Doing so causes double encoding within the Path class (ie: %20 becomes %2520).
> See attached JUnit test.
> This test case mimics an issue I ran into when trying to use Commons Configuration 1.9 AFTER initializing Spark. Commons Configuration uses URL class to load configuration files, but Spark installs _FsUrlStreamHandlerFactory_, which hits this issue. For now, we are using an AspectJ aspect to "patch" the bytecode at load time to work-around the issue.
> The real fix is quite simple. All you need to do is replace this line in _org.apache.hadoop.fs.FsUrlConnection.connect()_:
> is = fs.open(new Path(url.getPath()));
> with this line:
> is = fs.open(new Path(url.*toUri()*.getPath()));
> URI.getPath() will correctly decode the path, which is what is expected by _org.apache.hadoop.fs.Path(String)_ constructor.
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org