nus-yam/ex-repair huggingface dataset:
Program: 47803
Project: 47803
Buggy source:
public void writeUTF0(final DataOutput out,final String str,final byte[] buffer) throws IOException {
  if (!QuickMath.isPowerOfTwo(buffer.length)) {
    throw new IllegalArgumentException("String_Node_Str" + buffer.length);
  }
  boolean isNull=str == null;
  out.writeBoolean(isNull);
  if (isNull) {
    return;
  }
  final DataOutputAwareUtfWriter UTF_WRITER=out instanceof BufferObjectDataOutput ? BUFFERED_DATA_OUTPUT_UTF_WRITER : DEFAULT_DATA_OUTPUT_UTF_WRITER;
  int length=str.length();
  out.writeInt(length);
  out.writeInt(length);
  if (length > 0) {
    int chunkSize=(length / STRING_CHUNK_SIZE) + 1;
    for (int i=0; i < chunkSize; i++) {
      int beginIndex=Math.max(0,i * STRING_CHUNK_SIZE - 1);
      int endIndex=Math.min((i + 1) * STRING_CHUNK_SIZE - 1,length);
      UTF_WRITER.writeShortUTF(out,str,beginIndex,endIndex,buffer);
    }
  }
}

Fixed version (ground truth):
public void writeUTF0(final DataOutput out,final String str,final byte[] buffer) throws IOException {
  if (!QuickMath.isPowerOfTwo(buffer.length)) {
    throw new IllegalArgumentException("String_Node_Str" + buffer.length);
  }
  boolean isNull=str == null;
  out.writeBoolean(isNull);
  if (isNull) {
    return;
  }
  final DataOutputAwareUtfWriter utfWriter=out instanceof BufferObjectDataOutput ? BUFFERED_DATA_OUTPUT_UTF_WRITER : DEFAULT_DATA_OUTPUT_UTF_WRITER;
  int length=str.length();
  out.writeInt(length);
  out.writeInt(length);
  if (length > 0) {
    int chunkSize=(length / STRING_CHUNK_SIZE) + 1;
    for (int i=0; i < chunkSize; i++) {
      int beginIndex=Math.max(0,i * STRING_CHUNK_SIZE - 1);
      int endIndex=Math.min((i + 1) * STRING_CHUNK_SIZE - 1,length);
      utfWriter.writeShortUTF(out,str,beginIndex,endIndex,buffer);
    }
  }
}
Program: 47806
Project: 47806
Buggy source:
protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
  threadId=in.readLong();
}

Fixed version (ground truth):
protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
}
Program: 47807
Project: 47807
Buggy source:
protected void writeInternal(ObjectDataOutput out) throws IOException {
  super.writeInternal(out);
  out.writeLong(threadId);
}

Fixed version (ground truth):
protected void writeInternal(ObjectDataOutput out) throws IOException {
  super.writeInternal(out);
}
Program: 47808
Project: 47808
Buggy source:
protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
  dataKey=new Data();
  dataKey.readData(in);
}

Fixed version (ground truth):
protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
  dataKey=new Data();
  dataKey.readData(in);
  threadId=in.readLong();
}
Program: 47809
Project: 47809
Buggy source:
protected void writeInternal(ObjectDataOutput out) throws IOException {
  super.writeInternal(out);
  dataKey.writeData(out);
}

Fixed version (ground truth):
protected void writeInternal(ObjectDataOutput out) throws IOException {
  super.writeInternal(out);
  dataKey.writeData(out);
  out.writeLong(threadId);
}
Program: 47810
Project: 47810
Buggy source:
protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
  int size=in.readInt();
  opList=new ArrayList<Operation>(size);
  for (int i=0; i < size; i++) {
    opList.add((Operation)in.readObject());
  }
  caller=in.readUTF();
  threadId=in.readLong();
}

Fixed version (ground truth):
protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
  int size=in.readInt();
  opList=new ArrayList<Operation>(size);
  for (int i=0; i < size; i++) {
    opList.add((Operation)in.readObject());
  }
  caller=in.readUTF();
}
Program: 47811
Project: 47811
Buggy source:
protected void writeInternal(ObjectDataOutput out) throws IOException {
  super.writeInternal(out);
  out.writeInt(opList.size());
  for (  Operation op : opList) {
    out.writeObject(op);
  }
  out.writeUTF(caller);
  out.writeLong(threadId);
}

Fixed version (ground truth):
protected void writeInternal(ObjectDataOutput out) throws IOException {
  super.writeInternal(out);
  out.writeInt(opList.size());
  for (  Operation op : opList) {
    out.writeObject(op);
  }
  out.writeUTF(caller);
}
Program: 47812
Project: 47812
Buggy source:
protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
  ttl=in.readLong();
  threadId=in.readLong();
}

Fixed version (ground truth):
protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
  ttl=in.readLong();
}
Program: 47813
Project: 47813
Buggy source:
protected void writeInternal(ObjectDataOutput out) throws IOException {
  super.writeInternal(out);
  out.writeLong(ttl);
  out.writeLong(threadId);
}

Fixed version (ground truth):
protected void writeInternal(ObjectDataOutput out) throws IOException {
  super.writeInternal(out);
  out.writeLong(ttl);
}
Program: 47814
Project: 47814
Buggy source:
protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
  caller=in.readUTF();
  threadId=in.readLong();
  ttl=in.readLong();
}

Fixed version (ground truth):
protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
  caller=in.readUTF();
  ttl=in.readLong();
}
Program: 47815
Project: 47815
Buggy source:
protected void writeInternal(ObjectDataOutput out) throws IOException {
  super.writeInternal(out);
  out.writeUTF(caller);
  out.writeLong(threadId);
  out.writeLong(ttl);
}

Fixed version (ground truth):
protected void writeInternal(ObjectDataOutput out) throws IOException {
  super.writeInternal(out);
  out.writeUTF(caller);
  out.writeLong(ttl);
}
Program: 47816
Project: 47816
Buggy source:
protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
  caller=in.readUTF();
  threadId=in.readLong();
}

Fixed version (ground truth):
protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
  caller=in.readUTF();
}
Program: 47817
Project: 47817
Buggy source:
protected void writeInternal(ObjectDataOutput out) throws IOException {
  super.writeInternal(out);
  out.writeUTF(caller);
  out.writeLong(threadId);
}

Fixed version (ground truth):
protected void writeInternal(ObjectDataOutput out) throws IOException {
  super.writeInternal(out);
  out.writeUTF(caller);
}
Program: 47818
Project: 47818
Buggy source:
protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
  threadId=in.readLong();
}

