https://bz.apache.org/bugzilla/show_bug.cgi?id=62686

            Bug ID: 62686
           Summary: Very inconspicuous bug.
           Product: Ant
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

There is a bug in ZipOutputStream.java in method setLevel(int) at the line(s):

        hasCompressionLevelChanged = (this.level != level);
        this.level = level;

This is bad strategy…

Consider following scenario:

        – Level does not equal to 5.
        – User invokes setLevel(5).
        – There is no putNextEntry (nor another relevant method) call in
between…
        – User invokes setLevel(5) again.
        – User invokes putNextEntry(…) which will get invalid information about
the change of compression level.

I suggest to change the line(s) as follows:

        if (this.level != level)
        {
                hasCompressionLevelChanged = true;
                this.level = level;
        }

(Similar bugs may be hidden on another places…)

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to