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

InflaterOutputStream: writing after finish() results in a NullPointerException (NPE) instead of an IOException

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      write() to an InflatOutputStream after finish() will cause NPE.


      ---------- BEGIN SOURCE ----------
      InflaterOutputStream ios = new InflaterOutputStream(OutputStream.nullOutputStream());
              ios.finish();
              try {
                  ios.write(1);
              } catch (Exception e) {
                  System.out.println("InflaterOutputStream NPE after finish(): " + e.getClass().getName());
              }
      ---------- END SOURCE ----------
      Expected Behavior:
      Per Java's OutputStream convention, after finish() (or close()), further calls to write() should throw an IOException indicating the stream is closed, not an NPE.

      Actual Behavior:
      Instead, InflaterOutputStream.write() will throw a NullPointerException.

            jpai Jaikiran Pai
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: