db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@debrunners.com>
Subject Re: [jira] Commented: (DERBY-95) NPE when passing in url instead of database name to EmbeddedXADataSource
Date Fri, 07 Jan 2005 14:23:05 GMT
Hash: SHA1

Shreyas Kaushik (JIRA) wrote:

>      [
http://issues.apache.org/jira/browse/DERBY-95?page=comments#action_57371 ]
> Shreyas Kaushik commented on DERBY-95:
> --------------------------------------
> The EmbeddedXADataSource.getConnection() does not return null, the
call to this methods throws a NPE because the
EmbeddedDriver.getConnection() returns null and an attempt is made to
close the connection assuming that it will not return a null.

I was basing my comments on your first comment in Derby-95 that says the
EmbeddedXADataSource.getConnection() is returning null and the NPE
happens when the getConnection().close() is executed.
[by EmbeddedXADataSource.getConnection(), I mean the getConnection()
method that EmbeddedXADataSource inherits.]

Is this not the case?

> Here an NPE needs to be caught becuase the
EmbeddedDriver.getConnection can return null when
>   1) A database does not exist ( Url is valid

Is this true? I thought an exception was thrown if the database could
not be found.

>   2) The Url is invalid ( which is the case here )
>  After this NPE is caught we need to throw a SQLException saying that
the DB doesn't exist.
>  I hope everyone is ok with this approach, please comment and kindly
vote for the suggested fix.

In general code in Derby does not catch NPEs, but avoids them with
checks to see a reference is null before using it.

Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


View raw message