Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 77130 invoked from network); 19 Jan 2005 19:44:08 -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:44:08 -0000 Received: (qmail 18564 invoked by uid 500); 19 Jan 2005 19:44:07 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 18536 invoked by uid 500); 19 Jan 2005 19:44:07 -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 18523 invoked by uid 99); 19 Jan 2005 19:44:07 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from i.meepzor.com (HELO Boron.MeepZor.Com) (204.146.167.214) by apache.org (qpsmtpd/0.28) with ESMTP; Wed, 19 Jan 2005 11:44:05 -0800 Received: from [9.72.133.75] (dmz-firewall [206.199.198.4]) by Boron.MeepZor.Com (8.12.8/8.12.8) with ESMTP id j0JJi3wE029423 for ; Wed, 19 Jan 2005 14:44:04 -0500 Message-ID: <41EEB836.60506@Golux.Com> Date: Wed, 19 Jan 2005 11:42:46 -0800 From: myrna User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.1) Gecko/20040707 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> <41EEB267.1070804@debrunners.com> In-Reply-To: <41EEB267.1070804@debrunners.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Daniel John Debrunner wrote: >-----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----- > > > I see your point. My initial test case was overly simplistic - never actually did anything with the connection. Myrna