File tree Expand file tree Collapse file tree 2 files changed +8
-13
lines changed
src/main/java/com/github/shyiko/mysql/binlog/event Expand file tree Collapse file tree 2 files changed +8
-13
lines changed Original file line number Diff line number Diff line change @@ -192,21 +192,25 @@ public enum EventType {
192192 /**
193193 * Prepared XA transaction terminal event similar to XID except that it is specific to XA transaction.
194194 */
195- XA_PREPARE (38 ),
196- AURORA_PADDING (100 );
195+ XA_PREPARE (38 );
197196
198197 private final int eventId ;
199198
200199 EventType (int eventId ) {
201200 this .eventId = eventId ;
202201 }
203202
203+ /**
204+ * Parses the event type based on the ordinal.
205+ *
206+ * <p>If an invalid or proprietary ordinal is passed, EventType.UNKNOWN is returned.
207+ */
204208 public static EventType forId (int eventId ) {
205209 for (EventType type : EventType .values ()) {
206210 if (type .eventId == eventId ) return type ;
207211 }
208212
209- return null ;
213+ return EventType . UNKNOWN ;
210214 }
211215
212216 public static boolean isRowMutation (EventType eventType ) {
Original file line number Diff line number Diff line change @@ -30,20 +30,11 @@ public class EventHeaderV4Deserializer implements EventHeaderDeserializer<EventH
3030 public EventHeaderV4 deserialize (ByteArrayInputStream inputStream ) throws IOException {
3131 EventHeaderV4 header = new EventHeaderV4 ();
3232 header .setTimestamp (inputStream .readLong (4 ) * 1000L );
33- header .setEventType (getEventType (inputStream .readInteger (1 )));
33+ header .setEventType (EventType . forId (inputStream .readInteger (1 )));
3434 header .setServerId (inputStream .readLong (4 ));
3535 header .setEventLength (inputStream .readLong (4 ));
3636 header .setNextPosition (inputStream .readLong (4 ));
3737 header .setFlags (inputStream .readInteger (2 ));
3838 return header ;
3939 }
40-
41- private static EventType getEventType (int ordinal ) throws IOException {
42- EventType eventType = EventType .forId (ordinal );
43-
44- if (eventType == null ) {
45- throw new IOException ("Unknown event type " + ordinal );
46- }
47- return eventType ;
48- }
4940}
You can’t perform that action at this time.
0 commit comments