Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Processing and closing the ResultSet from callable statement and then using the getters throws NullPointerException [JDBC350] #167

Closed
firebird-automations opened this issue Apr 27, 2014 · 12 comments

Comments

@firebird-automations
Copy link

Submitted by: @mrotteveel

Is related to JDBC297
Is related to JDBC229
Is related to JDBC357
Relate to JDBC381

Attachments:
SO20140427.java

Votes: 1

When an executable stored procedure is processed by first reading the ResultSet and then using the getters on CallableStatement (as for example Spring SimpleJdbcCall does), then the getter will throw a NullPointerException.

See the attached file and http://stackoverflow.com/questions/23238260/simplejdbccall-nullpointerexception-on-firebird-db for an example of this problem.

See also JDBC297 and JDBC229

Commits: 0dd2b00 cadcfc3 FirebirdSQL/fbt-repository@448e08d FirebirdSQL/fbt-repository@51a2fd8

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Attachment: SO20140427.java [ 12503 ]

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Link: This issue is related to JDBC297 [ JDBC297 ]

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Link: This issue is related to JDBC229 [ JDBC229 ]

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Version: Jaybird 2.2.6 [ 10588 ]

Version: Jaybird 2.2.5 [ 10582 ] =>

Version: Jaybird 2.2.4 [ 10531 ] =>

Version: Jaybird 2.2.3 [ 10510 ] =>

Version: Jaybird 2.2.2 [ 10480 ] =>

Version: Jaybird 2.2.1 [ 10474 ] =>

Version: Jaybird 2.2 [ 10053 ] =>

Version: Jaybird 2.1.6 [ 10285 ] =>

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Version: Jaybird 2.2.5 [ 10582 ]

Version: Jaybird 2.2.4 [ 10531 ]

Version: Jaybird 2.2.3 [ 10510 ]

Version: Jaybird 2.2.2 [ 10480 ]

Version: Jaybird 2.2.1 [ 10474 ]

Version: Jaybird 2.2 [ 10053 ]

Version: Jaybird 2.1.6 [ 10285 ]

Fix Version: Jaybird 2.2.6 [ 10588 ]

Version: Jaybird 2.2.6 [ 10588 ] =>

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Link: This issue is related to JDBC357 [ JDBC357 ]

@firebird-automations
Copy link
Author

Commented by: Lukas Eder (lukas.eder)

While implementing routine support in jOOQ, I've run into this issue as well. This would be a very helpful fix.

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Fix Version: Jaybird 3.0 [ 10440 ]

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Made two changes:
1) the ResultSet.getRow` method now checks if the result set is still open, otherwise it throws an SQLException. This fixes the NPE thrown.
2) if the CallableStatement concerns an executable procedure (== singleton result), it creates an extra ResultSet with the returned row; this extra ResultSet is used for the accessors of CallableStatement.

For selectable procedures everything continues to work as is, except now trying to use an accessor after processing the result set will not produce a NullPointerException, but an SQLException that the result is closed.

NOTE Being able to obtain a ResultSet for an executable procedure, and use the accessors for a selectable procedure is actually invalid behavior, but for backwards compatibility we leave that as it is for now (might change in JDBC297).

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Link: This issue relate to JDBC381 [ JDBC381 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment