db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-3852) J2EEDataSourceTest may ignore some failures
Date Mon, 01 Feb 2010 09:43:50 GMT

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

Knut Anders Hatlen updated DERBY-3852:

    Attachment: assert.diff

It looks like most of it was fixed as part of DERBY-3853, but I found one occurrence that
wasn't fixed yet. The attached patch fixes that one too.

Committed revision 905224.

> J2EEDataSourceTest may ignore some failures
> -------------------------------------------
>                 Key: DERBY-3852
>                 URL: https://issues.apache.org/jira/browse/DERBY-3852
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions:
>            Reporter: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: assert.diff
> I noticed that the method testConnectionErrorEvent() in J2EEDataSourceTest had many occurrences
of code that was structured like this:
>   try {
>     // do something with a connection
>   } catch (SQLException e) {
>     assertSQLState("...", e);
>   }
> This code will only fail if an unexpected exception is thrown, not if the code in the
try block fails to throw any exception at all.
> It may be that we can fix this by adding a call to fail() at the end of each try block.
It may also be the case that the code is written like this because it is expected to throw
exception with the embedded driver and succeed with the client driver (or the other way around).
If the latter is the case, this should be made explicit, for instance by writing it like this:
>   try {
>     // do something with a connection
>     assertFalse(usingEmbedded(), "should have failed with the embedded driver");
>   } catch (SQLException e) {
>     if (!usingEmbedded()) {
>       throw e;
>     }
>     assertSQLState("...", e);
>   }

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message