Buggy code:
public class OplogOperationParser { private OplogOperationParser ( ) { } public static Function < BsonDocument , OplogOperation > asFunction ( ) { } public static OplogOperation fromBson ( @ Nonnull BsonValue uncastedOp ) throws BadValueException , NoSuchKeyException , TypesMismatchException { if ( ! ( uncastedOp . isDocument ( ) ) ) { throw new BadValueException ( ( ( ( "found<seq2seq4repair_space>a<seq2seq4repair_space>" + ( uncastedOp . getType ( ) . toString ( ) . toLowerCase ( Locale . ROOT ) ) ) + "<seq2seq4repair_space>where<seq2seq4repair_space>a<seq2seq4repair_space>document<seq2seq4repair_space>that<seq2seq4repair_space>represents<seq2seq4repair_space>a<seq2seq4repair_space>oplog<seq2seq4repair_space>operation<seq2seq4repair_space>" ) + "was<seq2seq4repair_space>expected" ) ) ; } BsonDocument doc = uncastedOp . asDocument ( ) ; OplogOperationType opType ; String opString = BsonReaderTool . getString ( doc , "op" ) ; try { opType = OplogOperationType . fromOplogName ( opString ) ; } catch ( IllegalArgumentException ex ) { throw new BadValueException ( ( ( "Unknown<seq2seq4repair_space>oplog<seq2seq4repair_space>operation<seq2seq4repair_space>with<seq2seq4repair_space>type<seq2seq4repair_space>'" + opString ) + "'" ) ) ; } String ns ; try { ns = BsonReaderTool . getString ( doc , "ns" ) ; } catch ( NoSuchKeyException ex ) { throw new NoSuchKeyException ( "ns" , ( "op<seq2seq4repair_space>does<seq2seq4repair_space>not<seq2seq4repair_space>contain<seq2seq4repair_space>required<seq2seq4repair_space>\"ns\"<seq2seq4repair_space>field:<seq2seq4repair_space>" + uncastedOp ) ) ; } catch ( TypesMismatchException ex ) { throw ex . newWithMessage ( ( "\"ns\"<seq2seq4repair_space>field<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>a<seq2seq4repair_space>string:<seq2seq4repair_space>" + uncastedOp ) ) ; } if ( ( ns . isEmpty ( ) ) && ( ! ( opType . equals ( NOOP ) ) ) ) { throw new BadValueException ( ( ( "\"ns\"<seq2seq4repair_space>field<seq2seq4repair_space>value<seq2seq4repair_space>cannot<seq2seq4repair_space>be<seq2seq4repair_space>empty<seq2seq4repair_space>" + "when<seq2seq4repair_space>op<seq2seq4repair_space>type<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>'n':<seq2seq4repair_space>" ) + doc ) ) ; } String db ; String collection ; int firstDotIndex = ns . indexOf ( '.' ) ; if ( ( firstDotIndex == ( - 1 ) ) || ( ( firstDotIndex + 1 ) == ( ns . length ( ) ) ) ) { db = ns ; collection = null ; } else { db = ns . substring ( 0 , firstDotIndex ) ; collection = ns . substring ( ( firstDotIndex + 1 ) ) ; } <START_BUG> OpTime optime = new OpTime ( BsonReaderTool . getInstant ( doc , "ts" ) ) ; <END_BUG> long h = BsonReaderTool . getLong ( doc , "h" ) ; OplogVersion version = OplogVersion . valueOf ( BsonReaderTool . getInteger ( doc , "v" ) ) ; boolean fromMigrate = doc . containsKey ( "fromMigrate" ) ; BsonDocument o = BsonReaderTool . getDocument ( doc , "o" ) ; switch ( opType ) { case DB : return new com . eightkdata . mongowp . server . api . oplog . DbOplogOperation ( db , optime , h , version , fromMigrate ) ; case DB_CMD : return new com . eightkdata . mongowp . server . api . oplog . DbCmdOplogOperation ( o , db , optime , h , version , fromMigrate ) ; case DELETE : return new com . eightkdata . mongowp . server . api . oplog . DeleteOplogOperation ( o , db , collection , optime , h , version , fromMigrate , BsonReaderTool . getBoolean ( doc , "b" , false ) ) ; case INSERT : return new com . eightkdata . mongowp . server . api . oplog . InsertOplogOperation ( o , db , collection , optime , h , version , fromMigrate ) ; case NOOP : return new com . eightkdata . mongowp . server . api . oplog . NoopOplogOperation ( o , db , optime , h , version , fromMigrate ) ; case UPDATE : return new com . eightkdata . mongowp . server . api . oplog . UpdateOplogOperation ( BsonReaderTool . getDocument ( doc , "o2" ) , db , collection , optime , h , version , fromMigrate , o , BsonReaderTool . getBoolean ( doc , "b" , false ) ) ; default : throw new AssertionError ( ( ( ( OplogOperationParser . class ) + "<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>prepared<seq2seq4repair_space>to<seq2seq4repair_space>work<seq2seq4repair_space>with<seq2seq4repair_space>oplog<seq2seq4repair_space>operations<seq2seq4repair_space>of<seq2seq4repair_space>type<seq2seq4repair_space>" ) + opType ) ) ; } } private static class AsFunction implements Function < BsonDocument , OplogOperation > { private static final OplogOperationParser . AsFunction INSTANCE = new OplogOperationParser . AsFunction ( ) ; @ Override public OplogOperation apply ( BsonDocument input ) { } } }

Fix:
OpTime optime = BsonReaderTool . getOpTime ( doc , "ts" ) ;