db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel John Debrunner (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-2005) convert jdbcapi/Stream.java to Junit
Date Thu, 02 Nov 2006 01:05:20 GMT
    [ http://issues.apache.org/jira/browse/DERBY-2005?page=comments#action_12446419 ] 
            
Daniel John Debrunner commented on DERBY-2005:
----------------------------------------------

I committed the patch but it does contain some cleanup code that I think itself could be cleaned
up, e.g. in runGetStreamTwiceTest

        } finally {
            if (st != null) {
                st.close();
            }
            
            if (rs != null) {
                rs.close();
            }
            
            if (is != null) {
                is.close();
            }
        }

In these cases st and rs can never be null, so the check to see if they are null is confusing.
There is also no need to have them inside the finally block.
The closing of the stream 'is' I think is also dubious at that point, the test does not expect
the stream to be successfully opened so is there a benefit to having cleanup code for the
stream?

My feeling is that that the cleanup code can distract from the actual focus of the test, in
this case did the second rs.getXXX fail.
All that is really needed here is no finally block and then simply

rs.close();
st.close();

or possibly since closing st is defined to close rs, just:

st.close();


> convert jdbcapi/Stream.java to Junit
> ------------------------------------
>
>                 Key: DERBY-2005
>                 URL: http://issues.apache.org/jira/browse/DERBY-2005
>             Project: Derby
>          Issue Type: Sub-task
>          Components: Test
>    Affects Versions: 10.3.0.0
>            Reporter: Fernanda Pizzorno
>         Assigned To: Fernanda Pizzorno
>         Attachments: derby-2005.diff, derby-2005.stat, derby-2005v2.diff, derby-2005v2.stat
>
>


-- 
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

        

Mime
View raw message