Thread: patch to avoid a NullPointerException

patch to avoid a NullPointerException

From
Derrick Hudson
Date:
I have observed a NullPointerException raised in PGobject.equals().
The attached patch checks for a null value and avoids raising an
exception.

I am working with an application which makes extensive use of
user-defined types, particularly enums, and also uses EclipseLink.  I
found it necessary to create EclipseLink converters to convert from
the Java representation of the user-defined types to a PGobject so
that PgJDBC sends the correct type information to the PostgreSQL
server.  It appears to be necessary to create an PGobject instance
with the correct type label and a null value in order to store a NULL
in a column with a user-defined type.  However, this results in a
NullPointerException when EclipseLink tests the two PGobject instances
for equality.

-Derrick


Attachment

Re: patch to avoid a NullPointerException

From
Dave Cramer
Date:
Derrick,

Thanks, applied

Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca


On Sat, Feb 16, 2013 at 12:15 AM, Derrick Hudson <dsh@dman13.dyndns.org> wrote:
I have observed a NullPointerException raised in PGobject.equals().
The attached patch checks for a null value and avoids raising an
exception.

I am working with an application which makes extensive use of
user-defined types, particularly enums, and also uses EclipseLink.  I
found it necessary to create EclipseLink converters to convert from
the Java representation of the user-defined types to a PGobject so
that PgJDBC sends the correct type information to the PostgreSQL
server.  It appears to be necessary to create an PGobject instance
with the correct type label and a null value in order to store a NULL
in a column with a user-defined type.  However, this results in a
NullPointerException when EclipseLink tests the two PGobject instances
for equality.

-Derrick



--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc


Re: patch to avoid a NullPointerException

From
Kris Jurka
Date:

On Wed, 20 Feb 2013, Dave Cramer wrote:

> Derrick,
> Thanks, applied
>

Shouldn't this be backpatched to all stable branches?

Kris Jurka



Re: patch to avoid a NullPointerException

From
Dave Cramer
Date:
Ya, I would think so too. I'm just trying to knock what I can in my limited available time.



Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca


On Wed, Feb 20, 2013 at 2:36 PM, Kris Jurka <books@ejurka.com> wrote:


On Wed, 20 Feb 2013, Dave Cramer wrote:

> Derrick,
> Thanks, applied
>

Shouldn't this be backpatched to all stable branches?

Kris Jurka


Re: patch to avoid a NullPointerException

From
Kris Jurka
Date:

On Wed, 20 Feb 2013, Dave Cramer wrote:

> Ya, I would think so too. I'm just trying to knock what I can in my limited
> available time.
>

I have backpatched this to all relevant versions.

Kris Jurka