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

java.util.zip.ZipOutputStream.putNextEntry works wrong if stream closed.

    Details

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

      Description



      Name: sdC67446 Date: 02/13/98


      method java.util.zip.ZipOutputStream.putNextEntry doesn't throw IOException when
      stream is closed.

      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 {
            
            OutputStream bos = new ByteArrayOutputStream();
            ZipOutputStream zos = new ZipOutputStream(bos);

            zos.putNextEntry(new ZipEntry("1"));
            zos.write(1);
            zos.closeEntry();
            zos.close();
            zos.putNextEntry(new ZipEntry("2"));
            zos.write(2);
            System.out.println("Wrong way.");

          } catch ( IOException e ) {
            System.out.println(e);
          }
        }
      }
      ---------Output from the test---------------------
      Wrong way.
      --------------------------------------------------
      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              dconnellsunw David Connelly (Inactive)
              Reporter:
              sdmitriesunw Sergei Dmitriev (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: