You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Yun Lee (JIRA)" <ji...@apache.org> on 2010/07/06 15:31:50 UTC

[jira] Created: (DERBY-4732) Release system resources in CanonTestCase thoroughly

Release system resources in CanonTestCase thoroughly
----------------------------------------------------

                 Key: DERBY-4732
                 URL: https://issues.apache.org/jira/browse/DERBY-4732
             Project: Derby
          Issue Type: Improvement
          Components: Test
            Reporter: Yun Lee
            Priority: Minor


Now, in the method of compareCanon(String canon) in CanonTestcase, two BufferedReaders----cannonReader and testOutput are closed in try catch block, however if some exception occurs above, the two BufferReaders won't be closed, and related system resources won't be released. 

Besides, a releative problem is about the ByteArrayOutputStream rawBytes in CanonTestcase, it's created in getOutputStream() and closed in compareCanon(String canon). It's pointed out by Knut in Derby-2708, ByteArrayOutputStream's javadoc says that closing it has no effect, so tearDown() method has been added  to CanonTestCase and sets rawBytes to null. It certainly can work. However, is it also OK to null out rawBytes in compareCanon(String canon)? If so, it seems cleaner than to null it out in tearDown() method.


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


[jira] Assigned: (DERBY-4732) Release system resources in CanonTestCase thoroughly

Posted by "Yun Lee (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4732?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yun Lee reassigned DERBY-4732:
------------------------------

    Assignee: Yun Lee

> Release system resources in CanonTestCase thoroughly
> ----------------------------------------------------
>
>                 Key: DERBY-4732
>                 URL: https://issues.apache.org/jira/browse/DERBY-4732
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Yun Lee
>            Assignee: Yun Lee
>            Priority: Minor
>
> Now, in the method of compareCanon(String canon) in CanonTestcase, two BufferedReaders----cannonReader and testOutput are closed in try catch block, however if some exception occurs above, the two BufferReaders won't be closed, and related system resources won't be released. 
> Besides, a releative problem is about the ByteArrayOutputStream rawBytes in CanonTestcase, it's created in getOutputStream() and closed in compareCanon(String canon). It's pointed out by Knut in Derby-2708, ByteArrayOutputStream's javadoc says that closing it has no effect, so tearDown() method has been added  to CanonTestCase and sets rawBytes to null. It certainly can work. However, is it also OK to null out rawBytes in compareCanon(String canon)? If so, it seems cleaner than to null it out in tearDown() method.

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


[jira] Closed: (DERBY-4732) Release system resources in CanonTestCase thoroughly

Posted by "Yun Lee (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4732?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yun Lee closed DERBY-4732.
--------------------------


> Release system resources in CanonTestCase thoroughly
> ----------------------------------------------------
>
>                 Key: DERBY-4732
>                 URL: https://issues.apache.org/jira/browse/DERBY-4732
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Yun Lee
>            Assignee: Yun Lee
>            Priority: Minor
>             Fix For: 10.7.0.0
>
>         Attachments: derby-4732.patch, derby-4732.stat
>
>
> Now, in the method of compareCanon(String canon) in CanonTestcase, two BufferedReaders----cannonReader and testOutput are closed in try catch block, however if some exception occurs above, the two BufferReaders won't be closed, and related system resources won't be released. 
> Besides, a releative problem is about the ByteArrayOutputStream rawBytes in CanonTestcase, it's created in getOutputStream() and closed in compareCanon(String canon). It's pointed out by Knut in Derby-2708, ByteArrayOutputStream's javadoc says that closing it has no effect, so tearDown() method has been added  to CanonTestCase and sets rawBytes to null. It certainly can work. However, is it also OK to null out rawBytes in compareCanon(String canon)? If so, it seems cleaner than to null it out in tearDown() method.

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


[jira] Updated: (DERBY-4732) Release system resources in CanonTestCase thoroughly

Posted by "Yun Lee (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4732?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yun Lee updated DERBY-4732:
---------------------------

    Attachment: derby-4732.stat
                derby-4732.patch

