Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-10368

Unused deflater in ZipDataFormat

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.17.4, 2.18.1, 2.19.0
    • camel-core
    • None
    • Unknown

    Description

      In the ZipDataForamt class you find

      final Deflater deflater = new Deflater(compressionLevel);
      final DeflaterOutputStream zipOutput = new DeflaterOutputStream(stream, new Deflater(compressionLevel));
      try

      { IOHelper.copy(is, zipOutput); }

      finally {
      IOHelper.close(is, zipOutput);

      /*

      • As we create the Deflater our self and do not use the stream default
      • (see {@link java.util.zip.DeflaterOutputStream#usesDefaultDeflater}

        )

      • we need to close the Deflater to not risk a OutOfMemoryException
      • in native code parts (see {@link java.util.zip.Deflater#end}

        )
        */
        deflater.end();
        }

      the deflater variable should be used in the DeflaterOutputStream

      final DeflaterOutputStream zipOutput = new DeflaterOutputStream(stream, deflater);

      Attachments

        Activity

          People

            forsthofer Franz Forsthofer
            forsthofer Franz Forsthofer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: