Skip to content

Commit

Permalink
πŸ“ Combine nested ifs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaoow committed Nov 22, 2021
1 parent ec61670 commit bf7eed4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,13 @@ public SQLiteDatabaseType(@NotNull File file) {

try {
File parent = file.getParentFile();
if (!parent.exists()) {
if (!parent.mkdirs()) {
throw new IOException("The database folder cannot be created.");
}
if (!parent.exists() && !parent.mkdirs()) {
throw new IOException("The database folder cannot be created.");
}

if (!file.exists()) {
if (!file.createNewFile()) {
throw new IOException("The database file cannot be created.");
}
if (!file.exists() && !file.createNewFile()) {
throw new IOException("The database file cannot be created.");
}

} catch (IOException e) {
e.printStackTrace();
}
Expand Down

0 comments on commit bf7eed4

Please sign in to comment.