Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 58341 invoked from network); 19 Jan 2005 19:18:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 19 Jan 2005 19:18:48 -0000 Received: (qmail 40643 invoked by uid 500); 19 Jan 2005 19:18:37 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 40587 invoked by uid 500); 19 Jan 2005 19:18:37 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: List-Id: Reply-To: "Derby Development" Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 40528 invoked by uid 99); 19 Jan 2005 19:18:36 -0000 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from e34.co.us.ibm.com (HELO e34.co.us.ibm.com) (32.97.110.132) by apache.org (qpsmtpd/0.28) with ESMTP; Wed, 19 Jan 2005 11:18:35 -0800 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e34.co.us.ibm.com (8.12.10/8.12.9) with ESMTP id j0JJIWaQ492964 for ; Wed, 19 Jan 2005 14:18:32 -0500 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay04.boulder.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id j0JJIWjI295384 for ; Wed, 19 Jan 2005 12:18:32 -0700 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.12.11/8.12.11) with ESMTP id j0JJIWlf004538 for ; Wed, 19 Jan 2005 12:18:32 -0700 Received: from debrunners.com (dyn9-72-133-60.usca.ibm.com [9.72.133.60] (may be forged)) by d03av04.boulder.ibm.com (8.12.11/8.12.11) with ESMTP id j0JJIVuZ004521 for ; Wed, 19 Jan 2005 12:18:32 -0700 Message-ID: <41EEB267.1070804@debrunners.com> Date: Wed, 19 Jan 2005 11:17:59 -0800 From: Daniel John Debrunner User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4.1) Gecko/20031008 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Derby Development Subject: Re: [jira] Commented: (DERBY-95) NPE when passing in url instead of database name to EmbeddedXADataSource References: <1688777574.1105615579485.JavaMail.jira@ajax.apache.org> <41EB75A9.2070302@Sun.com> <41EC827C.1000805@Golux.Com> In-Reply-To: <41EC827C.1000805@Golux.Com> X-Enigmail-Version: 0.76.8.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 myrna wrote: > It does no longer throw an NPE, and it passes all tests.... > > Could we leave EmbeddedDataSource alone & only change > EmbeddedXADataSource? Only with the xa datasource did we get a NPE... > Although strictly speaking, it should behave the same, so, with > EmbeddedDataSource too, we should accept the databasename only, it's > been able to resolve the url fine. I'd be apprehensive about any > possible cloudscape customers that have mistakenly used this > functionality... I agree with Shreyas that his patch is logically correct but I want to ensure that your concerns are addressed. Can you be explicit about what you believe the patch breaks for existing users of Derby. I tried this and it results in a NullPointerException if the return from getConnection() is referenced, e.g. in the conn.close() here. (this is before the patch is applied) org.apache.derby.jdbc.EmbeddedDataSource ds = new org.apache.derby.jdbc.EmbeddedDataSource(); ds.setDatabaseName("jdbc:derby:fred"); Connection conn = ds.getConnection(); // NPE here because conn is null conn.close(); The only issue I have with the patch is that the error thrown is misleading, "Database Not Available" implies to the user or application developer that they need to do something to make the database available. A database not found exception with the name obtained from DataSource.getDatabaseName() might make more sense. Or maybe even better, invalid property setting error, since databaseName is a Java Bean property of the datasource. E.g. SQLState.PROPERTY_INVALID_VALUE, resulting in an error like Invalid value for property 'databaseName'='jdbc:derby:fred'. Thanks, Dan. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFB7rJnIv0S4qsbfuQRApTGAKDj+MxB4kOY/GNFCMs/9R5Js3zK2wCgqYSm DrAWFRgPOfwMHin0vUwGi70= =zL6e -----END PGP SIGNATURE-----