Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6663810

(spec) File.mkdir should make it clear that it doesn't create parent directories

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 6
    • core-libs
    • 1.0
    • x86
    • linux

      1. File.mkdir method spec is not self-contained.

      ---------------------------------
        Creates the directory named by this abstract pathname

        Returns:
            true if and only if the directory was created; false otherwise
      ----------------------------------


      So what should happed if mkdir() is invoked for instance representing "/foo/bar" if "/foo" does not exist ?
      Looking at the method specification it looks like such directory should be created and true returned.
      At least I see nothing in the File.mkdir specification which would prevent such interpretation.

      Meanwhile the real behavior is different. No directory is created and false is returned.

      Well, if I see both File.mkdir and File.mkdirs specs I may make guess like "File.mkdirs is explicitly specified to create intermediate subdirs. So it looks like mkdir must not create them. Otherwise what is reason to introduce two such methods ?".

      I think File.mkdir specification should be clarified to be self-contained.

            Unassigned Unassigned
            sreznick Sergey Reznick (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: