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

java.util.zip.ZipFile throws irrelevant IOException

    XMLWordPrintable

    Details

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

      Description



      Name: sdC67446 Date: 07/27/98



      Constructors java.util.zip.ZipFile(String name) and
                   java.util.zip.ZipFile(File file)
      throw irrelevant IOException if input parameter
      specifies existent non ZIP file.
      In this case constructors should throw ZipException.

      The doc says:
      ----------------------------------------------------
      public ZipFile(String name)
              throws IOException

            Opens a zip file for reading.
            Parameters:
                  name - the name of the zip file
            Throws:
                  ZipException - if a ZIP format error has occurred
                  IOException - if an I/O error has occurred
                  
      Here is the test demostrating the bug:
      ----------------------------------------------------
      import java.util.zip.*;
      import java.io.*;

      public class Test {

        public static void main(String[] args) {
          try {
              ZipFile zfile = new ZipFile("ExistentNonZipFile.zip");
          } catch (IOException e) {
              System.out.println(e);
          }
        }
      }

      Here is test's output:
      ----------------------------------------------------
      java.io.IOException: Invalid argument
      ----------------------------------------------------
      ======================================================================

        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: