JDK-8061443 : Whitebox get*VMFlag() methods fail with develop flags in product builds
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2014-10-20
  • Updated: 2017-08-14
  • Resolved: 2014-10-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b40Fixed
Related Reports
Blocks :  
Relates :  
Description
The whitebox get*VMFlag() methods fail with a java.lang.NullPointerException if a notproduct or develop flag is requested in a product build.
Comments
Fix suggested by Igor Ignatyev: > diff -r 821164b0131a src/share/vm/runtime/globals.cpp > --- a/src/share/vm/runtime/globals.cpp Fri Oct 03 12:11:14 2014 -0700 > +++ b/src/share/vm/runtime/globals.cpp Sun Oct 19 04:05:40 2014 +0400 > @@ -629,8 +629,8 @@ > e.commit(); > } > > -bool CommandLineFlags::boolAt(const char* name, size_t len, bool* value) { > - Flag* result = Flag::find_flag(name, len); > +bool CommandLineFlags::boolAt(const char* name, size_t len, bool* value, bool allow_locked, bool return_flag) { > + Flag* result = Flag::find_flag(name, len, allow_locked, return_flag); > if (result == NULL) return false; > if (!result->is_bool()) return false; > *value = result->get_bool(); > diff -r 821164b0131a src/share/vm/runtime/globals.hpp > --- a/src/share/vm/runtime/globals.hpp Fri Oct 03 12:11:14 2014 -0700 > +++ b/src/share/vm/runtime/globals.hpp Sun Oct 19 04:05:40 2014 +0400 > @@ -377,8 +377,8 @@ > > class CommandLineFlags { > public: > - static bool boolAt(const char* name, size_t len, bool* value); > - static bool boolAt(const char* name, bool* value) { return boolAt(name, strlen(name), value); } > + static bool boolAt(const char* name, size_t len, bool* value, bool allow_locked = false, bool return_flag = false); > + static bool boolAt(const char* name, bool* value, bool allow_locked = false, bool return_flag = false) { return boolAt(name, strlen(name), value, allow_locked, return_flag); } > static bool boolAtPut(const char* name, size_t len, bool* value, Flag::Flags origin); > static bool boolAtPut(const char* name, bool* value, Flag::Flags origin) { return boolAtPut(name, strlen(name), value, origin); } > diff -r 821164b0131a src/share/vm/prims/whitebox.cpp > --- a/src/share/vm/prims/whitebox.cpp Fri Oct 03 12:11:14 2014 -0700 > +++ b/src/share/vm/prims/whitebox.cpp Sun Oct 19 04:06:59 2014 +0400 > @@ -543,7 +543,7 @@ > } > ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI > const char* flag_name = env->GetStringUTFChars(name, NULL); > - bool result = (*TAt)(flag_name, value); > + bool result = (*TAt)(flag_name, value, true, true); > env->ReleaseStringUTFChars(name, flag_name); > return result; > }
20-10-2014