A new ParseException Class

Brian Hawkins <brianhks-BYHubErIwDGZvNlLnfxc/[email protected]> Mon, 16 Jan 2006 13:19:39 -0700
Newsgroups gmane.comp.java.beanshell.devel
Message-ID <[email protected]>
I've had problems with this class for a long time but it wasn't until 
recently that I've been forced to dig down into it to find the problem.  
It looks like the constructor that sets any meaningful data is not being 
used.

OK let me back up a bit.  In my project I call getErrorLineNumber() on 
all EvalError's so that I can format my error messages.  Whenever the 
EvalError is actually a ParseException I get a NullPointerException from 
the getErrorLineNumber call.

After digging into the code ParseExceptions are created in one of two 
ways:  1 no params are passed to the constructor.  2 only a string 
message is passed that contains the line and column number.  It also 
looks like the ParseException was auto generated, overridden, kicked 
around, and is now not used for what it was auto generated for.

Proposed solution:  Return ParseException to its pristine generated 
state.  Create a new exception class that either inherits from 
ParseException or directly from EvalError that has the following 
constructors
NewParseException(int line, int column, String message);
NewParseException();

This way the new class would be able to return valid data from the other 
methods on EvalError.

What do you think?

Brian
brianhks.vcf (text/x-vcard, 206 B)
begin:vcard
fn:Brian Hawkins
n:Hawkins;Brian
email;internet:brianhks-BYHubErIwDGZvNlLnfxc/[email protected]
tel;home:801-754-1383
tel;cell:801-361-2845
x-mozilla-html:TRUE
version:2.1
end:vcard