mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
Merge pull request #532 from LavaCoref/hotfix/lava/1_json
fix(dbsync): json column of zero length has no value, value parsing s…
This commit is contained in:
@@ -969,17 +969,17 @@ public final class RowsLogBuffer {
|
|||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("!! Unknown JSON packlen = " + meta);
|
throw new IllegalArgumentException("!! Unknown JSON packlen = " + meta);
|
||||||
}
|
}
|
||||||
// len = buffer.getUint16();
|
if (0 == len) {
|
||||||
// buffer.forward(meta - 4);
|
// fixed issue #1 by lava, json column of zero length has no value, value parsing should be skipped
|
||||||
int position = buffer.position();
|
value = "";
|
||||||
Json_Value jsonValue = JsonConversion.parse_value(buffer.getUint8(), buffer, len - 1, charsetName);
|
} else {
|
||||||
StringBuilder builder = new StringBuilder();
|
int position = buffer.position();
|
||||||
jsonValue.toJsonString(builder, charsetName);
|
Json_Value jsonValue = JsonConversion.parse_value(buffer.getUint8(), buffer, len - 1, charsetName);
|
||||||
value = builder.toString();
|
StringBuilder builder = new StringBuilder();
|
||||||
buffer.position(position + len);
|
jsonValue.toJsonString(builder, charsetName);
|
||||||
// byte[] binary = new byte[len];
|
value = builder.toString();
|
||||||
// buffer.fillBytes(binary, 0, len);
|
buffer.position(position + len);
|
||||||
// value = binary;
|
}
|
||||||
javaType = Types.VARCHAR;
|
javaType = Types.VARCHAR;
|
||||||
length = len;
|
length = len;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user