Program: 134373
Project: 134373
Buggy source:
/** 
 * Loads YAML properties into scheduler database
 * @param config Properties loaded from YAML file as a Map
 * @param dataSource the dataSource to use to access the database
 * @return a map of check Classes indexed by the class name
 * @throws ClassNotFoundException
 */
static public Map<String,Class> load(Map config,ComboPooledDataSource dataSource) throws ClassNotFoundException {
  checkRequiredProp(config,PROP_CHECKS);
  checkRequiredProp(config,PROP_GROUPS);
  checkRequiredProp(config,PROP_GRIDS);
  Map<String,Map> checkMap=(Map<String,Map>)config.get(PROP_CHECKS);
  Map groupMap=(Map)config.get(PROP_GROUPS);
  List<Map> gridList=(List<Map>)config.get(PROP_GRIDS);
  HashMap<String,Class> checkTypeClassMap=new HashMap<String,Class>();
  Connection conn=null;
  try {
    conn=dataSource.getConnection();
    conn.createStatement().executeUpdate("String_Node_Str");
    PreparedStatement insertDimension=conn.prepareStatement("String_Node_Str");
    if (config.containsKey(PROP_DIMENSIONS) && config.get(PROP_DIMENSIONS) != null) {
      int i=1;
      for (      Map<Object,Object> dimension : (List<Map<Object,Object>>)config.get(PROP_DIMENSIONS)) {
        if (!dimension.containsKey(PROP_DIMENSIONS_ID) || dimension.get(PROP_DIMENSIONS_ID) == null) {
          throw new RuntimeException("String_Node_Str" + i + "String_Node_Str");
        }
        for (        Object dimensionParamObj : dimension.keySet()) {
          String dimensionParam=dimensionParamObj + "String_Node_Str";
          if (dimensionParam.equals(PROP_DIMENSIONS_ID)) {
            continue;
          }
          insertDimension.setString(1,dimension.get(PROP_DIMENSIONS_ID) + "String_Node_Str");
          insertDimension.setString(2,dimensionParam);
          insertDimension.setString(3,dimension.get(dimensionParam) + "String_Node_Str");
          insertDimension.executeUpdate();
        }
        i++;
      }
    }
    HashMap<String,Integer> templateIdMap=new HashMap<String,Integer>();
    PreparedStatement selTemplateStmt=conn.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    PreparedStatement insertTemplateStmt=conn.prepareStatement("String_Node_Str" + "String_Node_Str",Statement.RETURN_GENERATED_KEYS);
    PreparedStatement updateTemplateStmt=conn.prepareStatement("String_Node_Str");
    for (    String checkName : checkMap.keySet()) {
      selTemplateStmt.setString(1,checkName);
      insertTemplateStmt.setString(1,checkName);
      Map check=checkMap.get(checkName);
      checkRequiredProp(check,PROP_CHECKS_NAME);
      checkRequiredProp(check,PROP_CHECKS_DESCRIPTION);
      checkRequiredProp(check,PROP_CHECKS_TYPE);
      if (!checkTypeClassMap.containsKey(check.get(PROP_CHECKS_TYPE) + "String_Node_Str")) {
        checkTypeClassMap.put(check.get(PROP_CHECKS_TYPE) + "String_Node_Str",loadClass(check.get(PROP_CHECKS_TYPE) + "String_Node_Str"));
      }
      selTemplateStmt.setString(2,(String)check.get(PROP_CHECKS_TYPE));
      insertTemplateStmt.setString(2,(String)check.get(PROP_CHECKS_TYPE));
      String jsonParamString=CheckConstants.EMPTY_PARAMS;
      if (check.containsKey(PROP_CHECKS_PARAMS) && check.get(PROP_CHECKS_PARAMS) != null) {
        jsonParamString=JSONObject.fromObject(check.get(PROP_CHECKS_PARAMS)).toString();
      }
      SerialClob jsonClob=new SerialClob(jsonParamString.toCharArray());
      updateTemplateStmt.setClob(1,jsonClob);
      insertTemplateStmt.setClob(3,jsonClob);
      checkRequiredProp(check,PROP_CHECKS_INTERVAL);
      selTemplateStmt.setInt(3,(Integer)check.get(PROP_CHECKS_INTERVAL));
      insertTemplateStmt.setInt(4,(Integer)check.get(PROP_CHECKS_INTERVAL));
      checkRequiredProp(check,PROP_CHECKS_RETRY_INT);
      selTemplateStmt.setInt(4,(Integer)check.get(PROP_CHECKS_RETRY_INT));
      insertTemplateStmt.setInt(5,(Integer)check.get(PROP_CHECKS_RETRY_INT));
      checkRequiredProp(check,PROP_CHECKS_RETRY_ATT);
      selTemplateStmt.setInt(5,(Integer)check.get(PROP_CHECKS_RETRY_ATT));
      insertTemplateStmt.setInt(6,(Integer)check.get(PROP_CHECKS_RETRY_ATT));
      checkRequiredProp(check,PROP_CHECKS_TIMEOUT);
      selTemplateStmt.setInt(6,(Integer)check.get(PROP_CHECKS_TIMEOUT));
      insertTemplateStmt.setInt(7,(Integer)check.get(PROP_CHECKS_TIMEOUT));
      ResultSet selResult=selTemplateStmt.executeQuery();
      if (selResult.next()) {
        updateTemplateStmt.setInt(2,selResult.getInt(1));
        updateTemplateStmt.execute();
        templateIdMap.put(checkName,selResult.getInt(1));
      }
 else {
        insertTemplateStmt.executeUpdate();
        ResultSet genKeys=insertTemplateStmt.getGeneratedKeys();
        if (!genKeys.next()) {
          throw new RuntimeException("String_Node_Str");
        }
        templateIdMap.put(checkName,genKeys.getInt(1));
      }
    }
    conn.createStatement().executeUpdate("String_Node_Str");
    conn.createStatement().executeUpdate("String_Node_Str");
    PreparedStatement insertGridStmt=conn.prepareStatement("String_Node_Str");
    PreparedStatement selCheckStmt=conn.prepareStatement("String_Node_Str" + "String_Node_Str");
    PreparedStatement updateCheckStmt=conn.prepareStatement("String_Node_Str");
    PreparedStatement insertCheckStmt=conn.prepareStatement("String_Node_Str" + CheckConstants.RESULT_NOTRUN + "String_Node_Str"+ CheckConstants.RESULT_NOTRUN+ "String_Node_Str");
    for (    Map gridMap : gridList) {
      String rowOrder=(String)gridMap.get(PROP_GRIDS_ROW_ORDER);
      String colOrder=(String)gridMap.get(PROP_GRIDS_COL_ORDER);
      checkRequiredProp(gridMap,PROP_GRIDS_NAME);
      checkRequiredProp(gridMap,PROP_GRIDS_ROWS);
      checkRequiredProp(gridMap,PROP_GRIDS_EXCL_SELF);
      checkRequiredProp(gridMap,PROP_GRIDS_COL_ALG);
      checkRequiredProp(gridMap,PROP_GRIDS_COLS);
      checkRequiredProp(gridMap,PROP_GRIDS_CHECKS);
      checkRequiredProp(gridMap,PROP_GRIDS_STATUS_LABELS);
      String colAlg=((String)gridMap.get(PROP_GRIDS_COL_ALG)).toLowerCase();
      int exclSelf=(Integer)gridMap.get(PROP_GRIDS_EXCL_SELF);
      Map<String,List<String>> exclChecks=new HashMap<String,List<String>>();
      if (gridMap.containsKey(PROP_GRIDS_EXCL_CHECKS) && gridMap.get(PROP_GRIDS_EXCL_CHECKS) != null) {
        exclChecks=(Map<String,List<String>>)gridMap.get(PROP_GRIDS_EXCL_CHECKS);
      }
      checkRequiredProp(groupMap,(String)gridMap.get(PROP_GRIDS_ROWS));
      checkRequiredProp(groupMap,(String)gridMap.get(PROP_GRIDS_COLS));
      List<String> rows=new ArrayList<String>();
      for (      Object tmpRow : (List<Object>)groupMap.get(gridMap.get(PROP_GRIDS_ROWS))) {
        rows.add(tmpRow + "String_Node_Str");
      }
      if (ORDER_ALPHA.equals(rowOrder)) {
        Collections.sort(rows);
      }
      List<String> cols=new ArrayList<String>();
      List<String> tmpCols=new ArrayList<String>();
      for (      Object tmpCol : (List<Object>)groupMap.get(gridMap.get(PROP_GRIDS_COLS))) {
        cols.add(tmpCol + "String_Node_Str");
        tmpCols.add(tmpCol + "String_Node_Str");
      }
      if (ORDER_ALPHA.equals(colOrder)) {
        Collections.sort(tmpCols);
      }
      HashMap<String,Integer> colOrderMap=new HashMap<String,Integer>();
      for (int i=0; i < tmpCols.size(); i++) {
        colOrderMap.put(tmpCols.get(i),i);
      }
      Map<String,String> statusLabelMap=(Map<String,String>)gridMap.get(PROP_GRIDS_STATUS_LABELS);
      insertGridStmt.setString(1,(String)gridMap.get(PROP_GRIDS_NAME));
      insertGridStmt.setString(2,ConfigLoader.genStatusLabel(statusLabelMap,PROP_GRIDS_STATUS_LABELS_OK));
      insertGridStmt.setString(3,ConfigLoader.genStatusLabel(statusLabelMap,PROP_GRIDS_STATUS_LABELS_WARNING));
      insertGridStmt.setString(4,ConfigLoader.genStatusLabel(statusLabelMap,PROP_GRIDS_STATUS_LABELS_CRITICAL));
      insertGridStmt.setString(5,ConfigLoader.genStatusLabel(statusLabelMap,PROP_GRIDS_STATUS_LABELS_UNKNOWN));
      insertGridStmt.setString(6,ConfigLoader.genStatusLabel(statusLabelMap,PROP_GRIDS_STATUS_LABELS_NOTRUN));
      insertGridStmt.executeUpdate();
      selCheckStmt.setString(1,(String)gridMap.get(PROP_GRIDS_NAME));
      for (int ri=0; ri < rows.size(); ri++) {
        String row=rows.get(ri);
        boolean rowColFound=false;
        selCheckStmt.setString(2,row);
        for (        String col : cols) {
          if (col.equals(row) && exclSelf == 1) {
            rowColFound=true;
            continue;
          }
 else           if (col.equals(row)) {
            rowColFound=true;
          }
          if (exclChecks.containsKey(row) && exclChecks.get(row) != null) {
            if (exclChecks.get(row).contains(col) || exclChecks.get(row).contains(EXCL_CHECKS_ALL)) {
              continue;
            }
          }
 else           if (exclChecks.containsKey(EXCL_CHECKS_DEFAULT) && exclChecks.get(EXCL_CHECKS_DEFAULT) != null) {
            if (exclChecks.get(EXCL_CHECKS_DEFAULT).contains(col) || exclChecks.get(EXCL_CHECKS_DEFAULT).contains(EXCL_CHECKS_ALL)) {
              continue;
            }
          }
          if (colAlg.equals(ALG_AFTER) && !rowColFound) {
            continue;
          }
 else           if (colAlg.equals(ALG_BEFORE) && rowColFound) {
            break;
          }
          selCheckStmt.setString(3,col);
          for (          String checkName : (List<String>)gridMap.get(PROP_GRIDS_CHECKS)) {
            if (!checkMap.containsKey(checkName) || checkMap.get(checkName) == null) {
              throw new RuntimeException("String_Node_Str" + checkName + "String_Node_Str");
            }
            String checkNiceName=(String)checkMap.get(checkName).get(PROP_CHECKS_NAME);
            String checkDescrName=(String)checkMap.get(checkName).get(PROP_CHECKS_DESCRIPTION);
            checkRequiredProp(templateIdMap,checkName);
            selCheckStmt.setString(4,checkNiceName);
            selCheckStmt.setInt(5,templateIdMap.get(checkName));
            ResultSet selResult=selCheckStmt.executeQuery();
            if (selResult.next()) {
              log.debug("String_Node_Str" + checkName);
              updateCheckStmt.setString(1,formatCheckDescription(checkDescrName,row,col));
              updateCheckStmt.setInt(2,ri);
              updateCheckStmt.setInt(3,colOrderMap.get(col));
              updateCheckStmt.setInt(4,selResult.getInt(1));
              updateCheckStmt.executeUpdate();
            }
 else {
              log.debug("String_Node_Str" + checkName);
              insertCheckStmt.setInt(1,templateIdMap.get(checkName));
              insertCheckStmt.setString(2,(String)gridMap.get(PROP_GRIDS_NAME));
              insertCheckStmt.setString(3,row);
              insertCheckStmt.setString(4,col);
              insertCheckStmt.setString(5,checkNiceName);
              insertCheckStmt.setInt(6,ri);
              insertCheckStmt.setInt(7,colOrderMap.get(col));
              insertCheckStmt.setString(8,formatCheckDescription(checkDescrName,row,col));
              insertCheckStmt.executeUpdate();
            }
          }
        }
      }
    }
    conn.close();
  }
 catch (  SQLException e) {
    if (conn != null) {
      try {
        conn.close();
      }
 catch (      SQLException e2) {
      }
    }
    e.printStackTrace();
    throw new RuntimeException("String_Node_Str" + e.getMessage());
  }
  return checkTypeClassMap;
}

