Re: Bug report: NullPointerException from Driver.connect when passed a Properties with non-string values

From: dmp <danap(at)ttc-cmc(dot)net>
To: Dave Cramer <pg(at)fastcrypt(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Bug report: NullPointerException from Driver.connect when passed a Properties with non-string values
Date: 2013-01-28 21:20:17
Message-ID: 5106EB91.1040107@ttc-cmc.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I understand. Better also thow in:

if (info != null)
{
for (Enumeration e = info.propertyNames(); e.hasMoreElements();)
{
String propName = (String)e.nextElement();
props.setProperty(propName, info.getProperty(propName));
}
}

and Nathaniel's patch. With yours, the above, and Nathaniel's that
should cover everything I think.

danap.

Dave Cramer wrote:
> it irks me to have to do that, as the java api for getProperty suggests
> that you cannot have anything but a string in there, however it's not
> worth fighting for.
>
> Dave
>
> Dave Cramer
>
> dave.cramer(at)credativ(dot)ca
> http://www.credativ.ca
>
>
> On Mon, Jan 28, 2013 at 4:03 PM, dmp <danap(at)ttc-cmc(dot)net
> <mailto:danap(at)ttc-cmc(dot)net>> wrote:
>
> I think that is what threw me. You are still going to need to
> have Nathaniel's patch in case someone does try to throw in a bogus
> properties that ends up null even thought the url is correct.
>
> danap.
>
>
> Kevin Grittner wrote:
>
> Dave Cramer<pg(at)fastcrypt(dot)com <mailto:pg(at)fastcrypt(dot)com>> wrote:
>
> My proposed patch is this
>
>
> if (url.startsWith("jdbc:__postgresql:")) {
> return null;
> }
>
> Right at the top of getConnection, before we do any real work.
>
>
> Thoughts ?
>
>
> Shouldn't that have a bang to reverse the logic?
>
> -Kevin
> -
> Sent via pgsql-jdbc mailing list (pgsql-jdbc(at)postgresql(dot)org
> <mailto:pgsql-jdbc(at)postgresql(dot)org>)
> To make changes to your subscription:
> http://www.postgresql.org/__mailpref/pgsql-jdbc
> <http://www.postgresql.org/mailpref/pgsql-jdbc>
>
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2013-01-28 21:55:08 Re: Bug report: NullPointerException from Driver.connect when passed a Properties with non-string values
Previous Message Nathaniel Waisbrot 2013-01-28 21:18:41 Re: Bug report: NullPointerException from Driver.connect when passed a Properties with non-string values