Skip to content

Inconsistent Handling of Invalid setFetchDirection Input between ResultSet and Statement  #596

@dwenking

Description

@dwenking

When an invalid fetch direction value is passed to setFetchDirection, the ResultSet object accepts it without throwing an exception, whereas the Statement object correctly throws a SQLException for the same invalid input.

@Test
public void test() throws SQLException {
    Connection con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/test11?user=user&password=password");
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.getGeneratedKeys();
    rs.setFetchDirection(425635067); // succeed
    System.out.println(rs.getFetchDirection());
    stmt.setFetchDirection(425635067); // java.sql.SQLException: Illegal argument
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions