Skip to content

Commit fa45c7b

Browse files
committed
Fixed NPE in AbstractRowsEventDataDeserializer (shyiko#60)
1 parent 65529ff commit fa45c7b

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/main/java/com/github/shyiko/mysql/binlog/event/deserialization/AbstractRowsEventDataDeserializer.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ public AbstractRowsEventDataDeserializer(Map<Long, TableMapEventData> tableMapEv
7676
protected Serializable[] deserializeRow(long tableId, BitSet includedColumns, ByteArrayInputStream inputStream)
7777
throws IOException {
7878
TableMapEventData tableMapEvent = tableMapEventByTableId.get(tableId);
79+
if (tableMapEvent == null) {
80+
throw new MissingTableMapEventException("No TableMapEventData has been found for table id:" + tableId +
81+
". Usually that means that you have started reading binary log 'within the logic group'" +
82+
" (e.g. from WRITE_ROWS and not proceeding TABLE_MAP");
83+
}
7984
byte[] types = tableMapEvent.getColumnTypes();
8085
int[] metadata = tableMapEvent.getColumnMetadata();
8186
Serializable[] result = new Serializable[numberOfBitsSet(includedColumns)];
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.github.shyiko.mysql.binlog.event.deserialization;
2+
3+
import java.io.IOException;
4+
5+
public class MissingTableMapEventException extends IOException {
6+
7+
public MissingTableMapEventException(String message) {
8+
super(message);
9+
}
10+
}

0 commit comments

Comments
 (0)