Fixed version (ground truth):
protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
}
Program: 47819
Project: 47819
Buggy source:
protected void writeInternal(ObjectDataOutput out) throws IOException {
  super.writeInternal(out);
  out.writeLong(threadId);
}

Fixed version (ground truth):
protected void writeInternal(ObjectDataOutput out) throws IOException {
  super.writeInternal(out);
}
Program: 47820
Project: 47820
Buggy source:
protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
  dataKey=new Data();
  dataKey.readData(in);
}

Fixed version (ground truth):
protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
  dataKey=new Data();
  dataKey.readData(in);
  threadId=in.readLong();
}
Program: 47821
Project: 47821
Buggy source:
protected void writeInternal(ObjectDataOutput out) throws IOException {
  super.writeInternal(out);
  dataKey.writeData(out);
}

Fixed version (ground truth):
protected void writeInternal(ObjectDataOutput out) throws IOException {
  super.writeInternal(out);
  dataKey.writeData(out);
  out.writeLong(threadId);
}
Program: 47822
Project: 47822
Buggy source:
protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
  int size=in.readInt();
  opList=new ArrayList<Operation>(size);
  for (int i=0; i < size; i++) {
    opList.add((Operation)in.readObject());
  }
  caller=in.readUTF();
  threadId=in.readLong();
}

Fixed version (ground truth):
protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
  int size=in.readInt();
  opList=new ArrayList<Operation>(size);
  for (int i=0; i < size; i++) {
    opList.add((Operation)in.readObject());
  }
  caller=in.readUTF();
}
Program: 47823
Project: 47823
Buggy source:
protected void writeInternal(ObjectDataOutput out) throws IOException {
  super.writeInternal(out);
  out.writeInt(opList.size());
  for (  Operation op : opList) {
    out.writeObject(op);
  }
  out.writeUTF(caller);
  out.writeLong(threadId);
}

Fixed version (ground truth):
protected void writeInternal(ObjectDataOutput out) throws IOException {
  super.writeInternal(out);
  out.writeInt(opList.size());
  for (  Operation op : opList) {
    out.writeObject(op);
  }
  out.writeUTF(caller);
}
Program: 47824
Project: 47824
Buggy source:
protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
  ttl=in.readLong();
  threadId=in.readLong();
}

Fixed version (ground truth):
protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
  ttl=in.readLong();
}
Program: 47825
Project: 47825
Buggy source:
protected void writeInternal(ObjectDataOutput out) throws IOException {
  super.writeInternal(out);
  out.writeLong(ttl);
  out.writeLong(threadId);
}

Fixed version (ground truth):
protected void writeInternal(ObjectDataOutput out) throws IOException {
  super.writeInternal(out);
  out.writeLong(ttl);
}
Program: 47826
Project: 47826
Buggy source:
protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
  caller=in.readUTF();
  threadId=in.readLong();
  ttl=in.readLong();
}

Fixed version (ground truth):
protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
  caller=in.readUTF();
  ttl=in.readLong();
}
Program: 47827
Project: 47827
Buggy source:
protected void writeInternal(ObjectDataOutput out) throws IOException {
  super.writeInternal(out);
  out.writeUTF(caller);
  out.writeLong(threadId);
  out.writeLong(ttl);
}

Fixed version (ground truth):
protected void writeInternal(ObjectDataOutput out) throws IOException {
  super.writeInternal(out);
  out.writeUTF(caller);
  out.writeLong(ttl);
}
Program: 47828
Project: 47828
Buggy source:
protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
  caller=in.readUTF();
  threadId=in.readLong();
}

Fixed version (ground truth):
protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
  caller=in.readUTF();
}
Program: 47829
Project: 47829
Buggy source:
protected void writeInternal(ObjectDataOutput out) throws IOException {
  super.writeInternal(out);
  out.writeUTF(caller);
  out.writeLong(threadId);
}

Fixed version (ground truth):
protected void writeInternal(ObjectDataOutput out) throws IOException {
  super.writeInternal(out);
  out.writeUTF(caller);
}
Program: 47830
Project: 47830
Buggy source:
@Test public void testSameMasterDifferentMemberList() throws Exception {
  Config c1=buildConfig(false);
  Config c2=buildConfig(false);
  Config c3=buildConfig(false);
  c1.getNetworkConfig().setPort(45701);
  c2.getNetworkConfig().setPort(45702);
  c3.getNetworkConfig().setPort(45703);
  List<String> allMembers=Arrays.asList("String_Node_Str");
  c1.getNetworkConfig().getJoin().getTcpIpConfig().setMembers(allMembers);
  c2.getNetworkConfig().getJoin().getTcpIpConfig().setMembers(allMembers);
  c3.getNetworkConfig().getJoin().getTcpIpConfig().setMembers(allMembers);
  final HazelcastInstance h1=Hazelcast.newHazelcastInstance(c1);
  final HazelcastInstance h2=Hazelcast.newHazelcastInstance(c2);
  final HazelcastInstance h3=Hazelcast.newHazelcastInstance(c3);
  final MemberImpl m1=(MemberImpl)h1.getCluster().getLocalMember();
  final MemberImpl m2=(MemberImpl)h2.getCluster().getLocalMember();
  assertEquals(3,h1.getCluster().getMembers().size());
  assertEquals(3,h2.getCluster().getMembers().size());
  assertEquals(3,h3.getCluster().getMembers().size());
  final Node n2=TestUtil.getNode(h2);
  List<MemberInfo> members=new ArrayList<MemberInfo>();
  members.add(new MemberInfo(m1.getAddress(),m1.getUuid(),Collections.<String,Object>emptyMap()));
  members.add(new MemberInfo(m2.getAddress(),m2.getUuid(),Collections.<String,Object>emptyMap()));
  n2.clusterService.updateMembers(members);
  Thread.sleep(30 * 1000);
  assertEquals(m1,h1.getCluster().getMembers().iterator().next());
  assertEquals(m1,h2.getCluster().getMembers().iterator().next());
  assertEquals(m1,h3.getCluster().getMembers().iterator().next());
  assertEquals(3,h1.getCluster().getMembers().size());
  assertEquals(3,h2.getCluster().getMembers().size());
  assertEquals(3,h3.getCluster().getMembers().size());
}

Fixed version (ground truth):
@Test public void testSameMasterDifferentMemberList() throws Exception {
  List<HazelcastInstance> instanceList=buildInstances(3,45701);
  final HazelcastInstance h1=instanceList.get(0);
  final HazelcastInstance h2=instanceList.get(1);
  final HazelcastInstance h3=instanceList.get(2);
  final MemberImpl m1=(MemberImpl)h1.getCluster().getLocalMember();
  final MemberImpl m2=(MemberImpl)h2.getCluster().getLocalMember();
  assertEquals(3,h1.getCluster().getMembers().size());
  assertEquals(3,h2.getCluster().getMembers().size());
  assertEquals(3,h3.getCluster().getMembers().size());
  final Node n2=TestUtil.getNode(h2);
  List<MemberInfo> members=new ArrayList<MemberInfo>();
  members.add(new MemberInfo(m1.getAddress(),m1.getUuid(),Collections.<String,Object>emptyMap()));
  members.add(new MemberInfo(m2.getAddress(),m2.getUuid(),Collections.<String,Object>emptyMap()));
  n2.clusterService.updateMembers(members);
  Thread.sleep(30 * 1000);
  assertEquals(m1,h1.getCluster().getMembers().iterator().next());
  assertEquals(m1,h2.getCluster().getMembers().iterator().next());
  assertEquals(m1,h3.getCluster().getMembers().iterator().next());
  assertEquals(3,h1.getCluster().getMembers().size());
  assertEquals(3,h2.getCluster().getMembers().size());
  assertEquals(3,h3.getCluster().getMembers().size());
}
Program: 47836
Project: 47836
Buggy source:
private int buffered(final byte[] buffer,final int pos,final int utfLength,final DataInput in) throws IOException {
  try {
    buffer[0]=buffer[pos];
    return pos + 1;
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    in.readFully(buffer,1,Math.min(buffer.length - 1,utfLength - pos));
    buffer[0]=buffer[1];
    return 2;
  }
}

Fixed version (ground truth):
private int buffered(final byte[] buffer,final int pos,final int utfLength,final int readCount,final DataInput in) throws IOException {
  try {
    buffer[0]=buffer[pos];
    return pos + 1;
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    in.readFully(buffer,1,Math.min(buffer.length - 1,utfLength - readCount));
    buffer[0]=buffer[1];
    return 2;
  }
}
Program: 47837
Project: 47837
Buggy source:
private void handleProcessingFailure(ClientEndpointImpl endpoint,ClientRequest request,Throwable e){
  Level level=nodeEngine.isActive() ? Level.SEVERE : Level.FINEST;
  if (logger.isLoggable(level)) {
    if (request == null) {
      logger.log(level,e.getMessage(),e);
    }
 else {
      logger.log(level,"String_Node_Str" + request + "String_Node_Str"+ e.getMessage(),e);
    }
  }
  if (request != null && endpoint != null) {
    endpoint.sendResponse(e,request.getCallId());
  }
}

Fixed version (ground truth):
private void handleProcessingFailure(ClientEndpointImpl endpoint,ClientRequest request,Data data,Throwable e){
  Level level=nodeEngine.isActive() ? Level.SEVERE : Level.FINEST;
  if (logger.isLoggable(level)) {
    if (request == null) {
      logger.log(level,e.getMessage(),e);
    }
 else {
      logger.log(level,"String_Node_Str" + request + "String_Node_Str"+ e.getMessage(),e);
    }
  }
  if (request != null && endpoint != null) {
    endpoint.sendResponse(e,request.getCallId());
  }
 else   if (data != null && endpoint != null) {
    int callId=extractCallId(data);
    if (callId != -1) {
      endpoint.sendResponse(e,callId);
    }
  }
}
Program: 47838
Project: 47838
Buggy source:
private void handleProcessingFailure(ClientEndpointImpl endpoint,ClientRequest request,Throwable e){
  Level level=nodeEngine.isActive() ? Level.SEVERE : Level.FINEST;
  if (logger.isLoggable(level)) {
    if (request == null) {
      logger.log(level,e.getMessage(),e);
    }
 else {
      logger.log(level,"String_Node_Str" + request + "String_Node_Str"+ e.getMessage(),e);
    }
  }
  if (request != null && endpoint != null) {
    endpoint.sendResponse(e,request.getCallId());
  }
}

Fixed version (ground truth):
private void handleProcessingFailure(ClientEndpointImpl endpoint,ClientRequest request,Data data,Throwable e){
  Level level=nodeEngine.isActive() ? Level.SEVERE : Level.FINEST;
  if (logger.isLoggable(level)) {
    if (request == null) {
      logger.log(level,e.getMessage(),e);
    }
 else {
      logger.log(level,"String_Node_Str" + request + "String_Node_Str"+ e.getMessage(),e);
    }
  }
  if (request != null && endpoint != null) {
    endpoint.sendResponse(e,request.getCallId());
  }
 else   if (data != null && endpoint != null) {
    int callId=extractCallId(data);
    if (callId != -1) {
      endpoint.sendResponse(e,callId);
    }
  }
}
Program: 47839
Project: 47839
Buggy source:
public void whenDifferentGroups_thenDifferentClustersAreFormed(boolean tcp){
  Config config1=new Config();
  config1.getGroupConfig().setName("String_Node_Str");
  Config config2=new Config();
  config2.getGroupConfig().setName("String_Node_Str");
  if (tcp) {
    enableTcp(config1);
    enableTcp(config2);
  }
  HazelcastInstance hz1=Hazelcast.newHazelcastInstance(config1);
  HazelcastInstance hz2=Hazelcast.newHazelcastInstance(config2);
  assertTrue(hz1.getLifecycleService().isRunning());
  assertEquals(1,hz1.getCluster().getMembers().size());
  assertTrue(hz2.getLifecycleService().isRunning());
  assertEquals(1,hz2.getCluster().getMembers().size());
}

Fixed version (ground truth):
private void whenDifferentGroups_thenDifferentClustersAreFormed(boolean tcp){
  Config config1=new Config();
  config1.getGroupConfig().setName("String_Node_Str");
  Config config2=new Config();
  config2.getGroupConfig().setName("String_Node_Str");
  if (tcp) {
    enableTcp(config1);
    enableTcp(config2);
  }
  HazelcastInstance hz1=Hazelcast.newHazelcastInstance(config1);
  HazelcastInstance hz2=Hazelcast.newHazelcastInstance(config2);
  assertTrue(hz1.getLifecycleService().isRunning());
  assertEquals(1,hz1.getCluster().getMembers().size());
  assertTrue(hz2.getLifecycleService().isRunning());
  assertEquals(1,hz2.getCluster().getMembers().size());
}
Program: 47840
Project: 47840
Buggy source:
private void enableTcp(Config config1){
  config1.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true).addMember("String_Node_Str");
  config1.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
}

Fixed version (ground truth):
private void enableTcp(Config config){
  config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true).addMember("String_Node_Str");
  config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
  final int basePort=TestUtil.getAvailablePort(BASE_PORT);
  config.getNetworkConfig().setPort(basePort);
}
Program: 47841
Project: 47841
Buggy source:
public void whenGroupPasswordMismatch_thenNewNodeIsShutDown(boolean tcp){
  Config config1=new Config();
  config1.getGroupConfig().setName("String_Node_Str");
  config1.getGroupConfig().setPassword("String_Node_Str");
  Config config2=new Config();
  config2.getGroupConfig().setName("String_Node_Str");
  config2.getGroupConfig().setPassword("String_Node_Str");
  assertIncompatible(config1,config2,tcp);
}

Fixed version (ground truth):
private void whenGroupPasswordMismatch_thenNewNodeIsShutDown(boolean tcp){
  Config config1=new Config();
  config1.getGroupConfig().setName("String_Node_Str");
  config1.getGroupConfig().setPassword("String_Node_Str");
  Config config2=new Config();
  config2.getGroupConfig().setName("String_Node_Str");
  config2.getGroupConfig().setPassword("String_Node_Str");
  assertIncompatible(config1,config2,tcp);
}
Program: 47842
Project: 47842
Buggy source:
HazelcastInstanceImpl(String name,Config config,NodeContext nodeContext) throws Exception {
  this.name=name;
  this.threadGroup=new ThreadGroup(name);
  threadMonitoringService=new ThreadMonitoringService(threadGroup);
  lifecycleService=new LifecycleServiceImpl(this);
  ManagedContext configuredManagedContext=config.getManagedContext();
  managedContext=new HazelcastManagedContext(this,configuredManagedContext);
  userContext.putAll(config.getUserContext());
  node=new Node(this,config,nodeContext);
  try {
    logger=node.getLogger(getClass().getName());
    lifecycleService.fireLifecycleEvent(STARTING);
    node.start();
    if (!node.isActive()) {
      throw new IllegalStateException("String_Node_Str");
    }
    managementService=new ManagementService(this);
    initManagedContext(configuredManagedContext);
    initHealthMonitor();
  }
 catch (  Throwable e) {
    try {
      node.connectionManager.shutdown();
    }
 catch (    Throwable ignored) {
      EmptyStatement.ignore(ignored);
    }
    throw ExceptionUtil.rethrow(e);
  }
}

Fixed version (ground truth):
HazelcastInstanceImpl(String name,Config config,NodeContext nodeContext) throws Exception {
  this.name=name;
  this.threadGroup=new ThreadGroup(name);
  threadMonitoringService=new ThreadMonitoringService(threadGroup);
  lifecycleService=new LifecycleServiceImpl(this);
  ManagedContext configuredManagedContext=config.getManagedContext();
  managedContext=new HazelcastManagedContext(this,configuredManagedContext);
  userContext.putAll(config.getUserContext());
  node=new Node(this,config,nodeContext);
  try {
    logger=node.getLogger(getClass().getName());
    lifecycleService.fireLifecycleEvent(STARTING);
    node.start();
    if (!node.isActive()) {
      throw new IllegalStateException("String_Node_Str");
    }
    managementService=new ManagementService(this);
    initManagedContext(configuredManagedContext);
    initHealthMonitor();
  }
 catch (  Throwable e) {
    try {
      node.shutdown(true);
    }
 catch (    Throwable ignored) {
      EmptyStatement.ignore(ignored);
    }
    throw ExceptionUtil.rethrow(e);
  }
}
Program: 47843
Project: 47843
Buggy source:
public void whenDifferentGroups_thenDifferentClustersAreFormed(boolean tcp){
  Config config1=new Config();
  config1.getGroupConfig().setName("String_Node_Str");
  Config config2=new Config();
  config2.getGroupConfig().setName("String_Node_Str");
  if (tcp) {
    enableTcp(config1);
    enableTcp(config2);
  }
  HazelcastInstance hz1=Hazelcast.newHazelcastInstance(config1);
  HazelcastInstance hz2=Hazelcast.newHazelcastInstance(config2);
  assertTrue(hz1.getLifecycleService().isRunning());
  assertEquals(1,hz1.getCluster().getMembers().size());
  assertTrue(hz2.getLifecycleService().isRunning());
  assertEquals(1,hz2.getCluster().getMembers().size());
}

Fixed version (ground truth):
private void whenDifferentGroups_thenDifferentClustersAreFormed(boolean tcp){
  Config config1=new Config();
  config1.getGroupConfig().setName("String_Node_Str");
  Config config2=new Config();
  config2.getGroupConfig().setName("String_Node_Str");
  if (tcp) {
    enableTcp(config1);
    enableTcp(config2);
  }
  HazelcastInstance hz1=Hazelcast.newHazelcastInstance(config1);
  HazelcastInstance hz2=Hazelcast.newHazelcastInstance(config2);
  assertTrue(hz1.getLifecycleService().isRunning());
  assertEquals(1,hz1.getCluster().getMembers().size());
  assertTrue(hz2.getLifecycleService().isRunning());
  assertEquals(1,hz2.getCluster().getMembers().size());
}
Program: 47844
Project: 47844
Buggy source:
private void enableTcp(Config config1){
  config1.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true).addMember("String_Node_Str");
  config1.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
}

Fixed version (ground truth):
private void enableTcp(Config config){
  config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true).addMember("String_Node_Str");
  config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
  final int basePort=TestUtil.getAvailablePort(BASE_PORT);
  config.getNetworkConfig().setPort(basePort);
}
Program: 47845
Project: 47845
Buggy source:
public void whenGroupPasswordMismatch_thenNewNodeIsShutDown(boolean tcp){
  Config config1=new Config();
  config1.getGroupConfig().setName("String_Node_Str");
  config1.getGroupConfig().setPassword("String_Node_Str");
  Config config2=new Config();
  config2.getGroupConfig().setName("String_Node_Str");
  config2.getGroupConfig().setPassword("String_Node_Str");
  assertIncompatible(config1,config2,tcp);
}

Fixed version (ground truth):
private void whenGroupPasswordMismatch_thenNewNodeIsShutDown(boolean tcp){
  Config config1=new Config();
  config1.getGroupConfig().setName("String_Node_Str");
  config1.getGroupConfig().setPassword("String_Node_Str");
  Config config2=new Config();
  config2.getGroupConfig().setName("String_Node_Str");
  config2.getGroupConfig().setPassword("String_Node_Str");
  assertIncompatible(config1,config2,tcp);
}
Program: 47846
Project: 47846
Buggy source:
HazelcastInstanceImpl(String name,Config config,NodeContext nodeContext) throws Exception {
  this.name=name;
  this.threadGroup=new ThreadGroup(name);
  threadMonitoringService=new ThreadMonitoringService(threadGroup);
  lifecycleService=new LifecycleServiceImpl(this);
  ManagedContext configuredManagedContext=config.getManagedContext();
  managedContext=new HazelcastManagedContext(this,configuredManagedContext);
  userContext.putAll(config.getUserContext());
  node=new Node(this,config,nodeContext);
  try {
    logger=node.getLogger(getClass().getName());
    lifecycleService.fireLifecycleEvent(STARTING);
    node.start();
    if (!node.isActive()) {
      throw new IllegalStateException("String_Node_Str");
    }
    managementService=new ManagementService(this);
    initManagedContext(configuredManagedContext);
    initHealthMonitor();
  }
 catch (  Throwable e) {
    try {
      node.connectionManager.shutdown();
    }
 catch (    Throwable ignored) {
      EmptyStatement.ignore(ignored);
    }
    throw ExceptionUtil.rethrow(e);
  }
}

Fixed version (ground truth):
HazelcastInstanceImpl(String name,Config config,NodeContext nodeContext) throws Exception {
  this.name=name;
  this.threadGroup=new ThreadGroup(name);
  threadMonitoringService=new ThreadMonitoringService(threadGroup);
  lifecycleService=new LifecycleServiceImpl(this);
  ManagedContext configuredManagedContext=config.getManagedContext();
  managedContext=new HazelcastManagedContext(this,configuredManagedContext);
  userContext.putAll(config.getUserContext());
  node=new Node(this,config,nodeContext);
  try {
    logger=node.getLogger(getClass().getName());
    lifecycleService.fireLifecycleEvent(STARTING);
    node.start();
    if (!node.isActive()) {
      throw new IllegalStateException("String_Node_Str");
    }
    managementService=new ManagementService(this);
    initManagedContext(configuredManagedContext);
    initHealthMonitor();
  }
 catch (  Throwable e) {
    try {
      node.shutdown(true);
    }
 catch (    Throwable ignored) {
      EmptyStatement.ignore(ignored);
    }
    throw ExceptionUtil.rethrow(e);
  }
}
Program: 47847
Project: 47847
Buggy source:
@Test public void testIssue1085WriteBehindBackupWithLongRunnigMapStore() throws InterruptedException {
  final String name=randomMapName("String_Node_Str");
  final int expectedStoreCount=3;
  final int nodeCount=3;
  Config config=new Config();
  config.setProperty(GroupProperties.PROP_MAP_REPLICA_SCHEDULED_TASK_DELAY_SECONDS,"String_Node_Str");
  MapConfig writeBehindBackupConfig=config.getMapConfig(name);
  MapStoreConfig mapStoreConfig=new MapStoreConfig();
  mapStoreConfig.setWriteDelaySeconds(5);
  final MapStoreWithStoreCount mapStore=new MapStoreWithStoreCount(expectedStoreCount,300,100);
  mapStoreConfig.setImplementation(mapStore);
  writeBehindBackupConfig.setMapStoreConfig(mapStoreConfig);
  final TestHazelcastInstanceFactory factory=createHazelcastInstanceFactory(nodeCount);
  HazelcastInstance node1=factory.newHazelcastInstance(config);
  HazelcastInstance node2=factory.newHazelcastInstance(config);
  HazelcastInstance node3=factory.newHazelcastInstance(config);
  final String keyOwnedByNode1=generateKeyOwnedBy(node1);
  final String keyOwnedByNode2=generateKeyOwnedBy(node2);
  final String keyOwnedByNode3=generateKeyOwnedBy(node3);
  final IMap map=node1.getMap(name);
  map.put(keyOwnedByNode1,1);
  map.put(keyOwnedByNode2,2);
  map.put(keyOwnedByNode3,3);
  node2.getLifecycleService().shutdown();
  mapStore.awaitStores();
  assertTrue(expectedStoreCount <= mapStore.count.intValue());
}

Fixed version (ground truth):
@Test public void testIssue1085WriteBehindBackupWithLongRunnigMapStore() throws InterruptedException {
  final String name=randomMapName("String_Node_Str");
  final int expectedStoreCount=3;
  final int nodeCount=3;
  Config config=new Config();
  config.setProperty(GroupProperties.PROP_MAP_REPLICA_SCHEDULED_TASK_DELAY_SECONDS,"String_Node_Str");
  MapConfig writeBehindBackupConfig=config.getMapConfig(name);
  MapStoreConfig mapStoreConfig=new MapStoreConfig();
  mapStoreConfig.setWriteDelaySeconds(5);
  final MapStoreWithStoreCount mapStore=new MapStoreWithStoreCount(expectedStoreCount,300,50);
  mapStoreConfig.setImplementation(mapStore);
  writeBehindBackupConfig.setMapStoreConfig(mapStoreConfig);
  final TestHazelcastInstanceFactory factory=createHazelcastInstanceFactory(nodeCount);
  HazelcastInstance node1=factory.newHazelcastInstance(config);
  HazelcastInstance node2=factory.newHazelcastInstance(config);
  HazelcastInstance node3=factory.newHazelcastInstance(config);
  final String keyOwnedByNode1=generateKeyOwnedBy(node1);
  final String keyOwnedByNode2=generateKeyOwnedBy(node2);
  final String keyOwnedByNode3=generateKeyOwnedBy(node3);
  final IMap map=node1.getMap(name);
  map.put(keyOwnedByNode1,1);
  map.put(keyOwnedByNode2,2);
  map.put(keyOwnedByNode3,3);
  node2.getLifecycleService().shutdown();
  mapStore.awaitStores();
  assertTrue(expectedStoreCount <= mapStore.count.intValue());
}
Program: 47848
Project: 47848
Buggy source:
@Test public void testIssue1085WriteBehindBackupWithLongRunnigMapStore() throws InterruptedException {
  final String name=randomMapName("String_Node_Str");
  final int expectedStoreCount=3;
  final int nodeCount=3;
  Config config=new Config();
  config.setProperty(GroupProperties.PROP_MAP_REPLICA_SCHEDULED_TASK_DELAY_SECONDS,"String_Node_Str");
  MapConfig writeBehindBackupConfig=config.getMapConfig(name);
  MapStoreConfig mapStoreConfig=new MapStoreConfig();
  mapStoreConfig.setWriteDelaySeconds(5);
  final MapStoreWithStoreCount mapStore=new MapStoreWithStoreCount(expectedStoreCount,300,100);
  mapStoreConfig.setImplementation(mapStore);
  writeBehindBackupConfig.setMapStoreConfig(mapStoreConfig);
  final TestHazelcastInstanceFactory factory=createHazelcastInstanceFactory(nodeCount);
  HazelcastInstance node1=factory.newHazelcastInstance(config);
  HazelcastInstance node2=factory.newHazelcastInstance(config);
  HazelcastInstance node3=factory.newHazelcastInstance(config);
  final String keyOwnedByNode1=generateKeyOwnedBy(node1);
  final String keyOwnedByNode2=generateKeyOwnedBy(node2);
  final String keyOwnedByNode3=generateKeyOwnedBy(node3);
  final IMap map=node1.getMap(name);
  map.put(keyOwnedByNode1,1);
  map.put(keyOwnedByNode2,2);
  map.put(keyOwnedByNode3,3);
  node2.getLifecycleService().shutdown();
  mapStore.awaitStores();
  assertTrue(expectedStoreCount <= mapStore.count.intValue());
}

Fixed version (ground truth):
@Test public void testIssue1085WriteBehindBackupWithLongRunnigMapStore() throws InterruptedException {
  final String name=randomMapName("String_Node_Str");
  final int expectedStoreCount=3;
  final int nodeCount=3;
  Config config=new Config();
  config.setProperty(GroupProperties.PROP_MAP_REPLICA_SCHEDULED_TASK_DELAY_SECONDS,"String_Node_Str");
  MapConfig writeBehindBackupConfig=config.getMapConfig(name);
  MapStoreConfig mapStoreConfig=new MapStoreConfig();
  mapStoreConfig.setWriteDelaySeconds(5);
  final MapStoreWithStoreCount mapStore=new MapStoreWithStoreCount(expectedStoreCount,300,50);
  mapStoreConfig.setImplementation(mapStore);
  writeBehindBackupConfig.setMapStoreConfig(mapStoreConfig);
  final TestHazelcastInstanceFactory factory=createHazelcastInstanceFactory(nodeCount);
  HazelcastInstance node1=factory.newHazelcastInstance(config);
  HazelcastInstance node2=factory.newHazelcastInstance(config);
  HazelcastInstance node3=factory.newHazelcastInstance(config);
  final String keyOwnedByNode1=generateKeyOwnedBy(node1);
  final String keyOwnedByNode2=generateKeyOwnedBy(node2);
  final String keyOwnedByNode3=generateKeyOwnedBy(node3);
  final IMap map=node1.getMap(name);
  map.put(keyOwnedByNode1,1);
  map.put(keyOwnedByNode2,2);
  map.put(keyOwnedByNode3,3);
  node2.getLifecycleService().shutdown();
  mapStore.awaitStores();
  int mapStoreSize=mapStore.count.intValue();
  assertTrue("String_Node_Str" + expectedStoreCount + "String_Node_Str"+ mapStoreSize,expectedStoreCount <= mapStoreSize);
}
Program: 47849
Project: 47849
Buggy source:
@Override public void close(){
  HazelcastInstance hz=hazelcastInstance;
  Collection<DistributedObject> distributedObjects=hz.getDistributedObjects();
  for (  DistributedObject distributedObject : distributedObjects) {
    if (distributedObject instanceof ICache) {
      distributedObject.destroy();
    }
  }
}

Fixed version (ground truth):
@Override public void close(){
  closeTriggered=true;
  HazelcastInstance hz=hazelcastInstance;
  Collection<DistributedObject> distributedObjects=hz.getDistributedObjects();
  for (  DistributedObject distributedObject : distributedObjects) {
    if (distributedObject instanceof ICache) {
      distributedObject.destroy();
    }
  }
  hz.shutdown();
  cachingProvider.releaseCacheManager(uri,classLoaderReference.get());
}
Program: 47850
Project: 47850
Buggy source:
@Override public float getAverageRemoveTime(){
  if (statistics.getRemoveTimeTakenNanos() == 0 || getCacheGets() == 0) {
    return 0;
  }
  float avgRemoveTime=(float)(statistics.getRemoveTimeTakenNanos() / getCacheGets()) / NANOSECONDS_IN_A_MICROSECOND;
  return avgRemoveTime;
}

Fixed version (ground truth):
@Override public float getAverageRemoveTime(){
  if (statistics.getRemoveTimeTakenNanos() == 0 || getCacheGets() == 0) {
    return 0;
  }
  float avgRemoveTime=((1f * statistics.getRemoveTimeTakenNanos()) / getCacheGets()) / NANOSECONDS_IN_A_MICROSECOND;
  return avgRemoveTime;
}
Program: 47851
Project: 47851
Buggy source:
@Override public float getAverageGetTime(){
  if (statistics.getGetTimeTakenNanos() == 0 || getCacheGets() == 0) {
    return 0;
  }
  float avgGetTime=(float)(statistics.getGetTimeTakenNanos() / getCacheGets()) / NANOSECONDS_IN_A_MICROSECOND;
  return avgGetTime;
}

Fixed version (ground truth):
@Override public float getAverageGetTime(){
  if (statistics.getGetTimeTakenNanos() == 0 || getCacheGets() == 0) {
    return 0;
  }
  float avgGetTime=((1f * statistics.getGetTimeTakenNanos()) / getCacheGets()) / NANOSECONDS_IN_A_MICROSECOND;
  return avgGetTime;
}
Program: 47852
Project: 47852
Buggy source:
@Override public float getAveragePutTime(){
  if (statistics.getPutTimeTakenNanos() == 0 || getCacheGets() == 0) {
    return 0;
  }
  float avgPutTime=(float)(statistics.getPutTimeTakenNanos() / getCacheGets()) / NANOSECONDS_IN_A_MICROSECOND;
  return avgPutTime;
}

Fixed version (ground truth):
@Override public float getAveragePutTime(){
  if (statistics.getPutTimeTakenNanos() == 0 || getCacheGets() == 0) {
    return 0;
  }
  float avgPutTime=((1f * statistics.getPutTimeTakenNanos()) / getCacheGets()) / NANOSECONDS_IN_A_MICROSECOND;
  return avgPutTime;
}
Program: 47853
Project: 47853
Buggy source:
@Override public void readData(ObjectDataInput in) throws IOException {
  name=in.readUTF();
  managerPrefix=in.readUTF();
  uriString=in.readUTF();
  backupCount=in.readInt();
  asyncBackupCount=in.readInt();
  final int resultInMemoryFormat=in.readInt();
  inMemoryFormat=InMemoryFormat.values()[resultInMemoryFormat];
  final int resultEvictionPolicy=in.readInt();
  evictionPolicy=EvictionPolicy.values()[resultEvictionPolicy];
  keyType=in.readObject();
  valueType=in.readObject();
  cacheLoaderFactory=in.readObject();
  cacheWriterFactory=in.readObject();
  expiryPolicyFactory=in.readObject();
  isReadThrough=in.readBoolean();
  isWriteThrough=in.readBoolean();
  isStoreByValue=in.readBoolean();
  isManagementEnabled=in.readBoolean();
  final boolean listNotEmpty=in.readBoolean();
  if (listNotEmpty) {
    final int size=in.readInt();
    listenerConfigurations=new HashSet<CacheEntryListenerConfiguration<K,V>>(size);
    for (int i=0; i < size; i++) {
      listenerConfigurations.add((CacheEntryListenerConfiguration<K,V>)in.readObject());
    }
  }
}

Fixed version (ground truth):
@Override public void readData(ObjectDataInput in) throws IOException {
  name=in.readUTF();
  managerPrefix=in.readUTF();
  uriString=in.readUTF();
  backupCount=in.readInt();
  asyncBackupCount=in.readInt();
  final int resultInMemoryFormat=in.readInt();
  inMemoryFormat=InMemoryFormat.values()[resultInMemoryFormat];
  final int resultEvictionPolicy=in.readInt();
  evictionPolicy=EvictionPolicy.values()[resultEvictionPolicy];
  nearCacheConfig=in.readObject();
  keyType=in.readObject();
  valueType=in.readObject();
  cacheLoaderFactory=in.readObject();
  cacheWriterFactory=in.readObject();
  expiryPolicyFactory=in.readObject();
  isReadThrough=in.readBoolean();
  isWriteThrough=in.readBoolean();
  isStoreByValue=in.readBoolean();
  isManagementEnabled=in.readBoolean();
  final boolean listNotEmpty=in.readBoolean();
  if (listNotEmpty) {
    final int size=in.readInt();
    listenerConfigurations=new HashSet<CacheEntryListenerConfiguration<K,V>>(size);
    for (int i=0; i < size; i++) {
      listenerConfigurations.add((CacheEntryListenerConfiguration<K,V>)in.readObject());
    }
  }
}
Program: 47854
Project: 47854
Buggy source:
@Override public void writeData(ObjectDataOutput out) throws IOException {
  out.writeUTF(name);
  out.writeUTF(managerPrefix);
  out.writeUTF(uriString);
  out.writeInt(backupCount);
  out.writeInt(asyncBackupCount);
  out.writeInt(inMemoryFormat.ordinal());
  out.writeInt(evictionPolicy.ordinal());
  out.writeObject(keyType);
  out.writeObject(valueType);
  out.writeObject(cacheLoaderFactory);
  out.writeObject(cacheWriterFactory);
  out.writeObject(expiryPolicyFactory);
  out.writeBoolean(isReadThrough);
  out.writeBoolean(isWriteThrough);
  out.writeBoolean(isStoreByValue);
  out.writeBoolean(isManagementEnabled);
  final boolean listNotEmpty=listenerConfigurations != null && !listenerConfigurations.isEmpty();
  out.writeBoolean(listNotEmpty);
  if (listNotEmpty) {
    out.writeInt(listenerConfigurations.size());
    for (    CacheEntryListenerConfiguration<K,V> cc : listenerConfigurations) {
      out.writeObject(cc);
    }
  }
}

Fixed version (ground truth):
@Override public void writeData(ObjectDataOutput out) throws IOException {
  out.writeUTF(name);
  out.writeUTF(managerPrefix);
  out.writeUTF(uriString);
  out.writeInt(backupCount);
  out.writeInt(asyncBackupCount);
  out.writeInt(inMemoryFormat.ordinal());
  out.writeInt(evictionPolicy.ordinal());
  out.writeObject(nearCacheConfig);
  out.writeObject(keyType);
  out.writeObject(valueType);
  out.writeObject(cacheLoaderFactory);
  out.writeObject(cacheWriterFactory);
  out.writeObject(expiryPolicyFactory);
  out.writeBoolean(isReadThrough);
  out.writeBoolean(isWriteThrough);
  out.writeBoolean(isStoreByValue);
  out.writeBoolean(isManagementEnabled);
  final boolean listNotEmpty=listenerConfigurations != null && !listenerConfigurations.isEmpty();
  out.writeBoolean(listNotEmpty);
  if (listNotEmpty) {
    out.writeInt(listenerConfigurations.size());
    for (    CacheEntryListenerConfiguration<K,V> cc : listenerConfigurations) {
      out.writeObject(cc);
    }
  }
}
Program: 47855
Project: 47855
Buggy source:
@Override public String toString(){
  final StringBuilder sb=new StringBuilder("String_Node_Str");
  sb.append("String_Node_Str").append(hazelcastInstance);
  sb.append('}');
  return sb.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  final StringBuilder sb=new StringBuilder("String_Node_Str");
  sb.append("String_Node_Str").append(getHazelcastInstance());
  sb.append('}');
  return sb.toString();
}
Program: 47856
Project: 47856
Buggy source:
protected HazelcastInstance getHazelcastInstance(){
  if (hazelcastInstance == null) {
    hazelcastInstance=initHazelcast();
  }
  return hazelcastInstance;
}

Fixed version (ground truth):
protected HazelcastInstance getHazelcastInstance(){
  if (hazelcastInstance == null) {
synchronized (this) {
      if (hazelcastInstance == null) {
        hazelcastInstance=initHazelcast();
      }
    }
  }
  return hazelcastInstance;
}
Program: 47857
Project: 47857
Buggy source:
protected String cacheNamePrefix(){
  final StringBuilder sb=new StringBuilder("String_Node_Str");
  if (!isDefaultClassLoader) {
    sb.append("String_Node_Str").append(classLoaderReference.get().toString());
  }
  if (!isDefaultURI) {
    sb.append("String_Node_Str").append(uri.toASCIIString());
  }
  sb.append("String_Node_Str");
  return sb.toString();
}

Fixed version (ground truth):
protected String cacheNamePrefix(){
  final StringBuilder sb=new StringBuilder("String_Node_Str");
  final ClassLoader classLoader=getClassLoader();
  if (!isDefaultClassLoader && classLoader != null) {
    sb.append("String_Node_Str").append(classLoader.toString());
  }
  if (!isDefaultURI) {
    sb.append("String_Node_Str").append(uri.toASCIIString());
  }
  sb.append("String_Node_Str");
  return sb.toString();
}
Program: 47858
Project: 47858
Buggy source:
@Override public Object getResponse(){
  return response;
}

