Program: 134368
Project: 134368
Buggy source:
public CheckResult check(String gridName,String rowName,String colName,Map params,Map<String,String> rowVars,Map<String,String> colVars,int timeout){
  HashMap<String,String> netLogParams=new HashMap<String,String>();
  NetLogger netLog=NetLogger.getTlogger();
  HashMap<String,String> vars=new HashMap<String,String>();
  vars.put("String_Node_Str",rowName);
  vars.put("String_Node_Str",colName);
  vars.putAll(eventTypes);
  if (!params.containsKey(PARAM_MAURL) || params.get(PARAM_MAURL) == null) {
    return new CheckResult(CheckConstants.RESULT_UNKNOWN,PARAM_MAURL + "String_Node_Str",null);
  }
  Map maUrlMap=(Map)params.get(PARAM_MAURL);
  String maUrl=null;
  if (maUrlMap.containsKey(rowName) && maUrlMap.get(rowName) != null) {
    Map<String,String> rowMaUrlMap=(Map<String,String>)maUrlMap.get(rowName);
    if (rowMaUrlMap.containsKey(colName) && rowMaUrlMap.get(colName) != null) {
      maUrl=(String)rowMaUrlMap.get(colName);
    }
 else     if (rowMaUrlMap.containsKey(PROP_MAURL_DEFAULT) && rowMaUrlMap.get(PROP_MAURL_DEFAULT) != null) {
      maUrl=(String)rowMaUrlMap.get(PROP_MAURL_DEFAULT);
    }
  }
  if (maUrl == null) {
    maUrl=(String)maUrlMap.get(PROP_MAURL_DEFAULT);
  }
  if (maUrl == null) {
    return new CheckResult(CheckConstants.RESULT_UNKNOWN,"String_Node_Str",null);
  }
  maUrl=this.replaceVars(maUrl,vars,rowVars,colVars);
  vars.put("String_Node_Str",maUrl);
  String maUrlReverse=null;
  if (maUrlMap.containsKey(colName) && maUrlMap.get(colName) != null) {
    Map<String,String> colMaUrlMap=(Map<String,String>)maUrlMap.get(colName);
    if (colMaUrlMap.containsKey(rowName) && colMaUrlMap.get(rowName) != null) {
      maUrlReverse=(String)colMaUrlMap.get(rowName);
    }
 else     if (colMaUrlMap.containsKey(PROP_MAURL_DEFAULT) && colMaUrlMap.get(PROP_MAURL_DEFAULT) != null) {
      maUrlReverse=(String)colMaUrlMap.get(PROP_MAURL_DEFAULT);
    }
  }
  if (maUrlReverse == null) {
    maUrlReverse=(String)maUrlMap.get(PROP_MAURL_DEFAULT);
  }
  if (maUrlReverse == null) {
    maUrlReverse=maUrl;
  }
 else {
    HashMap<String,String> varsReverse=new HashMap<String,String>();
    varsReverse.put("String_Node_Str",colName);
    varsReverse.put("String_Node_Str",rowName);
    varsReverse.putAll(eventTypes);
    maUrlReverse=this.replaceVars(maUrlReverse,varsReverse,colVars,rowVars);
  }
  vars.put("String_Node_Str",maUrlReverse);
  String mdKeyLookupUrl=null;
  if (params.containsKey(PARAM_MD_KEY_LOOKUP) && params.get(PARAM_MD_KEY_LOOKUP) != null) {
    mdKeyLookupUrl=(String)params.get(PARAM_MD_KEY_LOOKUP);
    mdKeyLookupUrl=this.replaceVars(mdKeyLookupUrl,vars,rowVars,colVars);
  }
  if (!params.containsKey(PARAM_GRAPH_URL) || params.get(PARAM_GRAPH_URL) == null) {
    return new CheckResult(CheckConstants.RESULT_UNKNOWN,PARAM_GRAPH_URL + "String_Node_Str",null);
  }
  String graphUrl=null;
  try {
    graphUrl=(String)params.get(PARAM_GRAPH_URL);
  }
 catch (  Exception e) {
  }
  if (graphUrl == null) {
    Map graphUrlMap=(Map)params.get(PARAM_GRAPH_URL);
    if (graphUrlMap.containsKey(rowName) && graphUrlMap.get(rowName) != null) {
      Map<String,String> rowGraphUrlMap=(Map<String,String>)graphUrlMap.get(rowName);
      if (rowGraphUrlMap.containsKey(colName) && rowGraphUrlMap.get(colName) != null) {
        graphUrl=(String)rowGraphUrlMap.get(colName);
      }
 else       if (rowGraphUrlMap.containsKey(PROP_GRAPHURL_DEFAULT) && rowGraphUrlMap.get(PROP_GRAPHURL_DEFAULT) != null) {
        graphUrl=(String)rowGraphUrlMap.get(PROP_GRAPHURL_DEFAULT);
      }
    }
    if (graphUrl == null) {
      graphUrl=(String)graphUrlMap.get(PROP_GRAPHURL_DEFAULT);
    }
  }
  if (graphUrl == null) {
    return new CheckResult(CheckConstants.RESULT_UNKNOWN,"String_Node_Str",null);
  }
  if (!params.containsKey(PARAM_COMMAND) || params.get(PARAM_COMMAND) == null) {
    return new CheckResult(CheckConstants.RESULT_UNKNOWN,"String_Node_Str",null);
  }
  String command=(String)params.get(PARAM_COMMAND);
  command=this.replaceVars(command,vars,rowVars,colVars);
  params.put(PARAM_COMMAND,command);
  CheckResult nagiosResult=super.check(gridName,rowName,colName,params,rowVars,colVars,timeout);
  if (nagiosResult.getStats() == null) {
    nagiosResult.setStats(new HashMap<String,String>());
  }
  nagiosResult.getStats().put("String_Node_Str",maUrl);
  String response="String_Node_Str";
  try {
    if (mdKeyLookupUrl != null) {
      netlogger.debug(netLog.start("String_Node_Str",null,mdKeyLookupUrl));
      URL url=new URL(mdKeyLookupUrl);
      HttpURLConnection httpConn=(HttpURLConnection)url.openConnection();
      log.debug("String_Node_Str" + mdKeyLookupUrl);
      log.debug("String_Node_Str" + httpConn.getResponseCode());
      log.debug("String_Node_Str" + httpConn.getResponseMessage());
      netLogParams.put("String_Node_Str",httpConn.getResponseCode() + "String_Node_Str");
      if (httpConn.getResponseCode() / 200 != 1) {
        netlogger.debug(netLog.end("String_Node_Str",null,mdKeyLookupUrl,netLogParams));
        return nagiosResult;
      }
      BufferedReader responseReader=new BufferedReader(new InputStreamReader(httpConn.getInputStream()));
      String line=null;
      while ((line=responseReader.readLine()) != null) {
        response+=(line + '\n');
      }
      netlogger.debug(netLog.end("String_Node_Str",null,mdKeyLookupUrl,netLogParams));
      log.debug("String_Node_Str" + response);
      JSONObject responseJSON=JSONObject.fromObject(response);
      vars.put("String_Node_Str","String_Node_Str" + responseJSON.get("String_Node_Str"));
      vars.put("String_Node_Str","String_Node_Str" + responseJSON.get("String_Node_Str"));
      vars.put("String_Node_Str","String_Node_Str" + responseJSON.get("String_Node_Str"));
      vars.put("String_Node_Str","String_Node_Str" + responseJSON.get("String_Node_Str"));
      vars.put("String_Node_Str","String_Node_Str" + responseJSON.get("String_Node_Str"));
      vars.put("String_Node_Str","String_Node_Str" + responseJSON.get("String_Node_Str"));
      vars.put("String_Node_Str","String_Node_Str" + responseJSON.get("String_Node_Str"));
    }
    graphUrl=this.replaceVars(graphUrl,vars,rowVars,colVars);
    nagiosResult.getStats().put("String_Node_Str",graphUrl);
  }
 catch (  Exception e) {
    netlogger.debug(netLog.error("String_Node_Str",null,mdKeyLookupUrl,netLogParams));
    log.error("String_Node_Str" + e.getMessage());
    e.printStackTrace();
  }
  return nagiosResult;
}

