Buggy code:
public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { public static final String ACTION_DROP = "drop" ; public static final String ACTION_ADD = "add" ; public static final String ACTION_GET = "get" ; public static final String ACTION_SET = "set" ; private static final Localizer _loc = Localizer . forPackage ( TableJDBCSeq . class ) ; private JDBCConfiguration _conf = null ; private Log _log = null ; private int _alloc = 50 ; private final TableJDBCSeq . Status _stat = new TableJDBCSeq . Status ( ) ; private String _table = "OPENJPA_SEQUENCE_TABLE" ; private String _seqColumnName = "SEQUENCE_VALUE" ; private String _pkColumnName = "ID" ; private Column _seqColumn = null ; private Column _pkColumn = null ; public String getTable ( ) { } public void setTable ( String name ) { } public void setTableName ( String name ) { } public String getSequenceColumn ( ) { } public void setSequenceColumn ( String sequenceColumn ) { } public String getPrimaryKeyColumn ( ) { } public void setPrimaryKeyColumn ( String primaryKeyColumn ) { } public int getAllocate ( ) { } public void setAllocate ( int alloc ) { } public void setIncrement ( int inc ) { } public JDBCConfiguration getConfiguration ( ) { } public void setConfiguration ( Configuration conf ) { } public void startConfiguration ( ) { } public void endConfiguration ( ) { } public void addSchema ( ClassMapping mapping , SchemaGroup group ) { } protected Object nextInternal ( JDBCStore store , ClassMapping mapping ) throws Exception { } protected Object currentInternal ( JDBCStore store , ClassMapping mapping ) throws Exception { } protected void allocateInternal ( int count , JDBCStore store , ClassMapping mapping ) throws SQLException { } protected TableJDBCSeq . Status getStatus ( ClassMapping mapping ) { } protected Column addPrimaryKeyColumn ( Table table ) { } protected Object getPrimaryKey ( ClassMapping mapping ) { } private void buildTable ( ) { } private void allocateSequence ( JDBCStore store , ClassMapping mapping , TableJDBCSeq . Status stat , int alloc , boolean updateStatSeq ) { try { if ( ! ( setSequence ( mapping , stat , alloc , updateStatSeq , getConnection ( store ) ) ) ) { closeConnection ( ) ; SQLException err = null ; Connection conn = _conf . getDataSource2 ( store . getContext ( ) ) . getConnection ( ) ; try { insertSequence ( mapping , conn ) ; } catch ( SQLException se ) { err = se ; } finally { try { conn . close ( ) ; } catch ( SQLException se ) { } } if ( ! ( setSequence ( mapping , stat , alloc , updateStatSeq , getConnection ( store ) ) ) ) <START_BUG> throw err != null ? err : new SQLException ( TableJDBCSeq . _loc . get ( "no-seq-row" , mapping , _table ) ) ; <END_BUG> } } catch ( SQLException se2 ) { throw SQLExceptions . getStore ( TableJDBCSeq . _loc . get ( "bad-seq-up" , _table ) , se2 , _conf . getDBDictionaryInstance ( ) ) ; } } private void insertSequence ( ClassMapping mapping , Connection conn ) throws SQLException { } protected long getSequence ( ClassMapping mapping , Connection conn ) throws SQLException { } protected boolean setSequence ( ClassMapping mapping , TableJDBCSeq . Status stat , int inc , boolean updateStatSeq , Connection conn ) throws SQLException { } public void refreshTable ( ) throws SQLException { } public void dropTable ( ) throws SQLException { } public static void main ( String [ ] args ) throws Exception { } public static boolean run ( JDBCConfiguration conf , String [ ] args , Options opts ) throws Exception { } public static boolean run ( JDBCConfiguration conf , String [ ] args , String action ) throws Exception { } protected static class Status { public long seq = 1L ; public long max = 0L ; } }

Fix:
throw err != null ? err : new SQLException ( TableJDBCSeq . _loc . get ( "no-seq-row" , mapping , _table ) . getMessage ( ) ) ;