Fix race condition when saving null config nodes to non-existent files

This commit is contained in:
Luck 2017-11-23 20:15:29 +00:00
parent a7cb7ec1af
commit d992d7f77c
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
3 changed files with 12 additions and 6 deletions

View File

@ -57,8 +57,10 @@ public class HoconDao extends ConfigurateDao {
@Override
protected void saveFile(File file, ConfigurationNode node) throws IOException {
if (node == null && file.exists()) {
if (node == null) {
if (file.exists()) {
file.delete();
}
return;
}

View File

@ -58,8 +58,10 @@ public class JsonDao extends ConfigurateDao {
@Override
protected void saveFile(File file, ConfigurationNode node) throws IOException {
if (node == null && file.exists()) {
if (node == null) {
if (file.exists()) {
file.delete();
}
return;
}

View File

@ -60,8 +60,10 @@ public class YamlDao extends ConfigurateDao {
@Override
protected void saveFile(File file, ConfigurationNode node) throws IOException {
if (node == null && file.exists()) {
if (node == null) {
if (file.exists()) {
file.delete();
}
return;
}