mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
fixed compiler error
This commit is contained in:
@@ -1,9 +1,5 @@
|
|||||||
package com.alibaba.otter.canal.common.utils;
|
package com.alibaba.otter.canal.common.utils;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.alibaba.fastjson.TypeReference;
|
|
||||||
import com.alibaba.fastjson.serializer.*;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.net.Inet4Address;
|
import java.net.Inet4Address;
|
||||||
@@ -12,6 +8,15 @@ import java.net.InetAddress;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.TypeReference;
|
||||||
|
import com.alibaba.fastjson.serializer.JSONSerializer;
|
||||||
|
import com.alibaba.fastjson.serializer.ObjectSerializer;
|
||||||
|
import com.alibaba.fastjson.serializer.PropertyFilter;
|
||||||
|
import com.alibaba.fastjson.serializer.SerializeConfig;
|
||||||
|
import com.alibaba.fastjson.serializer.SerializeWriter;
|
||||||
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字节处理相关工具类
|
* 字节处理相关工具类
|
||||||
*
|
*
|
||||||
@@ -84,17 +89,6 @@ public class JsonUtils {
|
|||||||
public static InetAddressSerializer instance = new InetAddressSerializer();
|
public static InetAddressSerializer instance = new InetAddressSerializer();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(JSONSerializer serializer, Object object, Object fieldName, Type type, int i) throws IOException {
|
|
||||||
if (object == null) {
|
|
||||||
serializer.writeNull();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
InetAddress address = (InetAddress) object;
|
|
||||||
// 优先使用name
|
|
||||||
serializer.write(address.getHostName());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features)
|
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (object == null) {
|
if (object == null) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.alibaba.otter.canal.parse.inbound.mysql;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -147,7 +148,8 @@ public class MysqlConnection implements ErosaConnection {
|
|||||||
HeaderPacket binlogDumpHeader = new HeaderPacket();
|
HeaderPacket binlogDumpHeader = new HeaderPacket();
|
||||||
binlogDumpHeader.setPacketBodyLength(cmdBody.length);
|
binlogDumpHeader.setPacketBodyLength(cmdBody.length);
|
||||||
binlogDumpHeader.setPacketSequenceNumber((byte) 0x00);
|
binlogDumpHeader.setPacketSequenceNumber((byte) 0x00);
|
||||||
PacketManager.write(connector.getChannel(), binlogDumpHeader.toBytes(), cmdBody);
|
PacketManager.write(connector.getChannel(), new ByteBuffer[] { ByteBuffer.wrap(binlogDumpHeader.toBytes()),
|
||||||
|
ByteBuffer.wrap(cmdBody) });
|
||||||
|
|
||||||
connector.setDumping(true);
|
connector.setDumping(true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user