[Edge] EssCore: Fix NPE in "KeepingAllNearEqual" if mergedResult is null (or result.length is 0)#3277
Merged
sfeilmeier merged 1 commit intoOpenEMS:developfrom Aug 23, 2025
Conversation
We experienced NPE with the solver strategy of "KeepingAllNearEqual" by using multiple ESS and put them into a cluster. When those ESS were at 0 % no solution could be found and the mergedResult becomes null. To prevent NPE we check for the null occurence and if the result.length is greater than 0 (the last one might be not nec. but I still put this here in case it might occurr) And return null if either is the case. Same as previously done (like checking for NaN) After implementing this change, we did not experience the NPE anymore
Codecov Report❌ Patch coverage is ❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (75.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #3277 +/- ##
=============================================
- Coverage 59.42% 59.37% -0.05%
Complexity 113 113
=============================================
Files 2763 2763
Lines 119343 119347 +4
Branches 8889 8891 +2
=============================================
- Hits 70907 70845 -62
- Misses 45766 45845 +79
+ Partials 2670 2657 -13 🚀 New features to boost your workflow:
|
sfeilmeier
approved these changes
Aug 23, 2025
Contributor
sfeilmeier
left a comment
There was a problem hiding this comment.
Thank you for providing a fix!
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.
We experienced NPE with the solver strategy of "KeepingAllNearEqual" when using multiple (2) ESS and put them into a cluster.
("Error during handleEvent(). NullPointerException: null")
When those two ESS were at 0 % no solution could be found and the mergedResult becomes null.
To prevent the NPE we check if the mergedResult is null and if the result.length is greater than 0 (the latter one might be not nec. but I still put this here in case it might occurr)
And return null if either is the case. Same as previously done (like when checking for NaN)
After implementing this change, we did not experience the NPE anymore