xalan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tmil...@apache.org
Subject cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/runtime TransletLoader.java
Date Fri, 01 Mar 2002 19:16:38 GMT
tmiller     02/03/01 11:16:38

  Modified:    java/src/org/apache/xalan/xsltc/runtime TransletLoader.java
  Log:
  Tomcat 4.x external Java class bug fix, Tomcat 4.x
  could not find external java classes, contrib by Santiago Pericas
  
  Revision  Changes    Path
  1.2       +13 -8     xml-xalan/java/src/org/apache/xalan/xsltc/runtime/TransletLoader.java
  
  Index: TransletLoader.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/TransletLoader.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TransletLoader.java	8 Nov 2001 14:11:15 -0000	1.1
  +++ TransletLoader.java	1 Mar 2002 19:16:38 -0000	1.2
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: TransletLoader.java,v 1.1 2001/11/08 14:11:15 morten Exp $
  + * @(#)$Id: TransletLoader.java,v 1.2 2002/03/01 19:16:38 tmiller Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -57,6 +57,7 @@
    * <http://www.apache.org/>.
    *
    * @author Morten Jorgensen
  + * @author Santiago Pericas-Geertsen
    *
    */
   
  @@ -64,6 +65,9 @@
   
   import java.lang.Class;
   import java.lang.ClassLoader;
  +import java.lang.Thread;
  +
  +import java.net.*;	// temporary
   
   /**
    * This class is intended used when the default Class.forName() method fails.
  @@ -91,14 +95,14 @@
        * Get a handle to the system class loader
        */
       public TransletLoader() {
  -	// Get the default class loader
  -	ClassLoader loader = this.getClass().getClassLoader();
  -	// If this is the extensions class loader we need to get the
  -	// default system class loader instead. This is permitted if
  -	// this class was loaded by the extensions class loader.
  -	String loaderName = loader.getClass().getName();
  -	if (loaderName.equals("sun.misc.Launcher$ExtClassLoader"))
  +	// Get the loader for the current thread (not the current class)
  +	ClassLoader loader = Thread.currentThread().getContextClassLoader();
  +
  +	// Avoid using the extensions class loader (see comment above)
  +	final String loaderName = loader.getClass().getName();
  +	if (loaderName.equals("sun.misc.Launcher$ExtClassLoader")) {
   	    loader = ClassLoader.getSystemClassLoader();
  +	}
   	_loader = loader;
       }
   
  @@ -108,6 +112,7 @@
       public Class loadClass(String name) throws ClassNotFoundException {
   	return(Class.forName(name, false, _loader));
       }
  +
       /**
        * Loads a Class definition and runs static initializers.
        */
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org


Mime
View raw message