Call me crazy, but I can see how this may be useful.

NullPointerException on its own subclasses RuntimeException. This means
that you are not required to "catch" runtime exceptions or declare them
with a "throws" clause of a method.

But there are times where having an object be null may have a meaning other
than a bug in the code - for example you may read from some third-party
library that returns a null object as a valid response. If that happens,
you may need to catch it or declare it in a throws clause.
NullPointerException won't enforce this becaue it subclasses
RuntimeException.

The problem I would have is that it is not named after a recognizable
business event - it should be named as an application exception that
describes what caused it. Something like: NoDataAvailableException or
whatever describes the actual problem.

On the other hand, this person could just be an idiot - who am I to say? :
->

Kevin







"David Graham" <[EMAIL PROTECTED]> on 11/21/2002 09:44:44 AM

Please respond to "Struts Users Mailing List"
       <[EMAIL PROTECTED]>

To:    [EMAIL PROTECTED]
cc:     (bcc: Kevin Bedell/Systems/USHO/SunLife)
Subject:    Re: [OT] How to tell when a project you are on is in trouble


I like how it extends Exception which forces you to catch it.  It seems
like
java has this already...maybe NullPointerException?  At least that's a
RuntimeException.  Can you imagine having to catch all of the situations an
object might be null?  Tell your friend I'm sorry for him :-).

David






>From: Jeff Caddel <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: [OT] How to tell when a project you are on is in trouble
>Date: Wed, 20 Nov 2002 22:32:24 -0700
>
>The "architect" of the project a friend of mine is on just unleashed this
>beauty into the source tree, thought ya'll might get a kick out of it:
>
>/**
>* NullObjectException
>*
>* Copyright © 2001,2002 ###### Corp.  All rights reserved.
>* This exception is used if the object must not be null and it is
>*
>* @author #### #########
>*/
>public class NullObjectException extends Exception {
>    // Doesn't have to do anything
>}
>
>Note how neatly this disables nested exception handling!!!  Pretty nice
>eh??
>
>----
>Jeff Caddel
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>


_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus


--
To unsubscribe, e-mail:   <
mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <
mailto:[EMAIL PROTECTED]>







---------------------------------------------------------------------------
This e-mail message (including attachments, if any) is intended for the use
of the individual or entity to which it is addressed and may contain
information that is privileged, proprietary , confidential and exempt from
disclosure.  If you are not the intended recipient, you are notified that
any dissemination, distribution or copying of this communication is
strictly prohibited.  If you have received this communication in error,
please notify the sender and erase this e-mail message immediately.
---------------------------------------------------------------------------



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to