if (file.isFile() || file.createNewFile() || file.isFile()) {
return file;
}
throw new IOException("Can't create file '" + file + "'.");
}
<BUG>@SuppressWarnings({"DuplicateCondition", "DuplicateBooleanBranch"})
public static File ensureDirectoryExists(File directory) throws IOException {
</BUG>
if (directory.isDirectory() || directory.mkdirs() || directory.isDirectory()) {
return directory;

if (file.isFile() || file.createNewFile() || file.isFile()) {
return file;
}
throw new IOException("Can't create file '" + file + "'.");
}
@SuppressWarnings({"DuplicateCondition", "DuplicateBooleanBranch"})
@Nonnull
public static File ensureDirectoryExists(@Nonnull File directory) throws IOException {
if (directory.isDirectory() || directory.mkdirs() || directory.isDirectory()) {
return directory;
