You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-dev@xml.apache.org by Terry Rosenbaum <Te...@amicas.com> on 2002/10/03 15:27:30 UTC

[PATCH] Return null when collection not found per XMLDB API Database contracts

Hi,

The attached patch fixes the various implementations
of the XMLDB Database and Collection interfaces in Xindice.

This bug was reported recently by Gary Shea. I ran across
it my self and as a result spent a couple extra debugging
hours on my app so I decided to fix it.

With the attached patches applied, the following methods
will now return null if the requested Collection does not
exist:

Database.getCollection
Collection.getChildCollection
Collection.getParentCollection

Previously, the beahvior was to return a non-functional
Collection implementation instead of null. The contract
require a null return.

Also, there were several places in the CollectionImpl where
operations were attempted on a closed Collection. Those would
have resulted in NPE rather than an informative exception. I fixed
that problem too.

Fernando, can you please look over these changes and apply them?

Thanks!

-Terry

On Mon, 30 at Sep 2002 20:08:21 -0600 (MDT) Gary Shea wrote:

>I'm working with CVS from a few days ago, trying to figure out how to
>use the xindice-embed stuff.  I have a bit of XML:DB experience, but
>all with eXist.  Thought I'd have a look at xindice, since it has
>supposedly functioning XPathQuery and XUpdate services, which I could
>really use.
>
>I am under the impression that if I have the code (post-registration):
>
>    Collection collection = DatabaseManager.getCollection (
>        "xmldb:xindice-embed:///db/dog"
>    );
>
>and there is no 'dog' collection in /db, then collection will be
>returned null.  The spec says the returned value is "A Collection
>instance for the requested collection or null fi the collection could
>not be found".
>
>As far as I can see there's no way embed.DatabaseImpl.getCollection()
>can ever return null, since it returns "new CollectionImpl (...)".
>
>Am I missing something or is this a bug?  Or did the spec perhaps
>'mature' since the code was originally written?
>
>	Gary




Re: [PATCH] Return null when collection not found per XMLDB API Database contracts

Posted by Terry Rosenbaum <Te...@amicas.com>.
I created bug 13245 in bugzilla for this issue.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13245

-Terry