Program: 105835
Project: 105835
Buggy source:
/** 
 * This method creates a XenServer network and configures it for being used as a L2-in-L3 tunneled network
 */
private synchronized Network configureTunnelNetwork(Connection conn,long networkId,long hostId,String bridgeName){
  try {
    Network nw=findOrCreateTunnelNetwork(conn,bridgeName);
    String nwName=bridgeName;
    String bridge=nw.getBridge(conn);
    Map<String,String> nwOtherConfig=nw.getOtherConfig(conn);
    String configuredHosts=nwOtherConfig.get("String_Node_Str");
    boolean configured=false;
    if (configuredHosts != null) {
      String hostIdsStr[]=configuredHosts.split("String_Node_Str");
      for (      String hostIdStr : hostIdsStr) {
        if (hostIdStr.equals(((Long)hostId).toString())) {
          configured=true;
          break;
        }
      }
    }
    if (!configured) {
      if (!is_xcp())       enableXenServerNetwork(conn,nw,nwName,"String_Node_Str" + bridgeName);
      String result;
      if (bridgeName.startsWith("String_Node_Str")) {
        result=callHostPlugin(conn,"String_Node_Str","String_Node_Str","String_Node_Str",bridge,"String_Node_Str",bridgeName,"String_Node_Str",nw.getUuid(conn),"String_Node_Str",((Long)hostId).toString());
      }
 else {
        result=callHostPlugin(conn,"String_Node_Str","String_Node_Str","String_Node_Str",bridge,"String_Node_Str",bridgeName,"String_Node_Str",nw.getUuid(conn),"String_Node_Str",((Long)hostId).toString());
      }
      String[] res=result.split("String_Node_Str");
      if (res.length != 2 || !res[0].equalsIgnoreCase("String_Node_Str")) {
        throw new CloudRuntimeException("String_Node_Str" + bridge + "String_Node_Str"+ networkId+ "String_Node_Str"+ res);
      }
    }
    return nw;
  }
 catch (  Exception e) {
    s_logger.warn("String_Node_Str",e);
    return null;
  }
}

Fixed version (ground truth):
/** 
 * This method creates a XenServer network and configures it for being used as a L2-in-L3 tunneled network
 */
private synchronized Network configureTunnelNetwork(Connection conn,Long networkId,long hostId,String bridgeName){
  try {
    Network nw=findOrCreateTunnelNetwork(conn,bridgeName);
    String nwName=bridgeName;
    String bridge=nw.getBridge(conn);
    Map<String,String> nwOtherConfig=nw.getOtherConfig(conn);
    String configuredHosts=nwOtherConfig.get("String_Node_Str");
    boolean configured=false;
    if (configuredHosts != null) {
      String hostIdsStr[]=configuredHosts.split("String_Node_Str");
      for (      String hostIdStr : hostIdsStr) {
        if (hostIdStr.equals(((Long)hostId).toString())) {
          configured=true;
          break;
        }
      }
    }
    if (!configured) {
      if (!is_xcp())       enableXenServerNetwork(conn,nw,nwName,"String_Node_Str" + bridgeName);
      String result;
      if (bridgeName.startsWith("String_Node_Str")) {
        result=callHostPlugin(conn,"String_Node_Str","String_Node_Str","String_Node_Str",bridge,"String_Node_Str",bridgeName,"String_Node_Str",nw.getUuid(conn),"String_Node_Str",((Long)hostId).toString());
      }
 else {
        result=callHostPlugin(conn,"String_Node_Str","String_Node_Str","String_Node_Str",bridge,"String_Node_Str",bridgeName,"String_Node_Str",nw.getUuid(conn),"String_Node_Str",((Long)hostId).toString());
      }
      String[] res=result.split("String_Node_Str");
      if (res.length != 2 || !res[0].equalsIgnoreCase("String_Node_Str")) {
        throw new CloudRuntimeException("String_Node_Str" + bridge);
      }
    }
    return nw;
  }
 catch (  Exception e) {
    s_logger.warn("String_Node_Str",e);
    return null;
  }
}