Skip to content

Commit

Permalink
Config file parsing tolerate unexpected ids - just ignoring them.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgobbo committed May 29, 2019
1 parent 3ecd9e3 commit 425313a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/main/java/ch/psi/jstriptool/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,10 @@ void parse(String line) {
grid = c;
break;
default:
index = Integer.valueOf(code[2].substring(5));
colors[index - 1] = c;
if (code[2].startsWith("Color")){
index = Integer.valueOf(code[2].substring(5));
colors[index - 1] = c;
}
break;
}
break;
Expand Down Expand Up @@ -333,7 +335,11 @@ void parse(String line) {

public void open(File file) throws IOException {
try (Stream<String> lines = Files.lines(file.toPath())) {
lines.forEachOrdered(line -> parse(line));
try{
lines.forEachOrdered(line -> parse(line));
} catch (Exception ex){
ex.printStackTrace();
}
}
}

Expand Down

0 comments on commit 425313a

Please sign in to comment.