tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@locus.apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/resources FileResources.java
Date Sat, 02 Dec 2000 20:24:38 GMT
craigmcc    00/12/02 12:24:38

  Modified:    catalina/src/share/org/apache/catalina/resources
                        FileResources.java
  Log:
  When you call ServletContext.getResource() on a non-existent resource,
  FileResources now returns null instead of a URL to a non-existent resource.
  This fixes a Watchdog test failure on "/servlet-tests/GetResource_1Test".
  
  Revision  Changes    Path
  1.7       +12 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/resources/FileResources.java
  
  Index: FileResources.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/resources/FileResources.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- FileResources.java	2000/11/18 00:16:57	1.6
  +++ FileResources.java	2000/12/02 20:24:37	1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/resources/FileResources.java,v
1.6 2000/11/18 00:16:57 remm Exp $
  - * $Revision: 1.6 $
  - * $Date: 2000/11/18 00:16:57 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/resources/FileResources.java,v
1.7 2000/12/02 20:24:37 craigmcc Exp $
  + * $Revision: 1.7 $
  + * $Date: 2000/12/02 20:24:37 $
    *
    * ====================================================================
    *
  @@ -95,7 +95,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.6 $ $Date: 2000/11/18 00:16:57 $
  + * @version $Revision: 1.7 $ $Date: 2000/12/02 20:24:37 $
    */
   
   public final class FileResources extends ResourcesBase {
  @@ -224,6 +224,14 @@
   	// Acquire an absolute pathname for the requested resource
   	String pathname = getRealPath(path);
   	if (pathname == null) {
  +            //            if (debug >= 1)
  +            //                log("getResource(" + path + ") --> NULL");
  +	    return (null);
  +        }
  +
  +        // Does the specified resource actually exist?
  +        File file = new File(pathname);
  +        if ((file == null) || !file.exists() || !file.canRead()) {
               //            if (debug >= 1)
               //                log("getResource(" + path + ") --> NULL");
   	    return (null);
  
  
  

Mime
View raw message