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

read([B,I,I) does not throw NPE as specified

XMLWordPrintable

    • beta3
    • generic
    • generic



      Name: mlR10151 Date: 06/08/2001



      The description of the MemoryCacheImageOutputStream.read(byte[] b, int off, int len)
      says:

      Throws:
          NullPointerException - if b is null.

      But it does not throw any exception in the following example,
      if run on JDK-Merlin build b66:
      ===================== a.java =======================
      import javax.imageio.stream.*;
      import java.io.*;
      public class a {
          public static void main(String[] args) throws Exception {
              ByteArrayOutputStream baos = new ByteArrayOutputStream();
              MemoryCacheImageOutputStream mcios = new MemoryCacheImageOutputStream(baos);

              mcios.write(new byte[100]);
              mcios.seek(0);

              try {
                  mcios.read(null, 0, 0);
                  System.out.println("Failed for b = null");
              } catch (NullPointerException e) {
                  System.out.println("Passed for b = null");
              }
          }
      }
      ===================== log =======================
      % java -version
      java version "1.4.0-beta_refresh"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta_refresh-b66)
      Java HotSpot(TM) Client VM (build 1.4.0-beta_refresh-b66, mixed mode)
      % java a
      Failed for b = null


      The bug causes failure of the following test:
      api/javax_imageio/stream/MemoryCacheImageOutputStream/index.html#read

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

            dricesunw Daniel Rice (Inactive)
            mlsunw Ml Ml (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: