Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-4732

Release system resources in CanonTestCase thoroughly

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.7.1.1
    • Component/s: Test
    • Labels:
      None

      Description

      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.

        Attachments

        1. derby-4732.stat
          0.1 kB
          Yun Lee
        2. derby-4732.patch
          2 kB
          Yun Lee

          Issue Links

            Activity

              People

              • Assignee:
                yunlee Yun Lee
                Reporter:
                yunlee Yun Lee
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: