8081824: Remove dead code GetPublicJREHome in the launcher
authorksrini
Wed, 03 Jun 2015 14:35:17 -0700
changeset 30914 870f7227984a
parent 30913 bb5c454d451e
child 30915 504f95d17f58
child 30955 9f660470002c
8081824: Remove dead code GetPublicJREHome in the launcher Reviewed-by: mchung
jdk/src/java.base/windows/native/libjli/java_md.c
--- a/jdk/src/java.base/windows/native/libjli/java_md.c	Wed Jun 03 19:26:58 2015 +0300
+++ b/jdk/src/java.base/windows/native/libjli/java_md.c	Wed Jun 03 14:35:17 2015 -0700
@@ -44,7 +44,6 @@
 /*
  * Prototypes.
  */
-static jboolean GetPublicJREHome(char *path, jint pathsize);
 static jboolean GetJVMPath(const char *jrepath, const char *jvmtype,
                            char *jvmpath, jint jvmpathsize);
 static jboolean GetJREPath(char *path, jint pathsize);
@@ -334,12 +333,6 @@
         }
     }
 
-    /* Look for a public JRE on this machine. */
-    if (GetPublicJREHome(path, pathsize)) {
-        JLI_TraceLauncher("JRE path is %s\n", path);
-        return JNI_TRUE;
-    }
-
     JLI_ReportErrorMessage(JRE_ERROR8 JAVA_DLL);
     return JNI_FALSE;
 
@@ -426,89 +419,6 @@
 }
 
 /*
- * Helpers to look in the registry for a public JRE.
- */
-                    /* Same for 1.5.0, 1.5.1, 1.5.2 etc. */
-#define JRE_KEY     "Software\\JavaSoft\\Java Runtime Environment"
-
-static jboolean
-GetStringFromRegistry(HKEY key, const char *name, char *buf, jint bufsize)
-{
-    DWORD type, size;
-
-    if (RegQueryValueEx(key, name, 0, &type, 0, &size) == 0
-        && type == REG_SZ
-        && (size < (unsigned int)bufsize)) {
-        if (RegQueryValueEx(key, name, 0, 0, buf, &size) == 0) {
-            return JNI_TRUE;
-        }
-    }
-    return JNI_FALSE;
-}
-
-static jboolean
-GetPublicJREHome(char *buf, jint bufsize)
-{
-    HKEY key, subkey;
-    char version[MAXPATHLEN];
-
-    /*
-     * Note: There is a very similar implementation of the following
-     * registry reading code in the Windows java control panel (javacp.cpl).
-     * If there are bugs here, a similar bug probably exists there.  Hence,
-     * changes here require inspection there.
-     */
-
-    /* Find the current version of the JRE */
-    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, JRE_KEY, 0, KEY_READ, &key) != 0) {
-        JLI_ReportErrorMessage(REG_ERROR1, JRE_KEY);
-        return JNI_FALSE;
-    }
-
-    if (!GetStringFromRegistry(key, "CurrentVersion",
-                               version, sizeof(version))) {
-        JLI_ReportErrorMessage(REG_ERROR2, JRE_KEY);
-        RegCloseKey(key);
-        return JNI_FALSE;
-    }
-
-    if (JLI_StrCmp(version, GetDotVersion()) != 0) {
-        JLI_ReportErrorMessage(REG_ERROR3, JRE_KEY, version, GetDotVersion()
-        );
-        RegCloseKey(key);
-        return JNI_FALSE;
-    }
-
-    /* Find directory where the current version is installed. */
-    if (RegOpenKeyEx(key, version, 0, KEY_READ, &subkey) != 0) {
-        JLI_ReportErrorMessage(REG_ERROR1, JRE_KEY, version);
-        RegCloseKey(key);
-        return JNI_FALSE;
-    }
-
-    if (!GetStringFromRegistry(subkey, "JavaHome", buf, bufsize)) {
-        JLI_ReportErrorMessage(REG_ERROR4, JRE_KEY, version);
-        RegCloseKey(key);
-        RegCloseKey(subkey);
-        return JNI_FALSE;
-    }
-
-    if (JLI_IsTraceLauncher()) {
-        char micro[MAXPATHLEN];
-        if (!GetStringFromRegistry(subkey, "MicroVersion", micro,
-                                   sizeof(micro))) {
-            printf("Warning: Can't read MicroVersion\n");
-            micro[0] = '\0';
-        }
-        printf("Version major.minor.micro = %s.%s\n", version, micro);
-    }
-
-    RegCloseKey(key);
-    RegCloseKey(subkey);
-    return JNI_TRUE;
-}
-
-/*
  * Support for doing cheap, accurate interval timing.
  */
 static jboolean counterAvailable = JNI_FALSE;