yurloc commented on code in PR #5778:
URL:
https://github.com/apache/incubator-kie-drools/pull/5778#discussion_r1521550986
##########
drools-compiler/src/main/java/org/drools/compiler/rule/builder/PatternBuilder.java:
##########
@@ -1805,15 +1805,15 @@ protected ConstraintConnectiveDescr
parseExpression(final RuleBuildContext conte
final String
expression) {
DrlExprParser parser =
DrlExprParserFactory.getDrlExprParser(context.getConfiguration().getOption(LanguageLevelOption.KEY));
ConstraintConnectiveDescr result =
parser.parse(normalizeEval(expression));
- result.setResource(patternDescr.getResource());
- result.copyLocation(original);
if (parser.hasErrors()) {
for (DroolsParserException error : parser.getErrors()) {
registerDescrBuildError(context, patternDescr,
"Unable to parse pattern
expression:\n" + error.getMessage());
}
return null;
}
+ result.setResource(patternDescr.getResource());
+ result.copyLocation(original);
Review Comment:
`parser.hasErrors()` check needs to be performed _before_ accessing
`result`. If the parsers has errors, `result` is null.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]