[ http://issues.apache.org/jira/browse/DERBY-1710?page=all ]
Knut Anders Hatlen updated DERBY-1710:
--------------------------------------
Attachment: derby-1710.diff
derby-1710.stat
The attached patch makes NetworkServerControlImpl use
SQLException.getSQLState() instead of EmbedSQLException.getMessageId() where
possible. Where it is not possible, check that the exception is
EmbedSQLException before casting, and fall back to a more generic approach if
it is not.
> Unchecked casts from SQLException to EmbedSQLException cause
> ClassCastException in NetworkServerControlImpl when running Java SE 6
> ----------------------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-1710
> URL: http://issues.apache.org/jira/browse/DERBY-1710
> Project: Derby
> Issue Type: Bug
> Components: Network Server
> Affects Versions: 10.2.0.0
> Environment: Java SE 6 (beta)
> Reporter: Knut Anders Hatlen
> Assigned To: Knut Anders Hatlen
> Priority: Minor
> Fix For: 10.2.0.0
>
> Attachments: derby-1710.diff, derby-1710.stat
>
>
> Since Derby doesn't raise EmbedSQLExceptions when running Java SE 6 or later,
> casts from SQLException to EmbedSQLException fail with a ClassCastException.
> To reproduce, start a network server with Java SE 6, and with
> derby.drda.debug enabled:
> java -Dderby.drda.debug=true org.apache.derby.drda.NetworkServerControl
> start
> In another terminal, stop the server with this command:
> java org.apache.derby.drda.NetworkServerControl shutdown
> When the server stops, it will print
> java.sql.SQLException cannot be cast to
> org.apache.derby.impl.jdbc.EmbedSQLException
> java.lang.ClassCastException: java.sql.SQLException cannot be cast to
> org.apache.derby.impl.jdbc.EmbedSQLException
> at
> org.apache.derby.impl.drda.NetworkServerControlImpl.blockingStart(NetworkServerControlImpl.java:665)
> at
> org.apache.derby.impl.drda.NetworkServerControlImpl.executeWork(NetworkServerControlImpl.java:1739)
> at
> org.apache.derby.drda.NetworkServerControl.main(NetworkServerControl.java:239)
--
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