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

FileOutputStream.writeBytes() throws IOException which omits disk name

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.3.1, 5.0
    • core-libs
    • x86
    • windows_nt, windows_xp

      Name: gm110360 Date: 02/26/2002


      FULL PRODUCT VERSION :
      java version "1.3.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
      Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)


      FULL OPERATING SYSTEM VERSION :

      Windows NT Version 4.0



      A DESCRIPTION OF THE PROBLEM :
      If FileOutputStream generates an IOException, then
      it should also contain the file name.
      For e.g. if the disk runs out of space while writing
      then, FileOutputStream class throw an IOException with
      the message "There is not enough space on the disk" but
      does not specify which disk.
      In a simple program it is not a problem but in a complex
      multi-threaded program where the application writes into
      different files on different disks, the users will not
      know which disk is causing the problem.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Write a small test program that continually writes into
      a disk with little space.
      2. Run the program and wait until the disk runs out of
      space and observe the message. It will be some thing like
      this ....

      java.io.IOException: There is not enough space on the disk

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Probably the correct message should be

      java.io.IOException: There is not enough space on the disk
      (a:\abc.dat)
      ....



      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "main" java.io.IOException: There is not enough space on
      the disk
              at java.io.FileOutputStream.writeBytes(Native Method)
              at java.io.FileOutputStream.write(FileOutputStream.java:212)
              at java.io.ObjectOutputStream.drain(ObjectOutputStream.java:1463)
              at java.io.ObjectOutputStream.setBlockData(ObjectOutputStream.java:1486)
              at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:407)
              at Test.main(Test.java:10)


      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.io.*;
      public class Test implements Serializable
      {
      int a[] = new int[50000];
      public static void main(String[] args) throws Exception
      {
      ObjectOutputStream f = new ObjectOutputStream(new FileOutputStream
      ("a:\\abc.dat"));
      Test d = new Test();
      for(int i=0; i<10000; i++){
      f.writeObject(d);
      f.flush();
      }
      }
      }

      ---------- END SOURCE ----------
      (Review ID: 143324)
      ======================================================================

            jhangalsunw Jayalaxmi Hangal (Inactive)
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: