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

MemoryCacheImageOutputStream.close() throws IndexOutOfBoundsException

XMLWordPrintable

    • beta2
    • generic
    • generic



      Name: mlR10151 Date: 04/04/2001



      The spec. for the MemoryCacheImageOutputStream.close() says nothing about throwing
      IndexOutOfBoundsException, but it does throw it:

      ===================== a.java =======================
      import java.io.*;
      import javax.imageio.stream.*;

      public class a {
          public static void main (String argv[]) throws Exception {
              OutputStream ostream = new ByteArrayOutputStream();
              MemoryCacheImageOutputStream mcios = new MemoryCacheImageOutputStream(ostream);
              mcios.close();
              System.out.println("Passed");
          }
      }
      ===================== log =======================
      % java -version
      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b58)
      Java HotSpot(TM) Client VM (build 1.4.0-beta-b58, mixed mode)
      % java a
      Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
              at java.util.ArrayList.RangeCheck(ArrayList.java:497)
              at java.util.ArrayList.get(ArrayList.java:312)
              at javax.imageio.stream.MemoryCache.getCacheBlock(MemoryCache.java:54)
              at javax.imageio.stream.MemoryCache.writeToStream(MemoryCache.java:129)
              at javax.imageio.stream.MemoryCacheImageOutputStream.flushBefore(MemoryCacheImageOutputStream.java:159)
              at javax.imageio.stream.MemoryCacheImageOutputStream.close(MemoryCacheImageOutputStream.java:144)
              at a.main(a.java:8)


      This bug causes failure of the new JCK test
      api/javax_imageio/stream/MemoryCacheImageOutputStream/index.html#close


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

            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: