commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r941791 - /commons/proper/daemon/trunk/src/native/nt/procrun/src/javajni.c
Date Thu, 06 May 2010 16:18:24 GMT
Author: mturk
Date: Thu May  6 16:18:24 2010
New Revision: 941791

URL: http://svn.apache.org/viewvc?rev=941791&view=rev
Log:
Guard against empty or nil classpath

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

Modified: commons/proper/daemon/trunk/src/native/nt/procrun/src/javajni.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/nt/procrun/src/javajni.c?rev=941791&r1=941790&r2=941791&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/nt/procrun/src/javajni.c (original)
+++ commons/proper/daemon/trunk/src/native/nt/procrun/src/javajni.c Thu May  6 16:18:24 2010
@@ -380,7 +380,7 @@ apxJavaInitialize(APXHANDLE hJava, LPCST
     LPAPXJAVAVM     lpJava;
     JavaVMInitArgs  vmArgs;
     JavaVMOption    *lpJvmOptions;
-    DWORD           i, nOptions, sOptions = 1;
+    DWORD           i, nOptions, sOptions = 0;
     BOOL            rv = FALSE;
     if (hJava->dwType != APXHANDLE_TYPE_JVM)
         return FALSE;
@@ -419,13 +419,17 @@ apxJavaInitialize(APXHANDLE hJava, LPCST
             ++sOptions;
         if (bJniVfprintf)
             ++sOptions;
+        if (szClassPath && *szClassPath)
+            ++sOptions;
         nOptions = __apxMultiSzToJvmOptions(hJava->hPool, lpOptions,
                                             &lpJvmOptions, sOptions);
-        szCp = apxPoolAlloc(hJava->hPool, sizeof(JAVA_CLASSPATH) + lstrlenA(szClassPath));
-        lstrcpyA(szCp, JAVA_CLASSPATH);
-        lstrcatA(szCp, szClassPath);
-        lpJvmOptions[nOptions - sOptions].optionString = szCp;
-        --sOptions;
+        if (szClassPath && *szClassPath) {
+            szCp = apxPoolAlloc(hJava->hPool, sizeof(JAVA_CLASSPATH) + lstrlenA(szClassPath));
+            lstrcpyA(szCp, JAVA_CLASSPATH);
+            lstrcatA(szCp, szClassPath);
+            lpJvmOptions[nOptions - sOptions].optionString = szCp;
+            --sOptions;
+        }
         if (bJniVfprintf) {
             /* default JNI error printer */
             lpJvmOptions[nOptions - sOptions].optionString = "vfprintf";



Mime
View raw message