Program: 127770
Project: 127770
Buggy source:
/** 
 * DOC ggu Comment method "returnMetadataColumnsFormTable".
 * @param metadataConnection
 * @param tableLabel
 * @param dontCreateClose
 * @return
 * @deprecated because still use it
 */
@Deprecated public synchronized List<TdColumn> returnMetadataColumnsFormTable(IMetadataConnection metadataConnection,String tableLabel,boolean... dontCreateClose){
  List<TdColumn> metadataColumns=new ArrayList<TdColumn>();
  boolean needCreateAndClose=dontCreateClose.length == 0 || !dontCreateClose[0];
  DriverShim wapperDriver=null;
  String dbType="String_Node_Str";
  try {
    if (needCreateAndClose || ExtractMetaDataUtils.conn == null || ExtractMetaDataUtils.conn.isClosed()) {
      List list=ExtractMetaDataUtils.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);
          }
        }
      }
    }
    dbType=metadataConnection.getDbType();
    DatabaseMetaData dbMetaData=null;
    if (EDatabaseTypeName.HIVE.getXmlName().equalsIgnoreCase(dbType)) {
      dbMetaData=HiveConnectionManager.getInstance().extractDatabaseMetaData(metadataConnection);
    }
 else {
      dbMetaData=ExtractMetaDataUtils.getDatabaseMetaData(ExtractMetaDataUtils.conn,dbType,metadataConnection.isSqlMode(),metadataConnection.getDatabase());
    }
    tableLabel=checkTableLabel(tableLabel);
    List<String> cataAndShema=getTableCatalogAndSchema((DatabaseConnection)metadataConnection.getCurrentConnection(),tableLabel);
    metadataColumns=extractColumns(dbMetaData,metadataConnection,dbType,cataAndShema.get(0),cataAndShema.get(1),tableLabel);
    if (needCreateAndClose) {
      ExtractMetaDataUtils.closeConnection();
    }
  }
 catch (  Exception e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
 finally {
    closeConnection(metadataConnection,wapperDriver);
  }
  return metadataColumns;
}

Fixed version (ground truth):
/** 
 * DOC ggu Comment method "returnMetadataColumnsFormTable".
 * @param metadataConnection
 * @param tableLabel
 * @param dontCreateClose
 * @return
 * @deprecated because still use it
 */
@Deprecated public synchronized List<TdColumn> returnMetadataColumnsFormTable(IMetadataConnection metadataConnection,String tableLabel,boolean... dontCreateClose){
  List<TdColumn> metadataColumns=new ArrayList<TdColumn>();
  boolean needCreateAndClose=dontCreateClose.length == 0 || !dontCreateClose[0];
  DriverShim wapperDriver=null;
  String dbType="String_Node_Str";
  try {
    dbType=metadataConnection.getDbType();
    boolean isHive=EDatabaseTypeName.HIVE.getXmlName().equalsIgnoreCase(dbType);
    if (!isHive && (needCreateAndClose || ExtractMetaDataUtils.conn == null || ExtractMetaDataUtils.conn.isClosed())) {
      List list=ExtractMetaDataUtils.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);
          }
        }
      }
    }
    DatabaseMetaData dbMetaData=null;
    if (isHive) {
      dbMetaData=HiveConnectionManager.getInstance().extractDatabaseMetaData(metadataConnection);
    }
 else {
      dbMetaData=ExtractMetaDataUtils.getDatabaseMetaData(ExtractMetaDataUtils.conn,dbType,metadataConnection.isSqlMode(),metadataConnection.getDatabase());
    }
    tableLabel=checkTableLabel(tableLabel);
    List<String> cataAndShema=getTableCatalogAndSchema((DatabaseConnection)metadataConnection.getCurrentConnection(),tableLabel);
    metadataColumns=extractColumns(dbMetaData,metadataConnection,dbType,cataAndShema.get(0),cataAndShema.get(1),tableLabel);
    if (needCreateAndClose) {
      ExtractMetaDataUtils.closeConnection();
    }
  }
 catch (  Exception e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
 finally {
    closeConnection(metadataConnection,wapperDriver);
  }
  return metadataColumns;
}