Program: 128050
Project: 128050
Buggy source:
/** 
 * DOC ggu Comment method "returnTablesFormConnection". work for @see ExtractMetaDataFromDataBase.returnTablesFormConnection(...)
 * @param metadataConnection
 * @param tableInfoParameters
 * @return
 */
public List<String> returnTablesFormConnection(IMetadataConnection metadataConnection,TableInfoParameters tableInfoParameters){
  getTableTypeMap().clear();
  List<String> itemTablesName=new ArrayList<String>();
  List connList=ExtractMetaDataUtils.getConnection(metadataConnection.getDbType(),metadataConnection.getUrl(),metadataConnection.getUsername(),metadataConnection.getPassword(),metadataConnection.getDatabase(),metadataConnection.getSchema(),metadataConnection.getDriverClass(),metadataConnection.getDriverJarPath(),metadataConnection.getDbVersionString(),metadataConnection.getAdditionalParams());
  try {
    if (!tableInfoParameters.isUsedName()) {
      if (tableInfoParameters.getSqlFiter() != null && !"String_Node_Str".equals(tableInfoParameters.getSqlFiter())) {
        Statement stmt=ExtractMetaDataUtils.conn.createStatement();
        ExtractMetaDataUtils.setQueryStatementTimeout(stmt);
        ResultSet rsTables=stmt.executeQuery(tableInfoParameters.getSqlFiter());
        itemTablesName=ExtractMetaDataFromDataBase.getTableNamesFromQuery(rsTables);
        rsTables.close();
        stmt.close();
      }
    }
 else {
      itemTablesName=retrieveItemTables(metadataConnection,tableInfoParameters,itemTablesName);
    }
  }
 catch (  SQLException e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
catch (  Exception e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
  filterTablesFromRecycleBin(metadataConnection,itemTablesName);
  ExtractMetaDataUtils.closeConnection();
  DriverShim wapperDriver=null;
  if (connList != null && connList.size() > 0) {
    for (int i=0; i < connList.size(); i++) {
      if (connList.get(i) instanceof DriverShim) {
        wapperDriver=(DriverShim)connList.get(i);
      }
    }
  }
  closeConnection(metadataConnection,wapperDriver);
  return itemTablesName;
}

Fixed version (ground truth):
/** 
 * DOC ggu Comment method "returnTablesFormConnection". work for @see ExtractMetaDataFromDataBase.returnTablesFormConnection(...)
 * @param metadataConnection
 * @param tableInfoParameters
 * @return
 */
public List<String> returnTablesFormConnection(IMetadataConnection metadataConnection,TableInfoParameters tableInfoParameters){
  getTableTypeMap().clear();
  List<String> itemTablesName=new ArrayList<String>();
  List connList=ExtractMetaDataUtils.getConnection(metadataConnection.getDbType(),metadataConnection.getUrl(),metadataConnection.getUsername(),metadataConnection.getPassword(),metadataConnection.getDatabase(),metadataConnection.getSchema(),metadataConnection.getDriverClass(),metadataConnection.getDriverJarPath(),metadataConnection.getDbVersionString(),metadataConnection.getAdditionalParams());
  try {
    if (!tableInfoParameters.isUsedName()) {
      if (tableInfoParameters.getSqlFiter() != null && !"String_Node_Str".equals(tableInfoParameters.getSqlFiter())) {
        Statement stmt=ExtractMetaDataUtils.conn.createStatement();
        ExtractMetaDataUtils.setQueryStatementTimeout(stmt);
        ResultSet rsTables=stmt.executeQuery(tableInfoParameters.getSqlFiter());
        itemTablesName=ExtractMetaDataFromDataBase.getTableNamesFromQuery(rsTables,ExtractMetaDataUtils.conn);
        rsTables.close();
        stmt.close();
      }
    }
 else {
      itemTablesName=retrieveItemTables(metadataConnection,tableInfoParameters,itemTablesName);
    }
  }
 catch (  SQLException e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
catch (  Exception e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
  filterTablesFromRecycleBin(metadataConnection,itemTablesName);
  ExtractMetaDataUtils.closeConnection();
  DriverShim wapperDriver=null;
  if (connList != null && connList.size() > 0) {
    for (int i=0; i < connList.size(); i++) {
      if (connList.get(i) instanceof DriverShim) {
        wapperDriver=(DriverShim)connList.get(i);
      }
    }
  }
  closeConnection(metadataConnection,wapperDriver);
  return itemTablesName;
}