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

PrintWriter does not throw IOException for full floppy disk

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 1.2.2
    • core-libs
    • x86
    • windows_nt

      Name: stC104175 Date: 05/17/2000


      java version "1.3.0"
      Java (TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot (TM) Client VM (build 1.3.0-C, mixed mode)

      Write files to an almost full floppy disk. Files will be properly written until
      floppy disk is full. After that _no_ exception is thrown that the disk is full,
      but empty files of 0KB are written to floppy until name-table fills up. Then an
      exception is thrown.


      public class SimplCon {

      public SimplCon () {

      }

          static public void main(String args[]) {
              try {
                  String filename = "a:\\file";
                  File f;
                  for (int i = 0; ; i++) {
                      f = new File(filename + i + ".txt");
                      FileOutputStream fos = new FileOutputStream(f);
                      PrintWriter w = new PrintWriter(new OutputStreamWriter(fos));
                      String text = "blah blah blah blah blah blah blah blah";

                      w.print(text);
                      w.flush();
                      fos.flush();
                      fos.close();
                      w.close();
                  }
              } catch (Exception e) {
                  System.err.println(e.getMessage());
                  e.printStackTrace(new PrintStream(System.err));
              }
          }

      }
      (Review ID: 104951)
      ======================================================================

            iris Iris Clark
            stompkinsunw Sean Tompkins (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: