Skip to content

Remove Arrays.toString() from JsonDeserializer #2838

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

Closed
garyrussell opened this issue Oct 11, 2023 Discussed in #2837 · 0 comments · Fixed by #2841
Closed

Remove Arrays.toString() from JsonDeserializer #2838

garyrussell opened this issue Oct 11, 2023 Discussed in #2837 · 0 comments · Fixed by #2841

Comments

@garyrussell
Copy link
Contributor

Discussed in #2837

Originally posted by ccrafael October 11, 2023
Actually in the class org.springframework.kafka.support.serializer.JsonDeserializer when an error happen it is handled like this:

catch (IOException e) {
		throw new SerializationException("Can't deserialize data [" + Arrays.toString(data) +
				"] from topic [" + topic + "]", e);
	}

which I think is very inefficient as each byte of the payload is duplicated as a long array of numbers written as a String in the exception message. In my humble opinion the Arrays.toString(data) should be removed from the message and the original data[] object should be added to the SerializationException class.

garyrussell added a commit to garyrussell/spring-kafka that referenced this issue Oct 11, 2023
Resolves spring-projects#2838

Previously, the exception message contained the entire JSON content.

**cherry pick to 3.0.x (spring-projects#2839) and 2.9. (spring-projects#2840)**

I will add What's New? content to each branch after the merge.
artembilan pushed a commit that referenced this issue Oct 11, 2023
Resolves #2838

Previously, the exception message contained the entire JSON content.

**cherry pick to 3.0.x (#2839) and 2.9. (#2840)**

I will add What's New? content to each branch after the merge.
artembilan pushed a commit that referenced this issue Oct 11, 2023
Resolves #2839

Previously, the exception message contained the entire JSON content.

**cherry pick to 3.0.x (#2839) and 2.9. (#2840)**

I will add What's New? content to each branch after the merge.

(cherry picked from commit 9d76bde)
artembilan pushed a commit that referenced this issue Oct 11, 2023
Resolves #2840

Previously, the exception message contained the entire JSON content.

**cherry pick to 3.0.x (#2839) and 2.9. (#2840)**

I will add What's New? content to each branch after the merge.

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

Successfully merging a pull request may close this issue.

1 participant