file.js revision 877:cf4d2252d444
1139731Simp/* 226159Sse * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 366529Smsmith * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 466529Smsmith * 526159Sse * This code is free software; you can redistribute it and/or modify it 626159Sse * under the terms of the GNU General Public License version 2 only, as 726159Sse * published by the Free Software Foundation. 826159Sse * 926159Sse * This code is distributed in the hope that it will be useful, but WITHOUT 1026159Sse * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1126159Sse * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1226159Sse * version 2 for more details (a copy is included in the LICENSE file that 1326159Sse * accompanied this code). 1426159Sse * 1526159Sse * You should have received a copy of the GNU General Public License version 1626159Sse * 2 along with this work; if not, write to the Free Software Foundation, 1726159Sse * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1826159Sse * 1926159Sse * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2026159Sse * or visit www.oracle.com if you need additional information or have any 2126159Sse * questions. 2226159Sse */ 2326159Sse 2426159Sse/** 2526159Sse * try file system activities. 2626159Sse * 2726159Sse * @test 286104Sse * @security 29118031Sobrien */ 30118031Sobrien 31118031Sobrienfunction check(e) { 32126926Speter if (e instanceof java.lang.SecurityException) { 336734Sbde print(e); 3447307Speter } else { 35111068Speter fail("expected SecurityException, got " + e); 36182947Sjhb } 37111068Speter} 38192342Sjhb 39100435Simptry { 40100435Simp new java.io.File(".").getCanonicalPath(); 41181987Sjhb} catch (e) { 42181987Sjhb check(e); 4366529Smsmith} 4459294Smsmith 45181987Sjhbtry { 46181987Sjhb new java.io.FileInputStream("foo"); 47181987Sjhb} catch (e) { 48181987Sjhb check(e); 49181987Sjhb} 50181987Sjhb 51182910Sjhbtry { 52182910Sjhb new java.io.FileOutputStream("foo"); 53181987Sjhb} catch (e) { 54181987Sjhb check(e); 55181987Sjhb} 56181987Sjhb