A null is also liable to cause problems in IIOP based containers

On Fri, 16 Feb 2001, Gene Chuang wrote:

> Return an empty collection;  save the caller the hassle of
> NullPointerExceptions!
>
> Gene
>
> -----Original Message-----
> From: A mailing list for Enterprise JavaBeans development
> [mailto:[EMAIL PROTECTED]]On Behalf Of Wong Kok Wai
> Sent: Friday, February 16, 2001 2:10 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Null or empty collection
>
>
> The JavaDoc for ObjectNotFoundException put it as:
>
> <quote>
> This exception should not be thrown by
> finder methods that return a collection of EJB objects (they should return a
> null
> collection instead).
> </quote>
>
> Let me rephrase my original question: is there a difference between a null
> collection and an empty collection? To me, they mean different things.
>
> Dan Christopherson wrote:
>
> > You don't throw ObjectNotFoundException in this case: it's documentation
> > just included a red herring on the real issue.
> >
> > >From the 1.1 spec, section 9.1.9.4:
> > "Only single-object finders (see Subsection 9.1.8) should throw this
> > exception. Multi-object finders must not throw this exception.
> > Multi-object finders should return an empty collection as an indication
> > that no matching objects were found."
> >
> > On Fri, 16 Feb 2001, Tim Endres wrote:
> >
> > > Maybe I do not understand the question, but if you are throwing an
> > > ObjectNotFoundException, isn't the returned value meaningless?
> > >
> > > tim.
> > >
> > > > I'm a bit confused what should be returned by finders that return
> > > > multiple objects. In the EJB 1.1 specs, it is stated an empty
> collection
> > > > should be returned. However, in the JavaDocs for
> > > > ObjectNotFoundException, it is stated a null collection should be
> > > > returned. My understanding is null collection is null, and an empty
> > > > collection is a collection with zero elements. So which should I
> return
> > > > (I prefer the empty collection approach, as it simplifies both the
> bean
> > > > and client implementations)?
> > > >
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>

--
Dan Christopherson (danch)
nVisia Technical Architect (www.nvisia.com)

Opinions expressed are mine and do not neccessarily reflect any
position or opinion of nVISIA.

---------------------------------------------------------------------------
If you're a capitalist and you have the best goods and they're
free, you don't have to proselytize, you just have to wait.
-Eben Moglen

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to