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

File.mkdirs() return false if directory name ends with a "/".

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.1
    • core-libs
    • None
    • sparc
    • solaris_9

      I found out that although mkdirs() return false, directory did get created. It
      just give wrong return code. This is inconsistantly with the mkdir()
      method since mkdir("/a/) would create /a directory and return true.


      =========
      import java.io.*;
      import java.util.*;
      import java.util.zip.*;

      class file{
              public static void main(String[] args){
                      File f0=new File("a"+File.separator+"b"+File.separator);
                      if (!f0.mkdirs())
                              System.err.println("Can't create directory " + f0.getPath());

                      File f2=new File("c"+File.separator);
                      if (!f2.mkdir())
                              System.err.println("Can't create directory " + f2.getPath());

              }
      }

            Unassigned Unassigned
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: