-----BEGIN PGP SIGNED MESSAGE----- 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. Dan. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD4DBQFB3ptJIv0S4qsbfuQRAoYPAJjgw0KtpMyE8Nj6Y6EgBmEujCJKAKDf6tpD 4yFQybYzB6PBc8L7TUAClQ== =NwGv -----END PGP SIGNATURE-----
