loadLibrary.js revision 6:5a1b0714df0e
1173889Sjkoshy/*
2173889Sjkoshy * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
3173889Sjkoshy * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4173889Sjkoshy *
5173889Sjkoshy * This code is free software; you can redistribute it and/or modify it
6173889Sjkoshy * under the terms of the GNU General Public License version 2 only, as
7173889Sjkoshy * published by the Free Software Foundation.
8173889Sjkoshy *
9173889Sjkoshy * This code is distributed in the hope that it will be useful, but WITHOUT
10173889Sjkoshy * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11173889Sjkoshy * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12231871Sbrueffer * version 2 for more details (a copy is included in the LICENSE file that
13231871Sbrueffer * accompanied this code).
14231871Sbrueffer *
15231871Sbrueffer * You should have received a copy of the GNU General Public License version
16231871Sbrueffer * 2 along with this work; if not, write to the Free Software Foundation,
17231871Sbrueffer * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18231871Sbrueffer *
19231871Sbrueffer * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20231871Sbrueffer * or visit www.oracle.com if you need additional information or have any
21231871Sbrueffer * questions.
22231871Sbrueffer */
23173889Sjkoshy
24173889Sjkoshy/**
25173889Sjkoshy * Try to call System.loadLibrary
26173889Sjkoshy *
27206622Suqs * @test
28173889Sjkoshy * @security
29173889Sjkoshy */
30173889Sjkoshy
31173889Sjkoshyfunction check(e) {
32226514Sfabient    if (! (e instanceof java.lang.SecurityException)) {
33226514Sfabient        fail("expected SecurityException, got " + e);
34173889Sjkoshy    }
35173889Sjkoshy}
36173889Sjkoshy
37173889Sjkoshytry {
38173889Sjkoshy    java.lang.System.loadLibrary("foo");
39173889Sjkoshy    fail("should have thrown exception");
40173889Sjkoshy} catch (e) {
41173889Sjkoshy    check(e);
42173889Sjkoshy}
43173889Sjkoshy
44173889Sjkoshy