Hadoop Common
  1. Hadoop Common
  2. HADOOP-129

FileSystem should not name files with java.io.File


    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.1.0, 0.1.1
    • Fix Version/s: 0.2.0
    • Component/s: fs
    • Labels:


      In Hadoop's FileSystem API, files are currently named using java.io.File. This is confusing, as many methods on that class are inappropriate to call on Hadoop paths. For example, calling isDirectory(), exists(), etc. on a java.io.File is not the same as calling FileSystem.isDirectory() or FileSystem.exists() passing that same file. Using java.io.File also makes correct operation on Windows difficult, since java.io.File operates differently on Windows in order to accomodate Windows path names. For example, new File("/foo") is not absolute on Windows, and prints its path as "
      foo", which causes confusion.

      To fix this we could replace the uses of java.io.File in the FileSystem API with String, a new FileName class, or perhaps java.net.URI. The advantage of URI is that it can also naturally include the namenode host and port. The disadvantage is that URI does not support tree operations like getParent().

      This change will cause a lot of incompatibility. Thus it should probably be made early in a development cycle in order to maximize the time for folks to adapt to it.

      1. path.patch
        161 kB
        Doug Cutting


        Doug Cutting created issue -
        Doug Cutting made changes -
        Field Original Value New Value
        Attachment path.patch [ 12325464 ]
        Doug Cutting made changes -
        Assignee Doug Cutting [ cutting ]
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Doug Cutting made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Doug Cutting made changes -
        Workflow jira [ 12354992 ] no reopen closed [ 12373070 ]
        Doug Cutting made changes -
        Workflow no reopen closed [ 12373070 ] no-reopen-closed [ 12373406 ]
        Doug Cutting made changes -
        Workflow no-reopen-closed [ 12373406 ] no-reopen-closed, patch-avail [ 12377716 ]


          • Assignee:
            Doug Cutting
            Doug Cutting
          • Votes:
            0 Vote for this issue
            1 Start watching this issue


            • Created: