db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Waagan <Kristian.Waa...@Sun.COM>
Subject Re: svn commit: r542016 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4: BlobTest.java CallableStatementTest.java ClobTest.java DataSourceTest.java PreparedStatementTest.java ResultSetTest.java TestJDBC40Exception.java
Date Sun, 27 May 2007 22:12:26 GMT
Kristian Waagan wrote:
> kahatlen@apache.org wrote:
>> Author: kahatlen
>> Date: Sun May 27 11:30:45 2007
>> New Revision: 542016
>>
>> URL: http://svn.apache.org/viewvc?view=rev&rev=542016
>> Log:
>> DERBY-2707: Inadequate clean-up in many jdbc4 tests
>>
>> Fixed the tearDown() methods in many of the jdbc4 tests.
>>
>> Modified:
>>     
>> db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java

>>
>>     
>> db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java

>>
>>     
>> db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClobTest.java

>>
>>     
>> db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/DataSourceTest.java

>>
>>     
>> db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java

>>
>>     
>> db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetTest.java

>>
>>     
>> db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestJDBC40Exception.java

>>
>>
>> Modified: 
>> db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java

>>
>> URL: 
>> http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java?view=diff&rev=542016&r1=542015&r2=542016

>>
>> ============================================================================== 
>>
>> --- 
>> db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java

>> (original)
>> +++ 
>> db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java

>> Sun May 27 11:30:45 2007
>> @@ -125,7 +125,7 @@
>>      //throwing a SQLException when they are called after calling free()
>>      //on a LOB.
>>      -    private ExemptBlobMD [] emd = new ExemptBlobMD [] {
>> +    private static final ExemptBlobMD [] emd = new ExemptBlobMD [] {
>>          new ExemptBlobMD( "getBinaryStream", new Class[] { 
>> long.class,long.class }
>>                                                                     
>> ,true,true ),
>>          new ExemptBlobMD( "setBinaryStream", new Class[] { 
>> long.class },false,true ),
>> @@ -167,6 +167,13 @@
>>          //from throwing a SQLException after free has been called
>>          //on the Clob object.
>>          buildHashSet();
>> +    }
>> +
>> +    protected void tearDown() throws Exception {
>> +        blob.free();
>> +        blob = null;
>> +        excludedMethodSet = null;
>> +        super.tearDown();
>>      }
>>           /**
>>
>> Modified: 
>> db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java

>>
>> URL: 
>> http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java?view=diff&rev=542016&r1=542015&r2=542016

>>
>> ============================================================================== 
>>
>> --- 
>> db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java

>> (original)
>> +++ 
>> db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java

>> Sun May 27 11:30:45 2007
>> @@ -71,9 +71,9 @@
>>       */
>>      protected void tearDown()
>>          throws Exception {
>> -        if (cStmt != null && !cStmt.isClosed()) {
>> -            cStmt.close();
>> -        }
>> +
>> +        cStmt.close();
>> +        cStmt = null;
>>   
>
> Just out of curiosity:
> At first look the existing code looks sound - calling close only if 
> the statement is not null and not already closed.
> Why is that inadequate?

A bit quick on the send button...
I understand why you nullify the reference, what I was wondering about 
was if there was a reason for changing the if-block.
As far as I can tell, it removes complexity, but increases the chance of 
a NPE. Unless there is some other reason I don's see?


regards,
-- 
Kristian
>
>


Mime
View raw message