Commons Compress
  1. Commons Compress
  2. COMPRESS-14

[compress] CBZip2InputStream doesn't close the source stream

    Details

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

      Operating System: All
      Platform: All

      Description

      Hi there,

      I used compress component in sandbox via VFS component. And When I accessed
      a tbz2 file via VFS, I could not remove the tbz2 file after closing stream.
      I checked some codes and I found the reason of the phenomenon.
      When a client program accessed a tbz2 file, the code uses TarFileSystem
      ( org.apache.commons.vfs.provider.tar.TarFileSystem ). TarFileSystem uses
      CBZip2InputStream via Bzip2FileObject.wrapInputStream and the source
      stream is created from FileInputStream like this:

      class TarFileSystem

      ... snip ...

      protected TarInputStream createTarFile(final File file) throws
      FileSystemException

      ... snip ...

      else if ("tbz2".equalsIgnoreCase(getRootName().getScheme()))

      { return new TarInputStream(Bzip2FileObject.wrapInputStream( file.getAbsolutePath(), new FileInputStream(file))); }

      I think CBZip2InputStream should close source stream like BufferedInputStream
      and FilteredInputStream.

      Could you please consider to close source stream in CBZip2InputStream#close() ?

      Thanks,

      Hiroki

        Activity

        Hide
        Hiroki Ata added a comment -

        Created an attachment (id=16360)
        [PATCH] patch to fix commons compress CBZip2InputStream close a source stream

        I tried to create a patch of my suggestion to fix CBZip2InputStream.
        If you have an interest of it, please check and consider to use it.

        Show
        Hiroki Ata added a comment - Created an attachment (id=16360) [PATCH] patch to fix commons compress CBZip2InputStream close a source stream I tried to create a patch of my suggestion to fix CBZip2InputStream. If you have an interest of it, please check and consider to use it.
        Hide
        Mario Ivankovits added a comment -

        Didnt you use the svn head version for this patch?

        http://svn.apache.org/repos/asf/jakarta/commons/sandbox/compress/trunk

        There were already a fix for this, though it cased a NPE, so I applied your
        patch and now it works like a charm.

        Thanks for the patch!

        Show
        Mario Ivankovits added a comment - Didnt you use the svn head version for this patch? http://svn.apache.org/repos/asf/jakarta/commons/sandbox/compress/trunk There were already a fix for this, though it cased a NPE, so I applied your patch and now it works like a charm. Thanks for the patch!
        Hide
        Hiroki Ata added a comment -

        Thank you for checking this report quickly. And I'm so sorry I didn't
        check svn-repository. I think commons-compress is managed by CVS-repository
        to see the following page and the page figures CVS-repository for
        documentation.
        http://jakarta.apache.org/commons/sandbox/compress/
        I should check the following page first.
        http://jakarta.apache.org/site/cvsindex.html
        I will check svn when I filed a new bug .

        ( I confirmed the fix is merged, so please close this bug. )

        Thanks again !

        Show
        Hiroki Ata added a comment - Thank you for checking this report quickly. And I'm so sorry I didn't check svn-repository. I think commons-compress is managed by CVS-repository to see the following page and the page figures CVS-repository for documentation. http://jakarta.apache.org/commons/sandbox/compress/ I should check the following page first. http://jakarta.apache.org/site/cvsindex.html I will check svn when I filed a new bug . ( I confirmed the fix is merged, so please close this bug. ) Thanks again !
        Hide
        Mario Ivankovits added a comment -

        No problem.

        I updated the website, though it might take some time until you can see the changes.

        Thanks!

        Show
        Mario Ivankovits added a comment - No problem. I updated the website, though it might take some time until you can see the changes. Thanks!

          People

          • Assignee:
            Unassigned
            Reporter:
            Hiroki Ata
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development