4320N/A/*
4320N/A * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
4320N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4320N/A *
4320N/A * This code is free software; you can redistribute it and/or modify it
4320N/A * under the terms of the GNU General Public License version 2 only, as
4320N/A * published by the Free Software Foundation.
4320N/A *
4320N/A * This code is distributed in the hope that it will be useful, but WITHOUT
4320N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4320N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4320N/A * version 2 for more details (a copy is included in the LICENSE file that
4320N/A * accompanied this code).
4320N/A *
4320N/A * You should have received a copy of the GNU General Public License version
4320N/A * 2 along with this work; if not, write to the Free Software Foundation,
4320N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4320N/A *
4320N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4320N/A * or visit www.oracle.com if you need additional information or have any
4320N/A * questions.
4320N/A */
4320N/A/**
4320N/A * @test
4320N/A * @bug 7003952
4320N/A * @summary load DLLs and launch executables using fully qualified path
4320N/A */
4320N/Aimport java.security.*;
4320N/Aimport java.lang.reflect.*;
4320N/A
4320N/Apublic class Absolute {
4320N/A
4320N/A public static void main(String[] args) throws Exception {
4320N/A Constructor cons;
4320N/A try {
4320N/A Class clazz = Class.forName("sun.security.pkcs11.SunPKCS11");
4320N/A cons = clazz.getConstructor(new Class[] {String.class});
4320N/A } catch (Exception ex) {
4320N/A System.out.println("Skipping test - no PKCS11 provider available");
4320N/A return;
4320N/A }
4320N/A
4320N/A String config =
4320N/A System.getProperty("test.src", ".") + "/Absolute.cfg";
4320N/A
4320N/A try {
4320N/A Object obj = cons.newInstance(new Object[] {config});
4320N/A } catch (InvocationTargetException ite) {
4320N/A Throwable cause = ite.getCause();
4320N/A if (cause instanceof ProviderException) {
4320N/A Throwable cause2 = cause.getCause();
4320N/A if ((cause2 == null) ||
4320N/A !cause2.getMessage().startsWith(
4320N/A "Absolute path required for library value:")) {
4320N/A // rethrow
4320N/A throw (ProviderException) cause;
4320N/A }
4320N/A System.out.println("Caught expected Exception: \n" + cause2);
4320N/A }
4320N/A }
4320N/A }
4320N/A}