Environnment : Linux (Ubuntu 8.04) / intel / JRE build 1.6.0_10-beta-b25
In some rare cases, the audiofiles are truncated after a commit(). I managed to
reproduce this few times (this is not always reproductable) in following
- Access to a remote mp3 file located on a SMB NAS service thought wifi
- MP3 without any tag
- Tag creation + tag filled up with all available data (genre, )
My code was :
AudioFile audioFile = AudioFileIO
Tag tag = audioFile.getTag();
if (tag == null)
As a result, see the provided sample file.
After some searches, I may have a clue : RandomAccessFile are instanciated in
"rw" mode. So my feeling is that in very seldom conditions, the temporary file
may not be actually flushed before being renamed to the final file. I changed
all occurences of new RandomAccessFile(..,"rw") to new
RandomAccessFile(..,"rws") to force synchronous writing of tags.
What do you think about it ?
I'll continue testing but for now, I didn't observed the problem (of course,
I'll keep you in touch if I reproduce this again despite my patch).