# HG changeset patch # User amurillo # Date 1442425930 25200 # Node ID 5b7b63906ad434b661f336481f9f1f116647f38b # Parent 40bb086ea06023c3e68f430b9400bc0fdc8e7229 8134365: Test test/sun/misc/Version/Version.java should follow Verona rules for trailing zeros Reviewed-by: mchung, iris diff -r 40bb086ea060 -r 5b7b63906ad4 jdk/test/sun/misc/Version/Version.java --- a/jdk/test/sun/misc/Version/Version.java Mon Sep 14 10:00:25 2015 -0700 +++ b/jdk/test/sun/misc/Version/Version.java Wed Sep 16 10:52:10 2015 -0700 @@ -22,9 +22,10 @@ */ /* @test - * @bug 6994413 + * @bug 6994413, 8134365 * @summary Check the JDK and JVM version returned by sun.misc.Version - * matches the versions defined in the system properties + * matches the versions defined in the system properties. + * Should use the API described in JDK-8136651 when available * @modules java.base/sun.misc * @compile -XDignore.symbol.file Version.java * @run main Version @@ -90,12 +91,21 @@ public String toString() { StringBuilder sb = new StringBuilder(); - sb.append(major + "." + minor + "." + security); + // Do not include trailing zeros if (patch > 0) { - sb.append("." + patch); + sb.insert(0, "." + patch); + } + if (security > 0 || sb.length() > 0) { + sb.insert(0, "." + security); } + if (minor > 0 || sb.length() > 0) { + sb.insert(0, "." + minor); + } + sb.insert(0, major); - sb.append("+" + build); + if (build >= 0) + sb.append("+" + build); + return sb.toString(); } }