Program: 129824
Project: 129824
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);
        }
        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;
      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){
  Statement sta=null;
  ResultSet resultSet=null;
  try {
    if (conn.getMetaData().getDatabaseProductName().equals("String_Node_Str")) {
      String sql="String_Node_Str" + name + "String_Node_Str";
      sta=conn.createStatement();
      ExtractMetaDataUtils.setQueryStatementTimeout(sta);
      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);
  }
 finally {
    try {
      if (resultSet != null) {
        resultSet.close();
      }
      if (sta != null) {
        sta.close();
      }
    }
 catch (    SQLException e) {
      log.equals(e.toString());
    }
  }
  try {
    if (conn.getMetaData().getDatabaseProductName().equals("String_Node_Str")) {
      String sql="String_Node_Str" + name + "String_Node_Str";
      sta=conn.createStatement();
      ExtractMetaDataUtils.setQueryStatementTimeout(sta);
      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);
        }
        return baseName;
      }
    }
  }
 catch (  SQLException e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
 finally {
    try {
      if (resultSet != null) {
        resultSet.close();
      }
      if (sta != null) {
        sta.close();
      }
    }
 catch (    SQLException e) {
      log.equals(e.toString());
    }
  }
  try {
    if (conn.getMetaData().getDatabaseProductName().equals("String_Node_Str")) {
      String sql="String_Node_Str" + name + "String_Node_Str";
      sta=conn.createStatement();
      ExtractMetaDataUtils.setQueryStatementTimeout(sta);
      resultSet=sta.executeQuery(sql);
      while (resultSet.next()) {
        return resultSet.getString("String_Node_Str");
      }
    }
  }
 catch (  SQLException e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
 finally {
    try {
      if (resultSet != null) {
        resultSet.close();
      }
      if (sta != null) {
        sta.close();
      }
    }
 catch (    SQLException e) {
      log.equals(e.toString());
    }
  }
  return null;
}