Re: Integer is not a subclass of Short - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: Integer is not a subclass of Short
Date
Msg-id alpine.BSO.2.00.1007291947300.10995@leary.csoft.net
Whole thread Raw
In response to Integer is not a subclass of Short  (Lloyd Parkes <Lloyd.Parkes@ecs.vuw.ac.nz>)
Responses Re: Integer is not a subclass of Short  (Kris Jurka <books@ejurka.com>)
List pgsql-jdbc

On Fri, 30 Jul 2010, Lloyd Parkes wrote:

> I have found a problem with a discrepancy between getColumnClassName()
> in jdbc/pgjdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java
> and internalGetObject() in
> jdbc/pgjdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java.
>
> The former is defined (indirectly) to return the fully qualified class
> name of (a possible superclass of) the object returned by the latter.
> For a smallint column, the former returns "java.lang.Short", but the
> latter returns a java.lang.Integer. Short is neither Integer, nor a
> superclass of Integer.

According to my attached testcase getColumnClassName does return Integer.

> I guess someone should add the line "return new
> Short(getShort(columnIndex));" between lines 123 and 124 of rev 1.108 of
> AbstractJdbc2ResultSet.java. There may be a similar problem with tinyint
> columns, but I don't have any tinyint columns.

The spec requires the return type for smallint to be Integer.  See table
B-3 of the JDBC4 spec.

Kris Jurka

pgsql-jdbc by date:

Previous
From: Lloyd Parkes
Date:
Subject: Integer is not a subclass of Short
Next
From: Kris Jurka
Date:
Subject: Re: Integer is not a subclass of Short