From 1d7c6f9407be23b5fd20d8df0bc335b7203f2f2c Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Wed, 11 Oct 2023 12:44:56 -0400 Subject: [PATCH] GH-2838: JSON Deser. Remove Verbose Exc. Message Resolves https://github.com/spring-projects/spring-kafka/issues/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. --- .../kafka/support/serializer/JsonDeserializer.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/spring-kafka/src/main/java/org/springframework/kafka/support/serializer/JsonDeserializer.java b/spring-kafka/src/main/java/org/springframework/kafka/support/serializer/JsonDeserializer.java index a86f1341f5..14b4a218bb 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/support/serializer/JsonDeserializer.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/support/serializer/JsonDeserializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2021 the original author or authors. + * Copyright 2015-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -584,9 +584,8 @@ public T deserialize(String topic, Headers headers, byte[] data) { try { return deserReader.readValue(data); } - catch (IOException e) { - throw new SerializationException("Can't deserialize data [" + Arrays.toString(data) + - "] from topic [" + topic + "]", e); + catch (IOException ex) { + throw new SerializationException("Can't deserialize data from topic [" + topic + "]", ex); } }