diff --git a/jdk/src/windows/bin/java_md.c b/jdk/src/windows/bin/java_md.c index 62cc3006005..abd887c94d5 100644 --- a/jdk/src/windows/bin/java_md.c +++ b/jdk/src/windows/bin/java_md.c @@ -105,15 +105,15 @@ CreateExecutionEnvironment(int *pargc, char ***pargv, exit(1); } - /* Do this before we read jvm.cfg */ - EnsureJreInstallation(jrepath); - /* Find out where the JRE is that we will be using. */ if (!GetJREPath(jrepath, so_jrepath)) { JLI_ReportErrorMessage(JRE_ERROR1); exit(2); } + /* Do this before we read jvm.cfg and after jrepath is initialized */ + EnsureJreInstallation(jrepath); + /* Find the specified JVM type */ if (ReadKnownVMs(jrepath, (char*)GetArch(), JNI_FALSE) < 1) { JLI_ReportErrorMessage(CFG_ERROR7); @@ -213,6 +213,7 @@ EnsureJreInstallation(const char* jrepath) } /* Does our bundle directory exist ? */ JLI_Snprintf(tmpbuf, sizeof(tmpbuf), "%s\\lib\\bundles", jrepath); + JLI_TraceLauncher("EnsureJreInstallation: %s\n", tmpbuf); if (stat(tmpbuf, &s) != 0) { return; } diff --git a/jdk/test/tools/launcher/VerifyExceptions.java b/jdk/test/tools/launcher/MiscTests.java similarity index 60% rename from jdk/test/tools/launcher/VerifyExceptions.java rename to jdk/test/tools/launcher/MiscTests.java index 166ffff9b1b..654a56a01f4 100644 --- a/jdk/test/tools/launcher/VerifyExceptions.java +++ b/jdk/test/tools/launcher/MiscTests.java @@ -23,19 +23,22 @@ /* * @test - * @bug 6856415 - * @summary Checks to ensure that proper exceptions are thrown by java - * @compile -XDignore.symbol.file VerifyExceptions.java TestHelper.java - * @run main VerifyExceptions + * @bug 6856415 6981001 + * @summary Miscellaneous tests, Exceptions, EnsureJRE etc. + * @compile -XDignore.symbol.file MiscTests.java TestHelper.java + * @run main MiscTests */ import java.io.File; import java.io.FileNotFoundException; +import java.util.HashMap; +import java.util.Map; -public class VerifyExceptions { +public class MiscTests { + // 6856415: Checks to ensure that proper exceptions are thrown by java static void test6856415() { // No pkcs library on win-x64, so we bail out. if (TestHelper.is64Bit && TestHelper.isWindows) { @@ -53,13 +56,35 @@ public class VerifyExceptions { } catch (FileNotFoundException fnfe) { throw new RuntimeException(fnfe); } - TestHelper.TestResult tr = TestHelper.doExec(TestHelper.javacCmd, + TestHelper.TestResult tr = TestHelper.doExec(TestHelper.javaCmd, "-Djava.security.manager", "-jar", testJar.getName(), "foo.bak"); - tr.checkNegative(); - tr.contains("Exception in thread \"main\" java.security.AccessControlException: access denied (\"java.lang.RuntimePermission\" \"accessClassInPackage.sun.security.pkcs11\")\")"); + for (String s : tr.testOutput) { + System.out.println(s); + } + if (!tr.contains("java.security.AccessControlException:" + + " access denied (\"java.lang.RuntimePermission\"" + + " \"accessClassInPackage.sun.security.pkcs11\")")) { + System.out.println(tr.status); + } + } + // 6981001 : Check EnsureJreInstallation is ok, note we cannot + // thoroughly test this function, we simply do our best. + static void test6981001() { + if (TestHelper.is64Bit || !TestHelper.isWindows) { + return; + } + Map env = new HashMap(); + env.put("_JAVA_LAUNCHER_DEBUG", "true"); + TestHelper.TestResult tr = TestHelper.doExec(env, TestHelper.javaCmd); + if (!tr.contains(TestHelper.JAVAHOME + "\\lib\\bundles")) { + System.out.println(tr.status); + } } - public static void main(String... args) { test6856415(); + test6981001(); + if (TestHelper.testExitValue != 0) { + throw new Error(TestHelper.testExitValue + " tests failed"); } } +}