fixed #227 , loadBinlogChecksum NPE

This commit is contained in:
agapple
2016-12-30 14:51:22 +08:00
parent a1207060bf
commit a483f03711

View File

@@ -266,9 +266,11 @@ public class MysqlConnection implements ErosaConnection {
throw new IllegalStateException("unexpected binlog image query result:" + rs.getFieldValues());
}
}
/**
* 获取主库checksum信息
* https://dev.mysql.com/doc/refman/5.6/en/replication-options-binary-log.html#option_mysqld_binlog-checksum
* https://dev.mysql.com/doc/refman/5.6/en/replication-options
* -binary-log.html#option_mysqld_binlog-checksum
*/
private void loadBinlogChecksum() {
ResultSetPacket rs = null;
@@ -279,7 +281,7 @@ public class MysqlConnection implements ErosaConnection {
}
List<String> columnValues = rs.getFieldValues();
if(columnValues.get(0).toUpperCase().equals("CRC32")){
if (columnValues != null && columnValues.size() >= 1 && columnValues.get(0).toUpperCase().equals("CRC32")) {
binlogChecksum = LogEvent.BINLOG_CHECKSUM_ALG_CRC32;
} else {
binlogChecksum = LogEvent.BINLOG_CHECKSUM_ALG_OFF;