[ 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.

Here an NPE needs to be caught becuase the EmbeddedDriver.getConnection can 
return null when

  1) A database does not exist ( Url is valid )
  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.

> NPE when passing in url instead of database name to EmbeddedXADataSource
> ------------------------------------------------------------------------
>
>          Key: DERBY-95
>          URL: http://issues.apache.org/jira/browse/DERBY-95
>      Project: Derby
>         Type: Bug
>   Components: JDBC
>     Reporter: Myrna van Lunteren
>     Priority: Minor
>      Fix For: 10.0.2.1

>
> When passing in a url (e.g. jdbc:derby:mydb) instead of just the database 
> name (e.g. mydb) the XADataSource gives a NullPointerException.
> It should either handle this a little more gracefully & give an error, or 
> accept the url (like EmbeddedDataSource does).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira

Reply via email to