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

Wijnand Suijlen commented on HDFS-13:
-------------------------------------

I've recently been bitten by this issue, and while finding out why this is an 
issue at all, I was amazed that Hadoop tries to implement its own URL class 
which it calls org.apache.hadoop.fs.Path, and uses this class to interface with 
FileSystem. If I understand it correctly, the reason for this custom URL class, 
is that the user can't be bothered escaping his paths. But I think the current 
interface leads to confusion. If FileSystem worked with just java.net.URI 
instead of its own Path class then it is absolutely clear on how to construct 
paths and when extra escaping is necessary, because Sun's/Oracle's javadocs are 
very clear. Of course, when working from the command line, it might still be 
convenient to have a convenience class like the current 
org.apache.hadoop.fs.Path to ease the burden of writing well formed path names.

The colon thing is not the only problem, I found, related to 
org.apache.hadoop.fs.FileSystem and org.apache.hadoop.fs.Path. For example 
'FileSystem.checkPath' does string comparisons on the authority part. The 
problem there has almost been fixed by using a case insensitive string 
comparison, but it will still give bad results if one of the authorities is 
written with an IP address while the other is written with a DNS name. 




                
> filenames with ':' colon throws java.lang.IllegalArgumentException
> ------------------------------------------------------------------
>
>                 Key: HDFS-13
>                 URL: https://issues.apache.org/jira/browse/HDFS-13
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: Lohit Vijayarenu
>         Attachments: 2066_20071022.patch, HADOOP-2066.patch
>
>
> File names containing colon ":" throws  java.lang.IllegalArgumentException 
> while LINUX file system supports it.
> $ hadoop dfs -put ./testfile-2007-09-24-03:00:00.gz filenametest
> Exception in thread "main" java.lang.IllegalArgumentException: 
> java.net.URISyntaxException: Relative path in absolute
> URI: testfile-2007-09-24-03:00:00.gz
>       at org.apache.hadoop.fs.Path.initialize(Path.java:140)
>       at org.apache.hadoop.fs.Path.<init>(Path.java:126)
>       at org.apache.hadoop.fs.Path.<init>(Path.java:50)
>       at org.apache.hadoop.fs.FileUtil.checkDest(FileUtil.java:273)
>       at org.apache.hadoop.fs.FileUtil.copy(FileUtil.java:117)
>       at 
> org.apache.hadoop.fs.FileSystem.copyFromLocalFile(FileSystem.java:776)
>       at 
> org.apache.hadoop.fs.FileSystem.copyFromLocalFile(FileSystem.java:757)
>       at org.apache.hadoop.fs.FsShell.copyFromLocal(FsShell.java:116)
>       at org.apache.hadoop.fs.FsShell.run(FsShell.java:1229)
>       at org.apache.hadoop.util.ToolBase.doMain(ToolBase.java:187)
>       at org.apache.hadoop.fs.FsShell.main(FsShell.java:1342)
> Caused by: java.net.URISyntaxException: Relative path in absolute URI: 
> testfile-2007-09-24-03:00:00.gz
>       at java.net.URI.checkPath(URI.java:1787)
>       at java.net.URI.<init>(URI.java:735)
>       at org.apache.hadoop.fs.Path.initialize(Path.java:137)
>       ... 10 more
> Path(String pathString) when given a filename which contains ':' treats it as 
> URI and selects anything before ':' as
> scheme, which in this case is clearly not a valid scheme.

--
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