Fix potential NPE for switch statement when null case is missing#20044
Fix potential NPE for switch statement when null case is missing#20044gaobinlong merged 3 commits intoopensearch-project:mainfrom
Conversation
Signed-off-by: Binlong Gao <gbinlong@amazon.com>
|
❌ Gradle check result for 0df3ac1: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
❌ Gradle check result for 0df3ac1: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #20044 +/- ##
============================================
+ Coverage 73.27% 73.36% +0.09%
- Complexity 71541 71641 +100
============================================
Files 5789 5789
Lines 327153 327160 +7
Branches 47157 47154 -3
============================================
+ Hits 239729 240032 +303
+ Misses 68185 67903 -282
+ Partials 19239 19225 -14 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Binlong Gao <gbinlong@amazon.com>
Signed-off-by: Binlong Gao <gbinlong@amazon.com>
|
❌ Gradle check result for 1293555: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
sandeshkr419
left a comment
There was a problem hiding this comment.
LGTM, thanks for adding the test cases for the changes as well!
…nsearch-project#20044) * Fix potential NPE for switch case Signed-off-by: Binlong Gao <gbinlong@amazon.com> * Remove null case if checked null before switch Signed-off-by: Binlong Gao <gbinlong@amazon.com> * Add more unit tests Signed-off-by: Binlong Gao <gbinlong@amazon.com> --------- Signed-off-by: Binlong Gao <gbinlong@amazon.com>
…nsearch-project#20044) * Fix potential NPE for switch case Signed-off-by: Binlong Gao <gbinlong@amazon.com> * Remove null case if checked null before switch Signed-off-by: Binlong Gao <gbinlong@amazon.com> * Add more unit tests Signed-off-by: Binlong Gao <gbinlong@amazon.com> --------- Signed-off-by: Binlong Gao <gbinlong@amazon.com>
Description
In previous some PRs that replace explicit type conversion with instanceof pattern variable: #19979 and #19938, we change some if...else to switch...case, one issue is that if
nullcase is missing in switch, once the switch value is null, NPE will be thrown, so this PR aims to fix the potential NPE for the preivous change.Related Issues
No issue.
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.