test/java/io/File/Mkdir.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -20,20 +20,28 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
 /* @test
-   @bug 4344760
-   @summary Test mkdirs with . in path
+   @bug 4344760 6883354
+   @summary Test mkdirs with . or .. in path
  */
 import java.io.*;
 
 public class Mkdir {
     static File a = new File("a");
     static File a_dot = new File(a, ".");
     static File a_dot_b = new File(a_dot, "b");
 
+    static File aa = new File("aa");
+    static File bb = new File("bb");
+    static File aa_dot_dot = new File(aa, "..");
+    static File aa_dot_dot_bb = new File(aa_dot_dot, "bb");
+
     public static void main(String[] args) throws Exception {
-        if (!a_dot_b.mkdirs())
+        if (!a_dot_b.mkdirs() ||
+                !aa_dot_dot_bb.mkdirs() || !aa.exists() || !bb.exists() ||
+                !aa_dot_dot_bb.exists()) {
             throw new Exception("Test failed");
     }
+    }
 }