changeset 12205:d8b867be6027

8159799: Tests using jcmd fails intermittently with Could not open PerfMemory on Windows Reviewed-by: gtriantafill, dholmes, sla, fparain
author ctornqvi
date Tue, 18 Oct 2016 06:17:10 -0400
parents 313dda585dbc
children b2fa2456dc3c
files src/os/windows/vm/perfMemory_windows.cpp
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/os/windows/vm/perfMemory_windows.cpp	Tue Oct 18 06:14:10 2016 -0400
+++ b/src/os/windows/vm/perfMemory_windows.cpp	Tue Oct 18 06:17:10 2016 -0400
@@ -1404,12 +1404,14 @@
                objectname);      /* name for object */
 
   if (fmh == NULL) {
+    DWORD lasterror = GetLastError();
     if (PrintMiscellaneous && Verbose) {
       warning("OpenFileMapping failed for shared memory object %s:"
-              " lasterror = %d\n", objectname, GetLastError());
+              " lasterror = %d\n", objectname, lasterror);
     }
-    THROW_MSG_(vmSymbols::java_lang_Exception(),
-               "Could not open PerfMemory", INVALID_HANDLE_VALUE);
+    THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
+               err_msg("Could not open PerfMemory, error %d", lasterror),
+               INVALID_HANDLE_VALUE);
   }
 
   return fmh;;