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

method reset() throws unexpected IndexOutOfBoundsException

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      beta2
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Not verified

      Description



      Name: vpR10011 Date: 06/04/2001



      Specification of the class javax.imageio.stream.ImageInputStreamImpl says:

      "public void reset() throws IOException

      Resets the current stream byte and bit positions from the stack of marked
      positions.

      Specified by:
              reset in interface ImageInputStream
      Following copied from interface: javax.imageio.stream.ImageInputStream
      Throws:
              IOException - if an I/O error occur."


      This method throws unexpected IndexOutOfBoundsException when
      the current stream byte position from the stack of marked positions
      is smaller than the current flushed position.

      To reproduce this bug run the following test:
      ---------------------test.java--------------
      import java.io.*;
      import javax.imageio.stream.*;

      public class test {
          public static void main(String[] argv) {
              OutputStream os = (OutputStream) new ByteArrayOutputStream();
              MemoryCacheImageOutputStream iosI =
                      new MemoryCacheImageOutputStream(os);
              try {
                  iosI.writeBits(2L,7);
                  iosI.mark();
                  iosI.writeInt(1);
                  iosI.flush();
                  iosI.reset();
                  System.out.println("Passed");
              } catch (Exception e) {
                   System.out.println("Failed: unxepected exception: " + e);
              }
          }
      }
      -----------------------------------------
      % javac test.java
      % java -version
      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 test
      Failed: unxepected exception: java.lang.IndexOutOfBoundsException: pos < flushedPos!
      ----------------------------------------


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

        Attachments

          Activity

            People

            Assignee:
            dricesunw Daniel Rice (Inactive)
            Reporter:
            verapsunw Verap Verap (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: