1 /* 2 * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 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 /* 25 * @test 26 * @summary <rdar://problem/2405276> List of files in current directory using dot notation (".") is null 27 * @summary com.apple.junit.java.io.File 28 * @run junit R2405276ListCurDir 29 */ 30 31 import junit.framework.*; 32 import java.io.File; 33 34 public class R2405276ListCurDir extends TestCase { 35 public static Test suite() { 36 return new TestSuite(R2405276ListCurDir.class); 37 } 38 39 public static void main(String argv[]) { 40 junit.textui.TestRunner.run(suite()); 41 } 42 43 /* 44 Original test 45 */ 46 public void testR2405276() throws Exception { 47 String[] list = (new File(".")).list(); 48 assertNotNull(list); 49 } 50 51 /* 52 Stress test to make it a little more fun to play 53 */ 54 Exception cached = null; 55 Thread threads[] = new Thread[100]; 56 57 public void testR2405276Stress() throws Exception { 58 for( int i = 0; i < threads.length; i++) { 59 threads[i] = new Thread( new Runnable() { 60 public void run() { 61 try { 62 testR2405276(); 63 } 64 catch( Exception x) { 65 cached = x; 66 } 67 } 68 }); 69 } 70 71 for (Thread thread : threads) { 72 thread.start(); 73 } 74 75 for (Thread thread1 : threads) { 76 thread1.join(); 77 } 78 79 if (cached != null) { 80 throw cached; 81 } 82 } 83 }