IG question

I'm not sure if this is an IG inspection or "built-in" one but my question is about the 'JDBC resource opened but not safely closed' inspection. The following code is marked as "JDBC CallableStatement should be opened in a try block, and closed in a finally block." Looks like it is to me. Am I missing something?

6 comments

That is an Inspection Gadgets warning. I cannot reproduce it with your example code, but then I don't have an Oracle JDBC driver handy. It does look like you are hiding some NullPointerExceptions with that empty catch block though. But if you could produce a compilable example and submit a bug report, I would be glad to fix it.

Bas

0

Your Callable statement should get closed but you could end up throwing an exception on the oraCS.close and hang the connection itself.

0

According to the docs, I shouldn't be calling close() on the physical connection anyway. But, you're right with regards to the logical connection. How do others handle this situation where you need to close several resources like this? Have a try/catch for each?

0

I don't think I can send you a "compilable" example since you would need the Weblogic jdbc classes, Oracle classes and our classes (which I definitely can't send you).

0

Well, currently I can't reproduce your problem, which unfortunately means I can't fix it.

Bas

0

Well, since it's code I hopefully won't have to see very often, it's not a
big deal.

"Bas Leijdekkers" <no_mail@jetbrains.com> wrote in message
news:23090563.1126712448736.JavaMail.javamailuser@localhost...

Well, currently I can't reproduce your problem, which unfortunately means
I can't fix it.

>

Bas



0

Please sign in to leave a comment.