8049367: Modular Run-Time Images
Co-authored-by: Alan Bateman <alan.bateman@oracle.com> Co-authored-by: Alex Buckley <alex.buckley@oracle.com> Co-authored-by: Bradford Wetmore <bradford.wetmore@oracle.com> Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com> Co-authored-by: James Laskey <james.laskey@oracle.com> Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com> Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com> Co-authored-by: Magnus Ihse Bursie <magnus.ihse.bursie@oracle.com> Co-authored-by: Mandy Chung <mandy.chung@oracle.com> Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com> Co-authored-by: Paul Sandoz <paul.sandoz@oracle.com> Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com> Reviewed-by: chegar, dfuchs, ihse, joehw, mullan, psandoz, wetmore
This commit is contained in:
parent
b9ea81b9ed
commit
3c5c554fad
@ -151,18 +151,17 @@ public class ClassPath implements Serializable {
|
||||
}
|
||||
|
||||
/** Checks for class path components in the following properties:
|
||||
* "java.class.path", "sun.boot.class.path", "java.ext.dirs"
|
||||
* "java.class.path", "sun.boot.class.path"
|
||||
*
|
||||
* @return class path as used by default by BCEL
|
||||
*/
|
||||
public static final String getClassPath() {
|
||||
|
||||
String class_path, boot_path, ext_path;
|
||||
String class_path, boot_path;
|
||||
|
||||
try {
|
||||
class_path = SecuritySupport.getSystemProperty("java.class.path");
|
||||
boot_path = SecuritySupport.getSystemProperty("sun.boot.class.path");
|
||||
ext_path = SecuritySupport.getSystemProperty("java.ext.dirs");
|
||||
}
|
||||
catch (SecurityException e) {
|
||||
return "";
|
||||
@ -173,23 +172,6 @@ public class ClassPath implements Serializable {
|
||||
getPathComponents(class_path, list);
|
||||
getPathComponents(boot_path, list);
|
||||
|
||||
ArrayList dirs = new ArrayList();
|
||||
getPathComponents(ext_path, dirs);
|
||||
|
||||
for(Iterator e = dirs.iterator(); e.hasNext(); ) {
|
||||
File ext_dir = new File((String)e.next());
|
||||
String[] extensions = SecuritySupport.getFileList(ext_dir, new FilenameFilter() {
|
||||
public boolean accept(File dir, String name) {
|
||||
name = name.toLowerCase();
|
||||
return name.endsWith(".zip") || name.endsWith(".jar");
|
||||
}
|
||||
});
|
||||
|
||||
if(extensions != null)
|
||||
for(int i=0; i < extensions.length; i++)
|
||||
list.add(ext_path + File.separatorChar + extensions[i]);
|
||||
}
|
||||
|
||||
StringBuffer buf = new StringBuffer();
|
||||
|
||||
for(Iterator e = list.iterator(); e.hasNext(); ) {
|
||||
|
@ -243,6 +243,9 @@ public final class SecuritySupport {
|
||||
if (protocol.equalsIgnoreCase("jar")) {
|
||||
String path = url.getPath();
|
||||
protocol = path.substring(0, path.indexOf(":"));
|
||||
} else if (protocol.equalsIgnoreCase("jrt")) {
|
||||
// if the systemId is "jrt" then allow access if "file" allowed
|
||||
protocol = "file";
|
||||
}
|
||||
}
|
||||
|
||||
@ -278,7 +281,7 @@ public final class SecuritySupport {
|
||||
|
||||
/**
|
||||
* Read JAXP system property in this order: system property,
|
||||
* $java.home/lib/jaxp.properties if the system property is not specified
|
||||
* $java.home/conf/jaxp.properties if the system property is not specified
|
||||
*
|
||||
* @param propertyId the Id of the property
|
||||
* @return the value of the property
|
||||
@ -292,7 +295,7 @@ public final class SecuritySupport {
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from $java.home/lib/jaxp.properties for the specified property
|
||||
* Read from $java.home/conf/jaxp.properties for the specified property
|
||||
* The program
|
||||
*
|
||||
* @param propertyId the Id of the property
|
||||
@ -306,7 +309,7 @@ public final class SecuritySupport {
|
||||
synchronized (cacheProps) {
|
||||
if (firstTime) {
|
||||
String configFile = getSystemProperty("java.home") + File.separator +
|
||||
"lib" + File.separator + "jaxp.properties";
|
||||
"conf" + File.separator + "jaxp.properties";
|
||||
File f = new File(configFile);
|
||||
if (getFileExists(f)) {
|
||||
is = getFileInputStream(f);
|
||||
@ -332,12 +335,12 @@ public final class SecuritySupport {
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache for properties in java.home/lib/jaxp.properties
|
||||
* Cache for properties in java.home/conf/jaxp.properties
|
||||
*/
|
||||
static final Properties cacheProps = new Properties();
|
||||
|
||||
/**
|
||||
* Flag indicating if the program has tried reading java.home/lib/jaxp.properties
|
||||
* Flag indicating if the program has tried reading java.home/conf/jaxp.properties
|
||||
*/
|
||||
static volatile boolean firstTime = true;
|
||||
|
||||
|
@ -558,9 +558,6 @@ public class EnvironmentCheck
|
||||
* Logs java.class.path and other likely paths; then attempts
|
||||
* to search those paths for .jar files with Xalan-related classes.
|
||||
*
|
||||
* //@todo NOTE: We don't actually search java.ext.dirs for
|
||||
* // *.jar files therein! This should be updated
|
||||
*
|
||||
* @param h Hashtable to put information in
|
||||
* @see #jarNames
|
||||
* @see #checkPathForJars(String, String[])
|
||||
@ -615,20 +612,6 @@ public class EnvironmentCheck
|
||||
h.put(FOUNDCLASSES + "sun.boot.class.path", classpathJars);
|
||||
}
|
||||
|
||||
//@todo NOTE: We don't actually search java.ext.dirs for
|
||||
// *.jar files therein! This should be updated
|
||||
othercp = SecuritySupport.getSystemProperty("java.ext.dirs");
|
||||
|
||||
if (null != othercp)
|
||||
{
|
||||
h.put("java.ext.dirs", othercp);
|
||||
|
||||
classpathJars = checkPathForJars(othercp, jarNames);
|
||||
|
||||
if (null != classpathJars)
|
||||
h.put(FOUNDCLASSES + "java.ext.dirs", classpathJars);
|
||||
}
|
||||
|
||||
//@todo also check other System properties' paths?
|
||||
// v2 = checkPathForJars(System.getProperty("sun.boot.library.path"), jarNames); // ?? may not be needed
|
||||
// v3 = checkPathForJars(System.getProperty("java.library.path"), jarNames); // ?? may not be needed
|
||||
|
@ -41,7 +41,7 @@ import javax.xml.datatype.XMLGregorianCalendar;
|
||||
* Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}.
|
||||
* </li>
|
||||
* <li>
|
||||
* If the file ${JAVA_HOME}/lib/jaxp.properties exists, it is loaded in a {@link java.util.Properties} <code>Object</code>.
|
||||
* If the file ${JAVA_HOME}/conf/jaxp.properties exists, it is loaded in a {@link java.util.Properties} <code>Object</code>.
|
||||
* The <code>Properties</code> <code>Object </code> is then queried for the property as documented in the prior step
|
||||
* and processed as documented in the prior step.
|
||||
* </li>
|
||||
|
@ -237,6 +237,9 @@ public final class SecuritySupport {
|
||||
if (protocol.equalsIgnoreCase("jar")) {
|
||||
String path = url.getPath();
|
||||
protocol = path.substring(0, path.indexOf(":"));
|
||||
} else if (protocol.equalsIgnoreCase("jrt")) {
|
||||
// if the systemId is "jrt" then allow access if "file" allowed
|
||||
protocol = "file";
|
||||
}
|
||||
}
|
||||
|
||||
@ -272,7 +275,7 @@ public final class SecuritySupport {
|
||||
|
||||
/**
|
||||
* Read JAXP system property in this order: system property,
|
||||
* $java.home/lib/jaxp.properties if the system property is not specified
|
||||
* $java.home/conf/jaxp.properties if the system property is not specified
|
||||
*
|
||||
* @param propertyId the Id of the property
|
||||
* @return the value of the property
|
||||
@ -286,7 +289,7 @@ public final class SecuritySupport {
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from $java.home/lib/jaxp.properties for the specified property
|
||||
* Read from $java.home/conf/jaxp.properties for the specified property
|
||||
* The program
|
||||
*
|
||||
* @param propertyId the Id of the property
|
||||
@ -300,7 +303,7 @@ public final class SecuritySupport {
|
||||
synchronized (cacheProps) {
|
||||
if (firstTime) {
|
||||
String configFile = getSystemProperty("java.home") + File.separator +
|
||||
"lib" + File.separator + "jaxp.properties";
|
||||
"conf" + File.separator + "jaxp.properties";
|
||||
File f = new File(configFile);
|
||||
if (getFileExists(f)) {
|
||||
is = getFileInputStream(f);
|
||||
@ -326,12 +329,12 @@ public final class SecuritySupport {
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache for properties in java.home/lib/jaxp.properties
|
||||
* Cache for properties in java.home/conf/jaxp.properties
|
||||
*/
|
||||
static final Properties cacheProps = new Properties();
|
||||
|
||||
/**
|
||||
* Flag indicating if the program has tried reading java.home/lib/jaxp.properties
|
||||
* Flag indicating if the program has tried reading java.home/conf/jaxp.properties
|
||||
*/
|
||||
static volatile boolean firstTime = true;
|
||||
|
||||
|
@ -247,7 +247,7 @@ public final class XMLConstants {
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* <b>${JAVA_HOME}/lib/jaxp.properties:</b> This configuration file is in standard
|
||||
* <b>${JAVA_HOME}/conf/jaxp.properties:</b> This configuration file is in standard
|
||||
* {@link java.util.Properties} format. If the file exists and the system property is specified,
|
||||
* its value will be used to override the default of the property.
|
||||
* </p>
|
||||
@ -314,7 +314,7 @@ public final class XMLConstants {
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* <b>${JAVA_HOME}/lib/jaxp.properties:</b> This configuration file is in standard
|
||||
* <b>${JAVA_HOME}/conf/jaxp.properties:</b> This configuration file is in standard
|
||||
* java.util.Properties format. If the file exists and the system property is specified,
|
||||
* its value will be used to override the default of the property.
|
||||
*
|
||||
@ -380,7 +380,7 @@ public final class XMLConstants {
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* <b>${JAVA_HOME}/lib/jaxp.properties: </b> This configuration file is in standard
|
||||
* <b>${JAVA_HOME}/conf/jaxp.properties: </b> This configuration file is in standard
|
||||
* java.util.Properties format. If the file exists and the system property is specified,
|
||||
* its value will be used to override the default of the property.
|
||||
*
|
||||
|
@ -43,7 +43,7 @@ import java.util.regex.Pattern;
|
||||
* Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}.
|
||||
* </li>
|
||||
* <li>
|
||||
* If the file ${JAVA_HOME}/lib/jaxp.properties exists, it is loaded in a {@link java.util.Properties} <code>Object</code>.
|
||||
* If the file ${JAVA_HOME}/conf/jaxp.properties exists, it is loaded in a {@link java.util.Properties} <code>Object</code>.
|
||||
* The <code>Properties</code> <code>Object </code> is then queried for the property as documented in the prior step
|
||||
* and processed as documented in the prior step.
|
||||
* </li>
|
||||
|
@ -50,12 +50,12 @@ class FactoryFinder {
|
||||
private static boolean debug = false;
|
||||
|
||||
/**
|
||||
* Cache for properties in java.home/lib/jaxp.properties
|
||||
* Cache for properties in java.home/conf/jaxp.properties
|
||||
*/
|
||||
private final static Properties cacheProps = new Properties();
|
||||
|
||||
/**
|
||||
* Flag indicating if properties from java.home/lib/jaxp.properties
|
||||
* Flag indicating if properties from java.home/conf/jaxp.properties
|
||||
* have been cached.
|
||||
*/
|
||||
private static volatile boolean firstTime = true;
|
||||
@ -237,13 +237,13 @@ class FactoryFinder {
|
||||
if (debug) se.printStackTrace();
|
||||
}
|
||||
|
||||
// try to read from $java.home/lib/jaxp.properties
|
||||
// try to read from $java.home/conf/jaxp.properties
|
||||
try {
|
||||
if (firstTime) {
|
||||
synchronized (cacheProps) {
|
||||
if (firstTime) {
|
||||
String configFile = ss.getSystemProperty("java.home") + File.separator +
|
||||
"lib" + File.separator + "jaxp.properties";
|
||||
"conf" + File.separator + "jaxp.properties";
|
||||
File f = new File(configFile);
|
||||
firstTime = false;
|
||||
if (ss.doesFileExist(f)) {
|
||||
@ -256,7 +256,7 @@ class FactoryFinder {
|
||||
final String factoryClassName = cacheProps.getProperty(factoryId);
|
||||
|
||||
if (factoryClassName != null) {
|
||||
dPrint("found in $java.home/jaxp.properties, value=" + factoryClassName);
|
||||
dPrint("found in ${java.home}/conf/jaxp.properties, value=" + factoryClassName);
|
||||
return newInstance(type, factoryClassName, null, true);
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public abstract class DocumentBuilderFactory {
|
||||
* property.
|
||||
* </li>
|
||||
* <li>
|
||||
* Use the properties file "lib/jaxp.properties" in the JRE directory.
|
||||
* Use the properties file "conf/jaxp.properties" in the JRE directory.
|
||||
* This configuration file is in standard <code>java.util.Properties
|
||||
* </code> format and contains the fully qualified name of the
|
||||
* implementation class with the key being the system property defined
|
||||
|
@ -50,12 +50,12 @@ class FactoryFinder {
|
||||
private static boolean debug = false;
|
||||
|
||||
/**
|
||||
* Cache for properties in java.home/lib/jaxp.properties
|
||||
* Cache for properties in java.home/conf/jaxp.properties
|
||||
*/
|
||||
private static final Properties cacheProps = new Properties();
|
||||
|
||||
/**
|
||||
* Flag indicating if properties from java.home/lib/jaxp.properties
|
||||
* Flag indicating if properties from java.home/conf/jaxp.properties
|
||||
* have been cached.
|
||||
*/
|
||||
static volatile boolean firstTime = true;
|
||||
@ -236,13 +236,13 @@ class FactoryFinder {
|
||||
if (debug) se.printStackTrace();
|
||||
}
|
||||
|
||||
// try to read from $java.home/lib/jaxp.properties
|
||||
// try to read from $java.home/conf/jaxp.properties
|
||||
try {
|
||||
if (firstTime) {
|
||||
synchronized (cacheProps) {
|
||||
if (firstTime) {
|
||||
String configFile = ss.getSystemProperty("java.home") + File.separator +
|
||||
"lib" + File.separator + "jaxp.properties";
|
||||
"conf" + File.separator + "jaxp.properties";
|
||||
File f = new File(configFile);
|
||||
firstTime = false;
|
||||
if (ss.doesFileExist(f)) {
|
||||
@ -255,7 +255,7 @@ class FactoryFinder {
|
||||
final String factoryClassName = cacheProps.getProperty(factoryId);
|
||||
|
||||
if (factoryClassName != null) {
|
||||
dPrint("found in $java.home/jaxp.properties, value=" + factoryClassName);
|
||||
dPrint("found in ${java.home}/conf/jaxp.properties, value=" + factoryClassName);
|
||||
return newInstance(type, factoryClassName, null, true);
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public abstract class SAXParserFactory {
|
||||
* property.
|
||||
* </li>
|
||||
* <li>
|
||||
* Use the properties file "lib/jaxp.properties" in the JRE directory.
|
||||
* Use the properties file "conf/jaxp.properties" in the JRE directory.
|
||||
* This configuration file is in standard <code>java.util.Properties
|
||||
* </code> format and contains the fully qualified name of the
|
||||
* implementation class with the key being the system property defined
|
||||
|
@ -51,12 +51,12 @@ class FactoryFinder {
|
||||
private static boolean debug = false;
|
||||
|
||||
/**
|
||||
* Cache for properties in java.home/lib/jaxp.properties
|
||||
* Cache for properties in java.home/conf/jaxp.properties
|
||||
*/
|
||||
final private static Properties cacheProps = new Properties();
|
||||
|
||||
/**
|
||||
* Flag indicating if properties from java.home/lib/jaxp.properties
|
||||
* Flag indicating if properties from java.home/conf/jaxp.properties
|
||||
* have been cached.
|
||||
*/
|
||||
private static volatile boolean firstTime = true;
|
||||
@ -271,7 +271,7 @@ class FactoryFinder {
|
||||
}
|
||||
|
||||
// Try read $java.home/lib/stax.properties followed by
|
||||
// $java.home/lib/jaxp.properties if former not present
|
||||
// $java.home/conf/jaxp.properties if former not present
|
||||
String configFile = null;
|
||||
try {
|
||||
if (firstTime) {
|
||||
@ -287,7 +287,7 @@ class FactoryFinder {
|
||||
}
|
||||
else {
|
||||
configFile = ss.getSystemProperty("java.home") + File.separator +
|
||||
"lib" + File.separator + "jaxp.properties";
|
||||
"conf" + File.separator + "jaxp.properties";
|
||||
f = new File(configFile);
|
||||
if (ss.doesFileExist(f)) {
|
||||
dPrint("Read properties file "+f);
|
||||
|
@ -53,12 +53,12 @@ class FactoryFinder {
|
||||
private static boolean debug = false;
|
||||
|
||||
/**
|
||||
* Cache for properties in java.home/lib/jaxp.properties
|
||||
* Cache for properties in java.home/conf/jaxp.properties
|
||||
*/
|
||||
private final static Properties cacheProps = new Properties();
|
||||
|
||||
/**
|
||||
* Flag indicating if properties from java.home/lib/jaxp.properties
|
||||
* Flag indicating if properties from java.home/conf/jaxp.properties
|
||||
* have been cached.
|
||||
*/
|
||||
static volatile boolean firstTime = true;
|
||||
@ -268,13 +268,13 @@ class FactoryFinder {
|
||||
if (debug) se.printStackTrace();
|
||||
}
|
||||
|
||||
// try to read from $java.home/lib/jaxp.properties
|
||||
// try to read from $java.home/conf/jaxp.properties
|
||||
try {
|
||||
if (firstTime) {
|
||||
synchronized (cacheProps) {
|
||||
if (firstTime) {
|
||||
String configFile = ss.getSystemProperty("java.home") + File.separator +
|
||||
"lib" + File.separator + "jaxp.properties";
|
||||
"conf" + File.separator + "jaxp.properties";
|
||||
File f = new File(configFile);
|
||||
firstTime = false;
|
||||
if (ss.doesFileExist(f)) {
|
||||
@ -287,7 +287,7 @@ class FactoryFinder {
|
||||
final String factoryClassName = cacheProps.getProperty(factoryId);
|
||||
|
||||
if (factoryClassName != null) {
|
||||
dPrint("found in $java.home/jaxp.properties, value=" + factoryClassName);
|
||||
dPrint("found in ${java.home}/conf/jaxp.properties, value=" + factoryClassName);
|
||||
return newInstance(type, factoryClassName, null, true, true);
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public abstract class TransformerFactory {
|
||||
* property.
|
||||
* </li>
|
||||
* <li>
|
||||
* Use the properties file "lib/jaxp.properties" in the JRE directory.
|
||||
* Use the properties file "conf/jaxp.properties" in the JRE directory.
|
||||
* This configuration file is in standard <code>java.util.Properties
|
||||
* </code> format and contains the fully qualified name of the
|
||||
* implementation class with the key being the system property defined
|
||||
|
@ -141,7 +141,7 @@ public abstract class SchemaFactory {
|
||||
* and returns it if it is successfully created.
|
||||
* </li>
|
||||
* <li>
|
||||
* <code>$java.home/lib/jaxp.properties</code> is read and
|
||||
* <code>$java.home/conf/jaxp.properties</code> is read and
|
||||
* the value associated with the key being the system property above
|
||||
* is looked for. If present, the value is processed just like above.
|
||||
* </li>
|
||||
|
@ -181,10 +181,10 @@ class SchemaFactoryFinder {
|
||||
|
||||
String javah = ss.getSystemProperty( "java.home" );
|
||||
String configFile = javah + File.separator +
|
||||
"lib" + File.separator + "jaxp.properties";
|
||||
"conf" + File.separator + "jaxp.properties";
|
||||
|
||||
|
||||
// try to read from $java.home/lib/jaxp.properties
|
||||
// try to read from $java.home/conf/jaxp.properties
|
||||
try {
|
||||
if(firstTime){
|
||||
synchronized(cacheProps){
|
||||
@ -199,7 +199,7 @@ class SchemaFactoryFinder {
|
||||
}
|
||||
}
|
||||
final String factoryClassName = cacheProps.getProperty(propertyName);
|
||||
debugPrintln("found " + factoryClassName + " in $java.home/jaxp.properties");
|
||||
debugPrintln("found " + factoryClassName + " in $java.home/conf/jaxp.properties");
|
||||
|
||||
if (factoryClassName != null) {
|
||||
sf = createInstance(factoryClassName, true);
|
||||
|
@ -117,7 +117,7 @@ public abstract class XPathFactory {
|
||||
* and returns it if it is successfully created.
|
||||
* </li>
|
||||
* <li>
|
||||
* ${java.home}/lib/jaxp.properties is read and the value associated with the key being the system property above is looked for.
|
||||
* ${java.home}/conf/jaxp.properties is read and the value associated with the key being the system property above is looked for.
|
||||
* If present, the value is processed just like above.
|
||||
* </li>
|
||||
* <li>
|
||||
|
@ -176,9 +176,9 @@ class XPathFactoryFinder {
|
||||
|
||||
String javah = ss.getSystemProperty( "java.home" );
|
||||
String configFile = javah + File.separator +
|
||||
"lib" + File.separator + "jaxp.properties";
|
||||
"conf" + File.separator + "jaxp.properties";
|
||||
|
||||
// try to read from $java.home/lib/jaxp.properties
|
||||
// try to read from $java.home/conf/jaxp.properties
|
||||
try {
|
||||
if(firstTime){
|
||||
synchronized(cacheProps){
|
||||
@ -193,7 +193,7 @@ class XPathFactoryFinder {
|
||||
}
|
||||
}
|
||||
final String factoryClassName = cacheProps.getProperty(propertyName);
|
||||
debugPrintln("found " + factoryClassName + " in $java.home/jaxp.properties");
|
||||
debugPrintln("found " + factoryClassName + " in $java.home/conf/jaxp.properties");
|
||||
|
||||
if (factoryClassName != null) {
|
||||
xpathFactory = createInstance(factoryClassName, true);
|
||||
|
Loading…
Reference in New Issue
Block a user