I unwittingly ran a Java program on Linux where the partition that it, it’s properties and logs resided on was close to 100% full. It failed, but after clearing up the problem with the disk space, I ran it again and it failed a second time because it’s properties file was 0 bytes long.
I don’t have source of the file and I don’t want to go as far as decompiling the class files, but I was wondering whether the corruption of the properites could be because the program failed to write to the properties file.
The mystery is that, I expected that the properties would be read-only and don’t recall any items being updated by the program. Could it be that even if the properties are only read, the file is opened in read-write mode and could disappear if the partition is full?
N.b. this program has run without failure or incident at least 1000 times over several years.
That is the most likely explanation. There would have been an exception, but the application could have squashed it … or maybe you didn’t notice the error message. (Indeed, if the application tried to log the error to a file, that would most likely fail too.)
That is unlikely to be the answer in this case. Unlike many languages, in Java the code for reading a file and writing a file involves different stream classes. It is hard to imagine how / why the application’s developer would open a property file for writing (with truncation) if there was never any intention to write it.
The most plausible explanation is that the application does update the properties file. (Try installing the program again, using it, stopping it, and looking at the property file’s modification timestamp.)
And I bet this is the first time you’ve run it while the disk was full 🙂