Skip to content

[ISSUE #10835] fix(common): reject malformed topic config atomically - #11210

Open
beautyarbutin wants to merge 2 commits into
apache:developfrom
beautyarbutin:fix/topic-config-atomic-decode
Open

beautyarbutin wants to merge 2 commits into
apache:developfrom
beautyarbutin:fix/topic-config-atomic-decode

Conversation

@beautyarbutin

Copy link
Copy Markdown
Contributor

Which Issue(s) This PR Fixes

Brief Description

TopicConfig.decode() previously assigned topicName before parsing the mandatory numeric and enum fields. Invalid input could therefore throw and leave the existing object partially mutated.

Parse all mandatory fields into local variables first, return false on invalid numeric or filter-type values, and update the object only after all mandatory fields are valid. Regression coverage verifies truncated input and each invalid mandatory field while comparing the complete original object state.

This follows up on #10845, which was closed without being merged.

How Did You Test This Change?

  • mvn -B -ntp -pl common clean -DskipITs -Dtest=TopicConfigTest -Dspotbugs.skip=true test
  • TopicConfigTest: 4 tests passed
  • Checkstyle: 0 violations

@codecov-commenter

codecov-commenter commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.62%. Comparing base (78b96bc) to head (3552575).

Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #11210      +/-   ##
=============================================
- Coverage      49.71%   49.62%   -0.10%     
+ Complexity     14346    14314      -32     
=============================================
  Files           1390     1390              
  Lines         103190   103197       +7     
  Branches       13493    13493              
=============================================
- Hits           51301    51209      -92     
- Misses         45721    45791      +70     
- Partials        6168     6197      +29     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

TopicConfig.decode mutates state or throws for malformed config

2 participants