UNOMI-492 Make rules engine more robust when some rules are invalid (null actions)#314
Merged
sergehuber merged 2 commits intomasterfrom Jun 28, 2021
Merged
Conversation
…null actions) - Make sure we handle null actions gracefully instead of generating a NPE and blocking loading of further rules - Add an integration test to test the case of null actions in rule - Improve logging when rules have null or empty conditions and actions
jkevan
requested changes
Jun 25, 2021
| lastRuleCount = ruleMetadatas.size(); | ||
| loopCount++; | ||
| } | ||
| assertEquals("Rule not properly saved", initialRuleCount + 1, lastRuleCount); |
Contributor
There was a problem hiding this comment.
I think we should add a call to ruleService.getAllRules when it is registered.
Because the NPE from UNOMI-492 was generated at this moment:
java.lang.NullPointerException: null
at org.apache.unomi.services.impl.ParserHelper.resolveActionTypes(ParserHelper.java:101) ~[!/:?]
at org.apache.unomi.services.impl.rules.RulesServiceImpl.getAllRules(RulesServiceImpl.java:252) ~[!/:?]
ruleService.getRuleMetadatas() doesnt process the condition types and the actions.
ruleService.getRule(), ruleService.getAllRules() does
Contributor
Author
There was a problem hiding this comment.
yes you are right I need to correct that. Thanks for catching it.
Contributor
Author
There was a problem hiding this comment.
Ok I've modified the test to simply use getRule
jkevan
approved these changes
Jun 28, 2021
asfgit
pushed a commit
that referenced
this pull request
Jun 28, 2021
…null actions) (#314) * UNOMI-492 Make rules engine more robust when some rules are invalid (null actions) - Make sure we handle null actions gracefully instead of generating a NPE and blocking loading of further rules - Add an integration test to test the case of null actions in rule - Improve logging when rules have null or empty conditions and actions * UNOMI-492 Simplify and improve integration test (cherry picked from commit 0fa7cc1)
anatol-sialitski
pushed a commit
that referenced
this pull request
Sep 1, 2021
…null actions) (#314) * UNOMI-492 Make rules engine more robust when some rules are invalid (null actions) - Make sure we handle null actions gracefully instead of generating a NPE and blocking loading of further rules - Add an integration test to test the case of null actions in rule - Improve logging when rules have null or empty conditions and actions * UNOMI-492 Simplify and improve integration test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Here's what was achieved in this PR: