Review request 8145409: Better detect JRE that JLI will be using

Kumar Srinivasan kumar.x.srinivasan at oracle.com
Tue Jan 12 18:21:09 UTC 2016


Hi Dmitry,

src/java.base/windows/native/libjli/java_md.c

1) use NULL

-    GetModuleFileName(0, buf, bufsize);

+    GetModuleFileName(NULL, buf, bufsize);


2) extra LF ?

+ * Removes the trailing file name and one sub-folder from a path.
+ *
+ * If buf is "c:\foo\bin\javac", then put "c:\foo" into buf.

and

+    return TruncatePath(buf);
+}
+
+
+/*


3) Is this comment correct ?

  /*
+ * Retrieves the path to the executable file of the current process
+ * and then truncates the path
+ */

Shouldn't it say Retrieves the path the JRE home by locating the executable of
the current process ........


4) Could you please add some comments to GetApplicationHomeFromAddress ?
Shouldn't the method be called GetApplicationHomeFromDll ?

+    GetModuleHandleEx(dwFlags, (LPCSTR)&GetJREPath, &hModule);

shouldn't you be testing the return value for success ?

Thanks
Kumar




> Hello,
>
> Please review the following patch
>
> https://bugs.openjdk.java.net/browse/JDK-8145409
> http://cr.openjdk.java.net/~dcherepanov/8145409/webrev.v0/
>
> The patch improves GetJREPath() on Windows and implements a fallback 
> for applications with custom native launcher and private JRE.
>
> Thanks,
>
> Dmitry
>




More information about the core-libs-dev mailing list