1
0
Эх сурвалжийг харах

fixed issue #296, support getWithoutAck/ack/rollback for NPE

七锋 7 жил өмнө
parent
commit
bef6a66eaf

+ 5 - 5
client/src/main/java/com/alibaba/otter/canal/client/impl/ClusterCanalConnector.java

@@ -184,7 +184,7 @@ public class ClusterCanalConnector implements CanalConnector {
                 return msg;
             } catch (Throwable t) {
                 logger.warn(String.format("something goes wrong when getWithoutAck data from server:%s",
-                    currentConnector.getAddress()), t);
+                    currentConnector != null ? currentConnector.getAddress() : "null"), t);
                 times++;
                 restart();
                 logger.info("restart the connector for next round retry.");
@@ -201,7 +201,7 @@ public class ClusterCanalConnector implements CanalConnector {
                 return msg;
             } catch (Throwable t) {
                 logger.warn(String.format("something goes wrong when getWithoutAck data from server:%s",
-                    currentConnector.getAddress()), t);
+                    currentConnector != null ? currentConnector.getAddress() : "null"), t);
                 times++;
                 restart();
                 logger.info("restart the connector for next round retry.");
@@ -218,7 +218,7 @@ public class ClusterCanalConnector implements CanalConnector {
                 return;
             } catch (Throwable t) {
                 logger.warn(String.format("something goes wrong when rollbacking data from server:%s",
-                    currentConnector.getAddress()),
+                    currentConnector != null ? currentConnector.getAddress() : "null"),
                     t);
                 times++;
                 restart();
@@ -236,7 +236,7 @@ public class ClusterCanalConnector implements CanalConnector {
                 return;
             } catch (Throwable t) {
                 logger.warn(String.format("something goes wrong when rollbacking data from server:%s",
-                    currentConnector.getAddress()),
+                    currentConnector != null ? currentConnector.getAddress() : "null"),
                     t);
                 times++;
                 restart();
@@ -255,7 +255,7 @@ public class ClusterCanalConnector implements CanalConnector {
                 return;
             } catch (Throwable t) {
                 logger.warn(String.format("something goes wrong when acking data from server:%s",
-                    currentConnector.getAddress()),
+                    currentConnector != null ? currentConnector.getAddress() : "null"),
                     t);
                 times++;
                 restart();