Program: 127942
Project: 127942
Buggy source:
/** 
 * DOC cantoine. Method to return DatabaseMetaData of a DB connection.
 * @param Connection conn
 * @param isSqlMode whether is sqlMode
 * @param String dbType
 * @return DatabaseMetaData
 */
public static DatabaseMetaData getDatabaseMetaData(Connection conn,String dbType,boolean isSqlMode,String database){
  DatabaseMetaData dbMetaData=null;
  if (conn != null) {
    try {
      if (MSSQL_CONN_CLASS.equals(conn.getClass().getName())) {
        dbMetaData=createJtdsDatabaseMetaData(conn);
      }
 else       if (EDatabaseTypeName.IBMDB2ZOS.getXmlName().equals(dbType)) {
        dbMetaData=createDB2ForZosFakeDatabaseMetaData(conn);
      }
 else       if (EDatabaseTypeName.TERADATA.getXmlName().equals(dbType) && isSqlMode) {
        dbMetaData=createTeradataFakeDatabaseMetaData(conn);
        TeradataDataBaseMetadata teraDbmeta=(TeradataDataBaseMetadata)dbMetaData;
        teraDbmeta.setDatabaseName(database);
      }
 else       if (EDatabaseTypeName.SAS.getXmlName().equals(dbType)) {
        dbMetaData=createSASFakeDatabaseMetaData(conn);
      }
 else       if (EDatabaseTypeName.SYBASEASE.getDisplayName().equals(dbType) || SYBASE_DATABASE_PRODUCT_NAME.equals(dbType)) {
        dbMetaData=createSybaseFakeDatabaseMetaData(conn);
      }
 else       if (EDatabaseTypeName.HIVE.getDisplayName().equals(dbType) && isHiveEmbeddedConn(conn)) {
        dbMetaData=new EmbeddedHiveDataBaseMetadata(conn);
      }
 else {
        dbMetaData=conn.getMetaData();
      }
    }
 catch (    SQLException e) {
      log.error(e.toString());
      throw new RuntimeException(e);
    }
catch (    Exception e) {
      log.error(e.toString());
      throw new RuntimeException(e);
    }
  }
  return dbMetaData;
}

Fixed version (ground truth):
/** 
 * DOC cantoine. Method to return DatabaseMetaData of a DB connection.
 * @param Connection conn
 * @param isSqlMode whether is sqlMode
 * @param String dbType
 * @return DatabaseMetaData
 */
public static DatabaseMetaData getDatabaseMetaData(Connection conn,String dbType,boolean isSqlMode,String database){
  DatabaseMetaData dbMetaData=null;
  if (conn != null) {
    try {
      if (MSSQL_CONN_CLASS.equals(conn.getClass().getName())) {
        dbMetaData=createJtdsDatabaseMetaData(conn);
      }
 else       if (EDatabaseTypeName.IBMDB2ZOS.getXmlName().equals(dbType)) {
        dbMetaData=createDB2ForZosFakeDatabaseMetaData(conn);
      }
 else       if (EDatabaseTypeName.TERADATA.getXmlName().equals(dbType) && isSqlMode) {
        dbMetaData=createTeradataFakeDatabaseMetaData(conn);
        TeradataDataBaseMetadata teraDbmeta=(TeradataDataBaseMetadata)dbMetaData;
        teraDbmeta.setDatabaseName(database);
      }
 else       if (EDatabaseTypeName.SAS.getXmlName().equals(dbType)) {
        dbMetaData=createSASFakeDatabaseMetaData(conn);
      }
 else       if (EDatabaseTypeName.SYBASEASE.getDisplayName().equals(dbType) || SYBASE_DATABASE_PRODUCT_NAME.equals(dbType)) {
        dbMetaData=createSybaseFakeDatabaseMetaData(conn);
      }
 else       if (EDatabaseTypeName.HIVE.getDisplayName().equals(dbType) && isHiveEmbeddedConn(conn)) {
        dbMetaData=new EmbeddedHiveDataBaseMetadata(conn);
      }
 else       if (EDatabaseTypeName.AS400.getXmlName().equals(dbType)) {
        dbMetaData=createAS400FakeDatabaseMetaData(conn);
      }
 else {
        dbMetaData=conn.getMetaData();
      }
    }
 catch (    SQLException e) {
      log.error(e.toString());
      throw new RuntimeException(e);
    }
catch (    Exception e) {
      log.error(e.toString());
      throw new RuntimeException(e);
    }
  }
  return dbMetaData;
}