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

java.io.RandomAccessFile does not work on large files (1.3, hotspot & native)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 1.3.0
    • Fix Version/s: 1.3.0
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      kestrel
    • CPU:
      generic
    • OS:
      generic

      Description

      Sometime during Kestrel we broke support for large files in the
      RandomAccessFile class.

          import java.io.*;

          public class Big {

      public static void main(String[] args) throws Exception {
      File f = new File("big");
      f.delete();
      RandomAccessFile raf = new RandomAccessFile(f, "rw");
      raf.seek((long)Integer.MAX_VALUE * 2);
      raf.write('x');
      long l = raf.length();
      System.out.println((l == 0) ? "FAIL" : ("OK: " + l));
      raf.close();
      f.delete();
      }

          }

      This only fails with the classic/native) and HotSpot; it works fine with
      classic/green, and fine in 1.2.0 and 1.2.2:

          % /local/jdk/1.2.0/bin/java -green Big
          OK: 4294967295
          % /local/jdk/1.2.0/bin/java -native Big
          OK: 4294967295
          % /local/jdk/1.2.2/bin/java -green Big
          OK: 4294967295
          % /local/jdk/1.2.2/bin/java -native Big
          OK: 4294967295
          % /local/jdk/1.3beta/bin/java -green Big
          OK: 4294967295
          % /local/jdk/1.3beta/bin/java -native Big
          Exception in thread "main" java.io.IOException: Value too large for defined data type
      at java.io.RandomAccessFile.seek(Native Method)
      at Big.main(Big.java:11)
          % /local/jdk/1.3/bin/java -hotspot Big
          Exception in thread "main" java.io.IOException: Value too large for defined data type
      at java.io.RandomAccessFile.seek(Native Method)
      at Big.main(Big.java:11)
          %

      This regression should be fixed for Kestrel FCS.
      It was discovered while evaluating a fix for 4288670.

      -- mr@eng 1999/11/10

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mr Mark Reinhold
              Reporter:
              mr Mark Reinhold
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: