nus-yam/ex-repair huggingface dataset:
Program: 49496
Project: 49496
Buggy source:
protected List<String> read(Socket socket) throws IOException {
  List<String> values=new ArrayList<String>();
  InputStreamReader reader=new InputStreamReader(socket.getInputStream(),"String_Node_Str");
  BufferedReader buf=new BufferedReader(reader);
  String commandLine=buf.readLine();
  System.out.println(commandLine);
  String[] split=commandLine.split("String_Node_Str");
  if (split[split.length - 1].startsWith("String_Node_Str")) {
    String sizeLine=buf.readLine();
    System.out.println(sizeLine);
    String[] tokens=sizeLine.split("String_Node_Str");
    int count=Integer.valueOf(split[split.length - 1].substring(1));
    for (int i=0; i < count; i++) {
      int s=Integer.valueOf(tokens[i]);
      char[] value=new char[s];
      buf.read(value);
      System.out.println(String.valueOf(value));
      values.add(String.valueOf(value));
    }
  }
  if (values.size() == 0) {
    values.add(commandLine.split("String_Node_Str")[0]);
  }
  return values;
}

Fixed version (ground truth):
protected List<String> read(Socket socket) throws IOException {
  List<String> values=new ArrayList<String>();
  InputStreamReader reader=new InputStreamReader(socket.getInputStream(),"String_Node_Str");
  BufferedReader buf=new BufferedReader(reader);
  String commandLine=buf.readLine();
  System.out.println(commandLine);
  if (commandLine == null) {
    return Collections.emptyList();
  }
  String[] split=commandLine.split("String_Node_Str");
  if (split[split.length - 1].startsWith("String_Node_Str")) {
    String sizeLine=buf.readLine();
    System.out.println(sizeLine);
    String[] tokens=sizeLine.split("String_Node_Str");
    int count=Integer.valueOf(split[split.length - 1].substring(1));
    for (int i=0; i < count; i++) {
      int s=Integer.valueOf(tokens[i]);
      char[] value=new char[s];
      buf.read(value);
      System.out.println(String.valueOf(value));
      values.add(String.valueOf(value));
    }
  }
  if (values.size() == 0) {
    values.addAll(Arrays.asList(commandLine.split("String_Node_Str")));
  }
  return values;
}
Program: 49497
Project: 49497
Buggy source:
public void doLocalOp(){
  if (isMigrationAware() && isMigrating(request)) {
    setRedoResult(REDO_PARTITION_MIGRATING);
  }
 else {
    request.attachment=TargetAwareOp.this;
    request.local=true;
    ((RequestHandler)getPacketProcessor(request.operation)).handle(request);
  }
}

Fixed version (ground truth):
public void doLocalOp(){
  if (isMigrationAware() && isPartitionMigrating()) {
    setRedoResult(REDO_PARTITION_MIGRATING);
  }
 else {
    request.attachment=TargetAwareOp.this;
    request.local=true;
    ((RequestHandler)getPacketProcessor(request.operation)).handle(request);
  }
}
Program: 49498
Project: 49498
Buggy source:
protected boolean isMigrating(Request req){
  return false;
}

Fixed version (ground truth):
protected boolean isMigrating(Request req,int replica){
  return false;
}
Program: 49499
Project: 49499
Buggy source:
protected void backup(ClusterOperation operation){
  final int localBackupCount=backupCount;
  final int localAsyncBackupCount=asyncBackupCount;
  final int totalBackupCount=localBackupCount + localAsyncBackupCount;
  if (localBackupCount <= 0 && localAsyncBackupCount <= 0) {
    return;
  }
  if (totalBackupCount > MAX_BACKUP_COUNT) {
    String msg="String_Node_Str" + MAX_BACKUP_COUNT + "String_Node_Str"+ totalBackupCount;
    logger.log(Level.SEVERE,msg);
    throw new RuntimeException(msg);
  }
  if (request.key == null || request.key.size() == 0) {
    throw new RuntimeException("String_Node_Str" + request.key);
  }
  final MBackup[] backupOps=new MBackup[localBackupCount];
  for (int i=0; i < totalBackupCount; i++) {
    int replicaIndex=i + 1;
    if (i < localBackupCount) {
      MBackup backupOp=new MBackup();
      backupOps[i]=backupOp;
      backupOp.sendBackup(operation,replicaIndex,request);
    }
 else {
      final Request reqBackup=Request.copyFromRequest(request);
      reqBackup.operation=operation;
      enqueueAndReturn(new AsyncBackupProcessable(reqBackup,replicaIndex));
    }
  }
  for (int i=0; i < localBackupCount; i++) {
    MBackup backupOp=backupOps[i];
    backupOp.getResultAsBoolean();
  }
}

Fixed version (ground truth):
protected void backup(ClusterOperation operation){
  final int localBackupCount=backupCount;
  final int localAsyncBackupCount=asyncBackupCount;
  final int totalBackupCount=localBackupCount + localAsyncBackupCount;
  if (localBackupCount <= 0 && localAsyncBackupCount <= 0) {
    return;
  }
  if (totalBackupCount > MAX_BACKUP_COUNT) {
    String msg="String_Node_Str" + MAX_BACKUP_COUNT + "String_Node_Str"+ totalBackupCount;
    logger.log(Level.SEVERE,msg);
    throw new RuntimeException(msg);
  }
  if (request.key == null || request.key.size() == 0) {
    throw new RuntimeException("String_Node_Str" + request.key);
  }
  final MBackup[] backupOps=new MBackup[localBackupCount];
  for (int i=0; i < totalBackupCount; i++) {
    final int replicaIndex=i + 1;
    if (i < localBackupCount) {
      MBackup backupOp=new MBackup();
      backupOps[i]=backupOp;
      backupOp.sendBackup(operation,replicaIndex,request);
    }
 else {
      final Request reqBackup=Request.copyFromRequest(request);
      reqBackup.operation=operation;
      enqueueAndReturn(new AsyncBackupProcessable(reqBackup,replicaIndex));
    }
  }
  for (int i=0; i < localBackupCount; i++) {
    MBackup backupOp=backupOps[i];
    backupOp.getResultAsBoolean();
  }
}
Program: 49501
Project: 49501
Buggy source:
public void sendBackup(ClusterOperation operation,int replicaIndex,Request reqBackup){
  reset();
  this.replicaIndex=replicaIndex;
  SystemLogService css=node.getSystemLogService();
  if (css.shouldLog(TRACE)) {
    css.trace(this,"String_Node_Str",callId);
  }
  request.setFromRequest(reqBackup);
  request.operation=operation;
  request.caller=thisAddress;
  request.setBooleanRequest();
  doOp();
}

Fixed version (ground truth):
public void sendBackup(ClusterOperation operation,int replicaIndex,Request reqBackup){
  reset();
  this.replicaIndex=replicaIndex;
  SystemLogService css=node.getSystemLogService();
  if (css.shouldLog(TRACE)) {
    css.trace(this,"String_Node_Str",callId);
  }
  request.setFromRequest(reqBackup);
  request.operation=operation;
  request.caller=thisAddress;
  request.longValue=replicaIndex;
  request.setBooleanRequest();
  doOp();
}
Program: 49502
Project: 49502
Buggy source:
@Override public boolean isMigrating(Request req){
  final Data key=req.key;
  if (key == null)   return false;
  return partitionManager.isOwnedPartitionMigrating(getPartitionId(req));
}

Fixed version (ground truth):
@Override public boolean isMigrating(Request req,int replica){
  final Data key=req.key;
  return key != null && partitionManager.isPartitionMigrating(getPartitionId(req),replica);
}
Program: 49503
Project: 49503
Buggy source:
public void doJoin(AtomicBoolean joined){
  int tryCount=0;
  long joinStartTime=Clock.currentTimeMillis();
  long maxJoinMillis=node.getGroupProperties().MAX_JOIN_SECONDS.getInteger() * 1000;
  while (node.isActive() && !joined.get() && (Clock.currentTimeMillis() - joinStartTime < maxJoinMillis)) {
    String msg="String_Node_Str" + node.getMasterAddress();
    logger.log(Level.FINEST,msg);
    systemLogService.logJoin(msg);
    Address masterAddressNow=findMasterWithMulticast();
    node.setMasterAddress(masterAddressNow);
    if (masterAddressNow != null) {
      systemLogService.logJoin("String_Node_Str" + masterAddressNow);
    }
    if (node.getMasterAddress() == null || node.address.equals(node.getMasterAddress())) {
      TcpIpConfig tcpIpConfig=config.getNetworkConfig().getJoin().getTcpIpConfig();
      if (tcpIpConfig != null && tcpIpConfig.isEnabled()) {
        doTCP(joined);
      }
 else {
        node.setAsMaster();
      }
      return;
    }
    if (++tryCount > 24) {
      failedJoiningToMaster(true,tryCount);
    }
    if (!node.getMasterAddress().equals(node.address)) {
      connectAndSendJoinRequest(node.getMasterAddress());
    }
 else {
      node.setMasterAddress(null);
      tryCount=0;
    }
    try {
      Thread.sleep(500L);
    }
 catch (    InterruptedException ignored) {
    }
  }
}

Fixed version (ground truth):
public void doJoin(AtomicBoolean joined){
  int tryCount=0;
  long joinStartTime=Clock.currentTimeMillis();
  long maxJoinMillis=node.getGroupProperties().MAX_JOIN_SECONDS.getInteger() * 1000;
  while (node.isActive() && !joined.get() && (Clock.currentTimeMillis() - joinStartTime < maxJoinMillis)) {
    String msg="String_Node_Str" + node.getMasterAddress();
    logger.log(Level.FINEST,msg);
    systemLogService.logJoin(msg);
    Address masterAddressNow=findMasterWithMulticast();
    node.setMasterAddress(masterAddressNow);
    if (masterAddressNow != null) {
      systemLogService.logJoin("String_Node_Str" + masterAddressNow);
    }
    if (node.getMasterAddress() == null || node.address.equals(node.getMasterAddress())) {
      TcpIpConfig tcpIpConfig=config.getNetworkConfig().getJoin().getTcpIpConfig();
      if (tcpIpConfig != null && tcpIpConfig.isEnabled()) {
        doTCP(joined);
      }
 else {
        node.setAsMaster();
      }
      return;
    }
    if (++tryCount > 49) {
      failedJoiningToMaster(true,tryCount);
    }
    if (!node.getMasterAddress().equals(node.address)) {
      connectAndSendJoinRequest(node.getMasterAddress());
    }
 else {
      node.setMasterAddress(null);
      tryCount=0;
    }
    try {
      Thread.sleep(500L);
    }
 catch (    InterruptedException ignored) {
    }
  }
}
Program: 49504
Project: 49504
Buggy source:
/** 
 * @param partitionId
 * @return true if owned replica (0) of partition is migrating, false otherwise
 */
public boolean isOwnedPartitionMigrating(int partitionId){
  final MigratingPartition currentMigratingPartition=migratingPartition;
  return currentMigratingPartition != null && currentMigratingPartition.getPartitionId() == partitionId && currentMigratingPartition.getReplicaIndex() == 0;
}

Fixed version (ground truth):
/** 
 * @param partitionId
 * @return true if owned replica (0) of partition is migrating, false otherwise
 */
public boolean isOwnedPartitionMigrating(int partitionId){
  return isPartitionMigrating(partitionId,0);
}
Program: 49505
Project: 49505
Buggy source:
/** 
 * @param partitionId
 * @return true if any replica of partition is migrating, false otherwise
 */
public boolean isPartitionMigrating(int partitionId){
  final MigratingPartition currentMigratingPartition=migratingPartition;
  return currentMigratingPartition != null && currentMigratingPartition.getPartitionId() == partitionId;
}

Fixed version (ground truth):
/** 
 * @param partitionId
 * @param replicaIndex
 * @return true if replicaIndex of partition is migrating, false otherwise
 */
public boolean isPartitionMigrating(int partitionId,int replicaIndex){
  final MigratingPartition currentMigratingPartition=migratingPartition;
  return currentMigratingPartition != null && currentMigratingPartition.getPartitionId() == partitionId && currentMigratingPartition.getReplicaIndex() == replicaIndex;
}
Program: 49506
Project: 49506
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + "String_Node_Str" + name + '\''+ "String_Node_Str"+ operation+ "String_Node_Str"+ callId+ '\''+ "String_Node_Str"+ redoCount+ '\''+ "String_Node_Str"+ timeout+ '\''+ "String_Node_Str"+ lockThreadId+ '\''+ "String_Node_Str"+ target+ '\''+ '}';
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + "String_Node_Str" + name + '\''+ "String_Node_Str"+ operation+ "String_Node_Str"+ callId+ '\''+ "String_Node_Str"+ redoCount+ '\''+ "String_Node_Str"+ timeout+ '\''+ "String_Node_Str"+ lockThreadId+ '\''+ "String_Node_Str"+ target+ '\''+ "String_Node_Str"+ local+ '\''+ '}';
}
Program: 49508
Project: 49508
Buggy source:
@Test public void issue395BackupProblemWithBCount2() throws InterruptedException {
  final int size=1000;
  Config config=new Config();
  config.getProperties().put(GroupProperties.PROP_PARTITION_MIGRATION_INTERVAL,"String_Node_Str");
  config.getMapConfig("String_Node_Str").setBackupCount(2);
  HazelcastInstance h1=Hazelcast.newHazelcastInstance(config);
  HazelcastInstance h2=Hazelcast.newHazelcastInstance(config);
  IMap map1=h1.getMap("String_Node_Str");
  IMap map2=h2.getMap("String_Node_Str");
  for (int i=0; i < size; i++) {
    map1.put(i,i);
  }
  assertEquals(size,getTotalOwnedEntryCount(map1,map2));
  assertEquals(size,getTotalBackupEntryCount(map1,map2));
  HazelcastInstance h3=Hazelcast.newHazelcastInstance(config);
  IMap map3=h3.getMap("String_Node_Str");
  Thread.sleep(1000 * 2);
  assertEquals(size,getTotalOwnedEntryCount(map1,map2,map3));
  assertEquals(2 * size,getTotalBackupEntryCount(map1,map2,map3));
}

Fixed version (ground truth):
@Test public void issue395BackupProblemWithBCount2() throws InterruptedException {
  final int size=1000;
  Config config=new Config();
  config.setProperty(GroupProperties.PROP_PARTITION_MIGRATION_INTERVAL,"String_Node_Str");
  config.getMapConfig("String_Node_Str").setBackupCount(2);
  HazelcastInstance h1=Hazelcast.newHazelcastInstance(config);
  HazelcastInstance h2=Hazelcast.newHazelcastInstance(config);
  IMap map1=h1.getMap("String_Node_Str");
  IMap map2=h2.getMap("String_Node_Str");
  for (int i=0; i < size; i++) {
    map1.put(i,i);
  }
  assertEquals(size,getTotalOwnedEntryCount(map1,map2));
  assertEquals(size,getTotalBackupEntryCount(map1,map2));
  HazelcastInstance h3=Hazelcast.newHazelcastInstance(config);
  IMap map3=h3.getMap("String_Node_Str");
  Thread.sleep(1000 * 3);
  assertEquals(size,getTotalOwnedEntryCount(map1,map2,map3));
  assertEquals(2 * size,getTotalBackupEntryCount(map1,map2,map3));
}
Program: 49509
Project: 49509
Buggy source:
@Override public String toString(){
  StringBuffer sb=new StringBuffer("String_Node_Str");
  sb.append(lsMembers.size());
  sb.append("String_Node_Str");
  for (  MemberImpl member : lsMembers) {
    sb.append("String_Node_Str").append(member);
  }
  sb.append("String_Node_Str");
  return sb.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuilder sb=new StringBuilder("String_Node_Str");
  sb.append(lsMembers.size());
  sb.append("String_Node_Str");
  for (  MemberImpl member : lsMembers) {
    sb.append("String_Node_Str").append(member);
  }
  sb.append("String_Node_Str");
  return sb.toString();
}
Program: 49511
Project: 49511
Buggy source:
protected void failedJoiningToMaster(boolean multicast,int tryCount){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(tryCount);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(node.address);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(node.getMasterAddress());
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(multicast);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(node.connectionManager.getConnection(node.getMasterAddress()));
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  throw new IllegalStateException(sb.toString());
}

Fixed version (ground truth):
protected void failedJoiningToMaster(boolean multicast,int tryCount){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(tryCount);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(node.address);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(node.getMasterAddress());
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(multicast);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(node.connectionManager.getConnection(node.getMasterAddress()));
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  throw new IllegalStateException(sb.toString());
}
Program: 49512
Project: 49512
Buggy source:
public void pickAddress() throws Exception {
  if (address != null) {
    return;
  }
  try {
    final Config config=node.getConfig();
    final InetAddress inetAddress=pickInetAddress(config);
    final boolean reuseAddress=config.isReuseAddress();
    serverSocketChannel=ServerSocketChannel.open();
    final ServerSocket serverSocket=serverSocketChannel.socket();
    log(Level.FINEST,"String_Node_Str" + reuseAddress);
    serverSocket.setReuseAddress(reuseAddress);
    serverSocket.setSoTimeout(1000);
    InetSocketAddress isa;
    int port=config.getPort();
    for (int i=0; i < 100; i++) {
      try {
        boolean bindAny=node.getGroupProperties().SOCKET_BIND_ANY.getBoolean();
        if (bindAny) {
          isa=new InetSocketAddress(port);
        }
 else {
          isa=new InetSocketAddress(inetAddress,port);
        }
        log(Level.FINEST,"String_Node_Str" + isa);
        serverSocket.bind(isa,100);
        log(Level.FINEST,"String_Node_Str" + isa);
        break;
      }
 catch (      final Exception e) {
        if (config.isPortAutoIncrement()) {
          port++;
        }
 else {
          String msg="String_Node_Str" + port + "String_Node_Str"+ "String_Node_Str";
          logger.log(Level.SEVERE,msg,e);
          throw e;
        }
      }
    }
    serverSocketChannel.configureBlocking(false);
    address=new Address(inetAddress,port);
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,e.getMessage(),e);
    throw e;
  }
}

Fixed version (ground truth):
private AddressDefinition pickAddress(final Config config) throws UnknownHostException, SocketException {
  AddressDefinition infAddress=getSystemConfiguredAddress();
  if (infAddress == null) {
    final NetworkConfig networkConfig=config.getNetworkConfig();
    final Collection<InterfaceDefinition> interfaces=getInterfaces(networkConfig);
    if (interfaces.contains(new InterfaceDefinition("String_Node_Str")) || interfaces.contains(new InterfaceDefinition("String_Node_Str"))) {
      infAddress=pickLoopbackAddress();
    }
 else {
      if (preferIPv4Stack()) {
        logger.log(Level.INFO,"String_Node_Str");
      }
      if (interfaces.size() > 0) {
        infAddress=pickMatchingAddress(interfaces);
      }
      if (infAddress == null) {
        if (networkConfig.getInterfaces().isEnabled()) {
          String msg="String_Node_Str";
          msg+="String_Node_Str";
          logger.log(Level.SEVERE,msg);
          throw new RuntimeException(msg);
        }
 else {
          if (networkConfig.getJoin().getTcpIpConfig().isEnabled()) {
            logger.log(Level.WARNING,"String_Node_Str" + "String_Node_Str");
          }
          infAddress=pickMatchingAddress(null);
        }
      }
    }
  }
  if (infAddress != null) {
    infAddress.inetAddress=AddressUtil.fixScopeIdAndGetInetAddress(infAddress.inetAddress);
  }
  if (infAddress == null) {
    infAddress=pickLoopbackAddress();
  }
  return infAddress;
}
Program: 49513
Project: 49513
Buggy source:
private Collection<String> getInterfaces(final Config config){
  final Collection<String> interfaces=new HashSet<String>();
  if (config.getNetworkConfig().getInterfaces().isEnabled()) {
    interfaces.addAll(config.getNetworkConfig().getInterfaces().getInterfaces());
    logger.log(Level.INFO,"String_Node_Str" + "String_Node_Str" + interfaces);
  }
 else   if (config.getNetworkConfig().getJoin().getTcpIpConfig().isEnabled()) {
    final Collection<String> possibleAddresses=TcpIpJoiner.getConfigurationMembers(node.config);
    for (    String possibleAddress : possibleAddresses) {
      interfaces.add(AddressUtil.getAddressHolder(possibleAddress).address);
    }
    logger.log(Level.FINEST,"String_Node_Str" + "String_Node_Str" + interfaces);
  }
  return interfaces;
}

Fixed version (ground truth):
private Collection<InterfaceDefinition> getInterfaces(final NetworkConfig networkConfig) throws UnknownHostException {
  final Collection<InterfaceDefinition> interfaces=new HashSet<InterfaceDefinition>();
  if (networkConfig.getInterfaces().isEnabled()) {
    final Collection<String> configInterfaces=networkConfig.getInterfaces().getInterfaces();
    for (    String configInterface : configInterfaces) {
      if (AddressUtil.isIpAddress(configInterface)) {
        interfaces.add(new InterfaceDefinition(configInterface));
      }
 else {
        logger.log(Level.INFO,"String_Node_Str" + configInterface + "String_Node_Str");
      }
    }
    logger.log(Level.INFO,"String_Node_Str" + "String_Node_Str" + interfaces);
  }
 else   if (networkConfig.getJoin().getTcpIpConfig().isEnabled()) {
    final Collection<String> possibleAddresses=TcpIpJoiner.getConfigurationMembers(node.config);
    for (    String possibleAddress : possibleAddresses) {
      final String s=AddressUtil.getAddressHolder(possibleAddress).address;
      if (AddressUtil.isIpAddress(s)) {
        interfaces.add(new InterfaceDefinition(s));
      }
 else {
        String address=resolveDomainName(s);
        logger.log(Level.INFO,"String_Node_Str" + address + "String_Node_Str"+ s+ "String_Node_Str");
        interfaces.add(new InterfaceDefinition(s,address));
      }
    }
    logger.log(Level.INFO,"String_Node_Str" + "String_Node_Str" + interfaces);
  }
  return interfaces;
}
Program: 49514
Project: 49514
Buggy source:
private InetAddress pickLoopbackAddress() throws UnknownHostException {
  if (System.getProperty("String_Node_Str") == null && System.getProperty("String_Node_Str") == null) {
    logger.log(Level.WARNING,"String_Node_Str");
    System.setProperty("String_Node_Str","String_Node_Str");
  }
  return InetAddress.getByName("String_Node_Str");
}

Fixed version (ground truth):
private AddressDefinition pickLoopbackAddress() throws UnknownHostException {
  if (System.getProperty("String_Node_Str") == null && System.getProperty("String_Node_Str") == null) {
    logger.log(Level.WARNING,"String_Node_Str");
    System.setProperty("String_Node_Str","String_Node_Str");
  }
  return new AddressDefinition("String_Node_Str",InetAddress.getByName("String_Node_Str"));
}
Program: 49515
Project: 49515
Buggy source:
private boolean preferIPv4Stack(){
  boolean preferIPv4Stack=node.groupProperties.PREFER_IPv4_STACK.getBoolean();
  Join join=node.getConfig().getNetworkConfig().getJoin();
  AwsConfig awsConfig=join.getAwsConfig();
  boolean awsEnabled=awsConfig != null && awsConfig.isEnabled();
  return preferIPv4Stack || awsEnabled;
}

Fixed version (ground truth):
private boolean preferIPv4Stack(){
  boolean preferIPv4Stack=Boolean.getBoolean("String_Node_Str") || node.groupProperties.PREFER_IPv4_STACK.getBoolean();
  Join join=node.getConfig().getNetworkConfig().getJoin();
  AwsConfig awsConfig=join.getAwsConfig();
  boolean awsEnabled=awsConfig != null && awsConfig.isEnabled();
  return preferIPv4Stack || awsEnabled;
}
Program: 49516
Project: 49516
Buggy source:
private InetAddress getSystemConfiguredAddress() throws UnknownHostException {
  final String localAddress=System.getProperty("String_Node_Str");
  if (localAddress != null) {
    if ("String_Node_Str".equals(localAddress.trim()) || "String_Node_Str".equals(localAddress.trim())) {
      return pickLoopbackAddress();
    }
 else {
      return InetAddress.getByName(localAddress.trim());
    }
  }
  return null;
}

Fixed version (ground truth):
private AddressDefinition getSystemConfiguredAddress() throws UnknownHostException {
  String localAddress=System.getProperty("String_Node_Str");
  if (localAddress != null) {
    localAddress=localAddress.trim();
    if ("String_Node_Str".equals(localAddress) || "String_Node_Str".equals(localAddress)) {
      return pickLoopbackAddress();
    }
 else {
      logger.log(Level.INFO,"String_Node_Str");
      return new AddressDefinition(localAddress,InetAddress.getByName(localAddress));
    }
  }
  return null;
}
Program: 49517
Project: 49517
Buggy source:
public void doRun(){
  clientEndpoint.connectionRemoved(connection);
  if (node.securityContext != null) {
    try {
      clientEndpoint.getLoginContext().logout();
    }
 catch (    LoginException e) {
      logger.log(Level.WARNING,e.getMessage(),e);
    }
  }
}

Fixed version (ground truth):
public void doRun(){
  logger.log(Level.INFO,"String_Node_Str" + connection + "String_Node_Str");
  clientEndpoint.connectionRemoved(connection);
  if (node.securityContext != null) {
    try {
      clientEndpoint.getLoginContext().logout();
    }
 catch (    LoginException e) {
      logger.log(Level.WARNING,e.getMessage(),e);
    }
  }
}
Program: 49518
Project: 49518
Buggy source:
public void connectionRemoved(final Connection connection){
  final ClientEndpoint clientEndpoint=removeClientEndpoint(connection);
  if (clientEndpoint != null) {
    node.executorManager.executeNow(new FallThroughRunnable(){
      public void doRun(){
        clientEndpoint.connectionRemoved(connection);
        if (node.securityContext != null) {
          try {
            clientEndpoint.getLoginContext().logout();
          }
 catch (          LoginException e) {
            logger.log(Level.WARNING,e.getMessage(),e);
          }
        }
      }
    }
);
  }
}

Fixed version (ground truth):
public void connectionRemoved(final Connection connection){
  final ClientEndpoint clientEndpoint=removeClientEndpoint(connection);
  if (clientEndpoint != null) {
    node.executorManager.executeNow(new FallThroughRunnable(){
      public void doRun(){
        logger.log(Level.INFO,"String_Node_Str" + connection + "String_Node_Str");
        clientEndpoint.connectionRemoved(connection);
        if (node.securityContext != null) {
          try {
            clientEndpoint.getLoginContext().logout();
          }
 catch (          LoginException e) {
            logger.log(Level.WARNING,e.getMessage(),e);
          }
        }
      }
    }
);
  }
}
Program: 49519
Project: 49519
Buggy source:
public void searchForOtherClusters(SplitBrainHandler splitBrainHandler){
  final Collection<Address> colPossibleAddresses;
  try {
    colPossibleAddresses=getPossibleAddresses();
  }
 catch (  Throwable e) {
    logger.log(Level.SEVERE,e.getMessage(),e);
    return;
  }
  colPossibleAddresses.remove(node.getThisAddress());
  for (  Member member : node.getClusterImpl().getMembers()) {
    colPossibleAddresses.remove(((MemberImpl)member).getAddress());
  }
  if (colPossibleAddresses.size() == 0) {
    return;
  }
  for (  final Address possibleAddress : colPossibleAddresses) {
    logger.log(Level.FINEST,node.getThisAddress() + "String_Node_Str" + possibleAddress);
    node.connectionManager.getOrConnect(possibleAddress,true);
  }
  for (  Address possibleAddress : colPossibleAddresses) {
    try {
      Thread.sleep(1000);
    }
 catch (    InterruptedException e) {
      return;
    }
    final Connection conn=node.connectionManager.getConnection(possibleAddress);
    if (conn != null) {
      final JoinInfo response=node.clusterManager.checkJoin(conn);
      if (response != null && shouldMerge(response)) {
        logger.log(Level.WARNING,node.address + "String_Node_Str" + possibleAddress);
        splitBrainHandler.restart();
      }
      return;
    }
  }
}

Fixed version (ground truth):
public void searchForOtherClusters(SplitBrainHandler splitBrainHandler){
  final Collection<Address> colPossibleAddresses;
  try {
    colPossibleAddresses=getPossibleAddresses();
  }
 catch (  Throwable e) {
    logger.log(Level.SEVERE,e.getMessage(),e);
    return;
  }
  colPossibleAddresses.remove(node.getThisAddress());
  for (  Member member : node.getClusterImpl().getMembers()) {
    colPossibleAddresses.remove(((MemberImpl)member).getAddress());
  }
  if (colPossibleAddresses.isEmpty()) {
    return;
  }
  for (  Address possibleAddress : colPossibleAddresses) {
    logger.log(Level.FINEST,node.getThisAddress() + "String_Node_Str" + possibleAddress);
    node.connectionManager.getOrConnect(possibleAddress,true);
    try {
      Thread.sleep(1500);
    }
 catch (    InterruptedException e) {
      return;
    }
    final Connection conn=node.connectionManager.getConnection(possibleAddress);
    if (conn != null) {
      final JoinInfo response=node.clusterManager.checkJoin(conn);
      if (response != null && shouldMerge(response)) {
        logger.log(Level.WARNING,node.address + "String_Node_Str" + possibleAddress);
        splitBrainHandler.restart();
        return;
      }
 else {
        conn.close();
      }
    }
  }
}
Program: 49520
Project: 49520
Buggy source:
@Override public String toString(){
  StringBuffer sb=new StringBuffer("String_Node_Str");
  sb.append(lsMembers.size());
  sb.append("String_Node_Str");
  for (  MemberImpl member : lsMembers) {
    sb.append("String_Node_Str").append(member);
  }
  sb.append("String_Node_Str");
  return sb.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuilder sb=new StringBuilder("String_Node_Str");
  sb.append(lsMembers.size());
  sb.append("String_Node_Str");
  for (  MemberImpl member : lsMembers) {
    sb.append("String_Node_Str").append(member);
  }
  sb.append("String_Node_Str");
  return sb.toString();
}
Program: 49522
Project: 49522
Buggy source:
protected void failedJoiningToMaster(boolean multicast,int tryCount){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(tryCount);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(node.address);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(node.getMasterAddress());
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(multicast);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(node.connectionManager.getConnection(node.getMasterAddress()));
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  throw new IllegalStateException(sb.toString());
}

Fixed version (ground truth):
protected void failedJoiningToMaster(boolean multicast,int tryCount){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(tryCount);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(node.address);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(node.getMasterAddress());
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(multicast);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(node.connectionManager.getConnection(node.getMasterAddress()));
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  throw new IllegalStateException(sb.toString());
}
Program: 49523
Project: 49523
Buggy source:
public void pickAddress() throws Exception {
  if (address != null) {
    return;
  }
  try {
    final Config config=node.getConfig();
    final InetAddress inetAddress=pickInetAddress(config);
    final boolean reuseAddress=config.isReuseAddress();
    serverSocketChannel=ServerSocketChannel.open();
    final ServerSocket serverSocket=serverSocketChannel.socket();
    logger.log(Level.FINEST,"String_Node_Str" + reuseAddress);
    serverSocket.setReuseAddress(reuseAddress);
    serverSocket.setSoTimeout(1000);
    InetSocketAddress isa;
    int port=config.getPort();
    for (int i=0; i < 100; i++) {
      try {
        boolean bindAny=node.getGroupProperties().SOCKET_BIND_ANY.getBoolean();
        if (bindAny) {
          isa=new InetSocketAddress(port);
        }
 else {
          isa=new InetSocketAddress(inetAddress,port);
        }
        logger.log(Level.FINEST,"String_Node_Str" + isa);
        serverSocket.bind(isa,100);
        break;
      }
 catch (      final Exception e) {
        if (config.isPortAutoIncrement()) {
          port++;
        }
 else {
          String msg="String_Node_Str" + port + "String_Node_Str"+ "String_Node_Str";
          logger.log(Level.SEVERE,msg,e);
          throw e;
        }
      }
    }
    serverSocketChannel.configureBlocking(false);
    address=new Address(inetAddress,port);
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,e.getMessage(),e);
    throw e;
  }
}

Fixed version (ground truth):
public void pickAddress() throws Exception {
  if (address != null) {
    return;
  }
  try {
    final Config config=node.getConfig();
    final InetAddress inetAddress=pickInetAddress(config);
    final boolean reuseAddress=config.isReuseAddress();
    final boolean bindAny=node.getGroupProperties().SOCKET_BIND_ANY.getBoolean();
    serverSocketChannel=ServerSocketChannel.open();
    final ServerSocket serverSocket=serverSocketChannel.socket();
    logger.log(Level.FINEST,"String_Node_Str" + reuseAddress);
    serverSocket.setReuseAddress(reuseAddress);
    serverSocket.setSoTimeout(1000);
    InetSocketAddress isa;
    int port=config.getPort();
    for (int i=0; i < 100; i++) {
      try {
        if (bindAny) {
          isa=new InetSocketAddress(port);
        }
 else {
          isa=new InetSocketAddress(inetAddress,port);
        }
        logger.log(Level.FINEST,"String_Node_Str" + isa);
        serverSocket.bind(isa,100);
        break;
      }
 catch (      final Exception e) {
        if (config.isPortAutoIncrement()) {
          port++;
        }
 else {
          String msg="String_Node_Str" + port + "String_Node_Str"+ "String_Node_Str";
          logger.log(Level.SEVERE,msg,e);
          throw e;
        }
      }
    }
    serverSocketChannel.configureBlocking(false);
    address=new Address(inetAddress,port);
    logger.log(Level.INFO,"String_Node_Str" + address + "String_Node_Str"+ serverSocket+ "String_Node_Str"+ bindAny);
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,e.getMessage(),e);
    throw e;
  }
}
Program: 49524
Project: 49524
Buggy source:
private Collection<String> getInterfaces(final Config config){
  final Collection<String> interfaces=new HashSet<String>();
  if (config.getNetworkConfig().getInterfaces().isEnabled()) {
    interfaces.addAll(config.getNetworkConfig().getInterfaces().getInterfaces());
    logger.log(Level.INFO,"String_Node_Str" + "String_Node_Str" + interfaces);
  }
 else   if (config.getNetworkConfig().getJoin().getTcpIpConfig().isEnabled()) {
    final Collection<String> possibleAddresses=TcpIpJoiner.getConfigurationMembers(node.config);
    for (    String possibleAddress : possibleAddresses) {
      interfaces.add(AddressUtil.getAddressHolder(possibleAddress).address);
    }
    logger.log(Level.FINEST,"String_Node_Str" + "String_Node_Str" + interfaces);
  }
  return interfaces;
}

Fixed version (ground truth):
private Collection<String> getInterfaces(final NetworkConfig networkConfig) throws UnknownHostException {
  final Collection<String> interfaces=new HashSet<String>();
  if (networkConfig.getInterfaces().isEnabled()) {
    interfaces.addAll(networkConfig.getInterfaces().getInterfaces());
    logger.log(Level.INFO,"String_Node_Str" + "String_Node_Str" + interfaces);
    removeDomainNames(interfaces);
  }
 else   if (networkConfig.getJoin().getTcpIpConfig().isEnabled()) {
    final Collection<String> possibleAddresses=TcpIpJoiner.getConfigurationMembers(node.config);
    for (    String possibleAddress : possibleAddresses) {
      final String s=AddressUtil.getAddressHolder(possibleAddress).address;
      if (AddressUtil.isIpAddress(s)) {
        interfaces.add(s);
      }
 else {
        String address=resolveDomainName(s);
        logger.log(Level.INFO,"String_Node_Str" + address + "String_Node_Str"+ s+ "String_Node_Str");
        interfaces.add(address);
      }
    }
    logger.log(Level.INFO,"String_Node_Str" + "String_Node_Str" + interfaces);
  }
  return interfaces;
}
Program: 49525
Project: 49525
Buggy source:
public void doJoin(AtomicBoolean joined){
  int tryCount=0;
  long joinStartTime=Clock.currentTimeMillis();
  long maxJoinMillis=node.getGroupProperties().MAX_JOIN_SECONDS.getInteger() * 1000;
  while (node.isActive() && !joined.get() && (Clock.currentTimeMillis() - joinStartTime < maxJoinMillis)) {
    String msg="String_Node_Str" + node.getMasterAddress();
    logger.log(Level.FINEST,msg);
    systemLogService.logJoin(msg);
    Address masterAddressNow=findMasterWithMulticast();
    if (masterAddressNow != null && masterAddressNow.equals(node.getMasterAddress())) {
      tryCount--;
    }
    node.setMasterAddress(masterAddressNow);
    systemLogService.logJoin("String_Node_Str" + masterAddressNow);
    if (node.getMasterAddress() == null || node.address.equals(node.getMasterAddress())) {
      TcpIpConfig tcpIpConfig=config.getNetworkConfig().getJoin().getTcpIpConfig();
      if (tcpIpConfig != null && tcpIpConfig.isEnabled()) {
        doTCP(joined);
      }
 else {
        systemLogService.logJoin("String_Node_Str");
        node.setAsMaster();
      }
      return;
    }
    if (tryCount++ > 22) {
      failedJoiningToMaster(true,tryCount);
    }
    if (!node.getMasterAddress().equals(node.address)) {
      connectAndSendJoinRequest(node.getMasterAddress());
    }
 else {
      node.setMasterAddress(null);
      tryCount=0;
    }
    try {
      Thread.sleep(500L);
    }
 catch (    InterruptedException ignored) {
    }
  }
}

Fixed version (ground truth):
public void doJoin(AtomicBoolean joined){
  int tryCount=0;
  long joinStartTime=Clock.currentTimeMillis();
  long maxJoinMillis=node.getGroupProperties().MAX_JOIN_SECONDS.getInteger() * 1000;
  while (node.isActive() && !joined.get() && (Clock.currentTimeMillis() - joinStartTime < maxJoinMillis)) {
    String msg="String_Node_Str" + node.getMasterAddress();
    logger.log(Level.FINEST,msg);
    systemLogService.logJoin(msg);
    Address masterAddressNow=findMasterWithMulticast();
    node.setMasterAddress(masterAddressNow);
    systemLogService.logJoin("String_Node_Str" + masterAddressNow);
    if (node.getMasterAddress() == null || node.address.equals(node.getMasterAddress())) {
      TcpIpConfig tcpIpConfig=config.getNetworkConfig().getJoin().getTcpIpConfig();
      if (tcpIpConfig != null && tcpIpConfig.isEnabled()) {
        doTCP(joined);
      }
 else {
        systemLogService.logJoin("String_Node_Str");
        node.setAsMaster();
      }
      return;
    }
    if (++tryCount > 24) {
      failedJoiningToMaster(true,tryCount);
    }
    if (!node.getMasterAddress().equals(node.address)) {
      connectAndSendJoinRequest(node.getMasterAddress());
    }
 else {
      node.setMasterAddress(null);
      tryCount=0;
    }
    try {
      Thread.sleep(500L);
    }
 catch (    InterruptedException ignored) {
    }
  }
}
Program: 49526
Project: 49526
Buggy source:
private boolean connectAndSendJoinRequest(Address masterAddress){
  if (masterAddress == null || masterAddress.equals(node.address)) {
    throw new IllegalArgumentException();
  }
  Connection conn=node.connectionManager.getOrConnect(masterAddress);
  logger.log(Level.FINEST,"String_Node_Str" + conn);
  systemLogService.logJoin("String_Node_Str" + conn);
  if (conn != null) {
    return node.clusterManager.sendJoinRequest(masterAddress,true);
  }
  return false;
}

Fixed version (ground truth):
private boolean connectAndSendJoinRequest(Address masterAddress){
  if (masterAddress == null || masterAddress.equals(node.address)) {
    throw new IllegalArgumentException();
  }
  Connection conn=node.connectionManager.getOrConnect(masterAddress);
  logger.log(Level.FINEST,"String_Node_Str" + conn);
  systemLogService.logJoin("String_Node_Str" + conn);
  if (conn != null) {
    return node.clusterManager.sendJoinRequest(masterAddress,true);
  }
 else {
    logger.log(Level.INFO,"String_Node_Str" + masterAddress);
    return false;
  }
}
Program: 49527
Project: 49527
Buggy source:
void join(){
  long joinStartTime=Clock.currentTimeMillis();
  long maxJoinMillis=getGroupProperties().MAX_JOIN_SECONDS.getInteger() * 1000;
  try {
    if (joiner == null) {
      logger.log(Level.WARNING,"String_Node_Str");
      setAsMaster();
    }
 else {
      joiner.join(joined);
    }
  }
 catch (  Exception e) {
    logger.log(Level.WARNING,e.getMessage());
    if (Clock.currentTimeMillis() - joinStartTime < maxJoinMillis) {
      factory.lifecycleService.restart();
    }
 else {
      setActive(false);
      joined.set(false);
      Util.throwUncheckedException(e);
    }
  }
}

Fixed version (ground truth):
void join(){
  final long joinStartTime=joiner != null ? joiner.getStartTime() : Clock.currentTimeMillis();
  final long maxJoinMillis=getGroupProperties().MAX_JOIN_SECONDS.getInteger() * 1000;
  try {
    if (joiner == null) {
      logger.log(Level.WARNING,"String_Node_Str");
      setAsMaster();
    }
 else {
      joiner.join(joined);
    }
  }
 catch (  Exception e) {
    if (Clock.currentTimeMillis() - joinStartTime < maxJoinMillis) {
      logger.log(Level.WARNING,e.getMessage());
      rejoin();
    }
 else {
      logger.log(Level.SEVERE,e.getMessage(),e);
      shutdown(false,true);
    }
  }
}
Program: 49528
Project: 49528
Buggy source:
@Override public String toString(){
  StringBuffer sb=new StringBuffer("String_Node_Str");
  sb.append(lsMembers.size());
  sb.append("String_Node_Str");
  for (  MemberImpl member : lsMembers) {
    sb.append("String_Node_Str").append(member);
  }
  sb.append("String_Node_Str");
  return sb.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuilder sb=new StringBuilder("String_Node_Str");
  sb.append(lsMembers.size());
  sb.append("String_Node_Str");
  for (  MemberImpl member : lsMembers) {
    sb.append("String_Node_Str").append(member);
  }
  sb.append("String_Node_Str");
  return sb.toString();
}
Program: 49530
Project: 49530
Buggy source:
protected void failedJoiningToMaster(boolean multicast,int tryCount){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(tryCount);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(node.address);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(node.getMasterAddress());
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(multicast);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(node.connectionManager.getConnection(node.getMasterAddress()));
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  throw new IllegalStateException(sb.toString());
}

Fixed version (ground truth):
protected void failedJoiningToMaster(boolean multicast,int tryCount){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(tryCount);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(node.address);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(node.getMasterAddress());
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(multicast);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(node.connectionManager.getConnection(node.getMasterAddress()));
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  throw new IllegalStateException(sb.toString());
}
Program: 49531
Project: 49531
Buggy source:
public void pickAddress() throws Exception {
  if (address != null) {
    return;
  }
  try {
    final Config config=node.getConfig();
    final InetAddress inetAddress=pickInetAddress(config);
    final boolean reuseAddress=config.isReuseAddress();
    serverSocketChannel=ServerSocketChannel.open();
    final ServerSocket serverSocket=serverSocketChannel.socket();
    logger.log(Level.FINEST,"String_Node_Str" + reuseAddress);
    serverSocket.setReuseAddress(reuseAddress);
    serverSocket.setSoTimeout(1000);
    InetSocketAddress isa;
    int port=config.getPort();
    for (int i=0; i < 100; i++) {
      try {
        boolean bindAny=node.getGroupProperties().SOCKET_BIND_ANY.getBoolean();
        if (bindAny) {
          isa=new InetSocketAddress(port);
        }
 else {
          isa=new InetSocketAddress(inetAddress,port);
        }
        logger.log(Level.FINEST,"String_Node_Str" + isa);
        serverSocket.bind(isa,100);
        break;
      }
 catch (      final Exception e) {
        if (config.isPortAutoIncrement()) {
          port++;
        }
 else {
          String msg="String_Node_Str" + port + "String_Node_Str"+ "String_Node_Str";
          logger.log(Level.SEVERE,msg,e);
          throw e;
        }
      }
    }
    serverSocketChannel.configureBlocking(false);
    address=new Address(inetAddress,port);
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,e.getMessage(),e);
    throw e;
  }
}

Fixed version (ground truth):
private AddressDefinition pickAddress(final Config config) throws UnknownHostException, SocketException {
  AddressDefinition infAddress=getSystemConfiguredAddress();
  if (infAddress == null) {
    final NetworkConfig networkConfig=config.getNetworkConfig();
    final Collection<InterfaceDefinition> interfaces=getInterfaces(networkConfig);
    if (interfaces.contains(new InterfaceDefinition("String_Node_Str")) || interfaces.contains(new InterfaceDefinition("String_Node_Str"))) {
      infAddress=pickLoopbackAddress();
    }
 else {
      if (preferIPv4Stack()) {
        logger.log(Level.INFO,"String_Node_Str");
      }
      if (interfaces.size() > 0) {
        infAddress=pickMatchingAddress(interfaces);
      }
      if (infAddress == null) {
        if (networkConfig.getInterfaces().isEnabled()) {
          String msg="String_Node_Str";
          msg+="String_Node_Str";
          logger.log(Level.SEVERE,msg);
          throw new RuntimeException(msg);
        }
 else {
          if (networkConfig.getJoin().getTcpIpConfig().isEnabled()) {
            logger.log(Level.WARNING,"String_Node_Str" + "String_Node_Str");
          }
          infAddress=pickMatchingAddress(null);
        }
      }
    }
  }
  if (infAddress != null) {
    infAddress.inetAddress=AddressUtil.fixScopeIdAndGetInetAddress(infAddress.inetAddress);
  }
  if (infAddress == null) {
    infAddress=pickLoopbackAddress();
  }
  return infAddress;
}
Program: 49532
Project: 49532
Buggy source:
private Collection<String> getInterfaces(final Config config){
  final Collection<String> interfaces=new HashSet<String>();
  if (config.getNetworkConfig().getInterfaces().isEnabled()) {
    interfaces.addAll(config.getNetworkConfig().getInterfaces().getInterfaces());
    logger.log(Level.INFO,"String_Node_Str" + "String_Node_Str" + interfaces);
  }
 else   if (config.getNetworkConfig().getJoin().getTcpIpConfig().isEnabled()) {
    final Collection<String> possibleAddresses=TcpIpJoiner.getConfigurationMembers(node.config);
    for (    String possibleAddress : possibleAddresses) {
      interfaces.add(AddressUtil.getAddressHolder(possibleAddress).address);
    }
    logger.log(Level.FINEST,"String_Node_Str" + "String_Node_Str" + interfaces);
  }
  return interfaces;
}

Fixed version (ground truth):
private Collection<InterfaceDefinition> getInterfaces(final NetworkConfig networkConfig) throws UnknownHostException {
  final Collection<InterfaceDefinition> interfaces=new HashSet<InterfaceDefinition>();
  if (networkConfig.getInterfaces().isEnabled()) {
    final Collection<String> configInterfaces=networkConfig.getInterfaces().getInterfaces();
    for (    String configInterface : configInterfaces) {
      if (AddressUtil.isIpAddress(configInterface)) {
        interfaces.add(new InterfaceDefinition(configInterface));
      }
 else {
        logger.log(Level.INFO,"String_Node_Str" + configInterface + "String_Node_Str");
      }
    }
    logger.log(Level.INFO,"String_Node_Str" + "String_Node_Str" + interfaces);
  }
 else   if (networkConfig.getJoin().getTcpIpConfig().isEnabled()) {
    final Collection<String> possibleAddresses=TcpIpJoiner.getConfigurationMembers(node.config);
    for (    String possibleAddress : possibleAddresses) {
      final String s=AddressUtil.getAddressHolder(possibleAddress).address;
      if (AddressUtil.isIpAddress(s)) {
        interfaces.add(new InterfaceDefinition(s));
      }
 else {
        String address=resolveDomainName(s);
        logger.log(Level.INFO,"String_Node_Str" + address + "String_Node_Str"+ s+ "String_Node_Str");
        interfaces.add(new InterfaceDefinition(s,address));
      }
    }
    logger.log(Level.INFO,"String_Node_Str" + "String_Node_Str" + interfaces);
  }
  return interfaces;
}