2014-08-05 16:55 GMT+04:00  <ma...@apache.org>:
> Author: markt
> Date: Tue Aug  5 12:55:20 2014
> New Revision: 1615920
>
> URL: http://svn.apache.org/r1615920
> Log:
> Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56785
> Avoid NullPointerException if directory exists on the class path that is not 
> readable by the Tomcat user.

Would it be better if users had to opt-in for this silent skipping?

My concern that I mentioned in BZ [1] is that if permissions on web
application directories are not correctly configured, it may skip
classes that define a @WebFilter.

[1] https://issues.apache.org/bugzilla/show_bug.cgi?id=56785#c5

My thought is that better default behaviour would be to treat such
unreadable directories as deployment failure, unless a user opts-in
for the feature.


Best regards,
Konstantin Kolinko

> Modified:
>     tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
>     tomcat/trunk/webapps/docs/changelog.xml
>
> Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1615920&r1=1615919&r2=1615920&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java 
> (original)
> +++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Tue Aug  
> 5 12:55:20 2014
> @@ -1960,10 +1960,13 @@ public class ContextConfig implements Li
>              boolean handlesTypesOnly) {
>
>          if (file.isDirectory()) {
> +            // Returns null if directory is not readable
>              String[] dirs = file.list();
> -            for (String dir : dirs) {
> -                processAnnotationsFile(
> -                        new File(file,dir), fragment, handlesTypesOnly);
> +            if (dirs != null) {
> +                for (String dir : dirs) {
> +                    processAnnotationsFile(
> +                            new File(file,dir), fragment, handlesTypesOnly);
> +                }
>              }
>          } else if (file.canRead() && file.getName().endsWith(".class")) {
>              try (FileInputStream fis = new FileInputStream(file)) {
>
> Modified: tomcat/trunk/webapps/docs/changelog.xml
> URL: 
> http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1615920&r1=1615919&r2=1615920&view=diff
> ==============================================================================
> --- tomcat/trunk/webapps/docs/changelog.xml (original)
> +++ tomcat/trunk/webapps/docs/changelog.xml Tue Aug  5 12:55:20 2014
> @@ -81,6 +81,11 @@
>          Cédric Couralet. (markt)
>        </fix>
>        <fix>
> +        <bug>56785</bug>: Avoid <code>NullPointerException</code> if 
> directory
> +        exists on the class path that is not readable by the Tomcat user.
> +        (markt)
> +      </fix>
> +      <fix>
>          <bug>56796</bug>: Remove unnecessary sleep when stopping a web
>          application. (markt)
>        </fix>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>

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

Reply via email to