commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r1029549 - /commons/proper/daemon/trunk/src/native/windows/src/javajni.c
Date Mon, 01 Nov 2010 04:13:27 GMT
Author: mturk
Date: Mon Nov  1 04:13:27 2010
New Revision: 1029549

URL: http://svn.apache.org/viewvc?rev=1029549&view=rev
Log:
DAEMON-184: If RuntimeLib registry is invalid, use Jre JavaHome and server/jvm.dll

Modified:
    commons/proper/daemon/trunk/src/native/windows/src/javajni.c

Modified: commons/proper/daemon/trunk/src/native/windows/src/javajni.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/windows/src/javajni.c?rev=1029549&r1=1029548&r2=1029549&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/windows/src/javajni.c (original)
+++ commons/proper/daemon/trunk/src/native/windows/src/javajni.c Mon Nov  1 04:13:27 2010
@@ -175,6 +175,7 @@ static __inline BOOL __apxJvmDetach(LPAP
 static BOOL __apxLoadJvmDll(LPCWSTR szJvmDllPath)
 {
     UINT errMode;
+    WCHAR  jreAltPath[SIZ_PATHLEN];
     LPWSTR dllJvmPath = (LPWSTR)szJvmDllPath;
     DYNLOAD_FPTR_DECLARE(SetDllDirectoryW);
 
@@ -185,6 +186,19 @@ static BOOL __apxLoadJvmDll(LPCWSTR szJv
         dllJvmPath = apxGetJavaSoftRuntimeLib(NULL);
     if (!dllJvmPath)
         return FALSE;
+    if (GetFileAttributesW(szJvmDllPath) == INVALID_FILE_ATTRIBUTES) {
+        /* DAEMON-184: RuntimeLib registry key is invalid.
+         * Check from Jre JavaHome directly
+         */
+        LPWSTR szJreHome = apxGetJavaSoftHome(NULL, TRUE);
+        apxLogWrite(APXLOG_MARK_DEBUG "Invalid RuntimeLib '%S'", dllJvmPath);
+        if (szJreHome) {
+            apxLogWrite(APXLOG_MARK_DEBUG "Using Jre JavaHome '%S'", szJreHome);
+            lstrlcpyW(jreAltPath, SIZ_PATHLEN, szJreHome);
+            lstrlcatW(jreAltPath, SIZ_PATHLEN, L"\\bin\\server\\jvm.dll");
+            dllJvmPath = jreAltPath;
+        }
+    }
     /* Suppress the not found system popup message */
     errMode = SetErrorMode(SEM_FAILCRITICALERRORS);
 



Mime
View raw message