patch: PSQLException cleanups & exception chaining

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: patch: PSQLException cleanups & exception chaining
Date: 2003-12-02 06:23:21
Message-ID: 20031202062321.GG19205@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

In this patch (gzipped to avoid the message size limit):

- Support for 1.4-style exception chaining to PSQLException
- Various cleanups to PSQLException (ctors, don't override where not necessary)
- Set "vendor code" of PSQLException to the hashcode of the message key
(this is pretty speculative but might be useful to someone for identifying
particular exceptions irregardless of locale?)
- Change parsing of V3 server errors to avoid a trailing newline on the
resulting exception message.

This has been tested on JDK1.4/JDBC3 vs. a 7.3 and 7.4 server. I don't have
the resources to test other combinations but I've kept them in mind while
making the changes.

Note that PSQLException.java is removed entirely by this patch and replaced
by PSQLException.java.in (needed to support the differences in Throwable
between 1.4 and earlier revisions).

With this patch, a PSQLException built under 1.4 will store any nested
exception via initCause() instead of extracting the whole stack trace into
the exception message itself.

Also, nested exceptions are no longer considered arguments for
internationalization of exception messages. I've corrected the English
error.properties but not other translations. It should be pretty harmless
anyway -- some stray unexpanded {0} or {1} markers in the resulting
messages.

-O

Attachment Content-Type Size
psqlexception_cleanups.txt.gz application/octet-stream 6.7 KB

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2003-12-02 06:29:46 patch: improve exception propagation in testcases
Previous Message pginfo 2003-12-02 06:05:32 Re: autocommit trouble with jdbc on Postgres 7.4