nus-yam/ex-repair huggingface dataset:
Program: 50384
Project: 50384
Buggy source:
public PartitionProxy getPartition(final int partitionId){
  PartitionProxy partition=mapPartitions.get(partitionId);
  if (partition != null && partition.getOwner() != null)   return partition;
  final BlockingQueue<PartitionReal> responseQ=ResponseQueueFactory.newResponseQueue();
  concurrentMapManager.enqueueAndReturn(new Processable(){
    public void process(){
      Block block=concurrentMapManager.blocks[partitionId];
      if (block == null) {
        block=concurrentMapManager.getOrCreateBlock(partitionId);
      }
      MemberImpl memberOwner=null;
      if (block.getOwner() != null) {
        if (concurrentMapManager.thisAddress.equals(block.getOwner())) {
          memberOwner=concurrentMapManager.thisMember;
        }
 else {
          memberOwner=concurrentMapManager.getMember(block.getOwner());
        }
      }
      responseQ.offer(new PartitionReal(block.getBlockId(),memberOwner,null));
    }
  }
);
  partition=new PartitionProxy(partitionId);
  try {
    PartitionReal partitionReal=responseQ.take();
    mapRealPartitions.put(partitionId,partitionReal);
    PartitionProxy oldPartitionProxy=mapPartitions.putIfAbsent(partitionId,partition);
    if (oldPartitionProxy != null) {
      return oldPartitionProxy;
    }
  }
 catch (  InterruptedException ignored) {
  }
  return partition;
}

Fixed version (ground truth):
public PartitionProxy getPartition(final int partitionId){
  PartitionProxy partition=mapPartitions.get(partitionId);
  if (partition != null && partition.getOwner() != null)   return partition;
  final BlockingQueue<PartitionReal> responseQ=ResponseQueueFactory.newResponseQueue();
  concurrentMapManager.enqueueAndReturn(new Processable(){
    public void process(){
      Block block=concurrentMapManager.blocks[partitionId];
      if (block == null) {
        block=concurrentMapManager.getOrCreateBlock(partitionId);
      }
      MemberImpl memberOwner=null;
      if (block.getOwner() != null) {
        if (concurrentMapManager.thisAddress.equals(block.getOwner())) {
          memberOwner=concurrentMapManager.thisMember;
        }
 else {
          memberOwner=concurrentMapManager.getMember(block.getOwner());
        }
      }
      responseQ.offer(new PartitionReal(partitionId,memberOwner,null));
    }
  }
);
  partition=new PartitionProxy(partitionId);
  try {
    PartitionReal partitionReal=responseQ.take();
    mapRealPartitions.put(partitionId,partitionReal);
    PartitionProxy oldPartitionProxy=mapPartitions.putIfAbsent(partitionId,partition);
    if (oldPartitionProxy != null) {
      return oldPartitionProxy;
    }
  }
 catch (  InterruptedException ignored) {
  }
  return partition;
}
Program: 50385
Project: 50385
Buggy source:
Map<Address,List<Block>> getCurrentMemberBlocks(){
  Map<Address,List<Block>> addressBlocks=new HashMap<Address,List<Block>>();
  List<MemberImpl> lsMembers=concurrentMapManager.getMembers();
  for (  MemberImpl member : lsMembers) {
    if (!member.isSuperClient()) {
      addressBlocks.put(member.getAddress(),new ArrayList<Block>());
    }
  }
  if (addressBlocks.size() > 0) {
    for (    Block blockReal : blocks) {
      if (blockReal != null && !blockReal.isMigrating()) {
        List<Block> ownedBlocks=addressBlocks.get(blockReal.getOwner());
        ownedBlocks.add(new Block(blockReal));
      }
    }
  }
  return addressBlocks;
}

Fixed version (ground truth):
Map<Address,List<Block>> getCurrentMemberBlocks(){
  Map<Address,List<Block>> addressBlocks=new HashMap<Address,List<Block>>();
  List<MemberImpl> lsMembers=concurrentMapManager.getMembers();
  for (  MemberImpl member : lsMembers) {
    if (!member.isSuperClient()) {
      addressBlocks.put(member.getAddress(),new ArrayList<Block>());
    }
  }
  if (addressBlocks.size() > 0) {
    for (    Block blockReal : blocks) {
      if (blockReal != null && !blockReal.isMigrating()) {
        List<Block> ownedBlocks=addressBlocks.get(blockReal.getOwner());
        if (ownedBlocks != null) {
          ownedBlocks.add(new Block(blockReal));
        }
      }
    }
  }
  return addressBlocks;
}
Program: 50386
Project: 50386
Buggy source:
public Object waitAndGetResult(){
  while (true) {
    try {
      Object obj=responses.poll(5,TimeUnit.SECONDS);
      if (obj != null) {
        return obj;
      }
 else       if (node.factory.restarted) {
        throw new RuntimeException();
      }
 else       if (!node.isActive()) {
        throw new IllegalStateException("String_Node_Str");
      }
    }
 catch (    InterruptedException e) {
      if (node.factory.restarted) {
        throw new RuntimeException();
      }
 else {
        throw new RuntimeInterruptedException();
      }
    }
  }
}

Fixed version (ground truth):
public Object waitAndGetResult(){
  while (true) {
    try {
      Object obj=responses.poll(5,TimeUnit.SECONDS);
      if (obj != null) {
        return obj;
      }
      node.checkNodeState();
    }
 catch (    InterruptedException e) {
      if (node.factory.restarted) {
        throw new RuntimeException();
      }
 else {
        throw new RuntimeInterruptedException();
      }
    }
  }
}
Program: 50387
Project: 50387
Buggy source:
T call(){
  try {
    if (!node.isActive()) {
      throw new RuntimeException();
    }
    onCall();
    TargetAwareOp localCall=createNewTargetAwareOp(thisAddress);
    localCall.doOp();
    Object result=localCall.getResultAsObject();
    if (result == OBJECT_REDO) {
      onRedo();
      Thread.sleep(1000);
      return call();
    }
    if (onResponse(result)) {
      Set<Member> members=node.getClusterImpl().getMembers();
      List<TargetAwareOp> lsCalls=new ArrayList<TargetAwareOp>();
      for (      Member member : members) {
        if (!member.localMember()) {
          MemberImpl cMember=(MemberImpl)member;
          TargetAwareOp targetAwareOp=createNewTargetAwareOp(cMember.getAddress());
          targetAwareOp.doOp();
          lsCalls.add(targetAwareOp);
        }
      }
      for (      TargetAwareOp call : lsCalls) {
        result=call.getResultAsObject();
        if (result == OBJECT_REDO) {
          onRedo();
          Thread.sleep(1000);
          return call();
        }
 else {
          if (!onResponse(result)) {
            break;
          }
        }
      }
      onComplete();
    }
  }
 catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
  return (T)returnResult();
}

Fixed version (ground truth):
T call(){
  try {
    node.checkNodeState();
    onCall();
    TargetAwareOp localCall=createNewTargetAwareOp(thisAddress);
    localCall.doOp();
    Object result=localCall.getResultAsObject();
    if (result == OBJECT_REDO) {
      onRedo();
      Thread.sleep(1000);
      return call();
    }
    if (onResponse(result)) {
      Set<Member> members=node.getClusterImpl().getMembers();
      List<TargetAwareOp> lsCalls=new ArrayList<TargetAwareOp>();
      for (      Member member : members) {
        if (!member.localMember()) {
          MemberImpl cMember=(MemberImpl)member;
          TargetAwareOp targetAwareOp=createNewTargetAwareOp(cMember.getAddress());
          targetAwareOp.doOp();
          lsCalls.add(targetAwareOp);
        }
      }
      for (      TargetAwareOp call : lsCalls) {
        result=call.getResultAsObject();
        if (result == OBJECT_REDO) {
          onRedo();
          Thread.sleep(1000);
          return call();
        }
 else {
          if (!onResponse(result)) {
            break;
          }
        }
      }
      onComplete();
    }
  }
 catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
  return (T)returnResult();
}
Program: 50388
Project: 50388
Buggy source:
public EntryObject key(){
  Expression expression=new Expression(){
    public Object getValue(    Object obj){
      MapEntry entry=(MapEntry)obj;
      return entry.getKey();
    }
  }
;
  qb.exp=expression;
  return this;
}

Fixed version (ground truth):
public EntryObject key(){
  Expression expression=new EntryKeyObject();
  qb.exp=expression;
  return this;
}
Program: 50389
Project: 50389
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + getSource() + "String_Node_Str"+ getKey()+ "String_Node_Str"+ getValue()+ "String_Node_Str"+ entryEventType;
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + getSource() + "String_Node_Str"+ getKey()+ "String_Node_Str"+ getValue()+ "String_Node_Str"+ entryEventType+ "String_Node_Str"+ member;
}
Program: 50390
Project: 50390
Buggy source:
void enqueueEvent(final int eventType,final String name,final Data eventKey,final Data eventValue,final Address from){
  Member member=getMember(from);
  if (member == null) {
    member=new MemberImpl(from,thisAddress.equals(from));
  }
  final EventTask eventTask=new EventTask(member,eventType,name,eventKey,eventValue);
  int hash;
  if (eventKey != null) {
    hash=eventKey.hashCode();
  }
 else {
    hash=hashTwo(from.hashCode(),name.hashCode());
  }
  node.executorManager.getEventExecutorService().executeOrderedRunnable(hash,eventTask);
}

