Skip to content

Commit

Permalink
Never pass null ConfigOrigin to PathParser.parsePathNodeExpression (l…
Browse files Browse the repository at this point in the history
…ightbend#538)

This was causing NPEs on certain parse errors while trying to construct a ConfigException
  • Loading branch information
javaerb authored and ktoso committed Feb 21, 2018
1 parent f09c8d2 commit d225355
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ private AbstractConfigNodeValue parseValue(Token t) {
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);
Expand All @@ -279,7 +280,8 @@ private ConfigNodePath parseKey(Token token) {
}

putBack(t); // put back the token we ended with
return PathParser.parsePathNodeExpression(expression.iterator(), null);
return PathParser.parsePathNodeExpression(expression.iterator(),
baseOrigin.withLineNumber(lineNumber));
}
}

Expand Down

0 comments on commit d225355

Please sign in to comment.