luehe       2005/05/02 09:52:10

  Modified:    catalina/src/share/org/apache/catalina/servlets
                        DefaultServlet.java
  Log:
  - Avoid cache lookup if
  
      trimmed.equalsIgnoreCase("WEB-INF") ||
      trimmed.equalsIgnoreCase("META-INF") ||
      trimmed.equalsIgnoreCase(localXsltFile)
  
  - Avoid NPE (by adding check for "childCacheEntry.exists")
    in the case where ProxyDirContext.lookupCache()
    swallows NamingException, in which case the "attributes" field of
    the returned "childCacheEntry" will be null, causing
  
      childCacheEntry.attributes.getContentLength()
  
    in DefaultServlet.renderXml() to throw NPE.
  
  Revision  Changes    Path
  1.36      +7 -5      
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- DefaultServlet.java       29 Apr 2005 20:04:03 -0000      1.35
  +++ DefaultServlet.java       2 May 2005 16:52:10 -0000       1.36
  @@ -1164,7 +1164,6 @@
   
                   CacheEntry childCacheEntry =
                       resources.lookupCache(cacheEntry.name + resourceName);
  -
                   if (!childCacheEntry.exists) {
                       continue;
                   }
  @@ -1330,14 +1329,17 @@
   
                   NameClassPair ncPair = (NameClassPair) 
enumeration.nextElement();
                   String resourceName = ncPair.getName();
  -                CacheEntry childCacheEntry =
  -                    resources.lookupCache(cacheEntry.name + resourceName);
  -
                   String trimmed = resourceName/*.substring(trim)*/;
                   if (trimmed.equalsIgnoreCase("WEB-INF") ||
                       trimmed.equalsIgnoreCase("META-INF"))
                       continue;
   
  +                CacheEntry childCacheEntry =
  +                    resources.lookupCache(cacheEntry.name + resourceName);
  +                if (!childCacheEntry.exists) {
  +                    continue;
  +                }
  +
                   sb.append("<tr");
                   if (shade)
                       sb.append(" bgcolor=\"#eeeeee\"");
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to