Skip to content

Commit f6fc0df

Browse files
committed
Fixed NPE in AbstractRowsEventDataDeserializer (#60)
1 parent 05bc095 commit f6fc0df

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
@@ -66,6 +66,11 @@ public AbstractRowsEventDataDeserializer(Map<Long, TableMapEventData> tableMapEv
6666
protected Serializable[] deserializeRow(long tableId, BitSet includedColumns, ByteArrayInputStream inputStream)
6767
throws IOException {
6868
TableMapEventData tableMapEvent = tableMapEventByTableId.get(tableId);
69+
if (tableMapEvent == null) {
70+
throw new MissingTableMapEventException("No TableMapEventData has been found for table id:" + tableId +
71+
". Usually that means that you have started reading binary log 'within the logic group'" +
72+
" (e.g. from WRITE_ROWS and not proceeding TABLE_MAP");
73+
}
6974
byte[] types = tableMapEvent.getColumnTypes();
7075
int[] metadata = tableMapEvent.getColumnMetadata();
7176
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)