From 2442e79e3276a6c4f29e5a415858c7a487ec18b2 Mon Sep 17 00:00:00 2001 From: Barry Lind Date: Wed, 27 Mar 2002 05:33:27 +0000 Subject: [PATCH] applied patch from Liam Stewart fixing a message in the properties file also fixed a NPE when calling the next() method on a result set after the connection or resultset has been closed. (bug reported by Hans Deragon) --- src/interfaces/jdbc/org/postgresql/errors.properties | 9 +++++---- src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java | 3 +++ src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java | 3 +++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/interfaces/jdbc/org/postgresql/errors.properties b/src/interfaces/jdbc/org/postgresql/errors.properties index 7c5b32eb3f..eebe2d7d86 100644 --- a/src/interfaces/jdbc/org/postgresql/errors.properties +++ b/src/interfaces/jdbc/org/postgresql/errors.properties @@ -3,7 +3,7 @@ postgresql.arr.range:The array index is out of range. postgresql.drv.version:An internal error has occured. Please recompile the driver. postgresql.con.auth:The authentication type {0} is not supported. Check that you have configured the pg_hba.conf file to include the client's IP address or Subnet, and that it is using an authentication scheme supported by the driver. postgresql.con.authfail:An error occured while getting the authentication request. -postgresql.con.backend:Backend start-up failed: {0}. +postgresql.con.backend:Backend start-up failed: {0} postgresql.con.call:Callable Statements are not supported at this time. postgresql.con.creobj:Failed to create object for {0} {1} postgresql.con.failed:The connection attempt failed because {0} @@ -38,12 +38,12 @@ postgresql.geo.point:Conversion of point failed - {0} postgresql.jvm.version:The postgresql.jar file does not contain the correct JDBC classes for this JVM. Try rebuilding. If that fails, try forcing the version supplying it to the command line using the argument -Djava.version=1.1 or -Djava.version=1.2\nException thrown was {0} postgresql.lo.init:failed to initialise LargeObject API postgresql.metadata.unavailable:Metadata unavailable. -postgresql.money:conversion of money failed - {0}. +postgresql.money:conversion of money failed - {0} postgresql.noupdate:This ResultSet is not updateable. postgresql.notsensitive:This ResultSet is not sensitive to realtime updates after the query has run. postgresql.psqlnotimp:The backend currently does not support this feature. postgresql.prep.is:InputStream as parameter not supported -postgresql.prep.param:No value specified for parameter {0}. +postgresql.prep.param:No value specified for parameter {0} postgresql.prep.range:Parameter index out of range. postgresql.prep.type:Unknown Types value. postgresql.res.badbigdec:Bad BigDecimal {0} @@ -56,12 +56,13 @@ postgresql.res.badlong:Bad Long {0} postgresql.res.badshort:Bad Short {0} postgresql.res.badtime:Bad Time {0} postgresql.res.badtimestamp:Bad Timestamp Format at {0} in {1} +postgresql.res.closed:Result set is closed. Operation is not permitted. postgresql.res.colname:The column name {0} not found. postgresql.res.colrange:The column index is out of range. postgresql.res.nextrequired:Result set not positioned properly, perhaps you need to call next(). postgresql.serial.interface:You cannot serialize an interface. postgresql.serial.namelength:Class & Package name length cannot be longer than 32 characters. {0} is {1} characters. -postgresql.serial.noclass:No class found for {0}. +postgresql.serial.noclass:No class found for {0} postgresql.serial.table:The table for {0} is not in the database. Contact the DBA, as the database is in an inconsistent state. postgresql.serial.underscore:Class names may not have _ in them. You supplied {0}. postgresql.stat.batch.error:Batch entry {0} {1} was aborted. diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java b/src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java index 02a5195b95..84a7dc3f9f 100644 --- a/src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java +++ b/src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java @@ -106,6 +106,9 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu */ public boolean next() throws SQLException { + if (rows == null) + throw new PSQLException("postgresql.con.closed"); + if (++current_row >= rows.size()) return false; this_row = (byte [][])rows.elementAt(current_row); diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java b/src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java index d9e37035ee..20c68016ca 100644 --- a/src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java +++ b/src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java @@ -110,6 +110,9 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu */ public boolean next() throws SQLException { + if (rows == null) + throw new PSQLException("postgresql.con.closed"); + if (++current_row >= rows.size()) return false; this_row = (byte [][])rows.elementAt(current_row); -- 2.40.0