Program: 129867
Project: 129867
Buggy source:
/** 
 * Retrieves table name by synonym, this method is only for Oracle as we cannot get column informations by metadata in Oracle.
 * @param connection
 * @param name synonym
 * @param tableType
 * @return table name
 */
public static String getTableNameBySynonym(Connection conn,String name){
  try {
    if (conn.getMetaData().getDatabaseProductName().equals("String_Node_Str")) {
      String sql="String_Node_Str" + name + "String_Node_Str";
      Statement sta=conn.createStatement();
      ExtractMetaDataUtils.setQueryStatementTimeout(sta);
      ResultSet resultSet=sta.executeQuery(sql);
      while (resultSet.next()) {
        String baseName=resultSet.getString("String_Node_Str").trim();
        return baseName;
      }
    }
  }
 catch (  SQLException e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
  try {
    if (conn.getMetaData().getDatabaseProductName().equals("String_Node_Str")) {
      String sql="String_Node_Str" + name + "String_Node_Str";
      Statement sta=conn.createStatement();
      ExtractMetaDataUtils.setQueryStatementTimeout(sta);
      ResultSet resultSet=sta.executeQuery(sql);
      while (resultSet.next()) {
        String baseName=resultSet.getString("String_Node_Str").trim();
        if (baseName.contains("String_Node_Str") && baseName.length() > 2) {
          return baseName.substring(baseName.indexOf("String_Node_Str") + 2,baseName.length() - 1);
        }
      }
    }
  }
 catch (  SQLException e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
  try {
    String sql="String_Node_Str" + name + "String_Node_Str";
    Statement sta;
    sta=conn.createStatement();
    ExtractMetaDataUtils.setQueryStatementTimeout(sta);
    ResultSet resultSet=sta.executeQuery(sql);
    while (resultSet.next()) {
      return resultSet.getString("String_Node_Str");
    }
    resultSet.close();
    sta.close();
  }
 catch (  SQLException e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Retrieves table name by synonym, this method is only for Oracle as we cannot get column informations by metadata in Oracle.
 * @param connection
 * @param name synonym
 * @param tableType
 * @return table name
 */
public static String getTableNameBySynonym(Connection conn,String name){
  try {
    if (conn.getMetaData().getDatabaseProductName().equals("String_Node_Str")) {
      String sql="String_Node_Str" + name + "String_Node_Str";
      Statement sta=conn.createStatement();
      ExtractMetaDataUtils.setQueryStatementTimeout(sta);
      ResultSet resultSet=sta.executeQuery(sql);
      while (resultSet.next()) {
        String baseName=resultSet.getString("String_Node_Str").trim();
        return baseName;
      }
    }
  }
 catch (  SQLException e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
  try {
    if (conn.getMetaData().getDatabaseProductName().equals("String_Node_Str")) {
      String sql="String_Node_Str" + name + "String_Node_Str";
      Statement sta=conn.createStatement();
      ExtractMetaDataUtils.setQueryStatementTimeout(sta);
      ResultSet resultSet=sta.executeQuery(sql);
      while (resultSet.next()) {
        String baseName=resultSet.getString("String_Node_Str").trim();
        if (baseName.contains("String_Node_Str") && baseName.length() > 2) {
          return baseName.substring(baseName.indexOf("String_Node_Str") + 2,baseName.length() - 1);
        }
      }
    }
  }
 catch (  SQLException e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
  try {
    if (conn.getMetaData().getDatabaseProductName().equals("String_Node_Str")) {
      String sql="String_Node_Str" + name + "String_Node_Str";
      Statement sta;
      sta=conn.createStatement();
      ExtractMetaDataUtils.setQueryStatementTimeout(sta);
      ResultSet resultSet=sta.executeQuery(sql);
      while (resultSet.next()) {
        return resultSet.getString("String_Node_Str");
      }
      resultSet.close();
      sta.close();
    }
  }
 catch (  SQLException e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
  return null;
}