[ 
https://issues.apache.org/jira/browse/DERBY-6484?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Knut Anders Hatlen updated DERBY-6484:
--------------------------------------

    Attachment: d6484-1a.diff

The attached patch makes client.am.SqlException.toString() return the same as 
iapi.error.StandardException.toString(), and it adds a test case to verify it.

Example stack trace on the client after the fix:

{noformat}
java.sql.SQLDataException: Invalid character string format for type INTEGER.
        at 
org.apache.derby.client.am.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:72)
        at 
org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:321)
        at 
org.apache.derby.client.am.ClientStatement.execute(ClientStatement.java:990)
        at Kladd.main(Kladd.java:27)
Caused by: ERROR 22018: Invalid character string format for type INTEGER.
        at 
org.apache.derby.client.am.ClientStatement.completeSqlca(ClientStatement.java:2109)
        at 
org.apache.derby.client.net.NetStatementReply.parsePrepareError(NetStatementReply.java:579)
        at 
org.apache.derby.client.net.NetStatementReply.parsePRPSQLSTTreply(NetStatementReply.java:145)
        at 
org.apache.derby.client.net.NetStatementReply.readPrepareDescribeOutput(NetStatementReply.java:54)
        at 
org.apache.derby.client.net.StatementReply.readPrepareDescribeOutput(StatementReply.java:41)
        at 
org.apache.derby.client.net.NetStatement.readPrepareDescribeOutput_(NetStatement.java:156)
        at 
org.apache.derby.client.am.ClientStatement.readPrepareDescribeOutput(ClientStatement.java:1695)
        at 
org.apache.derby.client.am.ClientStatement.flowExecute(ClientStatement.java:2373)
        at 
org.apache.derby.client.am.ClientStatement.executeX(ClientStatement.java:995)
        at 
org.apache.derby.client.am.ClientStatement.execute(ClientStatement.java:981)
        ... 1 more
{noformat}

All the regression tests ran cleanly with the patch.

> Include SQLState in client exception messages
> ---------------------------------------------
>
>                 Key: DERBY-6484
>                 URL: https://issues.apache.org/jira/browse/DERBY-6484
>             Project: Derby
>          Issue Type: Improvement
>          Components: Network Client
>    Affects Versions: 10.11.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: d6484-1a.diff
>
>
> When the embedded driver raises an SQLException, it is linked to a 
> iapi.error.StandardException whose toString() method adds the SQLState to the 
> error message. An SQLException raised by the client driver is linked to a 
> client.am.SqlException, which does not add the SQLState. Because of this, 
> printStackTrace() gives more information when called on an embedded 
> exception. You have to call getSQLState() on the client exception in order to 
> see the SQLState.
> We should change client.am.SqlException's toString() method to work the same 
> way as StandardException.toString().
> See also the discussion in DERBY-1997.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to