Skip to content

KNOX-3317: Fixed NPE when no token-metadata-headers are declared for ICEBERG-REST#1225

Merged
smolnar82 merged 1 commit intoapache:masterfrom
smolnar82:KNOX-3317
May 8, 2026
Merged

KNOX-3317: Fixed NPE when no token-metadata-headers are declared for ICEBERG-REST#1225
smolnar82 merged 1 commit intoapache:masterfrom
smolnar82:KNOX-3317

Conversation

@smolnar82
Copy link
Copy Markdown
Contributor

KNOX-3317 - Add unit tests for TokenMetadataHeaderHandler

What changes were proposed in this pull request?

This PR introduces comprehensive unit tests for the TokenMetadataHeaderHandler class within the gateway-service-restcatalog module.
Specifically, it adds tests to:

  • Verify that no NullPointerException occurs when the token-metadata-headers configuration parameter is missing (null).
  • Ensure headers are correctly applied to outbound requests based on inbound client credentials and token metadata.
  • Validate support for custom header prefixes.
  • Confirm graceful handling of missing metadata items.

How was this patch tested?

The patch was tested by running the newly created unit tests and existing tests in the gateway-service-restcatalog module:
mvn -pl gateway-service-restcatalog test

The test suite TokenMetadataHeaderHandlerTest includes:

  • testNullTokenMetadataHeadersConfig: Verifies the fix for the NPE.
  • testEmptyTokenMetadataHeadersConfig: Verifies handling of empty configuration strings.
  • testApplyHeaders: Verifies correct mapping of multiple metadata items to headers.
  • testApplyHeadersCustomPrefix: Verifies that custom header prefixes are respected.
  • testApplyHeadersMissingMetadata: Verifies that headers are not added if metadata is missing.

Integration Tests

N/A

UI changes

(None)

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

Test Results

21 tests   21 ✅  1s ⏱️
 1 suites   0 💤
 1 files     0 ❌

Results for commit 49bd998.

@smolnar82 smolnar82 merged commit 7b5e518 into apache:master May 8, 2026
3 checks passed
@smolnar82 smolnar82 deleted the KNOX-3317 branch May 8, 2026 10:04
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.

2 participants