Buggy code:
if ( replyStatus == ( StatusType . DELETE_ERROR ) ) { reply = new ClientMessage ( replyStatus ) ; clientSocket . sendMessage ( reply ) ; } else { this . server . addToTimer ( key , value ) ; reply = new ClientMessage ( key , replyStatus ) ; clientSocket . sendMessage ( reply ) ; } } else { replyStatus = KVMessage . StatusType . valueOf ( this . server . getKVCache ( ) . processPutRequest ( key , value , this . server . getKVCache ( ) . getDatasetName ( ) ) ) ; if ( replyStatus == ( StatusType . PUT_SUCCESS ) ) { this . server . addToTimer ( key , value ) ; reply = new ClientMessage ( key , value , replyStatus ) ; clientSocket . sendMessage ( reply ) ; } else if ( replyStatus == ( StatusType . PUT_ERROR ) ) { reply = new ClientMessage ( key , value , replyStatus ) ; clientSocket . sendMessage ( reply ) ; } else { reply = new ClientMessage ( key , value , replyStatus ) ; clientSocket . sendMessage ( reply ) ; } } } break ; default : reply = new ClientMessage ( "error" , "Wrong<seq2seq4repair_space>KVMessage<seq2seq4repair_space>Status<seq2seq4repair_space>received" , StatusType . FAILURE ) ; clientSocket . sendMessage ( reply ) ; break ; } break ; case SERVERMESSAGE : ServerMessage sm = ( ( ServerMessage ) ( message ) ) ; ServerMessage serverReply = null ; switch ( sm . getStatus ( ) ) { case DATA_TRANSFER : Map < String , String > h = sm . getData ( ) ; ECSMessage . MoveCaseType caseType = sm . getMoveCase ( ) ; String result2 = "PUT_SUCCESS" ; ArrayList < String > keys = new ArrayList < String > ( ) ; String result = this . server . getKVCache ( ) . processMassPutRequest ( h , this . server . getKVCache ( ) . getDatasetName ( ) ) ; if ( caseType . equals ( DELETE_NODE ) ) { for ( String keytemp : h . keySet ( ) ) { keys . add ( keytemp ) ; } result2 = this . server . getKVCache ( ) . deleteDatasetEntry ( keys , server . getKVCache ( ) . getReplicaName ( ) ) ; } if ( ( result . equals ( "PUT_ERROR" ) ) || ( result2 . equals ( "DELETE_ERROR" ) ) ) { serverReply = new ServerMessage ( StatusType . DATA_TRANSFER_FAILED ) ; this . clientSocket . sendMessage ( serverReply ) ; } else { serverReply = new ServerMessage ( StatusType . DATA_TRANSFER_SUCCESS ) ; this . clientSocket . sendMessage ( serverReply ) ; } break ; case DELETEFROM_REPLICA : Range rng = sm . getRange ( ) ; if ( rng == null ) { Map < String , String > data = sm . getData ( ) ; if ( ( data . size ( ) ) > 0 ) { keys = new ArrayList < String > ( ) ; for ( String keytemp : data . keySet ( ) ) { keys . add ( keytemp ) ; } String delresult = this . server . getKVCache ( ) . deleteDatasetEntry ( keys , this . server . getKVCache ( ) . getReplicaName ( ) ) ; if ( delresult . equals ( "DELETE_ERROR" ) ) { serverReply = new ServerMessage ( StatusType . REPLICA_FAILURE ) ; this . clientSocket . sendMessage ( serverReply ) ; } else { serverReply = new ServerMessage ( StatusType . DELETEFROM_REPLICA_SUCCESS ) ; this . clientSocket . sendMessage ( serverReply ) ; } } else { serverReply = new ServerMessage ( StatusType . DELETEFROM_REPLICA_SUCCESS ) ; this . clientSocket . sendMessage ( serverReply ) ; } } else { Map < String , String > mp = this . server . getKVCache ( ) . findValuesInRange ( rng , hashFunction , this . server . getKVCache ( ) . getReplicaName ( ) ) ; <START_BUG> if ( ( mp . size ( ) ) > 1 ) { <END_BUG> keys = new ArrayList < String > ( ) ; for ( String keytemp : mp . keySet ( ) ) { keys . add ( keytemp ) ; } String res = this . server . getKVCache ( ) . deleteDatasetEntry ( keys , this . server . getKVCache ( ) . getReplicaName ( ) ) ; if ( res . equals ( "DELETE_ERROR" ) ) { serverReply = new ServerMessage ( StatusType . DELETEFROM_REPLICA_FAILED ) ; this . clientSocket . sendMessage ( serverReply ) ; throw new Exception ( "Delete<seq2seq4repair_space>speceific<seq2seq4repair_space>range<seq2seq4repair_space>of<seq2seq4repair_space>data<seq2seq4repair_space>from<seq2seq4repair_space>serve<seq2seq4repair_space>failed!" ) ; } else { serverReply = new ServerMessage ( StatusType . DELETEFROM_REPLICA_SUCCESS ) ; this . clientSocket . sendMessage ( serverReply ) ; } } else { serverReply = new ServerMessage ( StatusType . DELETEFROM_REPLICA_SUCCESS ) ; this . clientSocket . sendMessage ( serverReply ) ; } } break ; case INIT_REPLICA : Map < String , String > dta = sm . getData ( ) ; if ( ( dta . size ( ) ) > 0 ) { String initResult = this . server . getKVCache ( ) . processMassPutRequest ( dta , this . server . getKVCache ( ) . getReplicaName ( ) ) ; if ( initResult . equals ( "PUT_ERROR" ) ) { serverReply = new ServerMessage ( StatusType . REPLICA_FAILURE ) ; this . clientSocket . sendMessage ( serverReply ) ; } else { serverReply = new ServerMessage ( StatusType . DATA_TRANSFER_SUCCESS ) ; this . clientSocket . sendMessage ( serverReply ) ; } } else { serverReply = new ServerMessage ( StatusType . DATA_TRANSFER_SUCCESS ) ; this . clientSocket . sendMessage ( serverReply ) ; } break ; case UPDATE_REPLICA : Map < String , String > upData = sm . getData ( ) ;

Fix:
if ( ( mp . size ( ) ) > 0 ) {