Program: 125675
Project: 125675
Buggy source:
/** 
 * DOC ggu Comment method "returnColumns". work for @see ExtractMetaDataFromDataBase.returnColumns(...)
 * @param metadataConnection
 * @param tableNode
 * @param dontCreateClose
 * @return
 */
public List<TdColumn> returnColumns(IMetadataConnection metadataConnection,TableNode tableNode,boolean... dontCreateClose){
  if (metadataConnection == null || tableNode == null || tableNode.getType() != TableNode.TABLE) {
    return Collections.emptyList();
  }
  NamedColumnSet table=tableNode.getTable();
  if (table == null) {
    table=tableNode.getView();
  }
  if (table == null) {
    return Collections.emptyList();
  }
  List<TdColumn> metadataColumns=new ArrayList<TdColumn>();
  boolean needCreateAndClose=dontCreateClose.length == 0 || !dontCreateClose[0];
  DriverShim wapperDriver=null;
  String dbType="String_Node_Str";
  ExtractMetaDataUtils extractMeta=ExtractMetaDataUtils.getInstance();
  try {
    dbType=metadataConnection.getDbType();
    DatabaseMetaData dbMetaData=null;
    if (EDatabaseTypeName.HIVE.getXmlName().equalsIgnoreCase(dbType)) {
      dbMetaData=HiveConnectionManager.getInstance().extractDatabaseMetaData(metadataConnection);
    }
 else {
      if (needCreateAndClose || extractMeta.getConn() == null || extractMeta.getConn().isClosed()) {
        List list=extractMeta.getConnection(metadataConnection.getDbType(),metadataConnection.getUrl(),metadataConnection.getUsername(),metadataConnection.getPassword(),metadataConnection.getDatabase(),metadataConnection.getSchema(),metadataConnection.getDriverClass(),metadataConnection.getDriverJarPath(),metadataConnection.getDbVersionString(),metadataConnection.getAdditionalParams());
        if (list != null && list.size() > 0) {
          for (int i=0; i < list.size(); i++) {
            if (list.get(i) instanceof DriverShim) {
              wapperDriver=(DriverShim)list.get(i);
            }
          }
        }
      }
      dbMetaData=extractMeta.getDatabaseMetaData(extractMeta.getConn(),dbType,metadataConnection.isSqlMode(),metadataConnection.getDatabase());
    }
    String tableLabel=tableNode.getValue();
    TableNode newNode=tableNode;
    String name=newNode.getItemType();
    if (name != null && StringUtils.trimToEmpty(name).equals(ETableTypes.TABLETYPE_SYNONYM.getName())) {
      String tableName=getTableNameBySynonyms(extractMeta.getConn(),newNode.getValue());
      if (tableName != null && tableName.contains("String_Node_Str")) {
        tableName=tableName.replace("String_Node_Str","String_Node_Str");
      }
      fillSynonyms(metadataConnection,metadataColumns,table,tableName,dbMetaData);
    }
 else {
      EDatabaseTypeName currentEDatabaseType=EDatabaseTypeName.getTypeFromDbType(dbType);
      metadataColumns=MetadataFillFactory.getDBInstance(currentEDatabaseType).fillColumns(table,metadataConnection,dbMetaData,null);
    }
    ColumnSetHelper.addColumns(table,metadataColumns);
    if (needCreateAndClose) {
      extractMeta.closeConnection();
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
    log.error(e);
  }
 finally {
    if (extractMeta.getConn() != null) {
      ConnectionUtils.closeConnection(extractMeta.getConn());
    }
  }
  return metadataColumns;
}

Fixed version (ground truth):
/** 
 * DOC ggu Comment method "returnColumns". work for @see ExtractMetaDataFromDataBase.returnColumns(...)
 * @param metadataConnection
 * @param tableNode
 * @param dontCreateClose
 * @return
 */
public List<TdColumn> returnColumns(IMetadataConnection metadataConnection,TableNode tableNode,boolean... dontCreateClose){
  if (metadataConnection == null || tableNode == null || tableNode.getType() != TableNode.TABLE) {
    return Collections.emptyList();
  }
  NamedColumnSet table=tableNode.getTable();
  if (table == null) {
    table=tableNode.getView();
  }
  if (table == null) {
    return Collections.emptyList();
  }
  List<TdColumn> metadataColumns=new ArrayList<TdColumn>();
  boolean needCreateAndClose=dontCreateClose.length == 0 || !dontCreateClose[0];
  ExtractMetaDataUtils extractMeta=ExtractMetaDataUtils.getInstance();
  try {
    DatabaseMetaData dbMetaData=createDatabaseMetaData(metadataConnection,needCreateAndClose);
    TableNode newNode=tableNode;
    String name=newNode.getItemType();
    if (name != null && StringUtils.trimToEmpty(name).equals(ETableTypes.TABLETYPE_SYNONYM.getName())) {
      String tableName=getTableNameBySynonyms(extractMeta.getConn(),newNode.getValue());
      if (tableName != null && tableName.contains("String_Node_Str")) {
        tableName=tableName.replace("String_Node_Str","String_Node_Str");
      }
      fillSynonyms(metadataConnection,metadataColumns,table,tableName,dbMetaData);
    }
 else {
      EDatabaseTypeName currentEDatabaseType=EDatabaseTypeName.getTypeFromDbType(metadataConnection.getDbType());
      metadataColumns=MetadataFillFactory.getDBInstance(currentEDatabaseType).fillColumns(table,metadataConnection,dbMetaData,null);
    }
    ColumnSetHelper.addColumns(table,metadataColumns);
    if (needCreateAndClose) {
      extractMeta.closeConnection();
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
    log.error(e);
  }
 finally {
    if (extractMeta.getConn() != null) {
      ConnectionUtils.closeConnection(extractMeta.getConn());
    }
  }
  return metadataColumns;
}