>>>>> "Etienne" == Etienne M Gagnon <[EMAIL PROTECTED]> writes:
Etienne> The general rule for exception is: An exception denotes an
Etienne> "exceptional" situation (no surprize!), and thus should not
Etienne> be used on the normal execution path of a program/library.
I first heard this statement in a C++ context. It is undoubtably true
there. For Java, it might or might not be true. I've heard of people
optimizing their code for Sun's JVM by rewriting it to use exceptions
more heavily (eg for exiting a loop). This is a bad practice, but it
still might happen. In other words, rules like this are rarely
consistent across language or environment.
Still, I think we should just use an explicit null pointer check.
Here are my reasons:
1. Catching NullPointerException might possibly conceal actual bugs in
the security manager.
2. To me the explicit check is perfectly clear and maintainable. The
exception code is a bit less maintainable (for instance I think we'd
have to put a comment in explaining that this is a performance hack,
and we'd have to make sure that all new code is written using this
hack).
3. It isn't clear anyway that absolute maximal performance is required
when doing security manager checks. Has anybody tried to measure
this?
Tom