Skip to content

Conversation

@axreldable
Copy link
Contributor

What's Changed

CallHeaders has 3 implementations:

  • FlightCallHeaders
  • ErrorFlightMetadata
  • MetadataAdapter

Before this change:
MetadataAdapter could return null from getAll(String) and getAllByte(String) when there were no values for the key, because gRPC’s Metadata.getAll() returns null in that case. This was undocumented and forced callers to null-check.

After this change:
All 3 implementations consistently return an empty iterable (never null) when the key is absent or has no values. The contract is documented on the interface and covered by tests for each implementation.

This contains breaking changes.
MetadataAdapter.getAll(String) and getAllByte(String) return empty iterator instead of null.

Closes #139.

@github-actions

This comment has been minimized.

@axreldable
Copy link
Contributor Author

Please add the enhancement label.

Copy link
Contributor

@ennuite ennuite left a comment

Choose a reason for hiding this comment

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

Hello @axreldable
This looks good to me, thank you for it.

I note that this also fixes an NPE in MetadataAdapter.getAllByte(String key)

@lidavidm lidavidm added the enhancement PRs that add or improve features. label Feb 10, 2026
@github-actions github-actions bot added this to the 19.0.0 milestone Feb 10, 2026
@axreldable
Copy link
Contributor Author

Hello @axreldable This looks good to me, thank you for it.

I note that this also fixes an NPE in MetadataAdapter.getAllByte(String key)

Correct, it fixes NPE for getAll(key).spliterator() in MetadataAdapter.getAllByte(String key) method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change enhancement PRs that add or improve features.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Java][Docs] Undocumented null return from CallHeaders.getAll()

3 participants