Program: 113864
Project: 113864
Buggy source:
/** 
 * Returns a list of mappings for all reachable network endpoints.
 * @param port the port to assign to the mappings
 * @param protocol the protocol for the endpoint
 * @return a list of mappings
 * @throws IOException
 */
public static List<Map<String,Object>> getReachableEndpoints(int port,String protocol) throws IOException {
  List<Map<String,Object>> endpoints=new LinkedList<Map<String,Object>>();
  Enumeration<NetworkInterface> ifcs=NetworkInterface.getNetworkInterfaces();
  while (ifcs.hasMoreElements()) {
    NetworkInterface ifc=ifcs.nextElement();
    List<InterfaceAddress> addrs=ifc.getInterfaceAddresses();
    for (    InterfaceAddress addr : addrs) {
      InetAddress inetAddr=addr.getAddress();
      if (inetAddr.isLoopbackAddress() || inetAddr.isLinkLocalAddress())       continue;
      if (!(inetAddr.isLinkLocalAddress() || inetAddr.isSiteLocalAddress())) {
        endpoints.add(RPCClient.generateMap("String_Node_Str",inetAddr.getHostAddress(),"String_Node_Str",port,"String_Node_Str",protocol,"String_Node_Str",3600,"String_Node_Str","String_Node_Str"));
        break;
      }
    }
    if (!endpoints.isEmpty())     break;
  }
  if (endpoints.isEmpty()) {
    ifcs=NetworkInterface.getNetworkInterfaces();
    NetworkInterface ifc=ifcs.nextElement();
    List<InterfaceAddress> addrs=ifc.getInterfaceAddresses();
    ifcs=NetworkInterface.getNetworkInterfaces();
    while (ifcs.hasMoreElements()) {
      for (      InterfaceAddress addr : addrs) {
        InetAddress inetAddr=addr.getAddress();
        if (inetAddr.isSiteLocalAddress()) {
          endpoints.add(RPCClient.generateMap("String_Node_Str",inetAddr.getHostAddress(),"String_Node_Str",port,"String_Node_Str",protocol,"String_Node_Str",3600,"String_Node_Str","String_Node_Str"));
          break;
        }
      }
      if (!endpoints.isEmpty())       break;
    }
  }
  return endpoints;
}

Fixed version (ground truth):
/** 
 * Returns a list of mappings for all reachable network endpoints.
 * @param port the port to assign to the mappings
 * @param protocol the protocol for the endpoint
 * @return a list of mappings
 * @throws IOException
 */
public static List<Map<String,Object>> getReachableEndpoints(int port,String protocol) throws IOException {
  List<Map<String,Object>> endpoints=new LinkedList<Map<String,Object>>();
  Enumeration<NetworkInterface> ifcs=NetworkInterface.getNetworkInterfaces();
  while (ifcs.hasMoreElements()) {
    NetworkInterface ifc=ifcs.nextElement();
    List<InterfaceAddress> addrs=ifc.getInterfaceAddresses();
    for (    InterfaceAddress addr : addrs) {
      InetAddress inetAddr=addr.getAddress();
      if (inetAddr.isLoopbackAddress() || inetAddr.isLinkLocalAddress())       continue;
      if (!(inetAddr.isLinkLocalAddress() || inetAddr.isSiteLocalAddress())) {
        endpoints.add(RPCClient.generateMap("String_Node_Str",inetAddr.getHostAddress(),"String_Node_Str",port,"String_Node_Str",protocol,"String_Node_Str",3600,"String_Node_Str","String_Node_Str"));
        break;
      }
    }
    if (!endpoints.isEmpty())     break;
  }
  if (endpoints.isEmpty()) {
    ifcs=NetworkInterface.getNetworkInterfaces();
    while (ifcs.hasMoreElements()) {
      NetworkInterface ifc=ifcs.nextElement();
      List<InterfaceAddress> addrs=ifc.getInterfaceAddresses();
      for (      InterfaceAddress addr : addrs) {
        InetAddress inetAddr=addr.getAddress();
        if (inetAddr.isSiteLocalAddress()) {
          endpoints.add(RPCClient.generateMap("String_Node_Str",inetAddr.getHostAddress(),"String_Node_Str",port,"String_Node_Str",protocol,"String_Node_Str",3600,"String_Node_Str","String_Node_Str"));
          break;
        }
      }
      if (!endpoints.isEmpty())       break;
    }
  }
  return endpoints;
}