JDK-4533668 : File does not support a means to distinguish severe io problems from disk full
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 1.4.0,6u10
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: generic,linux
  • CPU: generic,x86
  • Submitted: 2001-11-30
  • Updated: 2005-08-25
Related Reports
Duplicate :  
Relates :  
Relates :  
Name: gm110360			Date: 11/30/2001

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)

Problem 1:

  There is currently no way for distinguish between severe io exceptions and
exceptions raised due to a full disk.

Problem 2:
 If a write operation failed the state of the file is unknown (is some or no
data written, can be read from the file?)

In detail: I implented a tempfile class which deletes the file in finalize().
Due to the garbage collection it may take a very long time until an old
tempfile object is removed and therefore the file lays for several hours
unnecessary on the disk and blocking disk space.
In case of a disk full exception the tempfile class may call the garbage
collector to force getting rid of unreferenced tempfiles.
(Review ID: 136520) 

WORK AROUND Name: gm110360 Date: 11/30/2001 Hoping theres enough diskspace. Maybe in case of an ioexception I can call the gc and then try to recover the file data, copy it into another file and write again the data. ======================================================================

EVALUATION We should take on whether it is possible to add a OutOfDiskSpaceException as a subclass of IOException, and throw such an exception in the case of a full disk. At the very least, we should make shure that the message of the IOException thrown states that the disk is full. ###@###.### 2002-04-10