From: | Jered Floyd <jered(at)permabit(dot)com> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Cc: | dev-server(at)permabit(dot)com |
Subject: | JDBC driver throws unfriendly exceptions |
Date: | 2001-02-07 08:13:49 |
Message-ID: | 87wvb2syf6.fsf@irregular-apocalypse.permabit.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================
Your name : Jered Floyd
Your email address : jered(at)permabit(dot)com
System Configuration
---------------------
Architecture (example: Intel Pentium) : x86
Operating System (example: Linux 2.0.26 ELF) : Linux 2.2.17
PostgreSQL version (example: PostgreSQL-7.0): PostgreSQL-7.0.3
Compiler used (example: gcc 2.8.0) : gcc 2.95.2
Please enter a FULL description of your problem:
------------------------------------------------
While using the JDBC driver:
Attempting to access data from a ResultSet (with getXXX(), etc.) before
calling ResultSet.next() causes a NullPointerException to be thrown at
the deference of this_row[] at ResultSet.java:164.
Yes, I'm a bonehead for trying to access the row data before calling
next(), but this isn't the ideal thing to have happen. The driver should
catch this case (by checking this_row[] or catching the exception) and
throw something more descriptive.
Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------
After construcing a PreparedStatement ps:
int i;
ResultSet rs = ps.executeQuery();
if (rs != null)
i = getInt(1);
If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------
As I mention above, the driver should catch this case and throw a more
descriptive exception. It's inappropriate and un-neighborly to go
around throwing exceptions like NullPointerException or
ArrayIndexOutOfBoundsException.
I think (hope) the JDBC driver is a moving target, so I'll take a look
at this issue when I move over to using 7.1beta (after I've beaten 7.0
into submission.)
From | Date | Subject | |
---|---|---|---|
Next Message | Jered Floyd | 2001-02-07 08:15:06 | JDBC driver doesn't allow access to BYTEA types via get/setBytes() |
Previous Message | Nat Howard | 2001-02-07 05:19:58 | 7.1beta4 jdbc problem on freebsd 4.2 with JSDK 1.1.8. |