[ 
http://issues.apache.org/jira/browse/DERBY-1438?page=comments#action_12422421 ] 
            
Knut Anders Hatlen commented on DERBY-1438:
-------------------------------------------

David wrote:

> We can't override the toString() method on the network client, as
> what's being returned to users is a vanilla java.sql.SQLException
> (or one of its subclasses in JDBC4).  So it's going to do the
> default behavior and there's nothing we can do about it.

Actually, there is something we can do. The spec doesn't say that we
can't create subclasses of the provided exception classes, so we can
override the toString() method.

I tried this code

    throw new SQLFeatureNotSupportedException("some error message") {
        public String toString() {
            return "SQLException: " + getMessage();
        }
    };

and it printed this message

  SQLException: some error message

not

  java.sql.SQLFeatureNotSupportedException: some error message

> Text written by SQLException.toString differs between client and embedded 
> driver
> --------------------------------------------------------------------------------
>
>                 Key: DERBY-1438
>                 URL: http://issues.apache.org/jira/browse/DERBY-1438
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC, Newcomer
>    Affects Versions: 10.2.0.0
>         Environment: Sun JDK 1.5
>            Reporter: Olav Sandstaa
>         Assigned To: David Van Couvering
>            Priority: Trivial
>         Attachments: DERBY-1438-rev2.diff, DERBY-1438.diff
>
>
> The first part of the string written by SQLExeption.toString() differs
> between the Derby client driver and the embedded driver. The embedded
> driver writes:
>    SQL Exception: Table/View 'DERBYDB' does not exist.
> while the client driver writes:
>    java.sql.SQLException: Table/View 'DERBYDB' does not exist.
> It would be good if we changed this so the same text is written by
> both drivers. This reduces the difference seen when changing between
> client and embedded Derby and it make it possible to reduce the amount
> of sed-ing or the number of master file variants for some tests.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to