--- old/src/share/classes/java/io/File.java 2013-08-17 02:13:37.909174856 +0400 +++ new/src/share/classes/java/io/File.java 2013-08-17 02:13:37.485180187 +0400 @@ -1343,16 +1343,12 @@ if (mkdir()) { return true; } - File canonFile = null; - try { - canonFile = getCanonicalFile(); - } catch (IOException e) { + File parent = getParentFile(); + if (parent == null) { return false; } - - File parent = canonFile.getParentFile(); - return (parent != null && (parent.mkdirs() || parent.exists()) && - canonFile.mkdir()); + parent.mkdirs(); + return mkdir(); } /** --- old/test/java/io/File/Mkdir.java 2013-08-17 02:13:39.357156654 +0400 +++ new/test/java/io/File/Mkdir.java 2013-08-17 02:13:38.977161430 +0400 @@ -1,5 +1,5 @@ /* - * 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 @@ -22,8 +22,8 @@ */ /* @test - @bug 4344760 - @summary Test mkdirs with . in path + @bug 4344760 6883354 + @summary Test mkdirs with . or .. in path */ import java.io.*; @@ -32,8 +32,21 @@ 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()) - throw new Exception("Test failed"); + if (!a_dot_b.mkdirs()) { + throw new Exception("Failed to create a/./b"); + } + + if (!System.getProperty("os.name").equals("Windows")) { + if (!aa_dot_dot_bb.mkdirs() || !aa.exists() || !bb.exists() || + !aa_dot_dot_bb.exists()) { + throw new Exception("Failed to create aa/../bb"); + } + } } }