Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4102961

java.util.zip.ZipOutputStream allows writing after close

    Details

    • Subcomponent:
    • Resolved In Build:
      1.2fcs
    • CPU:
      sparc
    • OS:
      solaris_2.5
    • Verification:
      Verified

      Description



      Name: sdC67446 Date: 01/09/98


      Method java.util.zip.ZipOutputStream.write allows writing after calling
      close() method.

      Here is the test demonstrating the bug:
      -----------------Test.java------------------------
      import java.util.zip.*;
      import java.io.*;

      public class Test {
        public static void main(String[] args) {
          try {

            byte[] buf = {1};

            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            ZipOutputStream zos = new ZipOutputStream(baos);
            zos.putNextEntry(new ZipEntry("1"));
            zos.write(buf,0,1);
            zos.close();
            
            zos.putNextEntry(new ZipEntry("2"));
            zos.write(buf,0,1);

            System.out.println("It's not good.");

          } catch (Exception e) {
            System.out.println(e+" - IT'S OK.");
          }
        }
      }
      ---------Output from the test---------------------
      It's not good.
      --------------------------------------------------

      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              zlisunw Zhenghua Li (Inactive)
              Reporter:
              sdmitriesunw Sergei Dmitriev (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: