< prev index next >

test/sun/misc/Version/Version.java

Print this page
rev 12675 : 8134365: Test test/sun/misc/Version/Version.java should follow Verona rules for trailing zeros
Reviewed-by: tbd

*** 20,32 **** * or visit www.oracle.com if you need additional information or have any * questions. */ /* @test ! * @bug 6994413 * @summary Check the JDK and JVM version returned by sun.misc.Version ! * matches the versions defined in the system properties * @modules java.base/sun.misc * @compile -XDignore.symbol.file Version.java * @run main Version */ --- 20,33 ---- * or visit www.oracle.com if you need additional information or have any * questions. */ /* @test ! * @bug 6994413, 8134365 * @summary Check the JDK and JVM version returned by sun.misc.Version ! * 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 */
*** 88,103 **** this.build == v.build); } public String toString() { StringBuilder sb = new StringBuilder(); ! sb.append(major + "." + minor + "." + security); if (patch > 0) { ! sb.append("." + patch); } sb.append("+" + build); return sb.toString(); } } private static VersionInfo newVersionInfo(String version) throws Exception { --- 89,113 ---- this.build == v.build); } public String toString() { StringBuilder sb = new StringBuilder(); ! // Do not include trailing zeros if (patch > 0) { ! 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); + if (build >= 0) sb.append("+" + build); + return sb.toString(); } } private static VersionInfo newVersionInfo(String version) throws Exception {
< prev index next >