Re: Patch for some bugs/annoyances

Lists: pgsql-jdbc
From: Patrick Higgins <phiggins(at)transzap(dot)com>
To: PostgreSQL JDBC <pgsql-jdbc(at)postgresql(dot)org>
Subject: Patch for some bugs/annoyances
Date: 2003-12-11 20:17:03
Message-ID: 1071173821.24112.31.camel@phiggins.transzap.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Here's a patch fixing a bug in throwing a PSQLException which causes
helpful information to not be displayed. The code is clearly trying to
call the PSQLException(String, PSQLState, Object[]) constructor, but
instead gets the PSQLException(String, Object) constructor because it
forgets the PSQLState.

This first bug may have been causing the second; I can't remember
anymore. Anyway, sometimes this.state in PSQLException is null causing
getSQLState() to throw a NullPointerException. I've included a check for
this and return the string "null" when the state is null.

Finally, I've changed PSQLState to implement Serializable so that I can
throw SQLExceptions to remote callers.

Attachment Content-Type Size
jdbc.patch text/x-patch 1.9 KB

From: Kris Jurka <books(at)ejurka(dot)com>
To: Patrick Higgins <phiggins(at)transzap(dot)com>
Cc: PostgreSQL JDBC <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Patch for some bugs/annoyances
Date: 2003-12-11 21:32:06
Message-ID: Pine.LNX.4.33.0312111627520.16693-100000@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Thu, 11 Dec 2003, Patrick Higgins wrote:

> This first bug may have been causing the second; I can't remember
> anymore. Anyway, sometimes this.state in PSQLException is null causing
> getSQLState() to throw a NullPointerException. I've included a check for
> this and return the string "null" when the state is null.
>

I don't think returning "null" is correct. I think
PSQLState.UNKNOWN_STATE should be used as the state when it is null.

Kris Jurka


From: Patrick Higgins <phiggins(at)transzap(dot)com>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: PostgreSQL JDBC <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Patch for some bugs/annoyances
Date: 2003-12-11 22:41:33
Message-ID: 1071182492.24112.46.camel@phiggins.transzap.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Thu, 2003-12-11 at 14:32, Kris Jurka wrote:
> On Thu, 11 Dec 2003, Patrick Higgins wrote:
>
> > This first bug may have been causing the second; I can't remember
> > anymore. Anyway, sometimes this.state in PSQLException is null causing
> > getSQLState() to throw a NullPointerException. I've included a check for
> > this and return the string "null" when the state is null.
> >
>
> I don't think returning "null" is correct. I think
> PSQLState.UNKNOWN_STATE should be used as the state when it is null.

That sounds like a much better idea. I only used "null" because I didn't
know better.


From: Kris Jurka <books(at)ejurka(dot)com>
To: Patrick Higgins <phiggins(at)transzap(dot)com>
Cc: PostgreSQL JDBC <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Patch for some bugs/annoyances
Date: 2003-12-12 01:45:18
Message-ID: Pine.LNX.4.33.0312112044080.25411-200000@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Thu, 11 Dec 2003, Patrick Higgins wrote:

> On Thu, 2003-12-11 at 14:32, Kris Jurka wrote:
> > On Thu, 11 Dec 2003, Patrick Higgins wrote:
> >
> > > This first bug may have been causing the second; I can't remember
> > > anymore. Anyway, sometimes this.state in PSQLException is null causing
> > > getSQLState() to throw a NullPointerException. I've included a check for
> > > this and return the string "null" when the state is null.
> > >
> >
> > I don't think returning "null" is correct. I think
> > PSQLState.UNKNOWN_STATE should be used as the state when it is null.
>
> That sounds like a much better idea. I only used "null" because I didn't
> know better.
>

Here's a patch to that effect. Also the Serializable part has already
been addressed.

Kris Jurka

Attachment Content-Type Size
missingsqlstate.patch text/plain 2.3 KB