Program: 129919
Project: 129919
Buggy source:
public List<MetadataTable> fillAll(Package pack,DatabaseMetaData dbJDBCMetadata,List<String> tableFilter,String tablePattern,String[] tableType){
  List<MetadataTable> list=new ArrayList<MetadataTable>();
  if (dbJDBCMetadata == null) {
    return null;
  }
  Package catalogOrSchema=PackageHelper.getCatalogOrSchema(pack);
  String catalogName=null;
  String schemaPattern=null;
  if (catalogOrSchema != null) {
    if (catalogOrSchema instanceof Catalog) {
      catalogName=catalogOrSchema.getName();
    }
 else {
      Package parentCatalog=PackageHelper.getParentPackage(catalogOrSchema);
      schemaPattern=catalogOrSchema.getName();
      catalogName=parentCatalog == null ? null : parentCatalog.getName();
    }
  }
  try {
    ResultSet tables=dbJDBCMetadata.getTables(catalogName,schemaPattern,tablePattern,tableType);
    String productName=dbJDBCMetadata.getDatabaseProductName();
    boolean isHive=MetadataConnectionUtils.isHive(dbJDBCMetadata);
    while (tables.next()) {
      String tableSchema=tables.getString(GetTable.TABLE_SCHEM.name());
      String tableName=tables.getString(GetTable.TABLE_NAME.name());
      String temptableType=tables.getString(GetTable.TABLE_TYPE.name());
      if (temptableType != null) {
        if ("String_Node_Str".equals(temptableType)) {
          temptableType=ETableTypes.TABLETYPE_TABLE.getName();
        }
        if ("String_Node_Str".equals(temptableType)) {
          temptableType=ETableTypes.TABLETYPE_VIEW.getName();
        }
        if ("String_Node_Str".equals(temptableType)) {
          temptableType=ETableTypes.TABLETYPE_ALIAS.getName();
        }
      }
      if (!filterMetadaElement(tableFilter,tableName)) {
        continue;
      }
      String tableOwner=null;
      if (!isHive && MetadataConnectionUtils.isSybase(dbJDBCMetadata)) {
        tableOwner=tableSchema;
      }
      boolean flag=true;
      String tableComment=null;
      if (pack != null) {
        Connection c=ConnectionHelper.getConnection(pack);
        flag=MetadataConnectionUtils.isOracle8i(c);
      }
      if (!flag) {
        tableComment=tables.getString(GetTable.REMARKS.name());
        if (StringUtils.isBlank(tableComment)) {
          String selectRemarkOnTable=MetadataConnectionUtils.getCommonQueryStr(productName,tableName);
          if (selectRemarkOnTable != null) {
            tableComment=executeGetCommentStatement(selectRemarkOnTable,dbJDBCMetadata.getConnection());
          }
        }
      }
      MetadataTable metadatatable=null;
      if (TableType.VIEW.toString().equals(temptableType)) {
        metadatatable=RelationalFactory.eINSTANCE.createTdView();
      }
 else {
        metadatatable=RelationalFactory.eINSTANCE.createTdTable();
      }
      metadatatable.setName(tableName);
      metadatatable.setTableType(temptableType);
      metadatatable.setLabel(metadatatable.getName());
      if (tableOwner != null) {
        ColumnSetHelper.setTableOwner(tableOwner,metadatatable);
      }
      if (tableComment != null) {
        metadatatable.setComment(tableComment);
        ColumnSetHelper.setComment(tableComment,metadatatable);
      }
      list.add(metadatatable);
    }
    if (dbJDBCMetadata.getDatabaseProductName() != null && dbJDBCMetadata.getDatabaseProductName().equals("String_Node_Str")) {
      for (int i=0; i < tableType.length; i++) {
        if (tableType[i].equals("String_Node_Str")) {
          Statement stmt=ExtractMetaDataUtils.conn.createStatement();
          ExtractMetaDataUtils.setQueryStatementTimeout(stmt);
          String schemaname=catalogName + "String_Node_Str" + schemaPattern+ "String_Node_Str";
          String sql="String_Node_Str" + schemaname + "String_Node_Str";
          ResultSet rsTables=stmt.executeQuery(sql);
          while (rsTables.next()) {
            String nameKey=rsTables.getString("String_Node_Str").trim();
            MetadataTable metadatatable=null;
            metadatatable=RelationalFactory.eINSTANCE.createTdTable();
            metadatatable.setName(nameKey);
            metadatatable.setTableType(ETableTypes.TABLETYPE_SYNONYM.getName());
            metadatatable.setLabel(metadatatable.getName());
            if (schemaPattern != null) {
              ColumnSetHelper.setTableOwner(schemaPattern,metadatatable);
            }
            list.add(metadatatable);
          }
        }
      }
    }
 else     if (dbJDBCMetadata.getDatabaseProductName() != null && dbJDBCMetadata.getDatabaseProductName().equals("String_Node_Str")) {
      for (int i=0; i < tableType.length; i++) {
        if (tableType[i].equals("String_Node_Str")) {
          Statement stmt=ExtractMetaDataUtils.conn.createStatement();
          ExtractMetaDataUtils.setQueryStatementTimeout(stmt);
          String sql="String_Node_Str" + schemaPattern + "String_Node_Str";
          ResultSet rsTables=stmt.executeQuery(sql);
          while (rsTables.next()) {
            String nameKey=rsTables.getString("String_Node_Str").trim();
            MetadataTable metadatatable=null;
            metadatatable=RelationalFactory.eINSTANCE.createTdTable();
            metadatatable.setName(nameKey);
            metadatatable.setTableType(ETableTypes.TABLETYPE_SYNONYM.getName());
            metadatatable.setLabel(metadatatable.getName());
            if (schemaPattern != null) {
              ColumnSetHelper.setTableOwner(schemaPattern,metadatatable);
            }
            list.add(metadatatable);
          }
        }
      }
    }
    if (isLinked()) {
      PackageHelper.addMetadataTable(ListUtils.castList(MetadataTable.class,list),pack);
    }
  }
 catch (  SQLException e) {
    log.error(e,e);
  }
  return list;
}

