--- old/test/jdk/sun/net/www/protocol/jar/MultiReleaseJarURLConnection.java 2018-01-30 10:43:48.989279271 -0800 +++ new/test/jdk/sun/net/www/protocol/jar/MultiReleaseJarURLConnection.java 2018-01-30 10:43:48.625279255 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 8132734 8144062 8159785 + * @bug 8132734 8144062 8159785 8194070 * @summary Test that URL connections to multi-release jars can be runtime versioned * @library /lib/testlibrary/java/util/jar * @modules jdk.compiler @@ -96,7 +96,7 @@ public void testRuntimeVersioning(String style, String file) throws Exception { String urlFile = "jar:file:" + file + "!/"; String baseUrlEntry = urlFile + "version/Version.java"; - String rtreturn = "return " + Runtime.version().major(); + String rtreturn = "return " + Math.min(Runtime.version().major(), 10); Assert.assertTrue(readAndCompare(new URL(baseUrlEntry), "return 8")); // #runtime is "magic" for a multi-release jar, but not for unversioned jar @@ -108,21 +108,23 @@ Assert.assertTrue(readAndCompare(new URL(baseUrlEntry), "return 8")); // the following tests will not work with unversioned jars - if (style.equals("unversioned")) return; + if (style.equals("unversioned")) + return; // direct access to versioned entry - String versUrlEntry = urlFile + "META-INF/versions/" + Runtime.version().major() + String versUrlEntry = urlFile + "META-INF/versions/" + + Math.min(Runtime.version().major(), 10) + "/version/Version.java"; Assert.assertTrue(readAndCompare(new URL(versUrlEntry), rtreturn)); // adding any fragment does not change things Assert.assertTrue(readAndCompare(new URL(versUrlEntry + "#runtime"), rtreturn)); Assert.assertTrue(readAndCompare(new URL(versUrlEntry + "#fragment"), rtreturn)); - + // it really doesn't change things - versUrlEntry = urlFile + "META-INF/versions/10/version/Version.java"; - Assert.assertTrue(readAndCompare(new URL(versUrlEntry), "return 10")); - Assert.assertTrue(readAndCompare(new URL(versUrlEntry + "#runtime"), "return 10")); - Assert.assertTrue(readAndCompare(new URL(versUrlEntry + "#fragment"), "return 10")); + // versUrlEntry = urlFile + "META-INF/versions/10/version/Version.java"; + // Assert.assertTrue(readAndCompare(new URL(versUrlEntry), "return 10")); + // Assert.assertTrue(readAndCompare(new URL(versUrlEntry + "#runtime"), "return 10")); + // Assert.assertTrue(readAndCompare(new URL(versUrlEntry + "#fragment"), "return 10")); } @Test(dataProvider = "data") @@ -189,7 +191,9 @@ MethodType mt = MethodType.methodType(int.class); MethodHandle mh = MethodHandles.lookup().findVirtual(vcls, "getVersion", mt); Assert.assertEquals((int)mh.invoke(vcls.newInstance()), - style.equals("unversioned") ? 8 : Runtime.version().major()); + style.equals("unversioned") ? + 8 : + Math.min(Runtime.version().major(), 10)); // now get a resource and verify that we don't have a fragment attached Enumeration vclsUrlEnum = cldr.getResources("version/Version.class"); @@ -217,7 +221,7 @@ if (style.equals("unversioned")) { suffix = ".jar!/version/Version.class"; } else { - suffix = ".jar!/META-INF/versions/" + Runtime.version().major() + suffix = ".jar!/META-INF/versions/" + Math.min(Runtime.version().major(), 10) + "/version/Version.class"; } Assert.assertTrue(rep.endsWith(suffix));