src/share/classes/sun/misc/URLClassPath.java
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
jdk Cdiff src/share/classes/sun/misc/URLClassPath.java
src/share/classes/sun/misc/URLClassPath.java
Print this page
*** 33,42 ****
--- 33,43 ----
import java.util.zip.ZipEntry;
import java.util.jar.JarEntry;
import java.util.jar.Manifest;
import java.util.jar.Attributes;
import java.util.jar.Attributes.Name;
+ import java.util.jar.UnsupportedProfileException;
import java.net.JarURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.HttpURLConnection;
*** 62,71 ****
--- 63,78 ----
public class URLClassPath {
final static String USER_AGENT_JAVA_VERSION = "UA-Java-Version";
final static String JAVA_VERSION;
private static final boolean DEBUG;
+ /**
+ * Used by launcher to indicate that checking of the JAR file "Profile"
+ * attribute has been suppressed.
+ */
+ private static boolean profileCheckSuppressedByLauncher;
+
static {
JAVA_VERSION = java.security.AccessController.doPrivileged(
new sun.security.action.GetPropertyAction("java.version"));
DEBUG = (java.security.AccessController.doPrivileged(
new sun.security.action.GetPropertyAction("sun.misc.URLClassPath.debug")) != null);
*** 579,588 ****
--- 586,604 ----
URL[] getClassPath() throws IOException {
return null;
}
}
+ /**
+ * Used by the launcher to suppress further checking of the JAR file Profile
+ * attribute (necessary when the launcher is aborting as the abort involves
+ * a resource lookup that may involve opening additional JAR files)
+ */
+ public static void suppressProfileCheckForLauncher() {
+ profileCheckSuppressedByLauncher = true;
+ }
+
/*
* Inner class used to represent a Loader of resources from a JAR URL.
*/
static class JarLoader extends Loader {
private JarFile jar;
*** 786,795 ****
--- 802,833 ----
}
}
return false;
}
+ /**
+ * If the Profile attribtue is present then this method checks that the runtime
+ * supports that profile.
+ *
+ * ## Add a fast path like Class-Path to avoid reading the manifest when the attribute
+ * is not present.
+ */
+ void checkProfileAttribute() throws IOException {
+ Manifest man = jar.getManifest();
+ if (man != null) {
+ Attributes attr = man.getMainAttributes();
+ if (attr != null) {
+ String value = attr.getValue(Name.PROFILE);
+ if (value != null && !Version.supportsProfile(value)) {
+ String prefix = Version.profileName().length() > 0 ?
+ "This runtime implements " + Version.profileName() + ", " : "";
+ throw new UnsupportedProfileException(prefix + csu + " requires " + value);
+ }
+ }
+ }
+ }
+
/*
* Returns the URL for a resource with the specified name
*/
URL findResource(final String name, boolean check) {
Resource rsc = getResource(name, check);
*** 955,964 ****
--- 993,1007 ----
return null;
}
ensureOpen();
parseExtensionsDependencies();
+
+ // check Profile attribute if present
+ if (!profileCheckSuppressedByLauncher)
+ checkProfileAttribute();
+
if (SharedSecrets.javaUtilJarAccess().jarFileHasClassPathAttribute(jar)) { // Only get manifest when necessary
Manifest man = jar.getManifest();
if (man != null) {
Attributes attr = man.getMainAttributes();
if (attr != null) {
src/share/classes/sun/misc/URLClassPath.java
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File