Skip to content

fix: #899 - Improve HttpUpgradeHandler initialization validation in TCK#973

Merged
markt-asf merged 2 commits intojakartaee:mainfrom
omatheusmesmo:fix/899-upgradehandler-init-validation
Feb 5, 2026
Merged

fix: #899 - Improve HttpUpgradeHandler initialization validation in TCK#973
markt-asf merged 2 commits intojakartaee:mainfrom
omatheusmesmo:fix/899-upgradehandler-init-validation

Conversation

@omatheusmesmo
Copy link
Copy Markdown

Problem

The current TCK tests for HttpUpgradeHandler fail to verify if the container initializes the handler correctly before calling its init(WebConnection) method. Specifically, TCKHttpUpgradeHandler had a default value for its delimiter, making it impossible to detect if setDelimiter() was called by the test servlet or if the container was invoking init() prematurely.

As noted in issue #899, this allows non-compliant implementations to pass the TCK.

Solution

This PR improves the robustness of the TCK by:

  1. Removing default initialization: The delimiter in TCKHttpUpgradeHandler is now null by default.
  2. Explicit Validation: TCKReadListener now performs a null check on the delimiter during construction (which happens inside init()), ensuring it fails fast if initialization was skipped.
  3. Consistency Check: Added a getDelimiter() check in the handler to verify that the delimiter used by the ReadListener matches the one set in the handler.
  4. Typo Fixes: Corrected minor typos in method names.

These changes ensure that:

  • HttpUpgradeHandler instances are properly initialized.
  • init(WebConnection wc) is not called too early.

Related Issue

Fixes #899

Verification Results

  • Code follows project formatting (2-space indentation)
  • Commits follow Eclipse Foundation guidelines and Conventional Commits

Matheus Oliveira added 2 commits February 1, 2026 11:45
…ener

Ensure that HttpUpgradeHandler has been properly initialized before calling
init() by checking that the delimiter is not null in TCKReadListener.
Added getDelimiter() for verification.
…tion

Set default delimiter to null and verify its initialization in
getDelimiter(). Also ensure consistency between the handler and the
read listener to prevent early or missing calls to init().
@markt-asf markt-asf merged commit 3e4b601 into jakartaee:main Feb 5, 2026
1 check passed
@markt-asf
Copy link
Copy Markdown
Contributor

All looks good. Thanks for the PR.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[tck] httpupgradehandler does not make sure that a HttpUpgradeHandler can be initialized properly

2 participants