Program: 126954
Project: 126954
Buggy source:
/** 
 * DOC Comment method "updateConnectionInformation".
 * @param dbConn
 * @throws SQLException
 * @throws IllegalAccessException
 * @throws InstantiationException
 * @throws ClassNotFoundException
 */
private void updateConnectionInformation(DatabaseConnection dbConn,IMetadataConnection metaConnection) throws ClassNotFoundException, InstantiationException, IllegalAccessException, SQLException {
  java.sql.Connection sqlConn=null;
  String dbType=null;
  ExtractMetaDataUtils extractMeta=ExtractMetaDataUtils.getInstance();
  try {
    dbConn=(DatabaseConnection)MetadataFillFactory.getDBInstance().fillUIConnParams(metaConnection,dbConn);
    sqlConn=MetadataConnectionUtils.checkConnection(metaConnection).getObject();
    dbType=metaConnection.getDbType();
    if (sqlConn != null) {
      DatabaseMetaData dbMetaData=null;
      if (EDatabaseTypeName.HIVE.getXmlName().equalsIgnoreCase(dbType)) {
        dbMetaData=HiveConnectionManager.getInstance().extractDatabaseMetaData(metaConnection);
      }
 else {
        dbMetaData=extractMeta.getDatabaseMetaData(sqlConn,dbType,false,metaConnection.getDatabase());
      }
      MetadataFillFactory.getDBInstance().fillCatalogs(dbConn,dbMetaData,metaConnection,MetadataConnectionUtils.getPackageFilter(dbConn,dbMetaData,true));
      MetadataFillFactory.getDBInstance().fillSchemas(dbConn,dbMetaData,metaConnection,MetadataConnectionUtils.getPackageFilter(dbConn,dbMetaData,false));
    }
  }
  finally {
    ConnectionUtils.closeConnection(sqlConn);
    MetadataConnectionUtils.closeDerbyDriver();
  }
}

Fixed version (ground truth):
/** 
 * DOC Comment method "updateConnectionInformation".
 * @param dbConn
 * @throws SQLException
 * @throws IllegalAccessException
 * @throws InstantiationException
 * @throws ClassNotFoundException
 */
private void updateConnectionInformation(DatabaseConnection dbConn,IMetadataConnection metaConnection) throws ClassNotFoundException, InstantiationException, IllegalAccessException, SQLException {
  java.sql.Connection sqlConn=null;
  String dbType=null;
  ExtractMetaDataUtils extractMeta=ExtractMetaDataUtils.getInstance();
  try {
    dbConn=(DatabaseConnection)MetadataFillFactory.getDBInstance().fillUIConnParams(metaConnection,dbConn);
    sqlConn=MetadataConnectionUtils.checkConnection(metaConnection).getObject();
    dbType=metaConnection.getDbType();
    if (sqlConn != null) {
      DatabaseMetaData dbMetaData=null;
      if (EDatabaseTypeName.HIVE.getXmlName().equalsIgnoreCase(dbType)) {
        dbMetaData=HiveConnectionManager.getInstance().extractDatabaseMetaData(metaConnection);
      }
 else {
        dbMetaData=extractMeta.getDatabaseMetaData(sqlConn,dbType,false,metaConnection.getDatabase());
      }
      MetadataFillFactory.getDBInstance().fillCatalogs(dbConn,dbMetaData,metaConnection,MetadataConnectionUtils.getPackageFilter(dbConn,dbMetaData,true));
      MetadataFillFactory.getDBInstance().fillSchemas(dbConn,dbMetaData,metaConnection,MetadataConnectionUtils.getPackageFilter(dbConn,dbMetaData,false));
    }
  }
  finally {
    if (sqlConn != null) {
      ConnectionUtils.closeConnection(sqlConn);
    }
    MetadataConnectionUtils.closeDerbyDriver();
  }
}