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

java.io.RandomAccessFile.writeUTF never throws UTFDataFormatError

XMLWordPrintable

    • 1.1.1
    • sparc
    • solaris_2.4, solaris_2.5
    • Not verified

      ==== Here is the minimized test demonstrating the bug ====
      import java.io.*;
      public class java_io_RandomAccessFile_writeUTF {
        public static void main( String argv[] ) {
          RandomAccessFile f;
          String s="\uffff";
          for (int i=0; i<16; i++)
            s+=s;
          System.out.println("String length= "+s.length());

          try {
            f=new RandomAccessFile("new_file","rw");

            try {
              f.writeUTF(s);
            }
            catch (Error e) {
              System.out.println(e);
            }
            System.out.println("File length now: "+f.length());

          }
          catch (IOException e) {
            System.out.println(e);
          }
        }
       
      }
      ==== Here is the output of the test ====
      String length= 65536
      File length now: 196610

            mr Mark Reinhold
            mgorshen Mikhail Gorshenev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: