tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 27520] New: - NullPointerException when using JspC on webapp tree containing unreadable dir
Date Mon, 08 Mar 2004 18:38:03 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27520>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27520

NullPointerException when using JspC on webapp tree containing unreadable dir

           Summary: NullPointerException when using JspC on webapp tree
                    containing unreadable dir
           Product: Tomcat 5
           Version: 5.0.16
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Jasper
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: seth@oculan.com


When using JspC, it is possible to get a null pointer exception if the webapp
tree you are attempting to compile contains an unreadable directory. Here are
the lines that cause the stack trace from JspC.java, CVS version 1.61:

 806                             if (f.exists() && f.isDirectory()) {
 807                                 String[] files = f.list();
 808                                 String ext;
 809                                 for (int i = 0; i < files.length; i++) {
 810                                     File f2 = new File(s, files[i]);

There is no check before line 809 to see if File.list() returned a null value.
Therefore, we get the following stack trace from the jspc Ant task:

   [jasper2] java.lang.NullPointerException
  [jasper2]     at org.apache.jasper.JspC.scanFiles(JspC.java:809)
  [jasper2]     at org.apache.jasper.JspC.execute(JspC.java:856)
  [jasper2]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  [jasper2]     at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  [jasper2]     at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  [jasper2]     at java.lang.reflect.Method.invoke(Method.java:324)
  [jasper2]     at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:157)
  [jasper2]     at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:306)
  [jasper2]     at org.apache.tools.ant.Task.perform(Task.java:401)
  [jasper2]     at
org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:102)
  [jasper2]     at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:306)
  [jasper2]     at org.apache.tools.ant.Task.perform(Task.java:401)
  [jasper2]     at
org.apache.tools.ant.taskdefs.Parallel$TaskRunnable.run(Parallel.java:457)
  [jasper2]     at java.lang.Thread.run(Thread.java:536)

It would be much nicer if the task simply logged a warning or ignored the
unreadable directory.

---------------------------------------------------------------------
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