Skip to content

Conversation

@Alberne
Copy link
Contributor

@Alberne Alberne commented Jun 25, 2025

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

Copy link
Contributor

Copilot AI left a 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 != null guard 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 pageField is null. Please add a test case that sets pageField to null and verifies that processPageMap completes 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 pageField to an earlier guard or using an early return at the top of processPageMap to simplify the conditional branches and improve readability.
                }

@Alberne
Copy link
Contributor Author

Alberne commented Jun 25, 2025

@Hisoka-X please review , thank you.

@Hisoka-X
Copy link
Member

Please add test case.

@nielifeng
Copy link
Contributor

@Alberne

@Alberne
Copy link
Contributor Author

Alberne commented Jun 30, 2025

Please add test case.
@Hisoka-X done, please review code,

Copy link
Member

@Hisoka-X Hisoka-X left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Alberne

@corgy-w corgy-w merged commit b898a32 into apache:dev Jun 30, 2025
4 checks passed
@Alberne Alberne deleted the hotfix-http-v2-npe-error branch June 30, 2025 08:38
chncaesar pushed a commit to chncaesar/seatunnel that referenced this pull request Jun 30, 2025
…ill occur when the pageField is null (apache#9498)

Co-authored-by: xinlong <[email protected]>
dybyte pushed a commit to dybyte/seatunnel that referenced this pull request Jul 23, 2025
…ill occur when the pageField is null (apache#9498)

Co-authored-by: xinlong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants