Skip to content

Commit

Permalink
Fix config first create issues
Browse files Browse the repository at this point in the history
(cherry picked from commit ee99268)
  • Loading branch information
StartsMercury committed Nov 21, 2024
1 parent 04bd52a commit efd9eee
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Comparator;
Expand Down Expand Up @@ -113,6 +114,10 @@ public void reloadConfig() {
}
}

/**
* @return {@code false} if loading encountered json syntax exceptions;
* {@code true} otherwise.
*/
private boolean loadConfig() {
this.logger.debug("[{}] Loading config...", VslConstants.NAME);

Expand All @@ -124,9 +129,12 @@ private boolean loadConfig() {
lines = lineStream
.filter(line -> !line.endsWith(VslConstants.IGNORE_TAG))
.collect(Collectors.toCollection(ArrayList::new));
} catch (final NoSuchFileException cause) {
this.logger.info("[{}] Config does not exist, using default", VslConstants.NAME);
return true;
} catch (final IOException cause) {
this.logger.warn("[{}] Unable to read config json", VslConstants.NAME, cause);
return false;
return true;
}

try{
Expand Down

0 comments on commit efd9eee

Please sign in to comment.