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

Luca Telloli updated HDFS-456:
------------------------------

    Attachment: HDFS-456.patch

After a personal discussion with Konstantin, I simplified the construction of 
the URL eliminating the custom windows check in favor of the more generic 
sequence below: 
{noformat}
 for(String name : dirNames) {
      URI u = null;
      try {
        u = new URI(name);
      } catch (Exception e){
        LOG.warn("Path " + name + " should be specified as a URI " +
        "in configuration files. Reverting to the default file scheme");
      }
      // if uri is null or scheme is undefined, then assume it's file://
      if(u == null || u.getScheme() == null){
        System.out.println("Using default scheme");
        try {
          u = new File(name).getCanonicalFile().toURI();
        } catch (IOException e) {
          LOG.error("Error while processing element as URI: " + name);
        }
      }
      if (u != null)
        dirs.add(u);
    }
   {noformat}

The idea is that Windows will raise an exception when trying to construct a url 
from a windows file name in the first attempt, so it'll be reverted to the 
default scheme construction procedure:  
{noformat}
new File(name).getCanonicalFile().toURI();
{noformat}


> Problems with dfs.name.edits.dirs as URI
> ----------------------------------------
>
>                 Key: HDFS-456
>                 URL: https://issues.apache.org/jira/browse/HDFS-456
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: name-node
>    Affects Versions: 0.21.0
>            Reporter: Konstantin Shvachko
>            Assignee: Luca Telloli
>             Fix For: 0.21.0
>
>         Attachments: failing-tests.zip, HDFS-456.patch, HDFS-456.patch, 
> HDFS-456.patch, HDFS-456.patch, HDFS-456.patch
>
>
> There are several problems with recent commit of HDFS-396.
> # It does not work with default configuration "file:///". Throws 
> {{IllegalArgumentException}}.
> # *ALL* hdfs tests fail on Windows because "C:\mypath" is treated as an 
> illegal URI. Backward compatibility is not provided.
> # {{IllegalArgumentException}} should not be thrown within hdfs code because 
> it is a {{RuntimException}}. We should throw {{IOException}} instead. This 
> was recently discussed in another jira.
> # Why do we commit patches without running unit tests and test-patch? This is 
> the minimum requirement for a patch to qualify as committable, right?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to