< prev index next >

test/java/io/pathNames/General.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1998, 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. --- 1,7 ---- /* ! * Copyright (c) 1998, 2016, 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.
*** 38,47 **** --- 38,48 ---- private static boolean win32 = (File.separatorChar == '\\'); private static int gensymCounter = 0; protected static final String userDir = System.getProperty("user.dir"); + private static final Path userDirPath = Paths.get(userDir).toAbsolutePath(); protected static String baseDir = null; protected static String relative = null; /* Generate a filename unique to this run */
*** 335,344 **** --- 336,349 ---- /** Check name cases for the given ask string */ public static void checkNames(int depth, boolean create, String ans, String ask) throws Exception { + if (!Paths.get(ans).toAbsolutePath().startsWith(userDirPath)) { + return; + } + int d = depth - 1; File f = new File(ans); String n; /* Normal name */
< prev index next >