Name: akC57697 Date: 06/02/99
Java io incorrectly works with files on mapped disks
For example , using SUNWNFS file system (provided by Solstice
NFS client).
The example:
-----------------------------------------------------------------------
public class Test {
public static void main(String[] argv) {
try {
char data[] = { '0', '1', '2', '3', '4', '5' };
char empty[] = { };
java.io.FileWriter f = new java.io.FileWriter("tempfile");
f.write(data);
f.close();
java.io.FileReader fr = new java.io.FileReader("tempfile");
System.out.println("The number of bytes read 1:" + fr.read(data));
fr.close();
f = new java.io.FileWriter("tempfile");
f.write(empty); // Nothing
f.close();
fr = new java.io.FileReader("tempfile");
System.out.println("The number of bytes read 2:" + fr.read(data));
fr.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
-----------------------------------------------------------------------
Output :
The number of bytes read 1:6
The number of bytes read 2:6
expected (if use local disk):
The number of bytes read 1:6
The number of bytes read 2:-1
======================================================================
- duplicates
-
JDK-4264105 writing data via a UNC pathname and reading via NFS or URL is unreliable
- Closed