mirror of
https://github.com/lightbend/config.git
synced 2025-03-22 23:30:27 +08:00
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:
parent
173a783f30
commit
17e0f65d13
@ -261,7 +261,8 @@ final class ConfigDocumentParser {
|
|||||||
private ConfigNodePath parseKey(Token token) {
|
private ConfigNodePath parseKey(Token token) {
|
||||||
if (flavor == ConfigSyntax.JSON) {
|
if (flavor == ConfigSyntax.JSON) {
|
||||||
if (Tokens.isValueWithType(token, ConfigValueType.STRING)) {
|
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 {
|
} else {
|
||||||
throw parseError("Expecting close brace } or a field name here, got "
|
throw parseError("Expecting close brace } or a field name here, got "
|
||||||
+ token);
|
+ token);
|
||||||
@ -279,7 +280,8 @@ final class ConfigDocumentParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
putBack(t); // put back the token we ended with
|
putBack(t); // put back the token we ended with
|
||||||
return PathParser.parsePathNodeExpression(expression.iterator(), null);
|
return PathParser.parsePathNodeExpression(expression.iterator(),
|
||||||
|
baseOrigin.withLineNumber(lineNumber));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user