Path: blob/master/test/jdk/java/awt/FileDialog/8003399/bug8003399.java
41154 views
/*1* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/* @test24@key headful25@bug 800339926@summary JFileChooser gives wrong path to selected file when saving to Libraries folder on Windows 727@author Semyon Sadetsky28@library /test/lib29@build jdk.test.lib.OSVersion jdk.test.lib.Platform30@run main bug800339931*/3233import jdk.test.lib.Platform;34import jdk.test.lib.OSVersion;3536import javax.swing.filechooser.FileSystemView;37import java.io.File;3839public class bug8003399 {4041public static void main(String[] args) throws Exception {42if (Platform.isWindows() &&43OSVersion.current().compareTo(OSVersion.WINDOWS_VISTA) > 0 ) {44FileSystemView fsv = FileSystemView.getFileSystemView();45for (File file : fsv.getFiles(fsv.getHomeDirectory(), false)) {46if(file.isDirectory()) {47for (File file1 : fsv.getFiles(file, false)) {48if(file1.isDirectory())49{50String path = file1.getPath();51if(path.startsWith("::{") &&52path.toLowerCase().endsWith(".library-ms")) {53System.err.println("file = " + file);54System.err.println("file1 = " + file1);55System.err.println("path = " + path);56throw new RuntimeException("Unconverted library link found");57}58}59}60}61}62}63System.out.println("ok");64}65}666768