Program: 129320
Project: 129320
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="String_Node_Str".equals(catalogOrSchema.getName()) ? null : catalogOrSchema.getName();
      catalogName=parentCatalog == null ? null : parentCatalog.getName();
    }
  }
  try {
    boolean flag=true;
    String tableComment=null;
    List<String> tablesToFilter=new ArrayList<String>();
    if (pack != null) {
      Connection c=ConnectionHelper.getConnection(pack);
      flag=MetadataConnectionUtils.isOracle8i(c);
      boolean isOracle=MetadataConnectionUtils.isOracle(c);
      boolean isOracleJdbc=MetadataConnectionUtils.isOracleJDBC(c);
      if ((isOracleJdbc || isOracle) && !flag) {
        Statement stmt;
        try {
          stmt=dbJDBCMetadata.getConnection().createStatement();
          ResultSet rsTables=stmt.executeQuery(TableInfoParameters.ORACLE_10G_RECBIN_SQL);
          tablesToFilter=ExtractMetaDataFromDataBase.getTableNamesFromQuery(rsTables);
          rsTables.close();
          stmt.close();
        }
 catch (        SQLException e) {
          ExceptionHandler.process(e);
        }
      }
    }
    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;
      }
      if (tableName == null || tablesToFilter.contains(tableName) || tableName.startsWith("String_Node_Str")) {
        continue;
      }
      String tableOwner=null;
      if (!isHive && MetadataConnectionUtils.isSybase(dbJDBCMetadata)) {
        tableOwner=tableSchema;
      }
      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";
          if (!schemaname.contains("String_Node_Str") && !schemaname.contains("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 {
    boolean flag=true;
    String tableComment=null;
    List<String> tablesToFilter=new ArrayList<String>();
    if (pack != null) {
      Connection c=ConnectionHelper.getConnection(pack);
      flag=MetadataConnectionUtils.isOracle8i(c);
      boolean isOracle=MetadataConnectionUtils.isOracle(c);
      boolean isOracleJdbc=MetadataConnectionUtils.isOracleJDBC(c);
      if ((isOracleJdbc || isOracle) && !flag) {
        Statement stmt;
        try {
          stmt=dbJDBCMetadata.getConnection().createStatement();
          ResultSet rsTables=stmt.executeQuery(TableInfoParameters.ORACLE_10G_RECBIN_SQL);
          tablesToFilter=ExtractMetaDataFromDataBase.getTableNamesFromQuery(rsTables);
          rsTables.close();
          stmt.close();
        }
 catch (        SQLException e) {
          ExceptionHandler.process(e);
        }
      }
    }
    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;
      }
      if (tableName == null || tablesToFilter.contains(tableName) || tableName.startsWith("String_Node_Str")) {
        continue;
      }
      String tableOwner=null;
      if (!isHive && MetadataConnectionUtils.isSybase(dbJDBCMetadata)) {
        tableOwner=tableSchema;
      }
      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";
          if (schemaPattern.equalsIgnoreCase("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;
}