{"record":{"id":"55c589ca11a3b76b","repo":"apache/shardingsphere","slug":"afterlast","errorCode":null,"errorMessage":"afterLast","messagePattern":"afterLast","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationResultSet.java","lineNumber":65,"sourceCode":"    \n    @Override\n    public final boolean isFirst() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"isFirst\");\n    }\n    \n    @Override\n    public final boolean isLast() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"isLast\");\n    }\n    \n    @Override\n    public final void beforeFirst() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"beforeFirst\");\n    }\n    \n    @Override\n    public final void afterLast() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"afterLast\");\n    }\n    \n    @Override\n    public final boolean first() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"first\");\n    }\n    \n    @Override\n    public final boolean last() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"last\");\n    }\n    \n    @Override\n    public final boolean absolute(final int row) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"absolute\");\n    }\n    \n    @Override","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationResultSet.java#L47-L83","documentation":"afterLast(), which moves the cursor past the final row, is unsupported and final in ShardingSphere's AbstractUnsupportedOperationResultSet — it throws SQLFeatureNotSupportedException. Positioning calls that are not forward next() have no meaning on a streaming merge of shard results, so the driver rejects them.","triggerScenarios":"Calling rs.afterLast() on a ShardingSphere query result, usually in generic cleanup/skip-resteps code or copy-pasted scrollable-cursor examples.","commonSituations":"Defensive 'drain the rest' code before closing; frameworks that normalize cursor state via afterLast(); migrations from drivers whose result sets allow repositioning.","solutions":["To skip remaining rows, simply close() the ResultSet (and Statement) — closing discards the streams safely.","If exhaustion is required, while (rs.next()) { } is the only supported way to advance to the end.","Remove the call: for forward-only cursors, afterLast() has no useful effect.","Wrap consumers that insist on afterLast() with a materialized CachedRowSet."],"exampleFix":"// before\nrs.afterLast(); // throws\nrs.close();\n\n// after\nrs.close(); // forward-only: closing is sufficient to discard remaining rows","handlingStrategy":"validation","validationCode":"if (rs.getType() == ResultSet.TYPE_FORWARD_ONLY) {\n    // positioning calls other than next() are unavailable; just close() to discard\n}","typeGuard":null,"tryCatchPattern":"try {\n    rs.afterLast();\n} catch (SQLFeatureNotSupportedException e) {\n    rs.close(); // equivalent effect for a forward-only cursor\n}","preventionTips":["Treat close() as the only 'finish' operation on forward-only results.","Delete boilerplate cursor normalization copied from scrollable-cursor examples.","Lint for afterLast()/beforeFirst() in code that targets the sharded datasource."],"tags":["jdbc","resultset","cursor","positioning","cleanup"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}