Never pass null ConfigOrigin to PathParser.parsePathNodeExpression (#538)

This was causing NPEs on certain parse errors while trying to construct a ConfigException
This commit is contained in:
Ërb 2018-02-21 08:55:34 -05:00 committed by Konrad `ktoso` Malawski
parent 173a783f30
commit 17e0f65d13

View File

@ -261,7 +261,8 @@ final class ConfigDocumentParser {
private ConfigNodePath parseKey(Token token) {
if (flavor == ConfigSyntax.JSON) {
if (Tokens.isValueWithType(token, ConfigValueType.STRING)) {
return PathParser.parsePathNodeExpression(Collections.singletonList(token).iterator(), null);
return PathParser.parsePathNodeExpression(Collections.singletonList(token).iterator(),
baseOrigin.withLineNumber(lineNumber));
} else {
throw parseError("Expecting close brace } or a field name here, got "
+ token);
@ -279,7 +280,8 @@ final class ConfigDocumentParser {
}
putBack(t); // put back the token we ended with
return PathParser.parsePathNodeExpression(expression.iterator(), null);
return PathParser.parsePathNodeExpression(expression.iterator(),
baseOrigin.withLineNumber(lineNumber));
}
}