Repository navigation
fix(serialization): support content-type parameters and case-insensitivity in text factories - #2236
Merged
Vincent Biret (baywet) merged 3 commits intoNov 4, 2026
Conversation
…ivity in text factories Strip MIME parameters and compare content types case-insensitively in TextParseNodeFactory and TextSerializationWriterFactory per RFC 2045. Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
… and case-insensitivity in TextParseNodeFactory Add unit and parameterized tests verifying TextParseNodeFactory accepts MIME parameters and case variants per RFC 2045. Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
… and case-insensitivity in TextSerializationWriterFactory Add unit and parameterized tests verifying TextSerializationWriterFactory accepts MIME parameters and case variants per RFC 2045. Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
Contributor
Author
|
Vincent Biret (@baywet) Opened this PR to address #2235 by aligning Previously, both text factories used strict string equality ( The PR is structured across 3 focused commits:
Verified locally: |
Vincent Biret (baywet)
approved these changes
Nov 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2235
TextParseNodeFactory.getParseNode()andTextSerializationWriterFactory.getSerializationWriter()used strict string equality (!contentType.equals(validContentType)) to validate the content type againsttext/plain.This caused both factories to reject valid content types that contain MIME parameters (such as
text/plain; charset=utf-8ortext/plain; charset=UTF-8) or use case variants (e.g.TEXT/PLAINorText/Plain; charset=utf-8).Per RFC 2045 §5.1, media types and subtypes are case-insensitive and parameter-agnostic for type identification.
Changes
TextParseNodeFactoryandTextSerializationWriterFactoryto strip MIME parameters (split(";", 2)[0].trim()) and compare against the valid content type case-insensitively (equalsIgnoreCase), matching the pattern implemented inMultipartSerializationWriterFactory(fix(multipart): support content-type parameters and case-insensitivity in MultipartSerializationWriterFactory #2229).TextParseNodeFactoryTestwith unit and parameterized regression tests covering validtext/plain, content types with charset parameters, uppercase, mixed case, invalid types, empty strings, and delimiter-only inputs.TextSerializationWriterFactoryTestwith corresponding unit and parameterized regression tests for the writer factory.Verification
spotlessCheck/spotlessApply: PASScompileJava/compileTestJava: PASSspotbugsMain/spotbugsTest: PASS:components:serialization:text:check: PASS (100% tests passing):components:bundle:check: PASS