Fixed version (ground truth):
void enqueueEvent(int eventType,String name,Data eventKey,Data eventValue,Address from){
  try {
    Member member=getMember(from);
    if (member == null) {
      member=new MemberImpl(from,thisAddress.equals(from));
    }
    final EventTask eventTask=new EventTask(member,eventType,name,eventKey,eventValue);
    int hash;
    if (eventKey != null) {
      hash=eventKey.hashCode();
    }
 else {
      hash=hashTwo(from.hashCode(),name.hashCode());
    }
    node.executorManager.getEventExecutorService().executeOrderedRunnable(hash,eventTask);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 50391
Project: 50391
Buggy source:
public EventTask(final Member from,final int eventType,final String name,final Data dataKey,final Data dataValue){
  super(name,from,eventType,null,null);
  this.dataKey=dataKey;
  this.dataValue=dataValue;
}

Fixed version (ground truth):
public EventTask(Member from,int eventType,String name,Data dataKey,Data dataValue){
  super(name,from,eventType,null,null);
  this.dataKey=dataKey;
  this.dataValue=dataValue;
}
Program: 50392
Project: 50392
Buggy source:
public void run(){
  try {
    node.listenerManager.callListeners(this);
  }
 catch (  final Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void run(){
  try {
    node.listenerManager.callListeners(EventTask.this);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 50393
Project: 50393
Buggy source:
void fireMapEvent(final Map<Address,Boolean> mapListeners,final String name,final int eventType,final Data key,final Data value,Map<Address,Boolean> keyListeners){
  try {
    Map<Address,Boolean> mapTargetListeners=null;
    if (keyListeners != null) {
      mapTargetListeners=new HashMap<Address,Boolean>(keyListeners);
    }
    if (mapListeners != null && mapListeners.size() > 0) {
      if (mapTargetListeners == null) {
        mapTargetListeners=new HashMap<Address,Boolean>(mapListeners);
      }
 else {
        final Set<Map.Entry<Address,Boolean>> entries=mapListeners.entrySet();
        for (        final Map.Entry<Address,Boolean> entry : entries) {
          if (mapTargetListeners.containsKey(entry.getKey())) {
            if (entry.getValue()) {
              mapTargetListeners.put(entry.getKey(),entry.getValue());
            }
          }
 else           mapTargetListeners.put(entry.getKey(),entry.getValue());
        }
      }
    }
    if (mapTargetListeners == null || mapTargetListeners.size() == 0) {
      return;
    }
    sendEvents(eventType,name,key,value,mapTargetListeners);
  }
 catch (  final Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
void fireMapEvent(final Map<Address,Boolean> mapListeners,final String name,final int eventType,final Data key,final Data value,Map<Address,Boolean> keyListeners,Address callerAddress){
  try {
    Map<Address,Boolean> mapTargetListeners=null;
    if (keyListeners != null) {
      mapTargetListeners=new HashMap<Address,Boolean>(keyListeners);
    }
    if (mapListeners != null && mapListeners.size() > 0) {
      if (mapTargetListeners == null) {
        mapTargetListeners=new HashMap<Address,Boolean>(mapListeners);
      }
 else {
        final Set<Map.Entry<Address,Boolean>> entries=mapListeners.entrySet();
        for (        final Map.Entry<Address,Boolean> entry : entries) {
          if (mapTargetListeners.containsKey(entry.getKey())) {
            if (entry.getValue()) {
              mapTargetListeners.put(entry.getKey(),entry.getValue());
            }
          }
 else           mapTargetListeners.put(entry.getKey(),entry.getValue());
        }
      }
    }
    if (mapTargetListeners == null || mapTargetListeners.size() == 0) {
      return;
    }
    sendEvents(eventType,name,key,value,mapTargetListeners,callerAddress);
  }
 catch (  final Exception e) {
    e.printStackTrace();
  }
}
Program: 50394
Project: 50394
Buggy source:
public void sendEvents(final int eventType,final String name,final Data key,final Data value,final Map<Address,Boolean> mapListeners){
  if (mapListeners != null) {
    final Set<Map.Entry<Address,Boolean>> listeners=mapListeners.entrySet();
    for (    final Map.Entry<Address,Boolean> listener : listeners) {
      final Address address=listener.getKey();
      final boolean includeValue=listener.getValue();
      if (address.isThisAddress()) {
        enqueueEvent(eventType,name,key,(includeValue) ? value : null,address);
      }
 else {
        final Packet packet=obtainPacket();
        packet.set(name,ClusterOperation.EVENT,key,(includeValue) ? value : null);
        packet.longValue=eventType;
        final boolean sent=send(packet,address);
        if (!sent)         releasePacket(packet);
      }
    }
  }
}

Fixed version (ground truth):
public void sendEvents(int eventType,String name,Data key,Data value,Map<Address,Boolean> mapListeners,Address callerAddress){
  if (mapListeners != null) {
    final Set<Map.Entry<Address,Boolean>> listeners=mapListeners.entrySet();
    for (    final Map.Entry<Address,Boolean> listener : listeners) {
      final Address toAddress=listener.getKey();
      final boolean includeValue=listener.getValue();
      if (toAddress.isThisAddress()) {
        enqueueEvent(eventType,name,key,(includeValue) ? value : null,callerAddress);
      }
 else {
        final Packet packet=obtainPacket();
        packet.set(name,ClusterOperation.EVENT,key,(includeValue) ? value : null);
        packet.lockAddress=callerAddress;
        packet.longValue=eventType;
        final boolean sent=send(packet,toAddress);
        if (!sent)         releasePacket(packet);
      }
    }
  }
}
Program: 50395
Project: 50395
Buggy source:
int offer(Request req){
  if (req.value == null) {
    throw new RuntimeException("String_Node_Str" + req.local);
  }
  if (req.value.size() == 0) {
    throw new RuntimeException("String_Node_Str" + req.local);
  }
  try {
    int addIndex=blCurrentPut.add(req.value);
    doFireEntryEvent(true,req.value);
    sendBackup(true,req.caller,req.value,blCurrentPut.blockId,addIndex);
    req.longValue=addIndex;
    if (blCurrentPut.isFull()) {
      fireBlockFullEvent(blCurrentPut);
      blCurrentPut=null;
      setCurrentPut();
    }
    return addIndex;
  }
  finally {
    boolean consumed=false;
    while (!consumed && lsScheduledPollActions.size() > 0) {
      ScheduledAction pollAction=lsScheduledPollActions.remove(0);
      if (!pollAction.expired()) {
        consumed=pollAction.consume();
        node.clusterManager.deregisterScheduledAction(pollAction);
      }
    }
  }
}

Fixed version (ground truth):
int offer(Request req){
  if (req.value == null) {
    throw new RuntimeException("String_Node_Str" + req.local);
  }
  if (req.value.size() == 0) {
    throw new RuntimeException("String_Node_Str" + req.local);
  }
  try {
    int addIndex=blCurrentPut.add(req.value);
    doFireEntryEvent(true,req.value,req.caller);
    sendBackup(true,req.caller,req.value,blCurrentPut.blockId,addIndex);
    req.longValue=addIndex;
    if (blCurrentPut.isFull()) {
      fireBlockFullEvent(blCurrentPut);
      blCurrentPut=null;
      setCurrentPut();
    }
    return addIndex;
  }
  finally {
    boolean consumed=false;
    while (!consumed && lsScheduledPollActions.size() > 0) {
      ScheduledAction pollAction=lsScheduledPollActions.remove(0);
      if (!pollAction.expired()) {
        consumed=pollAction.consume();
        node.clusterManager.deregisterScheduledAction(pollAction);
      }
    }
  }
}
Program: 50396
Project: 50396
Buggy source:
final void handleBackup(Packet packet){
  try {
    String name=packet.name;
    int blockId=packet.blockId;
    Q q=getQ(name);
    if (packet.operation == ClusterOperation.BLOCKING_QUEUE_BACKUP_ADD) {
      Data data=packet.getValueData();
      q.doBackup(true,data,blockId,(int)packet.longValue);
    }
 else     if (packet.operation == ClusterOperation.BLOCKING_QUEUE_BACKUP_REMOVE) {
      q.doBackup(false,null,blockId,0);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
 finally {
    releasePacket(packet);
  }
}

Fixed version (ground truth):
final void handleBackup(Packet packet){
  try {
    String name=packet.name;
    int blockId=packet.blockId;
    Q q=getQ(name);
    if (packet.operation == ClusterOperation.BLOCKING_QUEUE_BACKUP_ADD) {
      Data data=packet.getValueData();
      q.doBackup(true,data,blockId,(int)packet.longValue);
    }
 else     if (packet.operation == ClusterOperation.BLOCKING_QUEUE_BACKUP_REMOVE) {
      q.doBackup(false,null,blockId,(int)packet.longValue);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
 finally {
    releasePacket(packet);
  }
}
Program: 50397
Project: 50397
Buggy source:
@Override public void handleNoneRedoResponse(Packet packet){
  if (request.operation == ClusterOperation.BLOCKING_QUEUE_POLL && packet.responseType == Constants.ResponseTypes.RESPONSE_SUCCESS) {
    if (!zeroBackup) {
      if (getPreviousMemberBefore(thisAddress,true,1).getAddress().equals(packet.conn.getEndPoint())) {
        if (packet.getValueData() != null) {
          Q q=getQ(packet.name);
          q.doBackup(false,null,request.blockId,(int)request.longValue);
        }
      }
    }
  }
  super.handleNoneRedoResponse(packet);
}

Fixed version (ground truth):
@Override public void handleNoneRedoResponse(Packet packet){
  if (request.operation == ClusterOperation.BLOCKING_QUEUE_POLL && packet.responseType == Constants.ResponseTypes.RESPONSE_SUCCESS) {
    if (!zeroBackup) {
      if (getPreviousMemberBefore(thisAddress,true,1).getAddress().equals(packet.conn.getEndPoint())) {
        if (packet.getValueData() != null) {
          Q q=getQ(packet.name);
          q.doBackup(false,null,request.blockId,(int)packet.longValue);
        }
      }
    }
  }
  super.handleNoneRedoResponse(packet);
}
Program: 50398
Project: 50398
Buggy source:
final void handlePoll(Packet packet){
  if (rightRemotePollTarget(packet)) {
    Request request=Request.copy(packet);
    doPoll(request);
    if (!request.scheduled) {
      Data oldValue=(Data)request.response;
      if (oldValue != null && oldValue.size() > 0) {
        packet.setValue(oldValue);
      }
      sendResponse(packet);
    }
 else {
      releasePacket(packet);
    }
  }
}

Fixed version (ground truth):
final void handlePoll(Packet packet){
  if (rightRemotePollTarget(packet)) {
    Request request=Request.copy(packet);
    doPoll(request);
    packet.longValue=request.longValue;
    if (!request.scheduled) {
      Data oldValue=(Data)request.response;
      if (oldValue != null && oldValue.size() > 0) {
        packet.setValue(oldValue);
      }
      sendResponse(packet);
    }
 else {
      releasePacket(packet);
    }
  }
}
Program: 50399
Project: 50399
Buggy source:
public Data poll(Request request){
  try {
    setCurrentTake();
    QData qdata=blCurrentTake.remove();
    int removeIndex=blCurrentTake.removeIndex - 1;
    request.longValue=removeIndex;
    Data value=(qdata == null) ? null : qdata.data;
    if (request.txnId != -1) {
      MemberImpl backup=null;
      if (request.caller.equals(thisAddress)) {
        backup=getNextMemberAfter(thisAddress,true,1);
      }
 else {
        backup=getNextMemberAfter(request.caller,true,1);
      }
      if (backup != null) {
        if (backup.getAddress().equals(thisAddress)) {
          doTxnBackupPoll(request.txnId,value);
        }
 else {
          sendTxnBackup(backup.getAddress(),value,request.txnId);
        }
      }
    }
    doFireEntryEvent(false,value);
    sendBackup(false,request.caller,null,blCurrentTake.blockId,removeIndex);
    if (!blCurrentTake.containsValidItem() && blCurrentTake.isFull()) {
      fireBlockRemoveEvent(blCurrentTake);
      blCurrentTake=null;
    }
    return value;
  }
 catch (  Throwable t) {
    t.printStackTrace();
    return null;
  }
 finally {
    boolean consumed=false;
    while (!consumed && lsScheduledOfferActions.size() > 0) {
      ScheduledOfferAction offerAction=lsScheduledOfferActions.remove(0);
      if (!offerAction.expired()) {
        consumed=offerAction.consume();
        node.clusterManager.deregisterScheduledAction(offerAction);
      }
    }
  }
}

Fixed version (ground truth):
public Data poll(Request request){
  try {
    setCurrentTake();
    QData qdata=blCurrentTake.remove();
    int removeIndex=blCurrentTake.removeIndex - 1;
    request.longValue=removeIndex;
    Data value=(qdata == null) ? null : qdata.data;
    if (request.txnId != -1) {
      MemberImpl backup=null;
      if (request.caller.equals(thisAddress)) {
        backup=getNextMemberAfter(thisAddress,true,1);
      }
 else {
        backup=getNextMemberAfter(request.caller,true,1);
      }
      if (backup != null) {
        if (backup.getAddress().equals(thisAddress)) {
          doTxnBackupPoll(request.txnId,value);
        }
 else {
          sendTxnBackup(backup.getAddress(),value,request.txnId);
        }
      }
    }
    doFireEntryEvent(false,value,request.caller);
    sendBackup(false,request.caller,null,blCurrentTake.blockId,removeIndex);
    if (!blCurrentTake.containsValidItem() && blCurrentTake.isFull()) {
      fireBlockRemoveEvent(blCurrentTake);
      blCurrentTake=null;
    }
    return value;
  }
 catch (  Throwable t) {
    t.printStackTrace();
    return null;
  }
 finally {
    boolean consumed=false;
    while (!consumed && lsScheduledOfferActions.size() > 0) {
      ScheduledOfferAction offerAction=lsScheduledOfferActions.remove(0);
      if (!offerAction.expired()) {
        consumed=offerAction.consume();
        node.clusterManager.deregisterScheduledAction(offerAction);
      }
    }
  }
}
Program: 50400
Project: 50400
Buggy source:
void doFireEntryEvent(boolean add,Data value){
  if (mapListeners.size() == 0)   return;
  if (add) {
    fireMapEvent(mapListeners,name,EntryEvent.TYPE_ADDED,value);
  }
 else {
    fireMapEvent(mapListeners,name,EntryEvent.TYPE_REMOVED,value);
  }
}

Fixed version (ground truth):
void doFireEntryEvent(boolean add,Data value,Address callerAddress){
  if (mapListeners.size() == 0)   return;
  if (add) {
    fireMapEvent(mapListeners,name,EntryEvent.TYPE_ADDED,value,callerAddress);
  }
 else {
    fireMapEvent(mapListeners,name,EntryEvent.TYPE_REMOVED,value,callerAddress);
  }
}
Program: 50402
Project: 50402
Buggy source:
public boolean putMulti(Request req){
  Record record=getRecord(req.key);
  boolean added=true;
  if (record == null) {
    record=toRecord(req);
  }
 else {
    if (!record.isActive()) {
      markAsActive(record);
    }
    if (record.containsValue(req.value)) {
      added=false;
    }
  }
  if (added) {
    Data value=req.value;
    updateIndexes(record);
    record.addValue(value);
    record.incrementVersion();
    concurrentMapManager.fireMapEvent(mapListeners,getName(),EntryEvent.TYPE_ADDED,record.getKey(),value,record.getMapListeners());
  }
  if (req.txnId != -1) {
    unlock(record);
  }
  logger.log(Level.FINEST,record.getValue() + "String_Node_Str" + record.getMultiValues());
  req.clearForResponse();
  req.version=record.getVersion();
  return added;
}

Fixed version (ground truth):
public boolean putMulti(Request req){
  Record record=getRecord(req.key);
  boolean added=true;
  if (record == null) {
    record=toRecord(req);
  }
 else {
    if (!record.isActive()) {
      markAsActive(record);
    }
    if (record.containsValue(req.value)) {
      added=false;
    }
  }
  if (added) {
    Data value=req.value;
    updateIndexes(record);
    record.addValue(value);
    record.incrementVersion();
    concurrentMapManager.fireMapEvent(mapListeners,getName(),EntryEvent.TYPE_ADDED,record.getKey(),value,record.getMapListeners(),req.caller);
  }
  if (req.txnId != -1) {
    unlock(record);
  }
  logger.log(Level.FINEST,record.getValue() + "String_Node_Str" + record.getMultiValues());
  req.clearForResponse();
  req.version=record.getVersion();
  return added;
}
Program: 50403
Project: 50403
Buggy source:
boolean evict(Request req){
  Record record=getRecord(req.key);
  if (record != null && record.isEvictable()) {
    fireInvalidation(record);
    concurrentMapManager.fireMapEvent(mapListeners,getName(),EntryEvent.TYPE_EVICTED,record.getKey(),record.getValue(),record.getMapListeners());
    record.incrementVersion();
    updateStats(REMOVE,record,true,null);
    markAsRemoved(record);
    req.clearForResponse();
    req.version=record.getVersion();
    req.longValue=record.getCopyCount();
    lastEvictionTime=System.currentTimeMillis();
    return true;
  }
  return false;
}

Fixed version (ground truth):
boolean evict(Request req){
  Record record=getRecord(req.key);
  if (record != null && record.isEvictable()) {
    fireInvalidation(record);
    concurrentMapManager.fireMapEvent(mapListeners,getName(),EntryEvent.TYPE_EVICTED,record.getKey(),record.getValue(),record.getMapListeners(),req.caller);
    record.incrementVersion();
    updateStats(REMOVE,record,true,null);
    markAsRemoved(record);
    req.clearForResponse();
    req.version=record.getVersion();
    req.longValue=record.getCopyCount();
    lastEvictionTime=System.currentTimeMillis();
    return true;
  }
  return false;
}
Program: 50404
Project: 50404
Buggy source:
public boolean removeMulti(Request req){
  Record record=getRecord(req.key);
  if (record == null)   return false;
  boolean removed=false;
  if (req.value == null) {
    removed=true;
    markAsRemoved(record);
  }
 else {
    if (record.containsValue(req.value)) {
      if (record.getMultiValues() != null) {
        Iterator<Data> itValues=record.getMultiValues().iterator();
        while (itValues.hasNext()) {
          Data value=itValues.next();
          if (req.value.equals(value)) {
            itValues.remove();
            removed=true;
          }
        }
      }
    }
  }
  if (req.txnId != -1) {
    unlock(record);
  }
  if (removed) {
    record.incrementVersion();
    concurrentMapManager.fireMapEvent(mapListeners,getName(),EntryEvent.TYPE_REMOVED,record.getKey(),req.value,record.getMapListeners());
    logger.log(Level.FINEST,record.getValue() + "String_Node_Str" + record.getMultiValues());
  }
  req.version=record.getVersion();
  if (record.valueCount() == 0) {
    markAsRemoved(record);
  }
  return removed;
}

Fixed version (ground truth):
public boolean removeMulti(Request req){
  Record record=getRecord(req.key);
  if (record == null)   return false;
  boolean removed=false;
  if (req.value == null) {
    removed=true;
    markAsRemoved(record);
  }
 else {
    if (record.containsValue(req.value)) {
      if (record.getMultiValues() != null) {
        Iterator<Data> itValues=record.getMultiValues().iterator();
        while (itValues.hasNext()) {
          Data value=itValues.next();
          if (req.value.equals(value)) {
            itValues.remove();
            removed=true;
          }
        }
      }
    }
  }
  if (req.txnId != -1) {
    unlock(record);
  }
  if (removed) {
    record.incrementVersion();
    concurrentMapManager.fireMapEvent(mapListeners,getName(),EntryEvent.TYPE_REMOVED,record.getKey(),req.value,record.getMapListeners(),req.caller);
    logger.log(Level.FINEST,record.getValue() + "String_Node_Str" + record.getMultiValues());
  }
  req.version=record.getVersion();
  if (record.valueCount() == 0) {
    markAsRemoved(record);
  }
  return removed;
}
Program: 50405
Project: 50405
Buggy source:
public boolean removeItem(Request req){
  Record record=mapRecords.get(req.key);
  if (record == null) {
    return false;
  }
  if (req.txnId != -1) {
    unlock(record);
  }
  boolean removed=false;
  if (record.getCopyCount() > 0) {
    record.decrementCopyCount();
    removed=true;
  }
 else   if (record.getValue() != null) {
    removed=true;
  }
 else   if (record.getMultiValues() != null) {
    removed=true;
  }
  if (removed) {
    concurrentMapManager.fireMapEvent(mapListeners,getName(),EntryEvent.TYPE_REMOVED,record);
    record.incrementVersion();
  }
  req.version=record.getVersion();
  req.longValue=record.getCopyCount();
  markAsRemoved(record);
  return true;
}

Fixed version (ground truth):
public boolean removeItem(Request req){
  Record record=mapRecords.get(req.key);
  if (record == null) {
    return false;
  }
  if (req.txnId != -1) {
    unlock(record);
  }
  boolean removed=false;
  if (record.getCopyCount() > 0) {
    record.decrementCopyCount();
    removed=true;
  }
 else   if (record.getValue() != null) {
    removed=true;
  }
 else   if (record.getMultiValues() != null) {
    removed=true;
  }
  if (removed) {
    concurrentMapManager.fireMapEvent(mapListeners,getName(),EntryEvent.TYPE_REMOVED,record,req.caller);
    record.incrementVersion();
  }
  req.version=record.getVersion();
  req.longValue=record.getCopyCount();
  markAsRemoved(record);
  return true;
}
Program: 50408
Project: 50408
Buggy source:
void fireMapEvent(final Map<Address,Boolean> mapListeners,final String name,final int eventType,final Record record){
  checkServiceThread();
  fireMapEvent(mapListeners,name,eventType,record.getKey(),record.getValue(),record.getMapListeners());
}

Fixed version (ground truth):
void fireMapEvent(final Map<Address,Boolean> mapListeners,final String name,final int eventType,final Record record,Address callerAddress){
  checkServiceThread();
  fireMapEvent(mapListeners,name,eventType,record.getKey(),record.getValue(),record.getMapListeners(),callerAddress);
}
Program: 50409
Project: 50409
Buggy source:
private void handleEvent(Packet packet){
  int eventType=(int)packet.longValue;
  Data key=packet.getKeyData();
  Data value=packet.getValueData();
  String name=packet.name;
  Address from=packet.conn.getEndPoint();
  releasePacket(packet);
  enqueueEvent(eventType,name,key,value,from);
}

Fixed version (ground truth):
private void handleEvent(Packet packet){
  int eventType=(int)packet.longValue;
  Data key=packet.getKeyData();
  Data value=packet.getValueData();
  String name=packet.name;
  Address from=packet.lockAddress;
  releasePacket(packet);
  enqueueEvent(eventType,name,key,value,from);
}
Program: 50411
Project: 50411
Buggy source:
public void publish(final Data msg){
  topicManager.fireMapEvent(mapListeners,name,EntryEvent.TYPE_ADDED,msg);
}

Fixed version (ground truth):
public void publish(final Data msg){
  topicManager.fireMapEvent(mapListeners,name,EntryEvent.TYPE_ADDED,msg,thisAddress);
}
Program: 50412
Project: 50412
Buggy source:
public NoMemberAvailableException(){
  super("String_Node_Str");
}

Fixed version (ground truth):
public NoMemberAvailableException(String message){
  super(message);
}
Program: 50413
Project: 50413
Buggy source:
public void enQueue(Call call){
  try {
    logger.log(Level.FINEST,"String_Node_Str" + call);
    queue.put(call);
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void enQueue(Call call){
  try {
    if (running == false) {
      throw new NoMemberAvailableException("String_Node_Str" + "String_Node_Str");
    }
    logger.log(Level.FINEST,"String_Node_Str" + call);
    queue.put(call);
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
}
Program: 50414
Project: 50414
Buggy source:
public boolean containsAll(Collection<?> arg0){
  for (Iterator<?> iterator=arg0.iterator(); iterator.hasNext(); ) {
    Object object=iterator.next();
    if (!contains(object)) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean containsAll(Collection<?> arg0){
  for (  Object object : arg0) {
    if (!contains(object)) {
      return false;
    }
  }
  return true;
}
Program: 50415
Project: 50415
Buggy source:
public boolean isEmpty(){
  return proxy.size() == 0;
}

Fixed version (ground truth):
public boolean isEmpty(){
  return entrySet.size() == 0;
}
Program: 50416
Project: 50416
Buggy source:
public boolean contains(Object arg0){
  return proxy.containsValue(arg0);
}

Fixed version (ground truth):
public boolean contains(Object arg0){
  for (  Entry<K,V> anEntrySet : entrySet) {
    Object object=anEntrySet.getValue();
    if (object.equals(arg0)) {
      return true;
    }
  }
  return false;
}
Program: 50417
Project: 50417
Buggy source:
public int size(){
  return proxy.size();
}

Fixed version (ground truth):
public int size(){
  return entrySet.size();
}
Program: 50418
Project: 50418
Buggy source:
public <T>Future<T> submit(Runnable task,T result){
  if (!active)   throw new RejectedExecutionException("String_Node_Str" + name + "String_Node_Str");
  DistributedTask dtask;
  if (task instanceof DistributedTask) {
    dtask=(DistributedTask)task;
  }
 else {
    dtask=new DistributedTask(task,result);
  }
  node.executorManager.call(name,dtask);
  return dtask;
}

Fixed version (ground truth):
public <T>Future<T> submit(Runnable task,T result){
  if (!active)   throw new RejectedExecutionException("String_Node_Str" + name + "String_Node_Str");
  ThreadContext.get().setCurrentFactory(node.factory);
  DistributedTask dtask;
  if (task instanceof DistributedTask) {
    dtask=(DistributedTask)task;
  }
 else {
    dtask=new DistributedTask(task,result);
  }
  node.executorManager.call(name,dtask);
  return dtask;
}
Program: 50419
Project: 50419
Buggy source:
public void doFunctionalSQLQueryTest(IMap imap){
  imap.put("String_Node_Str",new Employee("String_Node_Str",33,false,14.56));
  imap.put("String_Node_Str",new Employee("String_Node_Str",23,true,15.00));
  for (int i=3; i < 103; i++) {
    imap.put(String.valueOf(i),new Employee("String_Node_Str" + i,i % 60,((i % 2) == 1),Double.valueOf(i)));
  }
  Set<Map.Entry> entries=imap.entrySet();
  assertEquals(102,entries.size());
  int itCount=0;
  for (  Map.Entry entry : entries) {
    Employee c=(Employee)entry.getValue();
    itCount++;
  }
  assertEquals(102,itCount);
  entries=imap.entrySet(new SqlPredicate("String_Node_Str"));
  assertEquals(3,entries.size());
  for (  Map.Entry entry : entries) {
    Employee c=(Employee)entry.getValue();
    assertEquals(c.getAge(),23);
    assertTrue(c.isActive());
  }
  imap.remove("String_Node_Str");
  entries=imap.entrySet(new SqlPredicate("String_Node_Str"));
  assertEquals(2,entries.size());
  for (  Map.Entry entry : entries) {
    Employee c=(Employee)entry.getValue();
    assertEquals(c.getAge(),23);
    assertTrue(c.isActive());
  }
}

Fixed version (ground truth):
public void doFunctionalSQLQueryTest(IMap imap){
  imap.put("String_Node_Str",new Employee("String_Node_Str",33,false,14.56));
  imap.put("String_Node_Str",new Employee("String_Node_Str",23,true,15.00));
  for (int i=3; i < 103; i++) {
    imap.put(String.valueOf(i),new Employee("String_Node_Str" + i,i % 60,((i % 2) == 1),Double.valueOf(i)));
  }
  Set<Map.Entry> entries=imap.entrySet();
  assertEquals(102,entries.size());
  int itCount=0;
  for (  Map.Entry entry : entries) {
    Employee c=(Employee)entry.getValue();
    itCount++;
  }
  assertEquals(102,itCount);
  entries=imap.entrySet(new SqlPredicate("String_Node_Str"));
  assertEquals(3,entries.size());
  for (  Map.Entry entry : entries) {
    Employee c=(Employee)entry.getValue();
    assertEquals(c.getAge(),23);
    assertTrue(c.isActive());
  }
  imap.remove("String_Node_Str");
  entries=imap.entrySet(new SqlPredicate("String_Node_Str"));
  assertEquals(2,entries.size());
  for (  Map.Entry entry : entries) {
    Employee c=(Employee)entry.getValue();
    assertEquals(c.getAge(),23);
    assertTrue(c.isActive());
  }
  entries=imap.entrySet(new SqlPredicate("String_Node_Str"));
  for (  Map.Entry entry : entries) {
    Employee c=(Employee)entry.getValue();
    assertTrue(c.isActive());
  }
}
Program: 50420
Project: 50420
Buggy source:
public static void writeObject(DataOutput out,Object obj) throws IOException {
  if (obj == null) {
    out.writeByte(0);
  }
 else   if (obj instanceof Long) {
    out.writeByte(1);
    out.writeLong((Long)obj);
  }
 else   if (obj instanceof Integer) {
    out.writeByte(2);
    out.writeInt((Integer)obj);
  }
 else   if (obj instanceof String) {
    out.writeByte(3);
    out.writeUTF((String)obj);
  }
 else   if (obj instanceof Double) {
    out.writeByte(4);
    out.writeDouble((Double)obj);
  }
 else   if (obj instanceof Float) {
    out.writeByte(5);
    out.writeDouble((Float)obj);
  }
 else   if (obj instanceof Boolean) {
    out.writeByte(6);
    out.writeBoolean((Boolean)obj);
  }
 else   if (obj instanceof DataSerializable) {
    out.writeByte(7);
    out.writeUTF(obj.getClass().getName());
    ((DataSerializable)obj).writeData(out);
  }
 else   if (obj instanceof Date) {
    out.writeByte(8);
    out.writeLong(((Date)obj).getTime());
  }
 else {
    out.writeByte(9);
    ByteArrayOutputStream bos=new ByteArrayOutputStream();
    ObjectOutputStream oos=new ObjectOutputStream(bos);
    oos.writeObject(obj);
    oos.close();
    byte[] buf=bos.toByteArray();
    out.writeInt(buf.length);
    out.write(buf);
  }
}

Fixed version (ground truth):
public static void writeObject(DataOutput out,Object obj) throws IOException {
  if (obj == null) {
    out.writeByte(0);
  }
 else   if (obj instanceof Long) {
    out.writeByte(1);
    out.writeLong((Long)obj);
  }
 else   if (obj instanceof Integer) {
    out.writeByte(2);
    out.writeInt((Integer)obj);
  }
 else   if (obj instanceof String) {
    out.writeByte(3);
    out.writeUTF((String)obj);
  }
 else   if (obj instanceof Double) {
    out.writeByte(4);
    out.writeDouble((Double)obj);
  }
 else   if (obj instanceof Float) {
    out.writeByte(5);
    out.writeFloat((Float)obj);
  }
 else   if (obj instanceof Boolean) {
    out.writeByte(6);
    out.writeBoolean((Boolean)obj);
  }
 else   if (obj instanceof DataSerializable) {
    out.writeByte(7);
    out.writeUTF(obj.getClass().getName());
    ((DataSerializable)obj).writeData(out);
  }
 else   if (obj instanceof Date) {
    out.writeByte(8);
    out.writeLong(((Date)obj).getTime());
  }
 else {
    out.writeByte(9);
    ByteArrayOutputStream bos=new ByteArrayOutputStream();
    ObjectOutputStream oos=new ObjectOutputStream(bos);
    oos.writeObject(obj);
    oos.close();
    byte[] buf=bos.toByteArray();
    out.writeInt(buf.length);
    out.write(buf);
  }
}
Program: 50421
Project: 50421
Buggy source:
public static Object readObject(DataInput in) throws IOException {
  byte type=in.readByte();
  if (type == 0) {
    return null;
  }
 else   if (type == 1) {
    return in.readInt();
  }
 else   if (type == 2) {
    return in.readInt();
  }
 else   if (type == 3) {
    return in.readUTF();
  }
 else   if (type == 4) {
    return in.readDouble();
  }
 else   if (type == 5) {
    return in.readFloat();
  }
 else   if (type == 6) {
    return in.readBoolean();
  }
 else   if (type == 7) {
    DataSerializable ds;
    try {
      ds=(DataSerializable)Serializer.classForName(in.readUTF()).newInstance();
    }
 catch (    Throwable e) {
      throw new IOException(e.getMessage());
    }
    ds.readData(in);
    return ds;
  }
 else   if (type == 8) {
    return new Date(in.readLong());
  }
 else   if (type == 9) {
    int len=in.readInt();
    byte[] buf=new byte[len];
    in.readFully(buf);
    ObjectInputStream oin=Serializer.newObjectInputStream(new ByteArrayInputStream(buf));
    try {
      return oin.readObject();
    }
 catch (    ClassNotFoundException e) {
      e.printStackTrace();
    }
    oin.close();
  }
 else {
    throw new IOException("String_Node_Str" + type);
  }
  return null;
}

Fixed version (ground truth):
public static Object readObject(DataInput in) throws IOException {
  byte type=in.readByte();
  if (type == 0) {
    return null;
  }
 else   if (type == 1) {
    return in.readLong();
  }
 else   if (type == 2) {
    return in.readInt();
  }
 else   if (type == 3) {
    return in.readUTF();
  }
 else   if (type == 4) {
    return in.readDouble();
  }
 else   if (type == 5) {
    return in.readFloat();
  }
 else   if (type == 6) {
    return in.readBoolean();
  }
 else   if (type == 7) {
    DataSerializable ds;
    try {
      ds=(DataSerializable)Serializer.classForName(in.readUTF()).newInstance();
    }
 catch (    Throwable e) {
      throw new IOException(e.getMessage());
    }
    ds.readData(in);
    return ds;
  }
 else   if (type == 8) {
    return new Date(in.readLong());
  }
 else   if (type == 9) {
    int len=in.readInt();
    byte[] buf=new byte[len];
    in.readFully(buf);
    ObjectInputStream oin=Serializer.newObjectInputStream(new ByteArrayInputStream(buf));
    try {
      return oin.readObject();
    }
 catch (    ClassNotFoundException e) {
      e.printStackTrace();
    }
    oin.close();
  }
 else {
    throw new IOException("String_Node_Str" + type);
  }
  return null;
}
Program: 50423
Project: 50423
Buggy source:
void initiateMigration(){
  boolean hasMigrating=false;
  for (int i=0; i < PARTITION_COUNT; i++) {
    Block block=blocks[i];
    if (block == null) {
      block=concurrentMapManager.getOrCreateBlock(i);
      block.setOwner(thisAddress);
    }
    if (block.isMigrating()) {
      hasMigrating=true;
    }
  }
  if (!hasMigrating && lsBlocksToMigrate.size() == 0) {
    reArrangeBlocks();
  }
  if (!hasMigrating && lsBlocksToMigrate.size() > 0) {
    Block block=lsBlocksToMigrate.remove(0);
    sendBlocks(block);
  }
 else {
    sendBlocks(null);
  }
}

Fixed version (ground truth):
void initiateMigration(){
  boolean hasMigrating=false;
  for (int i=0; i < PARTITION_COUNT; i++) {
    Block block=blocks[i];
    if (block == null) {
      block=concurrentMapManager.getOrCreateBlock(i);
    }
    if (block.isMigrating()) {
      hasMigrating=true;
    }
  }
  if (!hasMigrating && lsBlocksToMigrate.size() == 0) {
    reArrangeBlocks();
  }
  if (!hasMigrating && lsBlocksToMigrate.size() > 0) {
    Block block=lsBlocksToMigrate.remove(0);
    sendBlocks(block);
  }
 else {
    sendBlocks(null);
  }
}
Program: 50425
Project: 50425
Buggy source:
public void doRun(){
  try {
    logger.log(Level.FINEST,"String_Node_Str" + blockInfo + "String_Node_Str");
    latch.await(10,TimeUnit.SECONDS);
    concurrentMapManager.enqueueAndReturn(new Processable(){
      public void process(){
        blockInfo.setOwner(blockInfo.getMigrationAddress());
        blockInfo.setMigrationAddress(null);
        completeMigration(blockInfo.getBlockId());
        sendCompletionInfo(blockInfo);
      }
    }
);
  }
 catch (  InterruptedException ignored) {
  }
}

Fixed version (ground truth):
public void doRun(){
  try {
    logger.log(Level.FINEST,"String_Node_Str" + blockInfo + "String_Node_Str");
    latch.await(10,TimeUnit.SECONDS);
  }
 catch (  InterruptedException ignored) {
  }
 finally {
    concurrentMapManager.enqueueAndReturn(new Processable(){
      public void process(){
        blockInfo.setOwner(blockInfo.getMigrationAddress());
        blockInfo.setMigrationAddress(null);
        completeMigration(blockInfo.getBlockId());
        sendCompletionInfo(blockInfo);
      }
    }
);
  }
}
Program: 50426
Project: 50426
Buggy source:
Map<Address,List<Block>> getCurrentMemberBlocks(){
  Map<Address,List<Block>> addressBlocks=new HashMap<Address,List<Block>>();
  List<MemberImpl> lsMembers=concurrentMapManager.getMembers();
  for (  MemberImpl member : lsMembers) {
    if (!member.isSuperClient()) {
      addressBlocks.put(member.getAddress(),new ArrayList<Block>());
    }
  }
  for (  Block blockReal : blocks) {
    if (!blockReal.isMigrating()) {
      List<Block> ownedBlocks=addressBlocks.get(blockReal.getOwner());
      ownedBlocks.add(new Block(blockReal));
    }
  }
  return addressBlocks;
}

Fixed version (ground truth):
Map<Address,List<Block>> getCurrentMemberBlocks(){
  Map<Address,List<Block>> addressBlocks=new HashMap<Address,List<Block>>();
  List<MemberImpl> lsMembers=concurrentMapManager.getMembers();
  for (  MemberImpl member : lsMembers) {
    if (!member.isSuperClient()) {
      addressBlocks.put(member.getAddress(),new ArrayList<Block>());
    }
  }
  if (addressBlocks.size() > 0) {
    for (    Block blockReal : blocks) {
      if (blockReal != null && !blockReal.isMigrating()) {
        List<Block> ownedBlocks=addressBlocks.get(blockReal.getOwner());
        ownedBlocks.add(new Block(blockReal));
      }
    }
  }
  return addressBlocks;
}
Program: 50427
Project: 50427
Buggy source:
void backupIfNextOrPreviousChanged(boolean add){
  boolean shouldBackup=false;
  if (add && node.clusterManager.isNextChanged()) {
    shouldBackup=true;
  }
 else   if (!add && node.clusterManager.isPreviousChanged()) {
    shouldBackup=true;
  }
  if (shouldBackup) {
    List<Record> lsOwnedRecords=new ArrayList<Record>(1000);
    Collection<CMap> cmaps=concurrentMapManager.maps.values();
    for (    final CMap cmap : cmaps) {
      for (      Record rec : cmap.mapRecords.values()) {
        if (rec.isActive()) {
          if (rec.getKey() == null || rec.getKey().size() == 0) {
            throw new RuntimeException("String_Node_Str" + rec.getKey());
          }
          lsOwnedRecords.add(rec);
        }
      }
    }
    for (    final Record rec : lsOwnedRecords) {
      parallelExecutorBackups.execute(new FallThroughRunnable(){
        public void doRun(){
          concurrentMapManager.backupRecord(rec);
        }
      }
);
    }
  }
}

Fixed version (ground truth):
void backupIfNextOrPreviousChanged(boolean add){
  boolean shouldBackup=node.clusterManager.isNextChanged();
  if (shouldBackup) {
    List<Record> lsOwnedRecords=new ArrayList<Record>(1000);
    Collection<CMap> cmaps=concurrentMapManager.maps.values();
    for (    final CMap cmap : cmaps) {
      for (      Record rec : cmap.mapRecords.values()) {
        if (rec.isActive()) {
          if (rec.getKey() == null || rec.getKey().size() == 0) {
            throw new RuntimeException("String_Node_Str" + rec.getKey());
          }
          lsOwnedRecords.add(rec);
        }
      }
    }
    if (!add)     logger.log(Level.INFO,thisAddress + "String_Node_Str" + lsOwnedRecords.size());
    for (    final Record rec : lsOwnedRecords) {
      parallelExecutorBackups.execute(new FallThroughRunnable(){
        public void doRun(){
          concurrentMapManager.backupRecord(rec);
        }
      }
);
    }
  }
}