tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lar...@apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/compat SimpleClassLoader.java
Date Tue, 06 Mar 2001 05:39:25 GMT
larryi      01/03/05 21:39:24

  Modified:    src/share/org/apache/tomcat/util/compat
                        SimpleClassLoader.java
  Log:
  Move previously added zf.close() in doFindResource() since this method
  needs to return the Resource with ZipFile still open.
  
  Add parent delagation to getResource() and getResourceAsStream().  This
  is now needed when using Jdk1.1 because web.dtd has changed location.
  It used to be with the classes now handled by the "container" classloader.
  It is now handled by the "common" classloader which is a parent of the
  "container" classloader.
  
  Revision  Changes    Path
  1.3       +16 -2     jakarta-tomcat/src/share/org/apache/tomcat/util/compat/SimpleClassLoader.java
  
  Index: SimpleClassLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/compat/SimpleClassLoader.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SimpleClassLoader.java	2001/03/04 19:49:02	1.2
  +++ SimpleClassLoader.java	2001/03/06 05:39:24	1.3
  @@ -328,8 +328,15 @@
        */
       public URL getResource(String name) {
           if( debug > 0 ) log( "getResource() " + name );
  +	URL u = null;
   
  -	URL u = getSystemResource(name);
  +	if (parent != null) {
  +	    u = parent.getResource(name);
  +	    if (u != null)
  +		return u;
  +	}
  +
  +	u = getSystemResource(name);
   	if (u != null) {
   	    return u;
   	}
  @@ -391,6 +398,13 @@
   	//	InputStream s = getSystemResourceAsStream(name);
   	InputStream s = null;
   
  +	if (parent != null) {
  +	    s = parent.getResourceAsStream(name);
  +	    if( debug>0 ) log( "Found resource in parent " + s );
  +	    if (s != null)
  +		return s;
  +	}
  +
   	// Get this resource from system class loader 
   	s = getSystemResourceAsStream(name);
   
  @@ -475,7 +489,6 @@
                   try {
                       ZipFile zf = new ZipFile(file.getAbsolutePath());
                       ZipEntry ze = zf.getEntry(name);
  -		    zf.close();
   					
                       if (ze != null) {
   			r.zipEntry=ze;
  @@ -483,6 +496,7 @@
   			r.repository=file;
   			return r;
                       }
  +		    zf.close();
                   } catch (IOException ioe) {
                       ioe.printStackTrace();
   		    System.out.println("Name= " + name + " " + file );
  
  
  

Mime
View raw message