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

java.util.zip.ZipOutputStream allows writing after close

XMLWordPrintable

    • 1.2fcs
    • sparc
    • solaris_2.5
    • Verified



      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.
      --------------------------------------------------

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

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: