Scratch that - you guys are still on Java 1.6 it seems.
I think this might just be a matter of switching the order of the conditions in the if statement.
i.e. if (!dir.mkdirs() && !dir.exists())
However, there still might be a race condition if there are a number of parent directories to create.  If so, this can be addressed by iterating over the parent directories with the same logic.