7009828: Fix for 6938627 breaks visualvm monitoring when -Djava.io.tmpdir is defined
authorcoleenp
Wed, 12 Jan 2011 13:59:18 -0800
changeset 7901 ea3d83447861
parent 7900 4c7fc6332f7e
child 7902 7a2c2642784c
child 7913 dd096a83bdbb
7009828: Fix for 6938627 breaks visualvm monitoring when -Djava.io.tmpdir is defined Summary: Change get_temp_directory() back to /tmp and %TEMP% like it always was and where the tools expect it to be. Reviewed-by: phh, dcubed, kamg, alanb
hotspot/src/os/linux/vm/os_linux.cpp
hotspot/src/os/solaris/vm/os_solaris.cpp
hotspot/src/os/windows/vm/os_windows.cpp
hotspot/src/share/vm/utilities/vmError.cpp
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Wed Jan 12 15:44:16 2011 +0000
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Wed Jan 12 13:59:18 2011 -0800
@@ -1610,10 +1610,9 @@
 
 const char* os::dll_file_extension() { return ".so"; }
 
-const char* os::get_temp_directory() {
-  const char *prop = Arguments::get_property("java.io.tmpdir");
-  return prop == NULL ? "/tmp" : prop;
-}
+// This must be hard coded because it's the system's temporary
+// directory not the java application's temp directory, ala java.io.tmpdir.
+const char* os::get_temp_directory() { return "/tmp"; }
 
 static bool file_exists(const char* filename) {
   struct stat statbuf;
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp	Wed Jan 12 15:44:16 2011 +0000
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp	Wed Jan 12 13:59:18 2011 -0800
@@ -1884,10 +1884,9 @@
 
 const char* os::dll_file_extension() { return ".so"; }
 
-const char* os::get_temp_directory() {
-  const char *prop = Arguments::get_property("java.io.tmpdir");
-  return prop == NULL ? "/tmp" : prop;
-}
+// This must be hard coded because it's the system's temporary
+// directory not the java application's temp directory, ala java.io.tmpdir.
+const char* os::get_temp_directory() { return "/tmp"; }
 
 static bool file_exists(const char* filename) {
   struct stat statbuf;
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Wed Jan 12 15:44:16 2011 +0000
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Wed Jan 12 13:59:18 2011 -0800
@@ -1044,9 +1044,9 @@
     return 0;
 }
 
+// This must be hard coded because it's the system's temporary
+// directory not the java application's temp directory, ala java.io.tmpdir.
 const char* os::get_temp_directory() {
-  const char *prop = Arguments::get_property("java.io.tmpdir");
-  if (prop != 0) return prop;
   static char path_buf[MAX_PATH];
   if (GetTempPath(MAX_PATH, path_buf)>0)
     return path_buf;
--- a/hotspot/src/share/vm/utilities/vmError.cpp	Wed Jan 12 15:44:16 2011 +0000
+++ b/hotspot/src/share/vm/utilities/vmError.cpp	Wed Jan 12 13:59:18 2011 -0800
@@ -874,11 +874,13 @@
       }
 
       if (fd == -1) {
-        // try temp directory
         const char * tmpdir = os::get_temp_directory();
-        jio_snprintf(buffer, sizeof(buffer), "%s%shs_err_pid%u.log",
-                     tmpdir, os::file_separator(), os::current_process_id());
-        fd = open(buffer, O_WRONLY | O_CREAT | O_TRUNC, 0666);
+        // try temp directory if it exists.
+        if (tmpdir != NULL && tmpdir[0] != '\0') {
+          jio_snprintf(buffer, sizeof(buffer), "%s%shs_err_pid%u.log",
+                       tmpdir, os::file_separator(), os::current_process_id());
+          fd = open(buffer, O_WRONLY | O_CREAT | O_TRUNC, 0666);
+        }
       }
 
       if (fd != -1) {