Uploaded image for project: 'Commons BCEL'
  1. Commons BCEL
  2. BCEL-63

JavaClass.dump(OutputStream/DataOutputStream) shouldnt call close

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 5.1
    • 5.2
    • Main
    • None

    Description

      I think it would be more helpful if JavaClass.dump(*OutputStream)
      didnt call close as the caller may not be finished with the stream.

      Only for JavaClass.dump(File) does BCEL "own" the OutputStream.

      It also looks like the caller should provide an extra finally

      {... os.close() }

      as JavaClass.dump may not close the stream in the event of an error.

      For a concrete example: When writing a JAR using JarOutputStream
      the stream shouldnt be closed till multiple classes have been written.
      So the real stream has to be wrapped with a Filter/Proxy that ignores close.

      This problem also appears for ClassParser.

      Many thanks for your excellent code.

      Attachments

        Activity

          People

            issues@commons.apache.org Apache Commons Developers
            sam@redspr.com sam
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: