Buggy code:
public class SchemaGenerator { private static final Localizer _loc = Localizer . forPackage ( SchemaGenerator . class ) ; private final DataSource _ds ; private final DBDictionary _dict ; private final Log _log ; private final Object [ ] [ ] _allowed ; private boolean _indexes = true ; private boolean _fks = true ; private boolean _pks = true ; private boolean _seqs = true ; private boolean _openjpaTables = true ; private SchemaGroup _group = null ; private List < SchemaGenerator . Listener > _listeners = null ; private int _schemaObjects = 0 ; public SchemaGenerator ( JDBCConfiguration conf ) { } private static Object [ ] [ ] parseSchemasList ( DBIdentifier [ ] args ) { } public boolean getIndexes ( ) { } public void setIndexes ( boolean indexes ) { } public boolean getForeignKeys ( ) { } public void setForeignKeys ( boolean fks ) { } public boolean getPrimaryKeys ( ) { } public void setPrimaryKeys ( boolean pks ) { } public boolean getSequences ( ) { } public void setSequences ( boolean seqs ) { } public boolean getOpenJPATables ( ) { } public void setOpenJPATables ( boolean openjpaTables ) { } public SchemaGroup getSchemaGroup ( ) { } public void setSchemaGroup ( SchemaGroup group ) { } public void generateSchemas ( ) throws SQLException { } public void generateSchemas ( String [ ] schemasAndTables ) throws SQLException { } public void generateSchemas ( DBIdentifier [ ] schemasAndTables ) throws SQLException { } public void generateSchema ( String name , String [ ] tableNames ) throws SQLException { } public void generateSchema ( DBIdentifier name , DBIdentifier [ ] tableNames ) throws SQLException { } public void generatePrimaryKeys ( String schemaName , String [ ] tableNames ) throws SQLException { } public void generatePrimaryKeys ( DBIdentifier schemaName , DBIdentifier [ ] tableNames ) throws SQLException { } public void generateIndexes ( String schemaName , String [ ] tableNames ) throws SQLException { } public void generateIndexes ( DBIdentifier schemaName , DBIdentifier [ ] tableNames ) throws SQLException { } public void generateForeignKeys ( String schemaName , String [ ] tableNames ) throws SQLException { } public void generateForeignKeys ( DBIdentifier schemaName , DBIdentifier [ ] tableNames ) throws SQLException { } public void generateTables ( String schemaName , String tableName , Connection conn , DatabaseMetaData meta ) throws SQLException { } public void generateTables ( DBIdentifier schemaName , DBIdentifier tableName , Connection conn , DatabaseMetaData meta ) throws SQLException { } private boolean isAllowedTable ( DBIdentifier schema , DBIdentifier table ) { } public void generatePrimaryKeys ( String schemaName , String tableName , Connection conn , DatabaseMetaData meta ) throws SQLException { } public void generatePrimaryKeys ( DBIdentifier schemaName , DBIdentifier tableName , Connection conn , DatabaseMetaData meta ) throws SQLException { } public void generateIndexes ( String schemaName , String tableName , Connection conn , DatabaseMetaData meta ) throws SQLException { } public void generateIndexes ( DBIdentifier schemaName , DBIdentifier tableName , Connection conn , DatabaseMetaData meta ) throws SQLException { } public void generateForeignKeys ( String schemaName , String tableName , Connection conn , DatabaseMetaData meta ) throws SQLException { } public void generateForeignKeys ( DBIdentifier schemaName , DBIdentifier tableName , Connection conn , DatabaseMetaData meta ) throws SQLException { } public void generateSequences ( String schemaName , String sequenceName , Connection conn , DatabaseMetaData meta ) throws SQLException { } public void generateSequences ( DBIdentifier schemaName , DBIdentifier sequenceName , Connection conn , DatabaseMetaData meta ) throws SQLException { fireGenerationEvent ( SchemaGenerator . _loc . get ( "generating-sequences" , schemaName ) ) ; if ( _log . isTraceEnabled ( ) ) _log . trace ( SchemaGenerator . _loc . get ( "gen-seqs" , schemaName , sequenceName ) ) ; Sequence [ ] seqs = _dict . getSequences ( meta , DBIdentifier . newCatalog ( conn . getCatalog ( ) ) , NULL , sequenceName , conn ) ; SchemaGroup group = getSchemaGroup ( ) ; Schema schema ; DBIdentifier sequenceSchema = DBIdentifier . NULL ; for ( int i = 0 ; ( seqs != null ) && ( i < ( seqs . length ) ) ; i ++ ) { sequenceName = seqs [ i ] . getIdentifier ( ) ; sequenceSchema = DBIdentifier . trimToNull ( seqs [ i ] . getSchemaIdentifier ( ) ) ; String seqUpper = DBIdentifier . toUpper ( sequenceName ) . getName ( ) ; if ( ( ! ( _openjpaTables ) ) && ( ( seqUpper . startsWith ( "OPENJPA_" ) ) || ( seqUpper . startsWith ( "JDO_" ) ) ) ) continue ; <START_BUG> if ( _dict . isSystemSequence ( sequenceName , sequenceSchema , ( schemaName != null ) ) ) <END_BUG> continue ; if ( ! ( isAllowedTable ( sequenceSchema , null ) ) ) continue ; schema = group . getSchema ( sequenceSchema ) ; if ( schema == null ) { schema = group . addSchema ( sequenceSchema ) ; } if ( ( schema . getSequence ( sequenceName ) ) == null ) { schema . addSequence ( sequenceName ) ; } } } private void fireGenerationEvent ( Object schemaObject ) throws SQLException { } public void addListener ( SchemaGenerator . Listener l ) { } public boolean removeListener ( SchemaGenerator . Listener l ) { } private Collection < Table > getTables ( DBIdentifier schemaName ) { } public static interface Listener { boolean schemaObjectGenerated ( SchemaGenerator . Event e ) { } } @ SuppressWarnings ( "serial" ) public static class Event extends EventObject { private final int _total ; public Event ( Object ob , int total ) { } public int getTotal ( ) { } } }

Fix:
if ( _dict . isSystemSequence ( sequenceName , sequenceSchema , ( schemaName != null ) , conn ) )