8150679: closed/javax/crypto/CryptoPermission/CallerIdentification.sh fails after fix for JDK-8132734
Summary: also fixes JDK-8150920
Reviewed-by: psandoz, redestad
Contributed-by: steve.drach@oracle.com
--- a/jdk/src/java.base/share/classes/java/util/jar/JarFile.java Thu Mar 03 12:49:12 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/util/jar/JarFile.java Thu Mar 03 09:47:40 2016 -0800
@@ -893,11 +893,15 @@
}
private JarEntry verifiableEntry(ZipEntry ze) {
- if (!(ze instanceof JarFileEntry)) {
- ze = getJarEntry(ze.getName());
+ if (ze instanceof JarFileEntry) {
+ // assure the name and entry match for verification
+ return ((JarFileEntry)ze).reifiedEntry();
}
- // assure the name and entry match for verification
- return ze == null ? null : ((JarFileEntry)ze).reifiedEntry();
+ ze = getJarEntry(ze.getName());
+ if (ze instanceof JarFileEntry) {
+ return ((JarFileEntry)ze).reifiedEntry();
+ }
+ return (JarEntry)ze;
}
// Statics for hand-coded Boyer-Moore search
--- a/jdk/test/sun/net/www/protocol/jar/MultiReleaseJarURLConnection.java Thu Mar 03 12:49:12 2016 -0800
+++ b/jdk/test/sun/net/www/protocol/jar/MultiReleaseJarURLConnection.java Thu Mar 03 09:47:40 2016 -0800
@@ -42,27 +42,40 @@
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
public class MultiReleaseJarURLConnection {
String userdir = System.getProperty("user.dir",".");
- String urlFile = "jar:file:" + userdir + "/multi-release.jar!/";
- String urlEntry = urlFile + "version/Version.java";
+ String file = userdir + "/signed-multi-release.jar";
@BeforeClass
public void initialize() throws Exception {
CreateMultiReleaseTestJars creator = new CreateMultiReleaseTestJars();
creator.compileEntries();
creator.buildMultiReleaseJar();
+ creator.buildSignedMultiReleaseJar();
}
@AfterClass
public void close() throws IOException {
Files.delete(Paths.get(userdir, "multi-release.jar"));
+ Files.delete(Paths.get(userdir, "signed-multi-release.jar"));
}
- @Test
- public void testRuntimeVersioning() throws Exception {
+ @DataProvider(name = "data")
+ public Object[][] createData() {
+ return new Object[][]{
+ {"unsigned file", userdir + "/multi-release.jar"},
+ {"signed file", userdir + "/signed-multi-release.jar"},
+ };
+ }
+
+ @Test(dataProvider = "data")
+ public void testRuntimeVersioning(String ignore, String file) throws Exception {
+ String urlFile = "jar:file:" + file + "!/";
+ String urlEntry = urlFile + "version/Version.java";
+
Assert.assertTrue(readAndCompare(new URL(urlEntry), "return 8"));
// #runtime is "magic"
Assert.assertTrue(readAndCompare(new URL(urlEntry + "#runtime"), "return 9"));
@@ -72,8 +85,10 @@
Assert.assertTrue(readAndCompare(new URL(urlEntry), "return 8"));
}
- @Test
- public void testCachedJars() throws Exception {
+ @Test(dataProvider = "data")
+ public void testCachedJars(String ignore, String file) throws Exception {
+ String urlFile = "jar:file:" + file + "!/";
+
URL rootUrl = new URL(urlFile);
JarURLConnection juc = (JarURLConnection)rootUrl.openConnection();
JarFile rootJar = juc.getJarFile();