Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1X2Qqk-0007lM-33 for pgsql-jdbc@arkaria.postgresql.org; Wed, 02 Jul 2014 20:09:50 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1X2Qqj-0007wp-FB for pgsql-jdbc@arkaria.postgresql.org; Wed, 02 Jul 2014 20:09:49 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1X2Qqi-0007wi-7D for pgsql-jdbc@postgresql.org; Wed, 02 Jul 2014 20:09:48 +0000 Received: from mail-pd0-x232.google.com ([2607:f8b0:400e:c02::232]) by makus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1X2Qqf-0003kM-7j for pgsql-jdbc@postgresql.org; Wed, 02 Jul 2014 20:09:46 +0000 Received: by mail-pd0-f178.google.com with SMTP id r10so12477729pdi.23 for ; Wed, 02 Jul 2014 13:09:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; bh=VoHjCuVBovJulqZ5CHCWUq3275s0P9om8wXvNWhByeQ=; b=QBEJ98mvVt+hpMqffYcHqGm2cUEiu96fFZWXfrf0N+9SylUFj6uLE91iIXvRq+VAhN mmmQ+6G2t6d6/vCsxd7ebl7FsONEXCVSIR/O1nao7Mxxb276hste16DVtxUZlm0crPTJ c5jkN2e4kQKeIomPB85coH6DktmqOtOuFf+ws98qVS1DSpFYPQ8/yGx0Do55oAzsM441 TZubWpTqQxDL3RncegVbP5AZkiMSnaZmXLUtbvx10R+e8P6tGsZwnao76OZhAEsARF+Q EGZv6+zaXkCridkVrSg6e0yfSSYc+R7iE4pa8YokOX2amBHV/M65LgQZcZ3xg6Z/r3g/ J6Zg== X-Received: by 10.70.109.169 with SMTP id ht9mr1706356pdb.106.1404331783603; Wed, 02 Jul 2014 13:09:43 -0700 (PDT) Received: from [10.0.252.181] ([64.125.71.142]) by mx.google.com with ESMTPSA id vn5sm31216127pbc.18.2014.07.02.13.09.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 02 Jul 2014 13:09:42 -0700 (PDT) Message-ID: <53B46704.7060805@gmail.com> Date: Wed, 02 Jul 2014 13:09:40 -0700 From: Elizabeth Chatman User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: NullPointerException in AbstractJdbc2DatabaseMetaData.getUDTs Content-Type: multipart/mixed; boundary="------------070004070705050304050207" X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org This is a multi-part message in MIME format. --------------070004070705050304050207 Content-Type: multipart/alternative; boundary="------------070301010802030401000705" --------------070301010802030401000705 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------070301010802030401000705 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 --------------070301010802030401000705-- --------------070004070705050304050207 Content-Type: text/x-java; name="TestGetUDTs.java" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="TestGetUDTs.java" import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; /** * @author echatman */ public class TestGetUDTs { private static final String HOST = "localhost"; private static final int PORT = 5432; private static final String DBNAME = "test"; private static final String USERNAME = "postgres"; private static final String PASSWORD = ""; private static final String URL = "jdbc:postgresql://"+HOST+":"+PORT+"/"+DBNAME; public static void main(String[] args) throws Exception { for(int i = 0; i < 10; i++) { System.out.println(i); Connection connection = DriverManager.getConnection(URL, USERNAME, PASSWORD); Statement stmt = connection.createStatement(); stmt.executeUpdate("CREATE TEMPORARY TABLE temp_"+i+" ();"); stmt.close(); connection.close(); connection = DriverManager.getConnection(URL, USERNAME, PASSWORD); connection.getMetaData().getTypeInfo(); connection.getMetaData().getUDTs(null, "information_schema", "%", null); connection.close(); } } } --------------070004070705050304050207 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc --------------070004070705050304050207--