Skip to content

Conversation

@yangjm-41
Copy link
Contributor

Fix NullPointerException caused by empty choice.index() and Map.of() with null value

  • Resolve the issue where choice.index() returns an empty value, leading to a NullPointerException.
  • Ensure that Map.of() does not accept null values to prevent runtime errors.
  • Implement null checks and provide default values to handle edge cases gracefully.
  • Update unit tests to cover scenarios where choice.index() is empty or null.

Thank you for taking time to contribute this pull request!
You might have already read the [contributor guide][1], but as a reminder, please make sure to:

  • Sign the contributor license agreement
  • Rebase your changes on the latest main branch and squash your commits
  • Add/Update unit tests as needed
  • Run a build and make sure all tests pass prior to submission

Fix NullPointerException caused by empty choice.index() and Map.of() with null value

- Resolve the issue where choice.index() returns an empty value, leading to a NullPointerException.
- Ensure that Map.of() does not accept null values to prevent runtime errors.
- Implement null checks and provide default values to handle edge cases gracefully.
- Update unit tests to cover scenarios where choice.index() is empty or null.


Signed-off-by: yiangjm <[email protected]>
@markpollack markpollack added this to the 1.1.x milestone May 29, 2025
spring-builds pushed a commit that referenced this pull request Jun 18, 2025
Fixes #3376

Fix NullPointerException caused by empty choice.index() and Map.of() with null value

- Resolve the issue where choice.index() returns an empty value, leading to a NullPointerException.
- Ensure that Map.of() does not accept null values to prevent runtime errors.
- Implement null checks and provide default values to handle edge cases gracefully.
- Update unit tests to cover scenarios where choice.index() is empty or null.

Signed-off-by: yiangjm <[email protected]>
(cherry picked from commit 37b83fd)
@ilayaperumalg
Copy link
Member

@yangjm-41 Thanks for the PR fixing the NPE.

scionaltera pushed a commit to scionaltera/spring-ai that referenced this pull request Sep 3, 2025
Auto-cherry-pick to 1.0.x
Fixes spring-projects#3376

Fix NullPointerException caused by empty choice.index() and Map.of() with null value

- Resolve the issue where choice.index() returns an empty value, leading to a NullPointerException.
- Ensure that Map.of() does not accept null values to prevent runtime errors.
- Implement null checks and provide default values to handle edge cases gracefully.
- Update unit tests to cover scenarios where choice.index() is empty or null.

Signed-off-by: yiangjm <[email protected]>
chedim pushed a commit to couchbaselabs/spring-ai that referenced this pull request Sep 19, 2025
Auto-cherry-pick to 1.0.x
Fixes spring-projects#3376

Fix NullPointerException caused by empty choice.index() and Map.of() with null value

- Resolve the issue where choice.index() returns an empty value, leading to a NullPointerException.
- Ensure that Map.of() does not accept null values to prevent runtime errors.
- Implement null checks and provide default values to handle edge cases gracefully.
- Update unit tests to cover scenarios where choice.index() is empty or null.

Signed-off-by: yiangjm <[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.

5 participants