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

Opening a zip file with java.util.zip.ZipFile causes unwanted lines on stdout

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.3.1
    • core-libs
    • x86
    • windows_2000



      Name: gm110360 Date: 10/16/2001


      J:\Learn\java\Experiment>java -version
      java version "1.3.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
      Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)


      Create a zip file.
      Add some comments to some entries.
      Open that file using the following code.

      The output contains..
          J:\Learn\java\Experiment>java DisplayZip jk.zip
          Opening a zip file
          Allocating ZIP comments array
          Added ZIP comment "J:\Learn\SNMP\Beansexample.class"
          Zip file created
          Zip file has entries


      Where "Allocating ZIP comments array" and the
      next line "Added ZIP Comment..." are unwanted.

      ============= Java Source Follows ======================
      import java.io.*;
      import java.util.*;
      import java.util.zip.*;

      public class DisplayZip
      {
      public static void main(String args[])
      {
      try
         {
         System.out.println("Opening a zip file");
           ZipFile zf = new ZipFile(args[0]);
           System.out.println("Zip file created");
          
           Enumeration e = zf.entries();
           System.out.println("Zip file has entries");
           while (e.hasMoreElements())
           {
           ZipEntry ze = (ZipEntry) e.nextElement();
         
           System.out.println("Entry : " + ze.toString());
           System.out.println(" Name : " + ze.getName());
           System.out.println(" CRC : " + ze.getCrc());
           System.out.println(" Is Dir : " + ze.isDirectory
      ());
           System.out.println(" Comment: " + ze.getComment
      ());
           System.out.println(" Method : " + ze.getMethod
      ());
          
              }
           }
           catch (Exception e)
           {
           e.printStackTrace();
           }
      }
      }
      (Review ID: 133863)
      ======================================================================

            kkladkosunw Konstantin Kladko (Inactive)
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: