-
Bug
-
Resolution: Fixed
-
P3
-
1.0.2, 1.1
-
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
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
- duplicates
-
JDK-1267094 writeUTF arbitrarily truncates Strings
- Closed