Buggy code:
public abstract class EmbedResultSet extends ConnectionChild implements Comparable , EngineResultSet { protected static final int FIRST = 1 ; protected static final int NEXT = 2 ; protected static final int LAST = 3 ; protected static final int PREVIOUS = 4 ; protected static final int BEFOREFIRST = 5 ; protected static final int AFTERLAST = 6 ; protected static final int ABSOLUTE = 7 ; protected static final int RELATIVE = 8 ; private ExecRow currentRow ; protected boolean wasNull ; boolean isClosed ; private boolean isOnInsertRow ; private Object currentStream ; private ResultSet theResults ; private boolean forMetaData ; private SQLWarning topWarning ; Activation singleUseActivation ; final int order ; private final ResultDescription resultDescription ; private int maxRows ; private final int maxFieldSize ; private int NumberofFetchedRows ; private final EmbedStatement stmt ; private EmbedStatement owningStmt ; private Statement applicationStmt ; private final long timeoutMillis ; private final boolean isAtomic ; private final int concurrencyOfThisResultSet ; private final ExecRow updateRow ; private boolean [ ] columnGotUpdated ; private boolean currentRowHasBeenUpdated ; private int fetchDirection ; private int fetchSize ; private boolean [ ] streamUsedFlags ; public EmbedResultSet ( EmbedConnection conn , ResultSet resultsToWrap , boolean forMetaData , EmbedStatement stmt , boolean isAtomic ) throws SQLException { } private void checkNotOnInsertRow ( ) throws SQLException { } protected final void checkOnRow ( ) throws SQLException { } private void initializeUpdateRowModifiers ( ) { } final int getColumnType ( int columnIndex ) throws SQLException { } public boolean next ( ) throws SQLException { } protected boolean movePosition ( int position , String positionText ) throws SQLException { } protected boolean movePosition ( int position , int row , String positionText ) throws SQLException { } public void close ( ) throws SQLException { if ( isClosed ) return ; closeCurrentStream ( ) ; synchronized ( getConnectionSynchronization ( ) ) { try { setupContextStack ( ) ; } catch ( SQLException se ) { return ; } try { try { <START_BUG> theResults . finish ( ) ; <END_BUG> if ( ( this . singleUseActivation ) != null ) { this . singleUseActivation . close ( ) ; this . singleUseActivation = null ; } } catch ( Throwable t ) { throw handleException ( t ) ; } if ( forMetaData ) { LanguageConnectionContext lcc = getEmbedConnection ( ) . getLanguageConnection ( ) ; if ( ( lcc . getActivationCount ( ) ) > 1 ) { } else if ( ( owningStmt ) != null ) owningStmt . resultSetClosing ( this ) ; } else if ( ( owningStmt ) != null ) { owningStmt . resultSetClosing ( this ) ; } } finally { isClosed = true ; restoreContextStack ( ) ; } currentRow = null ; } } public final boolean wasNull ( ) throws SQLException { } public final String getString ( int columnIndex ) throws SQLException { } public final boolean getBoolean ( int columnIndex ) throws SQLException { } public final byte getByte ( int columnIndex ) throws SQLException { } public final short getShort ( int columnIndex ) throws SQLException { } public final int getInt ( int columnIndex ) throws SQLException { } public final long getLong ( int columnIndex ) throws SQLException { } public final float getFloat ( int columnIndex ) throws SQLException { } public final double getDouble ( int columnIndex ) throws SQLException { } public final byte [ ] getBytes ( int columnIndex ) throws SQLException { } public final Date getDate ( int columnIndex ) throws SQLException { } public final Time getTime ( int columnIndex ) throws SQLException { } public final Timestamp getTimestamp ( int columnIndex ) throws SQLException { } public Date getDate ( int columnIndex , Calendar cal ) throws SQLException { } public Date getDate ( String columnName , Calendar cal ) throws SQLException { } public Time getTime ( int columnIndex , Calendar cal ) throws SQLException { } public Time getTime ( String columnName , Calendar cal ) throws SQLException { } public Timestamp getTimestamp ( String columnName , Calendar cal ) throws SQLException { } public Timestamp getTimestamp ( int columnIndex , Calendar cal ) throws SQLException { } public final Reader getCharacterStream ( int columnIndex ) throws SQLException { } public final InputStream getAsciiStream ( int columnIndex ) throws SQLException { } public final InputStream getBinaryStream ( int columnIndex ) throws SQLException { } public final String getString ( String columnName ) throws SQLException { } public final boolean getBoolean ( String columnName ) throws SQLException { } public final byte getByte ( String columnName ) throws SQLException { } public final short getShort ( String columnName ) throws SQLException { } public final int getInt ( String columnName ) throws SQLException { } public final long getLong ( String columnName ) throws SQLException { } public final float getFloat ( String columnName ) throws SQLException { } public final double getDouble ( String columnName ) throws SQLException { } public final byte [ ] getBytes ( String columnName ) throws SQLException { } public final Date getDate ( String columnName ) throws SQLException { } public final Time getTime ( String columnName ) throws SQLException { } public final Timestamp getTimestamp ( String columnName ) throws SQLException { } public final Reader getCharacterStream ( String columnName ) throws SQLException { } public final InputStream getAsciiStream ( String columnName ) throws SQLException { } public final InputStream getBinaryStream ( String columnName ) throws SQLException { } public URL getURL ( int columnIndex ) throws SQLException { } public URL getURL ( String columnName ) throws SQLException { } public final SQLWarning getWarnings ( ) throws SQLException { } public final void clearWarnings ( ) throws SQLException { } public final String getCursorName ( ) throws SQLException { } public final ResultSetMetaData getMetaData ( ) throws SQLException { } public final int getHoldability ( ) throws SQLException { }

Fix:
theResults . close ( ) ;