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 "Plamen Jeliazkov (JIRA)" <ji...@apache.org> on 2016/02/25 20:50:18 UTC

[jira] [Created] (HADOOP-12842) LocalFileSystem checksum file creation fails when source filename contains a colon

Plamen Jeliazkov created HADOOP-12842:
-----------------------------------------

             Summary: LocalFileSystem checksum file creation fails when source filename contains a colon
                 Key: HADOOP-12842
                 URL: https://issues.apache.org/jira/browse/HADOOP-12842
             Project: Hadoop Common
          Issue Type: Bug
    Affects Versions: 2.6.4
            Reporter: Plamen Jeliazkov
            Assignee: Plamen Jeliazkov
            Priority: Minor


In most FileSystems you can create a file with a colon character in it, including HDFS. If you try to use the LocalFileSystem implementation (which extends ChecksumFileSystem) to create a file with a colon character in it you get a URISyntaxException during the creation of the checksum file because of the use of {code}new Path(path, checksumFile){code} where checksumFile will be considered as a relative path during URI parsing due to starting with a "." and containing a ":" in the path.  

Running the following test inside TestLocalFileSystem causes the failure:
{code}
@Test
  public void testColonFilePath() throws Exception {
    FileSystem fs = fileSys;
    Path file = new Path(TEST_ROOT_DIR + Path.SEPARATOR + "fileWith:InIt");
    fs.delete(file, true);
    FSDataOutputStream out = fs.create(file);
    try {
      out.write("text1".getBytes());
    } finally {
      out.close();
    }
}
{code}
With the following stack trace:
{code}
java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: .fileWith:InIt.crc
	at java.net.URI.checkPath(URI.java:1804)
	at java.net.URI.<init>(URI.java:752)
	at org.apache.hadoop.fs.Path.initialize(Path.java:201)
	at org.apache.hadoop.fs.Path.<init>(Path.java:170)
	at org.apache.hadoop.fs.Path.<init>(Path.java:92)
	at org.apache.hadoop.fs.ChecksumFileSystem.getChecksumFile(ChecksumFileSystem.java:88)
	at org.apache.hadoop.fs.ChecksumFileSystem$ChecksumFSOutputSummer.<init>(ChecksumFileSystem.java:397)
	at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:456)
	at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:435)
	at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:921)
	at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:902)
	at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:798)
	at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:787)
	at org.apache.hadoop.fs.TestLocalFileSystem.testColonFilePath(TestLocalFileSystem.java:625)
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)