Fixed version (ground truth):
public List<MetadataTable> fillAll(Package pack,DatabaseMetaData dbJDBCMetadata,List<String> tableFilter,String tablePattern,String[] tableType){
  List<MetadataTable> list=new ArrayList<MetadataTable>();
  if (dbJDBCMetadata == null) {
    return null;
  }
  Package catalogOrSchema=PackageHelper.getCatalogOrSchema(pack);
  String catalogName=null;
  String schemaPattern=null;
  if (catalogOrSchema != null) {
    if (catalogOrSchema instanceof Catalog) {
      catalogName=catalogOrSchema.getName();
    }
 else {
      Package parentCatalog=PackageHelper.getParentPackage(catalogOrSchema);
      schemaPattern="String_Node_Str".equals(catalogOrSchema.getName()) ? null : catalogOrSchema.getName();
      catalogName=parentCatalog == null ? null : parentCatalog.getName();
    }
  }
  try {
    ResultSet tables=dbJDBCMetadata.getTables(catalogName,schemaPattern,tablePattern,tableType);
    String productName=dbJDBCMetadata.getDatabaseProductName();
    boolean isHive=MetadataConnectionUtils.isHive(dbJDBCMetadata);
    while (tables.next()) {
      String tableSchema=null;
      if (schemaPattern != null) {
        tableSchema=tables.getString(GetTable.TABLE_SCHEM.name());
      }
 else {
        tableSchema="String_Node_Str";
      }
      String tableName=tables.getString(GetTable.TABLE_NAME.name());
      String temptableType=tables.getString(GetTable.TABLE_TYPE.name());
      if (temptableType != null) {
        if ("String_Node_Str".equals(temptableType)) {
          temptableType=ETableTypes.TABLETYPE_TABLE.getName();
        }
        if ("String_Node_Str".equals(temptableType)) {
          temptableType=ETableTypes.TABLETYPE_VIEW.getName();
        }
        if ("String_Node_Str".equals(temptableType)) {
          temptableType=ETableTypes.TABLETYPE_ALIAS.getName();
        }
      }
      if (!filterMetadaElement(tableFilter,tableName)) {
        continue;
      }
      String tableOwner=null;
      if (!isHive && MetadataConnectionUtils.isSybase(dbJDBCMetadata)) {
        tableOwner=tableSchema;
      }
      boolean flag=true;
      String tableComment=null;
      if (pack != null) {
        Connection c=ConnectionHelper.getConnection(pack);
        flag=MetadataConnectionUtils.isOracle8i(c);
      }
      if (!flag) {
        tableComment=tables.getString(GetTable.REMARKS.name());
        if (StringUtils.isBlank(tableComment)) {
          String selectRemarkOnTable=MetadataConnectionUtils.getCommonQueryStr(productName,tableName);
          if (selectRemarkOnTable != null) {
            tableComment=executeGetCommentStatement(selectRemarkOnTable,dbJDBCMetadata.getConnection());
          }
        }
      }
      MetadataTable metadatatable=null;
      if (TableType.VIEW.toString().equals(temptableType)) {
        metadatatable=RelationalFactory.eINSTANCE.createTdView();
      }
 else {
        metadatatable=RelationalFactory.eINSTANCE.createTdTable();
      }
      metadatatable.setName(tableName);
      metadatatable.setTableType(temptableType);
      metadatatable.setLabel(metadatatable.getName());
      if (tableOwner != null) {
        ColumnSetHelper.setTableOwner(tableOwner,metadatatable);
      }
      if (tableComment != null) {
        metadatatable.setComment(tableComment);
        ColumnSetHelper.setComment(tableComment,metadatatable);
      }
      list.add(metadatatable);
    }
    if (dbJDBCMetadata.getDatabaseProductName() != null && dbJDBCMetadata.getDatabaseProductName().equals("String_Node_Str")) {
      for (int i=0; i < tableType.length; i++) {
        if (tableType[i].equals("String_Node_Str")) {
          Statement stmt=ExtractMetaDataUtils.conn.createStatement();
          ExtractMetaDataUtils.setQueryStatementTimeout(stmt);
          String schemaname=catalogName + "String_Node_Str" + schemaPattern+ "String_Node_Str";
          String sql="String_Node_Str" + schemaname + "String_Node_Str";
          ResultSet rsTables=stmt.executeQuery(sql);
          while (rsTables.next()) {
            String nameKey=rsTables.getString("String_Node_Str").trim();
            MetadataTable metadatatable=null;
            metadatatable=RelationalFactory.eINSTANCE.createTdTable();
            metadatatable.setName(nameKey);
            metadatatable.setTableType(ETableTypes.TABLETYPE_SYNONYM.getName());
            metadatatable.setLabel(metadatatable.getName());
            if (schemaPattern != null) {
              ColumnSetHelper.setTableOwner(schemaPattern,metadatatable);
            }
            list.add(metadatatable);
          }
        }
      }
    }
 else     if (dbJDBCMetadata.getDatabaseProductName() != null && dbJDBCMetadata.getDatabaseProductName().equals("String_Node_Str")) {
      for (int i=0; i < tableType.length; i++) {
        if (tableType[i].equals("String_Node_Str")) {
          Statement stmt=ExtractMetaDataUtils.conn.createStatement();
          ExtractMetaDataUtils.setQueryStatementTimeout(stmt);
          String sql="String_Node_Str" + schemaPattern + "String_Node_Str";
          ResultSet rsTables=stmt.executeQuery(sql);
          while (rsTables.next()) {
            String nameKey=rsTables.getString("String_Node_Str").trim();
            MetadataTable metadatatable=null;
            metadatatable=RelationalFactory.eINSTANCE.createTdTable();
            metadatatable.setName(nameKey);
            metadatatable.setTableType(ETableTypes.TABLETYPE_SYNONYM.getName());
            metadatatable.setLabel(metadatatable.getName());
            if (schemaPattern != null) {
              ColumnSetHelper.setTableOwner(schemaPattern,metadatatable);
            }
            list.add(metadatatable);
          }
        }
      }
    }
    if (isLinked()) {
      PackageHelper.addMetadataTable(ListUtils.castList(MetadataTable.class,list),pack);
    }
  }
 catch (  SQLException e) {
    log.error(e,e);
  }
  return list;
}