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

InflaterInputStream.fill() does not throw IOE as expected

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.2.2
    • 1.1.7, 1.1.8
    • core-libs
    • None
    • 1.2.2
    • sparc
    • solaris_2.5
    • Verified



      Name: vsR10029 Date: 01/22/2001


      This bug is filed only for tracking purposes to exclude tests from
      TCKs for jdk1.1*-based products, the fix has already been integrated
      in jdk1.2, so feel free to close it as such.

      No IOException is thrown in InflaterInputStream.fill() call for
      already closed input stream.
      To reproduce run the code example:
      ---------------- TestIIS1.java ----------------------
      import java.io.ByteArrayInputStream;
      import java.io.InputStream;
      import java.io.IOException;
      import java.util.zip.InflaterInputStream;

      public class TestIIS1 {

          private final byte compressedOrig[] = {
              120, -100, -85, -107, -79, 74, 85, 97, 117,
              48, -9, 117, -47, 114, 15, -87, -27, -9, -54,
              -48, 49, -108, 17, 19, 20, 118, -87, -84, 78,
              -15, -10, -87, -112, 51, 115, 16, 85, 81, 54,
              11, 114, 44, 11, 98, 116, 17, 102, -10, 72,
              -10, 80, -79, 101, 14, 47, -50, 16, 117, -9,
              -83, 16, 13, -55, 83, 83, 103, -30, -117, -42,
              -82, -105, -119, 46, -16, 20, -111, -85, -16,
              -48, 54, 79, -53, -76, 116, -80, -78, 77, -88,
              -85, 50, 113, -54, 15, -74, -28, -44, 101,
              -43, 47, 85, 54, -74, 1, 0, -34, -35, 25, 7
          };

          public static void main(String argv[]) {
              TestIIS1 test = new TestIIS1();
              test.ioe();
          }

          public void ioe() {
              FakeIIS iis = null;
              try {
                  ByteArrayInputStream bis = new ByteArrayInputStream(compressedOrig);
                  iis = new FakeIIS(bis);
                  iis.close();
              } catch (Exception e) {
                  System.out.println("Setup failed: " + e);
                  return;
              }
              try {
                  iis.fill();
              } catch (IOException e) {
                  System.out.println("OKAY");
                  return;
              }
              System.out.println("IOException expected.");
          }
      }

      class FakeIIS extends InflaterInputStream {
          public FakeIIS(InputStream in) {
              super(in);
          }

          public void fill() throws IOException {
              super.fill();
          }
      }
      ----------------------------------------------------

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

            kkladkosunw Konstantin Kladko (Inactive)
            visaenko Vasily Isaenko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: