craigmcc 00/12/21 14:27:12
Modified: catalina/src/share/org/apache/catalina/startup
Bootstrap.java
Log:
Add some debugging instrumentation (still disabled by default) to track down
the "non-normalized" URLs issue. If you start Catalina using the standard
startup script, without a CATALINA_HOME environment variable set, you do indeed
get URLs that have "/../" in them passed to the classloader. Interestingly
enough, though, they continue to work.
I'm going to check this out on Solaris and Windows to see if there might be
platform-specific discrepancies in how URLClassLoader is implemented.
Revision Changes Path
1.7 +50 -4
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Bootstrap.java
Index: Bootstrap.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Bootstrap.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Bootstrap.java 2000/11/13 06:19:01 1.6
+++ Bootstrap.java 2000/12/21 22:27:11 1.7
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Bootstrap.java,v
1.6 2000/11/13 06:19:01 remm Exp $
- * $Revision: 1.6 $
- * $Date: 2000/11/13 06:19:01 $
+ * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Bootstrap.java,v
1.7 2000/12/21 22:27:11 craigmcc Exp $
+ * $Revision: 1.7 $
+ * $Date: 2000/12/21 22:27:11 $
*
* ====================================================================
*
@@ -84,12 +84,21 @@
* class path and therefore not visible to application level classes.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.6 $ $Date: 2000/11/13 06:19:01 $
+ * @version $Revision: 1.7 $ $Date: 2000/12/21 22:27:11 $
*/
public final class Bootstrap {
+ // ------------------------------------------------------- Static Variables
+
+
+ /**
+ * Debugging detail level for processing the startup.
+ */
+ private static int debug = 0;
+
+
// ----------------------------------------------------------- Main Program
@@ -108,12 +117,17 @@
// Load our startup class and call its process() method
try {
+ // Instantiate a startup class instance
+ if (debug >= 1)
+ log("Loading startup class");
Class startupClass =
catalinaLoader.loadClass
("org.apache.catalina.startup.Catalina");
Object startupInstance = startupClass.newInstance();
// Set the shared extensions class loader
+ if (debug >= 1)
+ log("Setting startup class properties");
String methodName = "setParentClassLoader";
Class paramTypes[] = new Class[1];
paramTypes[0] = Class.forName("java.lang.ClassLoader");
@@ -124,6 +138,8 @@
method.invoke(startupInstance, paramValues);
// Call the process() method
+ if (debug >= 1)
+ log("Calling startup class process() method");
methodName = "process";
paramTypes = new Class[1];
paramTypes[0] = args.getClass();
@@ -150,6 +166,9 @@
*/
private static ClassLoader createSystemLoader() {
+ if (debug >= 1)
+ log("Creating SYSTEM class loader");
+
// Construct the "class path" for this class loader
ArrayList list = new ArrayList();
@@ -170,6 +189,8 @@
File file = new File(directory, filenames[i]);
try {
URL url = new URL("file", null, file.getAbsolutePath());
+ if (debug >= 1)
+ log(" Adding " + url.toString());
list.add(url.toString());
} catch (MalformedURLException e) {
System.out.println("Cannot create URL for " +
@@ -193,6 +214,9 @@
*/
private static ClassLoader createCatalinaLoader(ClassLoader parent) {
+ if (debug >= 1)
+ log("Creating CATALINA class loader");
+
// Construct the "class path" for this class loader
ArrayList list = new ArrayList();
@@ -203,6 +227,8 @@
try {
URL url = new URL("file", null,
classes.getAbsolutePath() + "/");
+ if (debug >= 1)
+ log(" Adding " + url.toString());
list.add(url.toString());
} catch (MalformedURLException e) {
System.out.println("Cannot create URL for " +
@@ -226,6 +252,8 @@
File file = new File(directory, filenames[i]);
try {
URL url = new URL("file", null, file.getAbsolutePath());
+ if (debug >= 1)
+ log(" Adding " + url.toString());
list.add(url.toString());
} catch (MalformedURLException e) {
System.out.println("Cannot create URL for " +
@@ -249,6 +277,9 @@
*/
private static ClassLoader createSharedLoader(ClassLoader parent) {
+ if (debug >= 1)
+ log("Creating SHARED class loader");
+
// Construct the "class path" for this class loader
ArrayList list = new ArrayList();
@@ -267,6 +298,8 @@
File file = new File(directory, filenames[i]);
try {
URL url = new URL("file", null, file.getAbsolutePath());
+ if (debug >= 1)
+ log(" Adding " + url.toString());
list.add(url.toString());
} catch (MalformedURLException e) {
System.out.println("Cannot create URL for " +
@@ -292,6 +325,19 @@
*/
return (loader);
+
+ }
+
+
+ /**
+ * Log a debugging detail message.
+ *
+ * @param message The message to be logged
+ */
+ private static void log(String message) {
+
+ System.out.print("Bootstrap: ");
+ System.out.println(message);
}