In Derby-4732.patch, cannonReader and testOutput are closed in finally block to make sure they can be closed. Besides, rawBytes is nulled out in compareCanon() method and tearDown() method is removed.

> Release system resources in CanonTestCase thoroughly
> ----------------------------------------------------
>
>                 Key: DERBY-4732
>                 URL: https://issues.apache.org/jira/browse/DERBY-4732
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Yun Lee
>            Assignee: Yun Lee
>            Priority: Minor
>         Attachments: derby-4732.patch, derby-4732.stat
>
>
> Now, in the method of compareCanon(String canon) in CanonTestcase, two BufferedReaders----cannonReader and testOutput are closed in try catch block, however if some exception occurs above, the two BufferReaders won't be closed, and related system resources won't be released. 
> Besides, a releative problem is about the ByteArrayOutputStream rawBytes in CanonTestcase, it's created in getOutputStream() and closed in compareCanon(String canon). It's pointed out by Knut in Derby-2708, ByteArrayOutputStream's javadoc says that closing it has no effect, so tearDown() method has been added  to CanonTestCase and sets rawBytes to null. It certainly can work. However, is it also OK to null out rawBytes in compareCanon(String canon)? If so, it seems cleaner than to null it out in tearDown() method.

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


[jira] Updated: (DERBY-4732) Release system resources in CanonTestCase thoroughly

Posted by "Yun Lee (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4732?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yun Lee updated DERBY-4732:
---------------------------

    Issue & fix info: [Patch Available]

> Release system resources in CanonTestCase thoroughly
> ----------------------------------------------------
>
>                 Key: DERBY-4732
>                 URL: https://issues.apache.org/jira/browse/DERBY-4732
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Yun Lee
>            Assignee: Yun Lee
>            Priority: Minor
>         Attachments: derby-4732.patch, derby-4732.stat
>
>
> Now, in the method of compareCanon(String canon) in CanonTestcase, two BufferedReaders----cannonReader and testOutput are closed in try catch block, however if some exception occurs above, the two BufferReaders won't be closed, and related system resources won't be released. 
> Besides, a releative problem is about the ByteArrayOutputStream rawBytes in CanonTestcase, it's created in getOutputStream() and closed in compareCanon(String canon). It's pointed out by Knut in Derby-2708, ByteArrayOutputStream's javadoc says that closing it has no effect, so tearDown() method has been added  to CanonTestCase and sets rawBytes to null. It certainly can work. However, is it also OK to null out rawBytes in compareCanon(String canon)? If so, it seems cleaner than to null it out in tearDown() method.

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


[jira] Resolved: (DERBY-4732) Release system resources in CanonTestCase thoroughly

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4732?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kristian Waagan resolved DERBY-4732.
------------------------------------

    Issue & fix info:   (was: [Patch Available])
       Fix Version/s: 10.7.0.0
          Resolution: Fixed

Seems like an improvement.
I committed the patch to trunk with revision 963716.

> Release system resources in CanonTestCase thoroughly
> ----------------------------------------------------
>
>                 Key: DERBY-4732
>                 URL: https://issues.apache.org/jira/browse/DERBY-4732
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Yun Lee
>            Assignee: Yun Lee
>            Priority: Minor
>             Fix For: 10.7.0.0
>
>         Attachments: derby-4732.patch, derby-4732.stat
>
>
> Now, in the method of compareCanon(String canon) in CanonTestcase, two BufferedReaders----cannonReader and testOutput are closed in try catch block, however if some exception occurs above, the two BufferReaders won't be closed, and related system resources won't be released. 
> Besides, a releative problem is about the ByteArrayOutputStream rawBytes in CanonTestcase, it's created in getOutputStream() and closed in compareCanon(String canon). It's pointed out by Knut in Derby-2708, ByteArrayOutputStream's javadoc says that closing it has no effect, so tearDown() method has been added  to CanonTestCase and sets rawBytes to null. It certainly can work. However, is it also OK to null out rawBytes in compareCanon(String canon)? If so, it seems cleaner than to null it out in tearDown() method.

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