Buggy code:
public class EventLogAOElasticSearchImpl implements EventLogAO { private final String SUBJECT_USER = "anonymous" ; final IRODSAccessObjectFactory irodsAccessObjectFactory ; final RestConfiguration restConfiguration ; private Logger logger = LoggerFactory . getLogger ( this . getClass ( ) ) ; public EventLogAOElasticSearchImpl ( IRODSAccessObjectFactory irodsAccessObjectFactory , RestConfiguration restConfiguration ) { } @ Override public Log getLogs ( Date fromDate , Date toDate , EventsEnum event , String pidFilter , int startIdx , int count ) throws NoNodeAvailableException { } private Log copyHitsToLog ( int start , int count , long totalHits , SearchHit [ ] searchHits ) throws JargonException { Log log = new Log ( ) ; PropertiesLoader props = new PropertiesLoader ( ) ; int total = 0 ; log . setStart ( start ) ; <START_BUG> log . setCount ( count ) ; <END_BUG> if ( totalHits > ( ( long ) ( Integer . MAX_VALUE ) ) ) { total = Integer . MAX_VALUE ; } else { total = ( ( int ) ( totalHits ) ) ; } log . setTotal ( total ) ; if ( count > ( searchHits . length ) ) count = searchHits . length ; for ( int c = 0 ; c < count ; c ++ ) { LogEntry logEntry = new LogEntry ( ) ; logEntry . setEntryId ( String . valueOf ( ( start ++ ) ) ) ; Map < String , Object > hit = searchHits [ c ] . sourceAsMap ( ) ; Date createdDate = new Date ( ( ( Long ) ( hit . get ( "created" ) ) ) ) ; logEntry . setDateLogged ( createdDate ) ; Event event = EventsEnum . valueOfFromDatabook ( ( ( String ) ( hit . get ( "title" ) ) ) ) . getDataoneEvent ( ) ; logEntry . setEvent ( event ) ; ArrayList < Object > linkingDataEntity = ( ( ArrayList < Object > ) ( hit . get ( "linkingDataEntity" ) ) ) ; Map < String , Object > linkingDataEntity0 = ( ( Map < String , Object > ) ( linkingDataEntity . get ( 0 ) ) ) ; Map < String , Object > dataEntity = ( ( Map < String , Object > ) ( linkingDataEntity0 . get ( "dataEntity" ) ) ) ; String objectUri = new String ( ( ( String ) ( dataEntity . get ( "uri" ) ) ) ) ; int end = objectUri . indexOf ( '@' ) ; String objectPath = objectUri . substring ( 0 , end ) ; Identifier identifier = getDataObjectIdentifier ( objectPath ) ; logEntry . setIdentifier ( identifier ) ; NodeReference nodeReference = new NodeReference ( ) ; String nodeIdentifierProp = props . getProperty ( "irods.dataone.identifier" ) ; if ( nodeIdentifierProp != null ) { nodeReference . setValue ( nodeIdentifierProp ) ; logEntry . setNodeIdentifier ( nodeReference ) ; } Subject subject = new Subject ( ) ; String subjectString = new String ( ) ; subjectString += props . getProperty ( "irods.dataone.subject-string" ) ; subject . setValue ( subjectString ) ; logEntry . setSubject ( subject ) ; logger . info ( "adding<seq2seq4repair_space>new<seq2seq4repair_space>log<seq2seq4repair_space>entry:<seq2seq4repair_space>{}" , logEntry . getEntryId ( ) ) ; logger . info ( "<seq2seq4repair_space>date<seq2seq4repair_space>logged:<seq2seq4repair_space>{}" , logEntry . getDateLogged ( ) ) ; logger . info ( "<seq2seq4repair_space>event:<seq2seq4repair_space>{}" , logEntry . getEvent ( ) ) ; logger . info ( "<seq2seq4repair_space>object<seq2seq4repair_space>identifier:<seq2seq4repair_space>{}" , logEntry . getIdentifier ( ) . getValue ( ) ) ; logger . info ( "<seq2seq4repair_space>node<seq2seq4repair_space>identifier:<seq2seq4repair_space>{}" , logEntry . getNodeIdentifier ( ) . getValue ( ) ) ; logger . info ( "<seq2seq4repair_space>subject:<seq2seq4repair_space>{}" , logEntry . getSubject ( ) . getValue ( ) ) ; log . addLogEntry ( logEntry ) ; } return log ; } private String getDataOneDataObjectsRegex ( ) throws JargonException { } @ Override public void recordEvent ( Event event , Identifier id , String description ) throws ServiceFailure , InvalidArgumentException , JargonException { } private Identifier getDataObjectIdentifier ( String dataObjectPath ) throws JargonException { } }

Fix:
log . setCount ( searchHits . length ) ;