DBZ-1464 Fixed NPE when op is not u/i/d

Signed-off-by: Lev Zemlyanov <lev@confluent.io>
This commit is contained in:
Lev Zemlyanov 2019-09-05 14:30:24 -07:00 committed by Gunnar Morling
parent e595b1f530
commit 8cbb8eb63b
2 changed files with 9 additions and 0 deletions

View File

@ -94,6 +94,10 @@ public RecordsForCollection forCollection(CollectionId collectionId) {
});
}
public static boolean isValidOperation(String operation) {
return operationLiterals.containsKey(operation);
}
/**
* A record producer for a given collection.
*/

View File

@ -544,6 +544,11 @@ protected boolean handleOplogEvent(ServerAddress primaryAddress, Document event)
}
return true;
}
if (!RecordMakers.isValidOperation(event.getString("op"))) {
// the op is not insert/update/delete
logger.debug("Skipping event with \"op={}\"", event.getString("op"));
return true;
}
int delimIndex = ns.indexOf('.');
if (delimIndex > 0) {
assert (delimIndex + 1) < ns.length();