mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
支持用户自定义的CanalAlarmHandler (#1736)
* 支持用户自定义的CanalAlarmHandler * RowsLogEvent增加对TableMapLogEvent判空检查,防止NPE异常
This commit is contained in:
@@ -2,6 +2,7 @@ package com.taobao.tddl.dbsync.binlog.event;
|
||||
|
||||
import java.util.BitSet;
|
||||
|
||||
import com.taobao.tddl.dbsync.binlog.exception.TableIdNotFoundException;
|
||||
import com.taobao.tddl.dbsync.binlog.LogBuffer;
|
||||
import com.taobao.tddl.dbsync.binlog.LogContext;
|
||||
import com.taobao.tddl.dbsync.binlog.LogEvent;
|
||||
@@ -179,6 +180,10 @@ public abstract class RowsLogEvent extends LogEvent {
|
||||
public final void fillTable(LogContext context) {
|
||||
table = context.getTable(tableId);
|
||||
|
||||
if (table == null) {
|
||||
throw new TableIdNotFoundException("not found tableId:" + tableId);
|
||||
}
|
||||
|
||||
// end of statement check:
|
||||
if ((flags & RowsLogEvent.STMT_END_F) != 0) {
|
||||
// Now is safe to clear ignored map (clear_tables will also
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.taobao.tddl.dbsync.binlog.exception;
|
||||
|
||||
import com.alibaba.otter.canal.common.CanalException;
|
||||
|
||||
public class TableIdNotFoundException extends CanalException {
|
||||
|
||||
private static final long serialVersionUID = -7288830284122672209L;
|
||||
|
||||
public TableIdNotFoundException(String errorCode){
|
||||
super(errorCode);
|
||||
}
|
||||
|
||||
public TableIdNotFoundException(String errorCode, Throwable cause){
|
||||
super(errorCode, cause);
|
||||
}
|
||||
|
||||
public TableIdNotFoundException(String errorCode, String errorDesc){
|
||||
super(errorCode + ":" + errorDesc);
|
||||
}
|
||||
|
||||
public TableIdNotFoundException(String errorCode, String errorDesc, Throwable cause){
|
||||
super(errorCode + ":" + errorDesc, cause);
|
||||
}
|
||||
|
||||
public TableIdNotFoundException(Throwable cause){
|
||||
super(cause);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user