[ http://issues.apache.org/jira/browse/DERBY-1438?page=all ]

David Van Couvering updated DERBY-1438:
---------------------------------------

    Attachment: DERBY-1438.diff

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.

In the embedded deriver, you'll also get the default toString() output, because 
in SQLExceptionFactory40 we're converting to vanilla java.sql.SQLException 
classes and its subtypes.

Running pre-Java SE 6, the user gets an 
org.apache.derby.impl.jdbc.EmbedSQLException class, and that's kind of ugly to 
print out, and still wouldn't be consistent with the client.

What I have done (see attached patch) is change the toString() override method 
in EmbedSQLException to print out "java.sql.SQLException" rather than just "SQL 
Exception".  This is correct, in that EmbedSQLException is a subclass of 
java.sql.SQLException, and makes the client and the embedded drivers consistent.

Unless anyone objects, I'll commit this (and resulting master output changes) 
after running derbyall.

David

> 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
>         Type: Improvement

>   Components: JDBC, Newcomer
>     Versions: 10.2.0.0
>  Environment: Sun JDK 1.5
>     Reporter: Olav Sandstaa
>     Assignee: David Van Couvering
>     Priority: Trivial
>  Attachments: 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