From: Elizabeth Chatman <elizabeth.a.chatman@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: NullPointerException in AbstractJdbc2DatabaseMetaData.getUDTs
Date: Wed, 02 Jul 2014 14:03:51 -0700
Message-ID: <53B473B7.2020803@gmail.com> (raw)
In-Reply-To: <53B46704.7060805@gmail.com>
References: <53B46704.7060805@gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>
Proposed patch attached, to avoid adding null keys to the cache.
- Elizabeth Chatman
On 07/02/2014 01:09 PM, Elizabeth Chatman wrote:
> I am encountering an intermittent NullPointerException when I call
> connection.getMetaData().getUDTs(). I traced it to a null key in
> TypeInfoCache._pgNameToSQLType, inserted by a previous call to
> connection.getMetaData().getTypeInfo(), as a result of a lingering
> temporary table.
>
> I attached a basic reproducer. For me it usually fails on the second
> or third time through the loop.
>
> I am using the latest driver (9.3-1101-jdbc41), and I get the same
> results running against 9.2 and 9.3 servers.
>
> - Elizabeth Chatman
--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbcAttachments:TypeInfoCache.patch (text/x-patch, 508B) downloaddiff --git a/org/postgresql/jdbc2/TypeInfoCache.java b/org/postgresql/jdbc2/TypeInfoCache.javaindex 59a44c5..be5a012 100644--- a/org/postgresql/jdbc2/TypeInfoCache.java+++ b/org/postgresql/jdbc2/TypeInfoCache.java@@ -241,7 +241,9 @@ public class TypeInfoCache implements TypeInfo {
}
rs.close();
- _pgNameToSQLType.put(pgTypeName, type);+ if(pgTypeName != null) {+ _pgNameToSQLType.put(pgTypeName, type);+ }
return type.intValue();
}
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: elizabeth.a.chatman@gmail.com
Subject: Re: NullPointerException in AbstractJdbc2DatabaseMetaData.getUDTs
In-Reply-To: <53B473B7.2020803@gmail.com>
References: <53B46704.7060805@gmail.com> <53B473B7.2020803@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox