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

java.io.File.mkdirs returns different result in different os

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Linux:
      java version "1.8.0_341"
      Java(TM) SE Runtime Environment (build 1.8.0_341-b10)
      Java HotSpot(TM) 64-Bit Server VM (build 25.341-b10, mixed mode)

      Windows:
      java version "1.8.0_341"
      Java(TM) SE Runtime Environment (build 1.8.0_341-b10)
      Java HotSpot(TM) 64-Bit Server VM (build 25.341-b10, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      When given a directory ends with ">", mkdirs will output false in Windows and true in Linux. Moreover, this will create a strange directory in Linux.

      REGRESSION : Last worked in version 8u341

      ACTUAL -
      The result in Windows is false, while the result in linux is true,and a directory 'test>' is created.

      ---------- BEGIN SOURCE ----------
      import java.io.File;

      public class Test {
          public static void main(String[] args) {
              File file = new File("test>");
              System.out.println(file.mkdirs());
          }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


            tongwan Andrew Wang
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: