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

java.io.FileReader/Writer work incorrectly with NFS-mounted files (win32)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.2.2, 1.3.0
    • core-libs
    • x86, sparc
    • solaris_2.5.1, windows_nt



      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

      ======================================================================

            mmcclosksunw Michael Mccloskey (Inactive)
            akuzminorcl Alexander Kuzmin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: