814920a099ee946453263e682c7bb2cda00b7983ludo * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
54c356b692bd520cec70e821a41c97c39b76aac0mark * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
77ca522cbfce7ae2cfdd56c44de525097821bb15mark * This code is free software; you can redistribute it and/or modify it
814920a099ee946453263e682c7bb2cda00b7983ludo * under the terms of the GNU General Public License version 2 only, as
814920a099ee946453263e682c7bb2cda00b7983ludo * published by the Free Software Foundation.
814920a099ee946453263e682c7bb2cda00b7983ludo * This code is distributed in the hope that it will be useful, but WITHOUT
77ca522cbfce7ae2cfdd56c44de525097821bb15mark * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
814920a099ee946453263e682c7bb2cda00b7983ludo * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
814920a099ee946453263e682c7bb2cda00b7983ludo * version 2 for more details (a copy is included in the LICENSE file that
814920a099ee946453263e682c7bb2cda00b7983ludo * accompanied this code).
814920a099ee946453263e682c7bb2cda00b7983ludo * You should have received a copy of the GNU General Public License version
814920a099ee946453263e682c7bb2cda00b7983ludo * 2 along with this work; if not, write to the Free Software Foundation,
814920a099ee946453263e682c7bb2cda00b7983ludo * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
814920a099ee946453263e682c7bb2cda00b7983ludo * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
814920a099ee946453263e682c7bb2cda00b7983ludo * or visit www.oracle.com if you need additional information or have any
814920a099ee946453263e682c7bb2cda00b7983ludo * questions.
814920a099ee946453263e682c7bb2cda00b7983ludo @bug 6713352
814920a099ee946453263e682c7bb2cda00b7983ludo @summary Deadlock in JFileChooser with synchronized custom FileSystemView
814920a099ee946453263e682c7bb2cda00b7983ludo @author Pavel Porvatov
814920a099ee946453263e682c7bb2cda00b7983ludo @run main bug6713352
814920a099ee946453263e682c7bb2cda00b7983ludo public static void main(String[] args) throws Exception {
814920a099ee946453263e682c7bb2cda00b7983ludo public void run() {
814920a099ee946453263e682c7bb2cda00b7983ludo if (tempDir == null || !new File(tempDir).isDirectory()) {
814920a099ee946453263e682c7bb2cda00b7983ludo // Wait a little bit. BasicDirectoryModel will lock Invoker and stop on
814920a099ee946453263e682c7bb2cda00b7983ludo // the bug6713352.MyFileSystemView.getFiles() method
814920a099ee946453263e682c7bb2cda00b7983ludo throw new RuntimeException(e);
814920a099ee946453263e682c7bb2cda00b7983ludo ShellFolder.getShellFolder(new File(tempDir)).listFiles(true);
814920a099ee946453263e682c7bb2cda00b7983ludo throw new RuntimeException(e);
814920a099ee946453263e682c7bb2cda00b7983ludo // To avoid RejectedExecutionException in BasicDirectoryModel wait a second
814920a099ee946453263e682c7bb2cda00b7983ludo throw new RuntimeException(e);
814920a099ee946453263e682c7bb2cda00b7983ludo private static class MyFileSystemView extends FileSystemView {
814920a099ee946453263e682c7bb2cda00b7983ludo public File createNewFolder(File containingDir) throws IOException {
814920a099ee946453263e682c7bb2cda00b7983ludo public File[] getFiles(File dir, boolean useFileHiding) {
814920a099ee946453263e682c7bb2cda00b7983ludo synchronized (this) {
814920a099ee946453263e682c7bb2cda00b7983ludo return super.isTraversable(f);