[
https://issues.apache.org/jira/browse/DERBY-6147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Knut Anders Hatlen updated DERBY-6147:
--------------------------------------
Attachment: d6147-1a.diff
The new JDBC 4.2 methods in Java 8 have default methods that try to do
something slightly more useful than throwing AbstractMethodError. However, the
default methods don't behave quite like the test expect. There are three kinds
of failures:
- NullPointerException: These happen because we check if the SQLState starts
with "0A". That is, whether or not it's an SQLFeatureNotSupportedException.
However, the exceptions thrown by the default methods don't have an SQLState.
It is null, and the check fails with NPE.
- UnsupportedOperationException: The default methods for the mandatory JDBC 4.2
methods throw these rather than SQLFeatureNotSupportedException. The test is
not prepared for this.
- The default method for Statement.getLargeMaxRows() returns 0, also if the
statement is closed. The test expects the method to throw an exception if the
statement is closed.
The test should only test the methods that we actually implement, and we could
skip those methods that lack an implementation.
The attached patch makes the test skip those methods that don't have an
implementation in the Derby classes. It uses reflection and the isSynthetic()
method to check this.
I've verified that the patch skips the 252 previously failing test cases (and
only those) when running with Java 8 on the 10.9 branch. The test also passes
on trunk with the patch.
This fix should theoretically make the test work with no changes on later JDBC
versions as well. We'll see how that plays out in practice when we get there...
Colour diff:
https://github.com/kahatlen/derby/commit/b22ca3b4526222987ff134b7230f51ddd1940b18
> ClosedObjectTest fails on the 10.9 branch when running on Java 8
> ----------------------------------------------------------------
>
> Key: DERBY-6147
> URL: https://issues.apache.org/jira/browse/DERBY-6147
> Project: Derby
> Issue Type: Bug
> Components: Test
> Affects Versions: 10.9.2.2
> Reporter: Knut Anders Hatlen
> Assignee: Knut Anders Hatlen
> Attachments: d6147-1a.diff
>
>
> http://mail-archives.apache.org/mod_mbox/db-derby-dev/201304.mbox/%3CCADjEm_WJjDwDJ-vE-swq6XXvKD018ZZFFKgapF%3DTchPU9H3Pug%40mail.gmail.com%3E
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira