From: | Barry Lind <blind(at)xythos(dot)com> |
---|---|
To: | Oliver Jowett <oliver(at)opencloud(dot)com> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: patch: clean up exception formatting |
Date: | 2003-08-11 21:19:03 |
Message-ID: | 3F380847.3090600@xythos.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Patch applied.
--Barry
Oliver Jowett wrote:
> The attached patch (against CVS HEAD) cleans up exception messages in two
> areas:
>
> 1. Remove PSQLException's override of toString() so that the exception
> classname is included in the output of toString() (i.e. the default
> Throwable behaviour). Previously a .toString() on a PSQLException produces
> something like:
>
> "Parameter index out of range."
>
> With this patch you get the consistent-with-everything-else result:
>
> "org.postgresql.util.PSQLException: Parameter index out of range."
>
> 2. Strip whitespace from backend-generated errors when using them as an
> exception message. Previously, you'd get tracebacks with odd blank lines:
>
> java.sql.SQLException: ERROR: parser: parse error at or near "null" at character 27
>
> at org.postgresql.core.QueryExecutor.executeV2(QueryExecutor.java:286)
> at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:104)
>
> With this patch you get the expected form:
>
> java.sql.SQLException: ERROR: parser: parse error at or near "null" at character 27
> at org.postgresql.core.QueryExecutor.executeV2(QueryExecutor.java:286)
> at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:104)
>
> -O
>
>
> ------------------------------------------------------------------------
>
> 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.11
> diff -c -r1.11 PSQLException.java
> *** src/interfaces/jdbc/org/postgresql/util/PSQLException.java 14 Mar 2003 01:21:47 -0000 1.11
> --- src/interfaces/jdbc/org/postgresql/util/PSQLException.java 20 Jul 2003 04:29:16 -0000
> ***************
> *** 127,138 ****
> {
> return message;
> }
> -
> - /*
> - * Overides Object
> - */
> - public String toString()
> - {
> - return message != null ? message : "";
> - }
> }
> --- 127,130 ----
> 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.22
> diff -c -r1.22 QueryExecutor.java
> *** src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java 29 May 2003 03:21:32 -0000 1.22
> --- src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java 20 Jul 2003 04:29:16 -0000
> ***************
> *** 192,198 ****
>
> // did we get an error during this query?
> if ( errorMessage != null )
> ! throw new SQLException( errorMessage.toString() );
>
>
> //if an existing result set was passed in reuse it, else
> --- 192,198 ----
>
> // did we get an error during this query?
> if ( errorMessage != null )
> ! throw new SQLException( errorMessage.toString().trim() );
>
>
> //if an existing result set was passed in reuse it, else
> ***************
> *** 283,289 ****
>
> // did we get an error during this query?
> if ( errorMessage != null )
> ! throw new SQLException( errorMessage.toString() );
>
>
> //if an existing result set was passed in reuse it, else
> --- 283,289 ----
>
> // did we get an error during this query?
> if ( errorMessage != null )
> ! throw new SQLException( errorMessage.toString().trim() );
>
>
> //if an existing result set was passed in reuse it, else
>
>
> ------------------------------------------------------------------------
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
From | Date | Subject | |
---|---|---|---|
Next Message | Barry Lind | 2003-08-11 21:21:06 | Re: patch: fix skeleton code in test README |
Previous Message | Barry Lind | 2003-08-11 21:12:32 | Re: patch: tiny patch to correct stringbuffer size estimate |