Program: 50339
Project: 50339
Buggy source:
public Address pickAddress() throws Exception {
  String currentAddress=null;
  try {
    final Config config=node.getConfig();
    final String localAddress=System.getProperty("String_Node_Str");
    if (localAddress != null) {
      currentAddress=InetAddress.getByName(localAddress.trim()).getHostAddress();
    }
    if (currentAddress == null) {
      final Enumeration<NetworkInterface> enums=NetworkInterface.getNetworkInterfaces();
      interfaces:       while (enums.hasMoreElements()) {
        final NetworkInterface ni=enums.nextElement();
        final Enumeration<InetAddress> e=ni.getInetAddresses();
        while (e.hasMoreElements()) {
          final InetAddress inetAddress=e.nextElement();
          if (inetAddress instanceof Inet4Address) {
            final String address=inetAddress.getHostAddress();
            final Collection<String> interfaces=config.getNetworkConfig().getInterfaces().getInterfaces();
            if (config.getNetworkConfig().getInterfaces().isEnabled()) {
              if (matchAddress(address,interfaces)) {
                currentAddress=address;
                break interfaces;
              }
            }
 else {
              if (!inetAddress.isLoopbackAddress()) {
                currentAddress=address;
                break interfaces;
              }
            }
          }
        }
      }
      if (config.getNetworkConfig().getInterfaces().isEnabled() && currentAddress == null) {
        String msg="String_Node_Str";
        msg+="String_Node_Str";
        logger.log(Level.SEVERE,msg);
        throw new RuntimeException(msg);
      }
    }
    if (currentAddress == null) {
      currentAddress="String_Node_Str";
    }
    final InetAddress inetAddress=InetAddress.getByName(currentAddress);
    final boolean reuseAddress=config.isReuseAddress();
    ServerSocket serverSocket=serverSocketChannel.socket();
    serverSocket.setReuseAddress(reuseAddress);
    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);
        }
        serverSocket.bind(isa,100);
        break;
      }
 catch (      final Exception e) {
        if (config.isPortAutoIncrement()) {
          serverSocket=serverSocketChannel.socket();
          serverSocket.setReuseAddress(reuseAddress);
          port++;
        }
 else {
          String msg="String_Node_Str" + port + "String_Node_Str"+ "String_Node_Str";
          logger.log(Level.SEVERE,msg);
          throw e;
        }
      }
    }
    serverSocketChannel.configureBlocking(false);
    return new Address(currentAddress,port);
  }
 catch (  Exception e) {
    e.printStackTrace();
    throw e;
  }
}

Fixed version (ground truth):
public Address pickAddress() throws Exception {
  String currentAddress=null;
  try {
    final Config config=node.getConfig();
    final String localAddress=System.getProperty("String_Node_Str");
    if (localAddress != null) {
      currentAddress=InetAddress.getByName(localAddress.trim()).getHostAddress();
    }
    if (currentAddress == null) {
      final Set<String> interfaces=new HashSet<String>();
      if (config.getNetworkConfig().getJoin().getTcpIpConfig().isEnabled()) {
        Collection<Address> possibleAddresses=node.getPossibleMembers();
        for (        Address possibleAddress : possibleAddresses) {
          interfaces.add(possibleAddress.getHost());
        }
      }
      if (config.getNetworkConfig().getInterfaces().isEnabled()) {
        interfaces.addAll(config.getNetworkConfig().getInterfaces().getInterfaces());
      }
      if (interfaces.contains("String_Node_Str")) {
        currentAddress="String_Node_Str";
      }
 else {
        final Enumeration<NetworkInterface> enums=NetworkInterface.getNetworkInterfaces();
        interfaces:         while (enums.hasMoreElements()) {
          final NetworkInterface ni=enums.nextElement();
          final Enumeration<InetAddress> e=ni.getInetAddresses();
          while (e.hasMoreElements()) {
            final InetAddress inetAddress=e.nextElement();
            if (inetAddress instanceof Inet4Address) {
              final String address=inetAddress.getHostAddress();
              if (matchAddress(address,interfaces)) {
                currentAddress=address;
                break interfaces;
              }
 else {
                if (!inetAddress.isLoopbackAddress()) {
                  currentAddress=address;
                  break interfaces;
                }
              }
            }
          }
        }
        if (config.getNetworkConfig().getInterfaces().isEnabled() && currentAddress == null) {
          String msg="String_Node_Str";
          msg+="String_Node_Str";
          logger.log(Level.SEVERE,msg);
          throw new RuntimeException(msg);
        }
      }
    }
    if (currentAddress == null) {
      currentAddress="String_Node_Str";
    }
    final InetAddress inetAddress=InetAddress.getByName(currentAddress);
    final boolean reuseAddress=config.isReuseAddress();
    ServerSocket serverSocket=serverSocketChannel.socket();
    serverSocket.setReuseAddress(reuseAddress);
    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);
        }
        serverSocket.bind(isa,100);
        break;
      }
 catch (      final Exception e) {
        if (config.isPortAutoIncrement()) {
          serverSocket=serverSocketChannel.socket();
          serverSocket.setReuseAddress(reuseAddress);
          port++;
        }
 else {
          String msg="String_Node_Str" + port + "String_Node_Str"+ "String_Node_Str";
          logger.log(Level.SEVERE,msg);
          throw e;
        }
      }
    }
    serverSocketChannel.configureBlocking(false);
    return new Address(currentAddress,port);
  }
 catch (  Exception e) {
    e.printStackTrace();
    throw e;
  }
}