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

zhihai xu commented on HADOOP-10876:
------------------------------------

Andrew is right. The code can introduce empty Uri is at.
{code}
this.uri = new URI(scheme, authority, normalizePath(scheme, path), null, 
fragment)
        .normalize();
{code}
and
{code}
uri = aUri.normalize();
{code}

Normalize will remove ".", so we can remove normalize() in the code as

{code}
this.uri = new URI(scheme, authority, normalizePath(scheme, path), null, 
fragment);
uri = aUri;
{code}

But the problem is URI("") is valid in java based on 
http://download.java.net/jdk7/archive/b123/docs/api/java/net/URI.html.
"Empty relative paths are permitted; this seems to be the intent of RFC 2396 
although the grammar does not permit it. The primary consequence of this 
deviation is that a standalone fragment such as "#foo" parses as a relative URI 
with an empty path and the given fragment, and can be usefully resolved against 
a base URI."


> The constructor of Path should not take an empty URL as a parameter
> -------------------------------------------------------------------
>
>                 Key: HADOOP-10876
>                 URL: https://issues.apache.org/jira/browse/HADOOP-10876
>             Project: Hadoop Common
>          Issue Type: Bug
>            Reporter: zhihai xu
>            Assignee: zhihai xu
>         Attachments: HADOOP-10876.000.patch, HADOOP-10876.001.patch
>
>
> The constructor of Path should not take an empty URL as a parameter, As 
> discussed in HADOOP-10820, This JIRA is to change Path constructor at public 
> Path(URI aUri) to check the empty URI and throw IllegalArgumentException for 
> empty URI.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to