Re: problem with PSQLException/PSQLState

Lists: pgsql-jdbc
From: Jason Briggs <jason(at)lateralnz(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: problem with PSQLException/PSQLState
Date: 2003-12-03 01:16:14
Message-ID: 3FCD395E.3040403@lateralnz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Just discovered a possible issue with the SQLException thrown by the 7.4
beta3 jdbc driver.

PSQLException used to contain only a message, but now also has a ref to
org.postgresql.util.PSQLState. PSQLState isn't serializable and because
a SQLException is supposed to be serializable, this causes a problem in
situations where you might want to propogate your exceptions across the
wire (i.e. app server to client).

The problem is fixed if you change PSQLState to implement Serializable,
as follows:

[[SNIP

package org.postgresql.util;

import java.io.Serializable;

public class PSQLState implements Serializable
{

]]

J

--
_______________________________________________
Jason Briggs
. Development Manager ... Lateral NZ
. (a division of Lateral Profiles)
. -- Finalist - The TUANZ Mobile Service of the Year 2003
. -- Finalist - The TUANZ Telecommunications Innovation Award 2003
.


From: Kris Jurka <books(at)ejurka(dot)com>
To: Jason Briggs <jason(at)lateralnz(dot)com>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: problem with PSQLException/PSQLState
Date: 2003-12-09 21:45:44
Message-ID: Pine.LNX.4.33.0312091644430.3369-100000@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Wed, 3 Dec 2003, Jason Briggs wrote:

> Just discovered a possible issue with the SQLException thrown by the 7.4
> beta3 jdbc driver.
>
> PSQLException used to contain only a message, but now also has a ref to
> org.postgresql.util.PSQLState. PSQLState isn't serializable and because
> a SQLException is supposed to be serializable, this causes a problem in
> situations where you might want to propogate your exceptions across the
> wire (i.e. app server to client).
>
> The problem is fixed if you change PSQLState to implement Serializable,
> as follows:

Here's a patch to add the change indicated and more importantly a test
case so this won't happen again.

Kris Jurka


From: Kris Jurka <books(at)ejurka(dot)com>
To: Jason Briggs <jason(at)lateralnz(dot)com>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: problem with PSQLException/PSQLState
Date: 2003-12-09 21:56:09
Message-ID: Pine.LNX.4.33.0312091653140.3369-200000@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Tue, 9 Dec 2003, Kris Jurka wrote:

>
>
> On Wed, 3 Dec 2003, Jason Briggs wrote:
>
> > Just discovered a possible issue with the SQLException thrown by the 7.4
> > beta3 jdbc driver.
> >
> > PSQLException used to contain only a message, but now also has a ref to
> > org.postgresql.util.PSQLState. PSQLState isn't serializable and because
> > a SQLException is supposed to be serializable, this causes a problem in
> > situations where you might want to propogate your exceptions across the
> > wire (i.e. app server to client).
> >
> > The problem is fixed if you change PSQLState to implement Serializable,
> > as follows:
>
> Here's a patch to add the change indicated and more importantly a test
> case so this won't happen again.
>

This time with the actual patch.

Kris Jurka

Attachment Content-Type Size
sqle_serialize.patch text/plain 2.4 KB