Crossposting to watchdog-dev as this should be of interest I've made some modifications to catalina.core.ApplicationContext to fix a bug reported in bugzilla (don't have the number, bugzilla is currently unreachable from here...search on ServletContext...has to do with consecutive '//'). Also, these changes needed to pass a new test that I recently submitted to watchdog-dev.
The changes are simply: 1. Return null if input path argument is null (currently, NPE thrown) 2. Return null if a NamingException occurs in looking up a path (all the occurrances of NamingException [I've seen] report the error: "resource not found") (current empty set is returned) 3. Change all occurrances of the pattern "/*" in the input path to "/" These changes reflect my understanding of the doc for this method. I send an earlier email on watchdog-dev asking for clarifications: http://www.mail-archive.com/watchdog-dev%40jakarta.apache.org/msg00358.html But since I did not receive anything feedback, I just went ahead and coded to my understanding. - Gidado
Index: ApplicationContext.java =================================================================== RCS file: /home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.37 diff -u -r1.37 ApplicationContext.java --- ApplicationContext.java 26 Apr 2002 21:18:18 -0000 1.37 +++ ApplicationContext.java 4 Jun 2002 16:07:23 -0000 @@ -690,6 +690,20 @@ */ public Set getResourcePaths(String path) { + // Check and canonicalize path (change '//' to '/') + if (path==null) + return null; + StringBuffer buffer = new StringBuffer(path); + int length = buffer.length() - 1; + for (int i=0; i<length; i++) { + if (buffer.charAt(i)=='/') + while (buffer.charAt(i+1) == '/') { + buffer.deleteCharAt(i+1); + length--; + } + } + path = buffer.toString(); + DirContext resources = context.getResources(); if (resources != null) { if (System.getSecurityManager() != null) { @@ -717,7 +731,7 @@ try { listCollectionPaths(set, resources, path); } catch (NamingException e) { - ; // Ignore + return null; // likely resource not found } set.setLocked(true); return (set);
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>