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

method seek(long pos) throws IOException under Windows95 when pos is very large

    XMLWordPrintable

    Details

      Description



      Name: vpR10011 Date: 07/18/2001



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

      "public void seek(long pos) throws IOException
      ...
      Resets the stream pointer to the desired location. The next read will occur at
      this location. The bit offset is set to 0.

      An IndexOutOfBoundsException will be thrown if pos is smaller than
      the flushed position (as returned by getflushedPosition).

      ...
      Parameters: pos - a long containing the desired file pointer position.
      Throws:
              IndexOutOfBoundsException - if pos is smaller than the flushed
              position.
              IOException - if any other I/O error occurs."


      Specification of the method javax.imageio.stream.FileImageInputStream says:
      "public void seek(long pos) throws IOException
      ...
      Sets the current stream position and resets the bit offset to 0.
      ...
      Throws:
              IndexOutOfBoundsException - if pos is smaller than the flushed
              position.
              IOException - if any other I/O error occurs."

      Under Windows95 this method throws IOExeption when the value of
      the parameter pos is very large.

      Under Solaris and WindowsNT this method does not throw IOException.

      To reproduce this bug run the following test.
      "tmp" is file from current directory.
      ---------------------test.java--------------
      import java.io.*;
      import javax.imageio.stream.*;

      public class test {
          public static void main(String[] argv) {
              System.out.println("FileImageInputStream");
              try {
                  RandomAccessFile raf = new RandomAccessFile("tmp","rw");
                  FileImageInputStream fiis = new FileImageInputStream(raf);
                  fiis.seek(Long.MAX_VALUE);
                  System.out.println("file position: "+ fiis.getStreamPosition());
                  fiis.close();
              } catch (Exception e) {
                  System.out.println(e);
              }
              System.out.println("");
              System.out.println("FileImageOutputStream");
              try {
                  RandomAccessFile raf1 = new RandomAccessFile("tmp","rw");
                  FileImageOutputStream fios = new FileImageOutputStream(raf1);
                  fios.seek(Long.MAX_VALUE);
                  System.out.println("file position: "+ fios.getStreamPosition());
                  fios.close();
              } catch (Exception e) {
                  System.out.println(e);
              }
              
          }
      }----------------------log under Solaris--------------------
      % javac test.java
      % java -version
      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
      Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)
      % java test
      ja14 -classpath . test
      FileImageInputStream
      file position: 9223372036854775807

      FileImageOutputStream
      file position: 9223372036854775807
      ---------------------log under Windows95-------------------
      % java -version
      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
      Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)
      % java test
      FileImageInputStream
      java.io.IOException: The parameter is incorrect

      FileImageOutputStream
      java.io.IOException: The parameter is incorrect
      -----------------------------------------------------------


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

        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: