tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java LocalStrings.properties
Date Tue, 03 May 2005 17:24:10 GMT
luehe       2005/05/03 10:24:10

  Modified:    catalina/src/share/org/apache/catalina/core
                        ApplicationContext.java LocalStrings.properties
  Log:
  Prevent NPE when passing null path argument in several places
  
  Revision  Changes    Path
  1.28      +18 -1     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java
  
  Index: ApplicationContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- ApplicationContext.java	17 Mar 2005 10:53:44 -0000	1.27
  +++ ApplicationContext.java	3 May 2005 17:24:10 -0000	1.28
  @@ -355,6 +355,10 @@
           if (!context.isFilesystemBased())
               return null;
   
  +        if (path == null) {
  +            return null;
  +        }
  +
           File file = new File(basePath, path);
           return (file.getAbsolutePath());
   
  @@ -547,6 +551,15 @@
        */
       public Set getResourcePaths(String path) {
   
  +        // Validate the path argument
  +        if (path == null) {
  +            return null;
  +        }
  +        if (!path.startsWith("/")) {
  +            throw new IllegalArgumentException
  +                (sm.getString("applicationContext.resourcePaths.iae", path));
  +        }
  +
           path = normalize(path);
           if (path == null)
               return (null);
  @@ -867,6 +880,10 @@
        */
       private String normalize(String path) {
   
  +        if (path == null) {
  +            return null;
  +        }
  +
           String normalized = path;
   
           // Normalize the slashes and add leading slash if necessary
  
  
  
  1.21      +1 -0      jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/LocalStrings.properties,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- LocalStrings.properties	19 Apr 2005 18:42:29 -0000	1.20
  +++ LocalStrings.properties	3 May 2005 17:24:10 -0000	1.21
  @@ -1,6 +1,7 @@
   applicationContext.attributeEvent=Exception thrown by attributes event listener
   applicationContext.mapping.error=Error during mapping
   applicationContext.requestDispatcher.iae=Path {0} does not start with a "/" character
  +applicationContext.resourcePaths.iae=Path {0} does not start with a "/" character
   applicationContext.setAttribute.namenull=Name cannot be null
   applicationDispatcher.allocateException=Allocate exception for servlet {0}
   applicationDispatcher.deallocateException=Deallocate exception for servlet {0}
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message