==== 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