Enhance JsonMessage converter to handle byte[]

This commit is contained in:
Oleg Zhurakousky
2022-11-03 18:08:52 +01:00
parent acf86d53bd
commit 643f360a54

View File

@@ -77,7 +77,10 @@ public abstract class JsonMapper {
logger.debug(
"String already represents JSON. Skipping conversion in favor of 'getBytes(StandardCharsets.UTF_8'.");
}
result = ((String) value).getBytes(StandardCharsets.UTF_8);
result = value instanceof byte[] ? (byte[]) value : ((String) value).getBytes(StandardCharsets.UTF_8);
}
else if (value instanceof byte[]) {
result = (byte[]) value;
}
return result;
}