> I feel letting the parser throw an NPE is not a good idea.
That is not consistent with Java programming practice. In particular,
when the problem is that a null pointer is found when one is not allowed
you are supposed to throw a NullPointerException. Even in the official
SAX distribution, org.xml.sax.helpers.ParserAdapter#setContentHandler,
it says:
if (handler == null) {
throw new NullPointerException("Null content handler");
}
> So, it'd better if we throw a SAXException (which is more informative)
> wrapping the NPE.
Who is this better for ? (and I question the use of "we" since I have
seen no discussions or proposals on the mailing list about such changes)
So, if your only argument is that the message is not sufficiently
informative, and *we* don't mind filling the jar files up with byte
codes and message strings (not to mention correctly implementing and
using the right localization services), then by all means fill the
source code with checks for programming errors and provide informative
messages for those errors, but you should still use the proper type
of exception.
> It's, of course, not a SAX error but the parse(..) documentation says
> any SAX exception possibly wrapping another exception can be thrown.
As the saying goes, just because you can do a thing, it does not follow
that you should do that thing...
Regards,
Glenn
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]