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

Unused deflater in ZipDataFormat

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.17.4, 2.18.1, 2.19.0
    • Component/s: camel-core
    • Labels:
      None
    • Estimated Complexity:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: