9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /* @test
25 @bug 6868611
26 @summary FileSystemView throws NullPointerException
27 @author Pavel Porvatov
28 @run main bug6868611
29 */
30
31 import javax.swing.*;
32 import javax.swing.filechooser.FileSystemView;
33 import java.io.File;
34
35 public class bug6868611 {
36 private static final int COUNT = 1000;
37
38 public static void main(String[] args) throws Exception {
39 String tempDirProp = System.getProperty("java.io.tmpdir");
40
41 final String tempDir = tempDirProp == null || !new File(tempDirProp).isDirectory() ?
42 System.getProperty("user.home") : tempDirProp;
43
44 System.out.println("Temp directory: " + tempDir);
45
46 // Create 1000 files
47 for (int i = 0; i < 1000; i++) {
48 new File(tempDir, "temp" + i).createNewFile();
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /* @test
25 @bug 6868611
26 @summary FileSystemView throws NullPointerException
27 @author Pavel Porvatov
28 @run main bug6868611
29 @key randomness
30 */
31
32 import javax.swing.*;
33 import javax.swing.filechooser.FileSystemView;
34 import java.io.File;
35
36 public class bug6868611 {
37 private static final int COUNT = 1000;
38
39 public static void main(String[] args) throws Exception {
40 String tempDirProp = System.getProperty("java.io.tmpdir");
41
42 final String tempDir = tempDirProp == null || !new File(tempDirProp).isDirectory() ?
43 System.getProperty("user.home") : tempDirProp;
44
45 System.out.println("Temp directory: " + tempDir);
46
47 // Create 1000 files
48 for (int i = 0; i < 1000; i++) {
49 new File(tempDir, "temp" + i).createNewFile();
|