Fixed version (ground truth):
/** 
 * Loads YAML properties into scheduler database
 * @param config Properties loaded from YAML file as a Map
 * @param dataSource the dataSource to use to access the database
 * @return a map of check Classes indexed by the class name
 * @throws ClassNotFoundException
 */
static public Map<String,Class> load(Map config,ComboPooledDataSource dataSource) throws ClassNotFoundException {
  checkRequiredProp(config,PROP_CHECKS);
  checkRequiredProp(config,PROP_GROUPS);
  checkRequiredProp(config,PROP_GRIDS);
  Map<String,Map> checkMap=(Map<String,Map>)config.get(PROP_CHECKS);
  Map groupMap=(Map)config.get(PROP_GROUPS);
  List<Map> gridList=(List<Map>)config.get(PROP_GRIDS);
  HashMap<String,Class> checkTypeClassMap=new HashMap<String,Class>();
  HashMap<String,String> dimensionLabelMap=new HashMap<String,String>();
  Connection conn=null;
  try {
    conn=dataSource.getConnection();
    conn.createStatement().executeUpdate("String_Node_Str");
    PreparedStatement insertDimension=conn.prepareStatement("String_Node_Str");
    if (config.containsKey(PROP_DIMENSIONS) && config.get(PROP_DIMENSIONS) != null) {
      int i=1;
      for (      Map<Object,Object> dimension : (List<Map<Object,Object>>)config.get(PROP_DIMENSIONS)) {
        if (!dimension.containsKey(PROP_DIMENSIONS_ID) || dimension.get(PROP_DIMENSIONS_ID) == null) {
          throw new RuntimeException("String_Node_Str" + i + "String_Node_Str");
        }
        for (        Object dimensionParamObj : dimension.keySet()) {
          String dimensionParam=dimensionParamObj + "String_Node_Str";
          if (dimensionParam.equals(PROP_DIMENSIONS_ID)) {
            continue;
          }
          if (dimensionParam.equals(PROP_DIMENSIONS_LABEL)) {
            dimensionLabelMap.put(dimension.get(PROP_DIMENSIONS_ID) + "String_Node_Str",dimension.get(dimensionParam) + "String_Node_Str");
          }
          insertDimension.setString(1,dimension.get(PROP_DIMENSIONS_ID) + "String_Node_Str");
          insertDimension.setString(2,dimensionParam);
          insertDimension.setString(3,dimension.get(dimensionParam) + "String_Node_Str");
          insertDimension.executeUpdate();
        }
        i++;
      }
    }
    HashMap<String,Integer> templateIdMap=new HashMap<String,Integer>();
    PreparedStatement selTemplateStmt=conn.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    PreparedStatement insertTemplateStmt=conn.prepareStatement("String_Node_Str" + "String_Node_Str",Statement.RETURN_GENERATED_KEYS);
    PreparedStatement updateTemplateStmt=conn.prepareStatement("String_Node_Str");
    for (    String checkName : checkMap.keySet()) {
      selTemplateStmt.setString(1,checkName);
      insertTemplateStmt.setString(1,checkName);
      Map check=checkMap.get(checkName);
      checkRequiredProp(check,PROP_CHECKS_NAME);
      checkRequiredProp(check,PROP_CHECKS_DESCRIPTION);
      checkRequiredProp(check,PROP_CHECKS_TYPE);
      if (!checkTypeClassMap.containsKey(check.get(PROP_CHECKS_TYPE) + "String_Node_Str")) {
        checkTypeClassMap.put(check.get(PROP_CHECKS_TYPE) + "String_Node_Str",loadClass(check.get(PROP_CHECKS_TYPE) + "String_Node_Str"));
      }
      selTemplateStmt.setString(2,(String)check.get(PROP_CHECKS_TYPE));
      insertTemplateStmt.setString(2,(String)check.get(PROP_CHECKS_TYPE));
      String jsonParamString=CheckConstants.EMPTY_PARAMS;
      if (check.containsKey(PROP_CHECKS_PARAMS) && check.get(PROP_CHECKS_PARAMS) != null) {
        jsonParamString=JSONObject.fromObject(check.get(PROP_CHECKS_PARAMS)).toString();
      }
      SerialClob jsonClob=new SerialClob(jsonParamString.toCharArray());
      updateTemplateStmt.setClob(1,jsonClob);
      insertTemplateStmt.setClob(3,jsonClob);
      checkRequiredProp(check,PROP_CHECKS_INTERVAL);
      selTemplateStmt.setInt(3,(Integer)check.get(PROP_CHECKS_INTERVAL));
      insertTemplateStmt.setInt(4,(Integer)check.get(PROP_CHECKS_INTERVAL));
      checkRequiredProp(check,PROP_CHECKS_RETRY_INT);
      selTemplateStmt.setInt(4,(Integer)check.get(PROP_CHECKS_RETRY_INT));
      insertTemplateStmt.setInt(5,(Integer)check.get(PROP_CHECKS_RETRY_INT));
      checkRequiredProp(check,PROP_CHECKS_RETRY_ATT);
      selTemplateStmt.setInt(5,(Integer)check.get(PROP_CHECKS_RETRY_ATT));
      insertTemplateStmt.setInt(6,(Integer)check.get(PROP_CHECKS_RETRY_ATT));
      checkRequiredProp(check,PROP_CHECKS_TIMEOUT);
      selTemplateStmt.setInt(6,(Integer)check.get(PROP_CHECKS_TIMEOUT));
      insertTemplateStmt.setInt(7,(Integer)check.get(PROP_CHECKS_TIMEOUT));
      ResultSet selResult=selTemplateStmt.executeQuery();
      if (selResult.next()) {
        updateTemplateStmt.setInt(2,selResult.getInt(1));
        updateTemplateStmt.execute();
        templateIdMap.put(checkName,selResult.getInt(1));
      }
 else {
        insertTemplateStmt.executeUpdate();
        ResultSet genKeys=insertTemplateStmt.getGeneratedKeys();
        if (!genKeys.next()) {
          throw new RuntimeException("String_Node_Str");
        }
        templateIdMap.put(checkName,genKeys.getInt(1));
      }
    }
    conn.createStatement().executeUpdate("String_Node_Str");
    conn.createStatement().executeUpdate("String_Node_Str");
    PreparedStatement insertGridStmt=conn.prepareStatement("String_Node_Str");
    PreparedStatement selCheckStmt=conn.prepareStatement("String_Node_Str" + "String_Node_Str");
    PreparedStatement updateCheckStmt=conn.prepareStatement("String_Node_Str");
    PreparedStatement insertCheckStmt=conn.prepareStatement("String_Node_Str" + CheckConstants.RESULT_NOTRUN + "String_Node_Str"+ CheckConstants.RESULT_NOTRUN+ "String_Node_Str");
    for (    Map gridMap : gridList) {
      String rowOrder=(String)gridMap.get(PROP_GRIDS_ROW_ORDER);
      String colOrder=(String)gridMap.get(PROP_GRIDS_COL_ORDER);
      checkRequiredProp(gridMap,PROP_GRIDS_NAME);
      checkRequiredProp(gridMap,PROP_GRIDS_ROWS);
      checkRequiredProp(gridMap,PROP_GRIDS_EXCL_SELF);
      checkRequiredProp(gridMap,PROP_GRIDS_COL_ALG);
      checkRequiredProp(gridMap,PROP_GRIDS_COLS);
      checkRequiredProp(gridMap,PROP_GRIDS_CHECKS);
      checkRequiredProp(gridMap,PROP_GRIDS_STATUS_LABELS);
      String colAlg=((String)gridMap.get(PROP_GRIDS_COL_ALG)).toLowerCase();
      int exclSelf=(Integer)gridMap.get(PROP_GRIDS_EXCL_SELF);
      Map<String,List<String>> exclChecks=new HashMap<String,List<String>>();
      if (gridMap.containsKey(PROP_GRIDS_EXCL_CHECKS) && gridMap.get(PROP_GRIDS_EXCL_CHECKS) != null) {
        exclChecks=(Map<String,List<String>>)gridMap.get(PROP_GRIDS_EXCL_CHECKS);
      }
      checkRequiredProp(groupMap,(String)gridMap.get(PROP_GRIDS_ROWS));
      checkRequiredProp(groupMap,(String)gridMap.get(PROP_GRIDS_COLS));
      List<String> rows=new ArrayList<String>();
      for (      Object tmpRow : (List<Object>)groupMap.get(gridMap.get(PROP_GRIDS_ROWS))) {
        rows.add(tmpRow + "String_Node_Str");
      }
      if (ORDER_ALPHA.equals(rowOrder)) {
        rows=ConfigLoader.sortDimension(rows,dimensionLabelMap);
      }
      List<String> cols=new ArrayList<String>();
      List<String> tmpCols=new ArrayList<String>();
      for (      Object tmpCol : (List<Object>)groupMap.get(gridMap.get(PROP_GRIDS_COLS))) {
        cols.add(tmpCol + "String_Node_Str");
        tmpCols.add(tmpCol + "String_Node_Str");
      }
      if (ORDER_ALPHA.equals(colOrder)) {
        tmpCols=ConfigLoader.sortDimension(tmpCols,dimensionLabelMap);
      }
      HashMap<String,Integer> colOrderMap=new HashMap<String,Integer>();
      for (int i=0; i < tmpCols.size(); i++) {
        colOrderMap.put(tmpCols.get(i),i);
      }
      Map<String,String> statusLabelMap=(Map<String,String>)gridMap.get(PROP_GRIDS_STATUS_LABELS);
      insertGridStmt.setString(1,(String)gridMap.get(PROP_GRIDS_NAME));
      insertGridStmt.setString(2,ConfigLoader.genStatusLabel(statusLabelMap,PROP_GRIDS_STATUS_LABELS_OK));
      insertGridStmt.setString(3,ConfigLoader.genStatusLabel(statusLabelMap,PROP_GRIDS_STATUS_LABELS_WARNING));
      insertGridStmt.setString(4,ConfigLoader.genStatusLabel(statusLabelMap,PROP_GRIDS_STATUS_LABELS_CRITICAL));
      insertGridStmt.setString(5,ConfigLoader.genStatusLabel(statusLabelMap,PROP_GRIDS_STATUS_LABELS_UNKNOWN));
      insertGridStmt.setString(6,ConfigLoader.genStatusLabel(statusLabelMap,PROP_GRIDS_STATUS_LABELS_NOTRUN));
      insertGridStmt.executeUpdate();
      selCheckStmt.setString(1,(String)gridMap.get(PROP_GRIDS_NAME));
      for (int ri=0; ri < rows.size(); ri++) {
        String row=rows.get(ri);
        boolean rowColFound=false;
        selCheckStmt.setString(2,row);
        for (        String col : cols) {
          if (col.equals(row) && exclSelf == 1) {
            rowColFound=true;
            continue;
          }
 else           if (col.equals(row)) {
            rowColFound=true;
          }
          if (exclChecks.containsKey(row) && exclChecks.get(row) != null) {
            if (exclChecks.get(row).contains(col) || exclChecks.get(row).contains(EXCL_CHECKS_ALL)) {
              continue;
            }
          }
 else           if (exclChecks.containsKey(EXCL_CHECKS_DEFAULT) && exclChecks.get(EXCL_CHECKS_DEFAULT) != null) {
            if (exclChecks.get(EXCL_CHECKS_DEFAULT).contains(col) || exclChecks.get(EXCL_CHECKS_DEFAULT).contains(EXCL_CHECKS_ALL)) {
              continue;
            }
          }
          if (colAlg.equals(ALG_AFTER) && !rowColFound) {
            continue;
          }
 else           if (colAlg.equals(ALG_BEFORE) && rowColFound) {
            break;
          }
          selCheckStmt.setString(3,col);
          for (          String checkName : (List<String>)gridMap.get(PROP_GRIDS_CHECKS)) {
            if (!checkMap.containsKey(checkName) || checkMap.get(checkName) == null) {
              throw new RuntimeException("String_Node_Str" + checkName + "String_Node_Str");
            }
            String checkNiceName=(String)checkMap.get(checkName).get(PROP_CHECKS_NAME);
            String checkDescrName=(String)checkMap.get(checkName).get(PROP_CHECKS_DESCRIPTION);
            checkRequiredProp(templateIdMap,checkName);
            selCheckStmt.setString(4,checkNiceName);
            selCheckStmt.setInt(5,templateIdMap.get(checkName));
            ResultSet selResult=selCheckStmt.executeQuery();
            if (selResult.next()) {
              log.debug("String_Node_Str" + checkName);
              updateCheckStmt.setString(1,formatCheckDescription(checkDescrName,row,col));
              updateCheckStmt.setInt(2,ri);
              updateCheckStmt.setInt(3,colOrderMap.get(col));
              updateCheckStmt.setInt(4,selResult.getInt(1));
              updateCheckStmt.executeUpdate();
            }
 else {
              log.debug("String_Node_Str" + checkName);
              insertCheckStmt.setInt(1,templateIdMap.get(checkName));
              insertCheckStmt.setString(2,(String)gridMap.get(PROP_GRIDS_NAME));
              insertCheckStmt.setString(3,row);
              insertCheckStmt.setString(4,col);
              insertCheckStmt.setString(5,checkNiceName);
              insertCheckStmt.setInt(6,ri);
              insertCheckStmt.setInt(7,colOrderMap.get(col));
              insertCheckStmt.setString(8,formatCheckDescription(checkDescrName,row,col));
              insertCheckStmt.executeUpdate();
            }
          }
        }
      }
    }
    conn.close();
  }
 catch (  SQLException e) {
    if (conn != null) {
      try {
        conn.close();
      }
 catch (      SQLException e2) {
      }
    }
    e.printStackTrace();
    throw new RuntimeException("String_Node_Str" + e.getMessage());
  }
  return checkTypeClassMap;
}