Fixed version (ground truth):
public CheckResult check(String gridName,String rowName,String colName,Map params,TemplateVariableMap rowVars,TemplateVariableMap colVars,int timeout){
  HashMap<String,String> netLogParams=new HashMap<String,String>();
  NetLogger netLog=NetLogger.getTlogger();
  TemplateVariableMap vars=new TemplateVariableMap();
  vars.put("String_Node_Str",rowName);
  vars.put("String_Node_Str",colName);
  vars.putAll(eventTypes);
  if (!params.containsKey(PARAM_MAURL) || params.get(PARAM_MAURL) == null) {
    return new CheckResult(CheckConstants.RESULT_UNKNOWN,PARAM_MAURL + "String_Node_Str",null);
  }
  Map maUrlMap=(Map)params.get(PARAM_MAURL);
  String maUrl=null;
  if (maUrlMap.containsKey(rowName) && maUrlMap.get(rowName) != null) {
    Map<String,String> rowMaUrlMap=(Map<String,String>)maUrlMap.get(rowName);
    if (rowMaUrlMap.containsKey(colName) && rowMaUrlMap.get(colName) != null) {
      maUrl=(String)rowMaUrlMap.get(colName);
    }
 else     if (rowMaUrlMap.containsKey(PROP_MAURL_DEFAULT) && rowMaUrlMap.get(PROP_MAURL_DEFAULT) != null) {
      maUrl=(String)rowMaUrlMap.get(PROP_MAURL_DEFAULT);
    }
  }
  if (maUrl == null) {
    maUrl=(String)maUrlMap.get(PROP_MAURL_DEFAULT);
  }
  if (maUrl == null) {
    return new CheckResult(CheckConstants.RESULT_UNKNOWN,"String_Node_Str",null);
  }
  maUrl=this.replaceVars(maUrl,vars,rowVars,colVars);
  vars.put("String_Node_Str",maUrl);
  String maUrlReverse=null;
  if (maUrlMap.containsKey(colName) && maUrlMap.get(colName) != null) {
    Map<String,String> colMaUrlMap=(Map<String,String>)maUrlMap.get(colName);
    if (colMaUrlMap.containsKey(rowName) && colMaUrlMap.get(rowName) != null) {
      maUrlReverse=(String)colMaUrlMap.get(rowName);
    }
 else     if (colMaUrlMap.containsKey(PROP_MAURL_DEFAULT) && colMaUrlMap.get(PROP_MAURL_DEFAULT) != null) {
      maUrlReverse=(String)colMaUrlMap.get(PROP_MAURL_DEFAULT);
    }
  }
  if (maUrlReverse == null) {
    maUrlReverse=(String)maUrlMap.get(PROP_MAURL_DEFAULT);
  }
  if (maUrlReverse == null) {
    maUrlReverse=maUrl;
  }
 else {
    TemplateVariableMap varsReverse=new TemplateVariableMap();
    varsReverse.put("String_Node_Str",colName);
    varsReverse.put("String_Node_Str",rowName);
    varsReverse.putAll(eventTypes);
    maUrlReverse=this.replaceVars(maUrlReverse,varsReverse,colVars,rowVars);
  }
  vars.put("String_Node_Str",maUrlReverse);
  String mdKeyLookupUrl=null;
  if (params.containsKey(PARAM_MD_KEY_LOOKUP) && params.get(PARAM_MD_KEY_LOOKUP) != null) {
    mdKeyLookupUrl=(String)params.get(PARAM_MD_KEY_LOOKUP);
    mdKeyLookupUrl=this.replaceVars(mdKeyLookupUrl,vars,rowVars,colVars);
  }
  if (!params.containsKey(PARAM_GRAPH_URL) || params.get(PARAM_GRAPH_URL) == null) {
    return new CheckResult(CheckConstants.RESULT_UNKNOWN,PARAM_GRAPH_URL + "String_Node_Str",null);
  }
  String graphUrl=null;
  try {
    graphUrl=(String)params.get(PARAM_GRAPH_URL);
  }
 catch (  Exception e) {
  }
  if (graphUrl == null) {
    Map graphUrlMap=(Map)params.get(PARAM_GRAPH_URL);
    if (graphUrlMap.containsKey(rowName) && graphUrlMap.get(rowName) != null) {
      Map<String,String> rowGraphUrlMap=(Map<String,String>)graphUrlMap.get(rowName);
      if (rowGraphUrlMap.containsKey(colName) && rowGraphUrlMap.get(colName) != null) {
        graphUrl=(String)rowGraphUrlMap.get(colName);
      }
 else       if (rowGraphUrlMap.containsKey(PROP_GRAPHURL_DEFAULT) && rowGraphUrlMap.get(PROP_GRAPHURL_DEFAULT) != null) {
        graphUrl=(String)rowGraphUrlMap.get(PROP_GRAPHURL_DEFAULT);
      }
    }
    if (graphUrl == null) {
      graphUrl=(String)graphUrlMap.get(PROP_GRAPHURL_DEFAULT);
    }
  }
  if (graphUrl == null) {
    return new CheckResult(CheckConstants.RESULT_UNKNOWN,"String_Node_Str",null);
  }
  if (!params.containsKey(PARAM_COMMAND) || params.get(PARAM_COMMAND) == null) {
    return new CheckResult(CheckConstants.RESULT_UNKNOWN,"String_Node_Str",null);
  }
  String command=(String)params.get(PARAM_COMMAND);
  command=this.replaceVars(command,vars,rowVars,colVars);
  params.put(PARAM_COMMAND,command);
  CheckResult nagiosResult=super.check(gridName,rowName,colName,params,rowVars,colVars,timeout);
  if (nagiosResult.getStats() == null) {
    nagiosResult.setStats(new HashMap<String,String>());
  }
  nagiosResult.getStats().put("String_Node_Str",maUrl);
  String response="String_Node_Str";
  try {
    if (mdKeyLookupUrl != null) {
      netlogger.debug(netLog.start("String_Node_Str",null,mdKeyLookupUrl));
      URL url=new URL(mdKeyLookupUrl);
      HttpURLConnection httpConn=(HttpURLConnection)url.openConnection();
      log.debug("String_Node_Str" + mdKeyLookupUrl);
      log.debug("String_Node_Str" + httpConn.getResponseCode());
      log.debug("String_Node_Str" + httpConn.getResponseMessage());
      netLogParams.put("String_Node_Str",httpConn.getResponseCode() + "String_Node_Str");
      if (httpConn.getResponseCode() / 200 != 1) {
        netlogger.debug(netLog.end("String_Node_Str",null,mdKeyLookupUrl,netLogParams));
        return nagiosResult;
      }
      BufferedReader responseReader=new BufferedReader(new InputStreamReader(httpConn.getInputStream()));
      String line=null;
      while ((line=responseReader.readLine()) != null) {
        response+=(line + '\n');
      }
      netlogger.debug(netLog.end("String_Node_Str",null,mdKeyLookupUrl,netLogParams));
      log.debug("String_Node_Str" + response);
      JSONObject responseJSON=JSONObject.fromObject(response);
      vars.put("String_Node_Str","String_Node_Str" + responseJSON.get("String_Node_Str"));
      vars.put("String_Node_Str","String_Node_Str" + responseJSON.get("String_Node_Str"));
      vars.put("String_Node_Str","String_Node_Str" + responseJSON.get("String_Node_Str"));
      vars.put("String_Node_Str","String_Node_Str" + responseJSON.get("String_Node_Str"));
      vars.put("String_Node_Str","String_Node_Str" + responseJSON.get("String_Node_Str"));
      vars.put("String_Node_Str","String_Node_Str" + responseJSON.get("String_Node_Str"));
      vars.put("String_Node_Str","String_Node_Str" + responseJSON.get("String_Node_Str"));
    }
    graphUrl=this.replaceVars(graphUrl,vars,rowVars,colVars);
    nagiosResult.getStats().put("String_Node_Str",graphUrl);
  }
 catch (  Exception e) {
    netlogger.debug(netLog.error("String_Node_Str",null,mdKeyLookupUrl,netLogParams));
    log.error("String_Node_Str" + e.getMessage());
    e.printStackTrace();
  }
  return nagiosResult;
}