-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[Bug] [seatunnel-connector-http-base] An NPE (NullPointerException) will occur when the pageField is null #9498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ill occur when the pageField is null apache#9474
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request fixes a NullPointerException in HttpSourceReader by adding a null check for pageField before accessing it in the page map logic.
- Added
pageField != nullguard in the fallback branch to prevent NPE - No new tests were provided to cover the null-case scenario
Comments suppressed due to low confidence (2)
seatunnel-connectors-v2/connector-http/connector-http-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/http/source/HttpSourceReader.java:272
- There is no unit test covering the scenario where
pageFieldis null. Please add a test case that setspageFieldto null and verifies thatprocessPageMapcompletes without throwing an exception.
} else if (pageField != null && map.containsKey(pageField)) {
seatunnel-connectors-v2/connector-http/connector-http-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/http/source/HttpSourceReader.java:269
- [nitpick] Consider moving the null check for
pageFieldto an earlier guard or using an early return at the top ofprocessPageMapto simplify the conditional branches and improve readability.
}
|
@Hisoka-X please review , thank you. |
|
Please add test case. |
|
Hisoka-X
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Alberne
…ill occur when the pageField is null (apache#9498) Co-authored-by: xinlong <[email protected]>
…ill occur when the pageField is null (apache#9498) Co-authored-by: xinlong <[email protected]>
Purpose of this pull request
close issue #9474
Does this PR introduce any user-facing change?
'No'
How was this patch tested?
not added, this code is very simple and clear. only check whether pageField is null , to avoid occur an NPE (NullPointerException)
Check list
New License Guide