diff src/share/vm/runtime/arguments.cpp @ 1956:35f885165c69

6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0 Summary: Change property value to 1.<major_version> for major_version >= 7 Reviewed-by: dholmes, acorn
author kamg
date Fri, 05 Nov 2010 09:32:08 -0400
parents 4e22405d98d6
children 9752a6549f2e
line wrap: on
line diff
--- a/src/share/vm/runtime/arguments.cpp	Wed Oct 27 12:53:36 2010 -0400
+++ b/src/share/vm/runtime/arguments.cpp	Fri Nov 05 09:32:08 2010 -0400
@@ -116,7 +116,6 @@
 // Initialize system properties key and value.
 void Arguments::init_system_properties() {
 
-  PropertyList_add(&_system_properties, new SystemProperty("java.vm.specification.version", "1.0", false));
   PropertyList_add(&_system_properties, new SystemProperty("java.vm.specification.name",
                                                                  "Java Virtual Machine Specification",  false));
   PropertyList_add(&_system_properties, new SystemProperty("java.vm.version", VM_Version::vm_release(),  false));
@@ -151,9 +150,23 @@
 
   // Update/Initialize System properties after JDK version number is known
 void Arguments::init_version_specific_system_properties() {
-  PropertyList_add(&_system_properties, new SystemProperty("java.vm.specification.vendor",
-        JDK_Version::is_gte_jdk17x_version() ? "Oracle Corporation" : "Sun Microsystems Inc.", false));
-  PropertyList_add(&_system_properties, new SystemProperty("java.vm.vendor", VM_Version::vm_vendor(),  false));
+  enum { bufsz = 16 };
+  char buffer[bufsz];
+  const char* spec_vendor = "Sun Microsystems Inc.";
+  uint32_t spec_version = 0;
+
+  if (JDK_Version::is_gte_jdk17x_version()) {
+    spec_vendor = "Oracle Corporation";
+    spec_version = JDK_Version::current().major_version();
+  }
+  jio_snprintf(buffer, bufsz, "1." UINT32_FORMAT, spec_version);
+
+  PropertyList_add(&_system_properties,
+      new SystemProperty("java.vm.specification.vendor",  spec_vendor, false));
+  PropertyList_add(&_system_properties,
+      new SystemProperty("java.vm.specification.version", buffer, false));
+  PropertyList_add(&_system_properties,
+      new SystemProperty("java.vm.vendor", VM_Version::vm_vendor(),  false));
 }
 
 /**