Skip to content

Commit

Permalink
GH-686: Handle tombstones in Json Ser/Deser
Browse files Browse the repository at this point in the history
Fixes #686

**Cherry-pick to 2.1.x, 2.0.x, 1.3.x**

(cherry picked from commit 8dc1dcd)
  • Loading branch information
garyrussell authored and artembilan committed Jun 13, 2018
1 parent 62e9325 commit 4fe846d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ private void addTargetPackageToTrusted() {

@Override
public T deserialize(String topic, Headers headers, byte[] data) {
if (data == null) {
return null;
}
JavaType javaType = this.typeMapper.toJavaType(headers);
if (javaType == null) {
Assert.state(this.targetType != null, "No type information in headers and no default type provided");
Expand All @@ -233,6 +236,9 @@ public T deserialize(String topic, Headers headers, byte[] data) {

@Override
public T deserialize(String topic, byte[] data) {
if (data == null) {
return null;
}
if (this.reader == null) {
this.reader = this.objectMapper.readerFor(this.targetType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ else if (config instanceof String) {

@Override
public byte[] serialize(String topic, Headers headers, T data) {
if (data == null) {
return null;
}
if (this.addTypeInfo && headers != null) {
this.typeMapper.fromJavaType(this.objectMapper.constructType(data.getClass()), headers);
}
Expand All @@ -138,6 +141,9 @@ public byte[] serialize(String topic, Headers headers, T data) {

@Override
public byte[] serialize(String topic, T data) {
if (data == null) {
return null;
}
try {
byte[] result = null;
if (data != null) {
Expand Down

0 comments on commit 4fe846d

Please sign in to comment.