Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SimpleJsonSerializer sometimes fails to produce correct JSON #9614

Closed
ilya-komlev opened this issue Oct 30, 2024 · 0 comments
Closed

SimpleJsonSerializer sometimes fails to produce correct JSON #9614

ilya-komlev opened this issue Oct 30, 2024 · 0 comments

Comments

@ilya-komlev
Copy link

In what version(s) of Spring Integration are you seeing this issue?

6.3.5

Describe the bug

SimpleJsonSerializer has a bug that makes it produce incorrect JSON when dealing with strings that contain $.
For example, when there is a flow with:

  • a FileSplitter that has markers=true, markersJson=true
  • a file like My $1000000 plan.txt that goes through the splitter

To Reproduce

Run the app from the sample shared below.

Expected behavior

Expecting no IOException.

Sample

https://github.com/ilya-komlev/spring-integration-bug-202410301536

@ilya-komlev ilya-komlev added status: waiting-for-triage The issue need to be evaluated and its future decided type: bug labels Oct 30, 2024
@artembilan artembilan added this to the 6.4.0 milestone Oct 30, 2024
@artembilan artembilan added in: core for: backport-to-6.2.x for: backport-to-6.3.x and removed status: waiting-for-triage The issue need to be evaluated and its future decided labels Oct 30, 2024
spring-builds pushed a commit that referenced this issue Oct 30, 2024
Fixes: #9614
Issue link: #9614

The `Matcher.quoteReplacement()` escapes `\` as well as `$`.
However, Jackson tries to resolve special symbol from the escaped `$` and fails as `Unrecognized character escape '$' (code 36)`

* Fix `SimpleJsonSerializer.toElement()` to escape only `\`

(cherry picked from commit 8dad15b)
spring-builds pushed a commit that referenced this issue Oct 30, 2024
Fixes: #9614
Issue link: #9614

The `Matcher.quoteReplacement()` escapes `\` as well as `$`.
However, Jackson tries to resolve special symbol from the escaped `$` and fails as `Unrecognized character escape '$' (code 36)`

* Fix `SimpleJsonSerializer.toElement()` to escape only `\`

(cherry picked from commit 8dad15b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants