Index: src/interfaces/jdbc/org/postgresql/PG_Stream.java =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/PG_Stream.java,v retrieving revision 1.17 diff -c -p -r1.17 PG_Stream.java *** src/interfaces/jdbc/org/postgresql/PG_Stream.java 2002/08/20 04:26:02 1.17 --- src/interfaces/jdbc/org/postgresql/PG_Stream.java 2002/11/19 22:21:33 *************** public class PG_Stream *** 137,143 **** { c = pg_input.read(); if (c < 0) ! throw new PSQLException("postgresql.stream.eof"); } catch (IOException e) { --- 137,143 ---- { c = pg_input.read(); if (c < 0) ! throw new PSQLException("postgresql.stream.eof", "08S01"); } catch (IOException e) { *************** public class PG_Stream *** 164,170 **** int b = pg_input.read(); if (b < 0) ! throw new PSQLException("postgresql.stream.eof"); n = n | (b << (8 * i)) ; } } --- 164,170 ---- int b = pg_input.read(); if (b < 0) ! throw new PSQLException("postgresql.stream.eof", "08S01"); n = n | (b << (8 * i)) ; } } *************** public class PG_Stream *** 193,199 **** int b = pg_input.read(); if (b < 0) ! throw new PSQLException("postgresql.stream.eof"); n = b | (n << 8); } } --- 193,199 ---- int b = pg_input.read(); if (b < 0) ! throw new PSQLException("postgresql.stream.eof", "08S01"); n = b | (n << 8); } } *************** public class PG_Stream *** 227,233 **** { int c = pg_input.read(); if (c < 0) ! throw new PSQLException("postgresql.stream.eof"); else if (c == 0) { rst[s] = 0; --- 227,233 ---- { int c = pg_input.read(); if (c < 0) ! throw new PSQLException("postgresql.stream.eof", "08S01"); else if (c == 0) { rst[s] = 0; *************** public class PG_Stream *** 330,336 **** { int w = pg_input.read(b, off + s, siz - s); if (w < 0) ! throw new PSQLException("postgresql.stream.eof"); s += w; } } --- 330,336 ---- { int w = pg_input.read(b, off + s, siz - s); if (w < 0) ! throw new PSQLException("postgresql.stream.eof", "08S01"); s += w; } } Index: src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java,v retrieving revision 1.17 diff -c -p -r1.17 QueryExecutor.java *** src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java 2002/11/14 05:35:45 1.17 --- src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java 2002/11/19 22:21:33 *************** public class QueryExecutor *** 156,162 **** } catch (IOException e) { ! throw new PSQLException("postgresql.con.ioerror", e); } } --- 156,162 ---- } catch (IOException e) { ! throw new PSQLException("postgresql.con.ioerror", "08S01", e); } } Index: src/interfaces/jdbc/org/postgresql/util/PSQLException.java =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/util/PSQLException.java,v retrieving revision 1.7 diff -c -p -r1.7 PSQLException.java *** src/interfaces/jdbc/org/postgresql/util/PSQLException.java 2001/11/19 22:33:39 1.7 --- src/interfaces/jdbc/org/postgresql/util/PSQLException.java 2002/11/19 22:21:33 *************** public class PSQLException extends SQLEx *** 21,26 **** --- 21,37 ---- } /* + * Like the above, but sets SQLState + * @param error Error string + * @param sqlstate SQLState string + */ + public PSQLException(String error, String sqlstate) + { + super("", sqlstate); + translate(error, null); + } + + /* * A more generic entry point. * @param error Error string or standard message id * @param args Array of arguments *************** public class PSQLException extends SQLEx *** 50,55 **** --- 61,95 ---- public PSQLException(String error, Exception ex) { super(); + + Object[] argv = new Object[1]; + + try + { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + PrintWriter pw = new PrintWriter(baos); + pw.println("Exception: " + ex.toString() + "\nStack Trace:\n"); + ex.printStackTrace(pw); + pw.println("End of Stack Trace"); + pw.flush(); + argv[0] = baos.toString(); + pw.close(); + baos.close(); + } + catch (Exception ioe) + { + argv[0] = ex.toString() + "\nIO Error on stack trace generation! " + ioe.toString(); + } + + translate(error, argv); + } + + /* + * Like the above, but sets the SQLState + */ + public PSQLException(String error, String sqlstate, Exception ex) + { + super("", sqlstate); Object[] argv = new Object[1];