--- old/src/share/classes/java/net/URLClassLoader.java 2014-08-09 00:43:08.392804447 -0700 +++ new/src/share/classes/java/net/URLClassLoader.java 2014-08-09 00:43:08.208797445 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -407,10 +407,37 @@ return pkg; } + // Also called by VM to define Package for classes loaded from the CDS + // archive + private void definePackageInternal(String pkgname, Manifest man, URL url) + { + if (getAndVerifyPackage(pkgname, man, url) == null) { + try { + if (man != null) { + definePackage(pkgname, man, url); + } else { + definePackage(pkgname, null, null, null, null, null, null, null); + } + } catch (IllegalArgumentException iae) { + // parallel-capable class loaders: re-verify in case of a + // race condition + if (getAndVerifyPackage(pkgname, man, url) == null) { + // Should never happen + throw new AssertionError("Cannot find package " + + pkgname); + } + } + } + } + /* * Defines a Class using the class bytes obtained from the specified * Resource. The resulting Class must be resolved before it can be * used. + * + * NOTE: the logic used here has been duplicated in the VM native code + * (search for invocation of definePackageInternal in the HotSpot sources). + * If this is changed, the VM code also need to be modified. */ private Class defineClass(String name, Resource res) throws IOException { long t0 = System.nanoTime(); @@ -420,23 +447,7 @@ String pkgname = name.substring(0, i); // Check if package already loaded. Manifest man = res.getManifest(); - if (getAndVerifyPackage(pkgname, man, url) == null) { - try { - if (man != null) { - definePackage(pkgname, man, url); - } else { - definePackage(pkgname, null, null, null, null, null, null, null); - } - } catch (IllegalArgumentException iae) { - // parallel-capable class loaders: re-verify in case of a - // race condition - if (getAndVerifyPackage(pkgname, man, url) == null) { - // Should never happen - throw new AssertionError("Cannot find package " + - pkgname); - } - } - } + definePackageInternal(pkgname, man, url); } // Now read the class bytes and define the class java.nio.ByteBuffer bb = res.getByteBuffer(); --- old/src/share/classes/java/security/SecureClassLoader.java 2014-08-09 00:43:09.260837477 -0700 +++ new/src/share/classes/java/security/SecureClassLoader.java 2014-08-09 00:43:09.076830476 -0700 @@ -215,6 +215,15 @@ return pd; } + // Used by the VM to create the ProtectionDomain for the url. Assumes + // that the url points to an unsigned code source. + private ProtectionDomain getProtectionDomain(URL url) { + CodeSigner[] signers = null; + CodeSource cs = new CodeSource(url, signers); + + return getProtectionDomain(cs); + } + /* * Check to make sure the class loader has been initialized. */ --- old/src/share/classes/java/util/jar/Manifest.java 2014-08-09 00:43:10.220874007 -0700 +++ new/src/share/classes/java/util/jar/Manifest.java 2014-08-09 00:43:09.944863505 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -25,6 +25,7 @@ package java.util.jar; +import java.io.ByteArrayInputStream; import java.io.FilterInputStream; import java.io.DataOutputStream; import java.io.InputStream; @@ -80,6 +81,14 @@ } /** + * Used by the VM to create a Manifest object from input bytes. + */ + private static Manifest getManifest(byte buf[]) throws IOException { + ByteArrayInputStream is = new ByteArrayInputStream(buf); + return new Manifest(is); + } + + /** * Returns the main Attributes for the Manifest. * @return the main Attributes for the Manifest */ --- old/src/share/classes/sun/misc/Launcher.java 2014-08-09 00:43:11.192910995 -0700 +++ new/src/share/classes/sun/misc/Launcher.java 2014-08-09 00:43:10.900899883 -0700 @@ -461,6 +461,11 @@ private static URLStreamHandler fileHandler; + // Called by VM + static URL getFileURL(String file) { + return getFileURL(new File(file)); + } + static URL getFileURL(File file) { try { file = file.getCanonicalFile();