Never pass null ConfigOrigin to PathParser.parsePathNodeExpression

This was causing NPEs on certain parse errors while trying to construct a ConfigException
This commit is contained in:
Ërb 2018-01-11 12:32:46 -05:00 committed by GitHub
parent eeb95825bf
commit ce45141a67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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));
}
}