/* * Copyright (c) 2022, 2023, 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. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.File; import java.util.Arrays; import javax.swing.JCheckBox; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.WindowConstants; /* * @test * @bug 8281966 * @key headful * @requires (os.family == "windows") * @library /java/awt/regtesthelpers * @build PassFailJFrame * @summary Test to check if the absolute path of Symbolic Link folder * is valid on ValueChanged property listener. * @run main/manual FileChooserSymLinkTest */ public class FileChooserSymLinkTest { private static final String INSTRUCTIONS = """
Instructions to Test:cd /d C:\\
mkdir FileChooserTest
cd FileChooserTest
mkdir target
mklink /d link target
C:\\FileChooserTest
in
the JFileChooser
.
link
directory,
the absolute path of the symbolic
link should be displayed.null
, click Fail.
target
directory,
its absolute path should be displayed.
link
,
target
.
link
can't be selected or
if its absolute path is null
,
click Fail.
If link
can be selected in both
single- and multi-selection modes, click Pass.
FileChooserTest
directory:
cd \\
rmdir /s /q C:\\FileChooserTest
or use File Explorer to clean it up.