DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18967>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18967

NullPointerException instead of error message when running JspC





------- Additional Comments From [EMAIL PROTECTED]  2003-10-16 02:07 -------
The problem is that Compiler.errDispatcher is null when the Validator encounters
the syntax error in the tag.  Compiler only instantiates its errDispatcher in
Compiler.compile(), even though Compiler.generateJava() also needs
errDispatcher.  This triggers a NullPointerException, for example, if
JspC.processFile() invokes Compiler.generateJava() directly, then the JSP fails
to validate.

I believe that the best fix would be for Compiler to instantiate errDispatcher
in its constructor, instead of instantiating it lazily.  Even if lazy
instantiation were correctly implemented, it would hardly be worth the trouble
-- creating an ErrorDispatcher involves a very simple constructor, and the two
objects created have very few members.  Here is the graph of references:

                             +----------------------------------------+
 Compiler                    v                                        |
   .errorDispatcher  -->  ErrorDispatcher                             |
                            .bundle       --> ResourceBundle*         |
                            .errHandler   --> DefaultErrorHandler     |
                                                 .err ----------------+

      * the ResourceBundle would have been loaded already anyway

Given that analysis, I have submitted a patch to ensure that
Compiler.errorDispatcher is not null by instantiating it in the constructor. 
The patch should apply to both Tomcat 4.1.24 and 4.1.27, since Compiler.java did
not change between the two versions.

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

Reply via email to