You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Martin Kahr <ma...@case.dhs.org> on 2002/02/12 13:50:07 UTC

Jasper error handling extensions

Hi.
 
I want to implement a simple jsp compiler plugin for the eclipse IDE.
After 1 day analyzing the current (tomcat 4.0.2) jasper code I have not
found any hooks where I can install my code to get the jasper error
messages.
Of course I can parse the text message of the exceptions thrown during
parsing and compilation but I think there should be a better way.
 
I think about an special ErrorHandler Interface with a concrete
implementation which provides the same error handling (exception
generation) as the current jasper code (leads to minimal code change and
no change of the current interface).
This Error Handler objects are plugged into the parser eigther through
the Options or JspCompilationContext object. (I think Options is the
better one because the ErrorHandler will not change between 2 jsp files)
 
With this I will be able to implement a special Error Handler (extending
the default one) for my plugin.
 
Possible Interface (first draft):
public interface JasperErrorHandler {
    public void handleParseError(Mark mark, String msg) throws
JasperException;
    public void handleCompileError(String msg, JspLineMap map) throws
JasperException;
}
 
I looked at the code of some IDE which integrate the jasper compiler.
They are duplicating a large number of the orignal jasper code to get
access to the error messages. I think they have the same problems as I
have.
The problem with this is that on each new Tomcat release (with Jasper
code changes) they have to adopt their code :-(
 
What do you think about this idea ?
 
nice greetings from vienna
 Martin Kahr