Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.97
    • Fix Version/s: 1.0
    • Component/s: None
    • Labels:
      None
    • Environment:

      Windows 7, Java 1.7.0.1, 0.97-Incubator

      Description

      The attached image is somehow corrupt (it still can be opened with IrfanView).

      Trying to read the image information with Sanselan.getImageInfo(file) results in an IOException.

      After this the image is still locked on the file system, and can't be deleted for example. I expected it to be immediately get unlocked on the file system, after the error occured.

      1. 380440_295155317172029_185275861493309_985773_37867068_n.bmp
        2.89 MB
        Adrian Moerchen
      2. finbugs.patch
        0.5 kB
        Adrian Moerchen

        Activity

        Hide
        Damjan Jovanovic added a comment -

        Audited and fixed all ByteSource.getInputStream() leaks in commit 1294807, resolving FIXED .

        Show
        Damjan Jovanovic added a comment - Audited and fixed all ByteSource.getInputStream() leaks in commit 1294807, resolving FIXED .
        Hide
        Damjan Jovanovic added a comment -

        Ok I've hacked MCLIRR to work, and committed your patch. Thank you for your contribution.

        It finds all kinds of problems, but doesn't find the resource leak in BmpImageParser . Maybe because ByteSource.getInputStream() returns the stream, and FindBugs can only find streams that leak within a method? Either way, I'll audit all the calls to ByteSource.getInputStream().

        Show
        Damjan Jovanovic added a comment - Ok I've hacked MCLIRR to work, and committed your patch. Thank you for your contribution. It finds all kinds of problems, but doesn't find the resource leak in BmpImageParser . Maybe because ByteSource.getInputStream() returns the stream, and FindBugs can only find streams that leak within a method? Either way, I'll audit all the calls to ByteSource.getInputStream().
        Hide
        Damjan Jovanovic added a comment -

        Thank you for your patch, that's a great Maven plugin. Sadly "mvn site" is broken at the moment due to http://jira.codehaus.org/browse/MCLIRR-36 - this being the second Maven plugin bug I am having to fix - so I can't use your patch yet.

        I want to release as soon as possible, but there's a lot left to do, including a rename of the project to "Apache Commons Imaging". Maybe by the end of Q1 2012.

        Show
        Damjan Jovanovic added a comment - Thank you for your patch, that's a great Maven plugin. Sadly "mvn site" is broken at the moment due to http://jira.codehaus.org/browse/MCLIRR-36 - this being the second Maven plugin bug I am having to fix - so I can't use your patch yet. I want to release as soon as possible, but there's a lot left to do, including a rename of the project to "Apache Commons Imaging". Maybe by the end of Q1 2012.
        Hide
        Adrian Moerchen added a comment -

        I've recommend you to use Findbugs. I've attached a patch for you pom.xml. After applying the patch you can run mvn site. This will also generate the Findbugs analyses. There you can search for OS_OPEN_STREAM to find possible candidates where stream may left be open.

        For developent you could add Findbugs to Eclipse or whatever you use.

        Links:
        http://findbugs.sourceforge.net/
        http://mojo.codehaus.org/findbugs-maven-plugin/
        http://findbugs.sourceforge.net/manual/eclipse.html

        Btw. Is there a release date for the next version?

        Show
        Adrian Moerchen added a comment - I've recommend you to use Findbugs. I've attached a patch for you pom.xml . After applying the patch you can run mvn site . This will also generate the Findbugs analyses. There you can search for OS_OPEN_STREAM to find possible candidates where stream may left be open. For developent you could add Findbugs to Eclipse or whatever you use. Links: http://findbugs.sourceforge.net/ http://mojo.codehaus.org/findbugs-maven-plugin/ http://findbugs.sourceforge.net/manual/eclipse.html Btw. Is there a release date for the next version?
        Hide
        Damjan Jovanovic added a comment -

        This probably happens because BmpImageParser.getImageInfo() calls byteSource.getInputStream() and never closes it, thus leaking that InputStream.

        It's easy to fix with a try/finally around that one line of code, but the entire project should be audited for such leaks.

        Show
        Damjan Jovanovic added a comment - This probably happens because BmpImageParser.getImageInfo() calls byteSource.getInputStream() and never closes it, thus leaking that InputStream. It's easy to fix with a try/finally around that one line of code, but the entire project should be audited for such leaks.

          People

          • Assignee:
            Unassigned
            Reporter:
            Adrian Moerchen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development