java.io.file renameTo return false

Had a issue today where a java function which moves files stopped working. I realised that Java`s io.file.renameTo only throws Exceptions for some scenarios. For some errors, it will only return false when something goes wrong.

Only getting true/false on a rather vital operation is rather silly, so my “fix” was to move over to a library from Apache, aka FileUtils.

So now i simply do this: FileUtils.moveFile(oldFile, newFile);

That function actually throws exceptions when something fails 🙂