Fixed version (ground truth):
@Override public Object getResponse(){
  return null;
}
Program: 47859
Project: 47859
Buggy source:
@Override public void run() throws Exception {
  CacheService service=getService();
  ICacheRecordStore cache=service.getOrCreateCache(name,getPartitionId());
  response=cache.putIfAbsent(key,value,expiryPolicy,getCallerUuid());
  if (response == Boolean.TRUE) {
    backupRecord=cache.getRecord(key);
  }
}

Fixed version (ground truth):
@Override public void run() throws Exception {
  CacheService service=getService();
  ICacheRecordStore cache=service.getOrCreateCache(name,getPartitionId());
  response=cache.putIfAbsent(key,value,expiryPolicy,getCallerUuid());
  if (Boolean.TRUE.equals(response)) {
    backupRecord=cache.getRecord(key);
  }
}
Program: 47860
Project: 47860
Buggy source:
@Override public boolean shouldBackup(){
  return response == Boolean.TRUE;
}

Fixed version (ground truth):
@Override public boolean shouldBackup(){
  return Boolean.TRUE.equals(response);
}
Program: 47861
Project: 47861
Buggy source:
@Override public boolean shouldBackup(){
  return response == Boolean.TRUE;
}

Fixed version (ground truth):
@Override public boolean shouldBackup(){
  return Boolean.TRUE.equals(response);
}
Program: 47862
Project: 47862
Buggy source:
@Override public void run() throws Exception {
  if (cache != null) {
    if (currentValue == null) {
      response=cache.replace(key,value,expiryPolicy,getCallerUuid());
    }
 else {
      response=cache.replace(key,currentValue,value,expiryPolicy,getCallerUuid());
    }
    if (response == Boolean.TRUE) {
      backupRecord=cache.getRecord(key);
    }
  }
 else {
    response=Boolean.FALSE;
  }
}

Fixed version (ground truth):
@Override public void run() throws Exception {
  if (cache != null) {
    if (currentValue == null) {
      response=cache.replace(key,value,expiryPolicy,getCallerUuid());
    }
 else {
      response=cache.replace(key,currentValue,value,expiryPolicy,getCallerUuid());
    }
    if (Boolean.TRUE.equals(response)) {
      backupRecord=cache.getRecord(key);
    }
  }
 else {
    response=Boolean.FALSE;
  }
}
Program: 47863
Project: 47863
Buggy source:
@Override public boolean shouldBackup(){
  return response == Boolean.TRUE;
}

Fixed version (ground truth):
@Override public boolean shouldBackup(){
  return Boolean.TRUE.equals(response);
}
Program: 47864
Project: 47864
Buggy source:
public CacheReplicationOperation(CachePartitionSegment segment,int replicaIndex){
  source=new HashMap<String,Map<Data,CacheRecord>>();
  destination=null;
  Iterator<ICacheRecordStore> iter=segment.cacheIterator();
  while (iter.hasNext()) {
    ICacheRecordStore next=iter.next();
    CacheConfig cacheConfig=next.getConfig();
    if (cacheConfig.getAsyncBackupCount() + cacheConfig.getBackupCount() >= replicaIndex) {
      source.put(next.getName(),next.getReadOnlyRecords());
    }
  }
}

Fixed version (ground truth):
public CacheReplicationOperation(CachePartitionSegment segment,int replicaIndex){
  data=new HashMap<String,Map<Data,CacheRecord>>();
  Iterator<ICacheRecordStore> iter=segment.cacheIterator();
  while (iter.hasNext()) {
    ICacheRecordStore next=iter.next();
    CacheConfig cacheConfig=next.getConfig();
    if (cacheConfig.getAsyncBackupCount() + cacheConfig.getBackupCount() >= replicaIndex) {
      data.put(next.getName(),next.getReadOnlyRecords());
    }
  }
}
Program: 47865
Project: 47865
Buggy source:
public boolean isEmpty(){
  return source == null || source.isEmpty();
}

Fixed version (ground truth):
public boolean isEmpty(){
  return data == null || data.isEmpty();
}
Program: 47866
Project: 47866
Buggy source:
@Override public void run() throws Exception {
  CacheService service=getService();
  for (  Map.Entry<String,Map<Data,CacheRecord>> entry : destination.entrySet()) {
    ICacheRecordStore cache=service.getOrCreateCache(entry.getKey(),getPartitionId());
    Map<Data,CacheRecord> map=entry.getValue();
    Iterator<Map.Entry<Data,CacheRecord>> iter=map.entrySet().iterator();
    while (iter.hasNext()) {
      Map.Entry<Data,CacheRecord> next=iter.next();
      Data key=next.getKey();
      CacheRecord record=next.getValue();
      iter.remove();
      cache.setRecord(key,record);
    }
  }
  destination.clear();
}

Fixed version (ground truth):
@Override public void run() throws Exception {
  CacheService service=getService();
  for (  Map.Entry<String,Map<Data,CacheRecord>> entry : data.entrySet()) {
    ICacheRecordStore cache=service.getOrCreateCache(entry.getKey(),getPartitionId());
    Map<Data,CacheRecord> map=entry.getValue();
    Iterator<Map.Entry<Data,CacheRecord>> iter=map.entrySet().iterator();
    while (iter.hasNext()) {
      Map.Entry<Data,CacheRecord> next=iter.next();
      Data key=next.getKey();
      CacheRecord record=next.getValue();
      iter.remove();
      cache.setRecord(key,record);
    }
  }
  data.clear();
}
Program: 47867
Project: 47867
Buggy source:
@Override protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
  int count=in.readInt();
  if (count > 0) {
    for (int i=0; i < count; i++) {
      int subCount=in.readInt();
      if (subCount > 0) {
        String name=in.readUTF();
        Map<Data,CacheRecord> m=new HashMap<Data,CacheRecord>(subCount);
        destination.put(name,m);
        for (int j=0; j < subCount; j++) {
          final Data key=new Data();
          key.readData(in);
          final CacheRecord record=in.readObject();
          m.put(key,record);
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void readInternal(ObjectDataInput in) throws IOException {
  super.readInternal(in);
  int count=in.readInt();
  if (count > 0) {
    for (int i=0; i < count; i++) {
      int subCount=in.readInt();
      if (subCount > 0) {
        String name=in.readUTF();
        Map<Data,CacheRecord> m=new HashMap<Data,CacheRecord>(subCount);
        data.put(name,m);
        for (int j=0; j < subCount; j++) {
          final Data key=new Data();
          key.readData(in);
          if (key.bufferSize() == 0) {
            break;
          }
          final CacheRecord record=in.readObject();
          m.put(key,record);
        }
      }
    }
  }
}