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 47717] createJavacError throws NPE
Date Thu, 05 Nov 2009 19:49:52 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=47717

--- Comment #1 from Tim Funk <funkman@apache.org> 2009-11-05 11:49:49 UTC ---
I believe the NPE is this:
        page.visit(errVisitor);

Which is caused by
                JavacErrorDetail detail = ErrorDispatcher.createJavacError(
                        jspFrame.getMethodName(),
                        this.ctxt.getCompiler().getPageNodes(),
                        null,
                        javaLineNumber,
                        ctxt);

So one wonders ... why is this.ctxt.getCompiler().getPageNodes() null?

It could be that compilation is done in 2 passes. And the first pass is
validation. So if this fails - then getPageNodes would be null.

So the easy fix may be this (not sure if its the right fix)...

Index: java/org/apache/jasper/compiler/ErrorDispatcher.java
===================================================================
--- java/org/apache/jasper/compiler/ErrorDispatcher.java        (revision
833114)
+++ java/org/apache/jasper/compiler/ErrorDispatcher.java        (working copy)
@@ -524,7 +524,8 @@
         JavacErrorDetail javacError;
         // Attempt to map javac error line number to line in JSP page
         ErrorVisitor errVisitor = new ErrorVisitor(lineNum);
-        page.visit(errVisitor);
+        if (page!=null)
+            page.visit(errVisitor);
         Node errNode = errVisitor.getJspSourceNode();
         if ((errNode != null) && (errNode.getStart() != null)) {
             // If this is a scriplet node then there is a one to one mapping

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


Mime
View raw message