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

java.util.zip.DeflaterOutputStream/InflaterInputStream ctors don't check for nul

XMLWordPrintable

    • jar
    • 1.2fcs
    • sparc
    • solaris_2.5
    • Verified



      Name: sdC67446 Date: 02/24/98


      Constructor java.util.zip.DeflaterOutputStream(OutputStream os)
      doesn't check input parameter for null. Thus calling the write method
      later causes undocumented NullPointerException.

      The similar bug is present in InflaterInputStream constructor as well.
      --------------------------------------------------

      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) {
          DeflaterOutputStream dos = new DeflaterOutputStream(null);
          try {
            dos.write(123);
          } catch (NullPointerException e) {
            System.out.println(e);
          } catch (IOException e) {
            System.out.println(e);
          }
        }
      }
      ---------Output from the test---------------------
      java.lang.NullPointerException
      --------------------------------------------------

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

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: