db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dag H. Wanvik (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-5988) Instability in DataSourceTest: some test fixture orderings makes test_jdbc4_1 fail
Date Sun, 11 Nov 2012 23:17:12 GMT

    [ https://issues.apache.org/jira/browse/DERBY-5988?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13495038#comment-13495038

Dag H. Wanvik commented on DERBY-5988:

The problem seems to be that the call to EmbeddedDataSource40#getParentLogger tries to raise

   throw (SQLFeatureNotSupportedException) Util.notImplemented( "getParentLogger()" );

However, at this point in time the Util has the wrong version (pre-Java 6) of the exception
factory, which leads to the SQLException object being created as a plain SQLException instance,
whereas it should be created as a SQLFeatureNotSupportedException.
By default the exception factory used by Util#newEmbedSQLException is initialized to 


When Driver40 is loaded, Driver40#boot calls 

   Util.setExceptionFactory (new SQLExceptionFactory40 ());

however, in our case, this has not yet happened, so instead of producing an exception with
SQLExceptionFactory40, we erroneously employ SQLExceptionFactory, leading to missing use of

I guess calling EmbeddedDataSource40#getParentLogger before trying to get a connection (which
would make the correct driver and and hence exception factory load) is not a common use case,
but I think this is still a product error, so I mark it as such for now.

The user would possibly expect an SQLException but not a java.lang.ClassCastException,

> Instability in DataSourceTest: some test fixture orderings makes test_jdbc4_1 fail
> ----------------------------------------------------------------------------------
>                 Key: DERBY-5988
>                 URL: https://issues.apache.org/jira/browse/DERBY-5988
>             Project: Derby
>          Issue Type: Bug
>            Reporter: Dag H. Wanvik
>            Priority: Minor
>         Attachments: DataSourceTest.java
> If this test fixture is executed before the driver is loaded the first time, a call to
EmbeddedDataSource40.getParentLogger will fail with this symptom:
> org.apache.derby.impl.jdbc.EmbedSQLException cannot be cast to java.sql.SQLFeatureNotSupportedException
> at org.apache.derby.jdbc.EmbeddedDataSource40.getParentLogger(EmbeddedDataSource40.java:193)
> at org.apache.derbyTesting.functionTests.tests.jdbc4.Wrapper41DataSource.getParentLogger(Wrapper41DataSource.java:81)
> at org.apache.derbyTesting.functionTests.tests.jdbc4.DataSourceTest.vetDSjdbc4_1(DataSourceTest.java:318)
> at org.apache.derbyTesting.functionTests.tests.jdbc4.DataSourceTest.test_jdbc4_1(DataSourceTest.java:307)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:117)
> at org.apache.derbyTesting.junit.BaseJDBCTestCase.runBareOverridable(BaseJDBCTestCase.java:424)
> at org.apache.derbyTesting.junit.BaseJDBCTestCase.runBare(BaseJDBCTestCase.java:441)

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

View raw message