RFR 8183400: runtime/6981737/Test6981737.java fails with java.lang.RuntimeException: FAIL: Wrong value for java.version property, "9", expected to be of form: "[0-9]+[\\.[0-9]+]*\-.*"

Paul Sandoz paul.sandoz at oracle.com
Thu Jul 6 21:48:48 UTC 2017

Hi Harold,

Can you directly use the instance of Runtime.Version returned from Runtime.version(), since IIUC the property “java.version” is derived from its state (see the generated class VersionProps). Then you don’t need to perform any regex operation for spliting.


  Version v = Runtime.version();
  int major_version = v.major();
  String vm_spec_version_re = Integer.toString(major_version);

I bet you can simplify further and remove the check for:

  48         if (major_version < 7) {

since Runtime only exists on 9 upwards. So it’s redundant unless there is some crazy version number overriding testing going on with that test we could remove it.


> On 6 Jul 2017, at 12:46, harold seigel <harold.seigel at oracle.com> wrote:
> Hi,
> Please review this JDK-10 test bug fix.  The fix changes the test to call Runtime.Version.parse() to parse the "java.version" property value instead of using its own regular expression.
> Open Webrev: http://cr.openjdk.java.net/~hseigel/bug_8183400/webrev/
> JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8183400
> The fixed test was tested on Linux using "java.version" property values of "9", "9-ea", and "10-internal".
> Thanks, Harold

More information about the hotspot-runtime-dev mailing list