1
0
mirror of https://github.com/SKCraft/Launcher.git synced 2024-11-30 13:13:58 +01:00

Tolerate missing terminating newlines in Java release files

Had a report out in the wild of a release file that doesn't end in a
terminating newline, which was causing the parser to blow up.
This commit relaxes the parsing to tolerate EOFs while parsing values.
This commit is contained in:
Henry Le Grys 2021-09-27 21:21:46 +01:00
parent 1c663e1c04
commit 9bd7df4d3c

View File

@ -85,6 +85,7 @@ public class EnvironmentParser {
private String parseValue() throws IOException {
StringBuilder buffer = new StringBuilder();
try {
while (true) {
char c = read();
@ -103,6 +104,10 @@ public class EnvironmentParser {
buffer.append(c);
}
}
} catch (EOFException e) {
// No terminating newline. bad!
return buffer.toString();
}
}
private String parseQuotedPhrase() throws IOException {