Structural search question on resource management

Hi,
I am sorry for moroonic question, but I am trying to build a template for hunting stuff similar to opening JDBC resource w/o closing it safely (for instance,
PreparedStatement statement = ...;
statement.setInt(1, 10);
doSomethingWithStatement(statement);
statement.executeUpdate();
statement.close();
).

I am using

MySQLStatement $statement$ = $inst$;
$statement$.$method$($arg$);
$statement$.close();

with

inst min = 1, max = 1;
statement: min = 1, max = unlimited
method: min = 0, max = unlimited
arg: min = 0, max = unlimited

and find nothing. Can you help?
Thanks!

3 comments
Comment actions Permalink

Hi,
Statement, method should be min/max = 1
I believe you may need MySQLStatement to be $type$;

Dima wrote:

Hi,
I am sorry for moroonic question, but I am trying to build a template for hunting stuff similar to opening JDBC resource w/o closing it safely (for instance,
PreparedStatement statement = ...;
statement.setInt(1, 10);
doSomethingWithStatement(statement);
statement.executeUpdate();
statement.close();
).

I am using

MySQLStatement $statement$ = $inst$;
$statement$.$method$($arg$);
$statement$.close();

with

inst min = 1, max = 1;
statement: min = 1, max = unlimited
method: min = 0, max = unlimited
arg: min = 0, max = unlimited

and find nothing. Can you help?
Thanks!



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink

Hi,

I tried everything you suggested and it didn't work.

Maybe the problem is in the definition of inner block (marked bold italic):

MySQLStatement $statement$ = $inst$;

$statement$.$method$($arg$);

$statement$.close();

as w/o it it works on code comprised of instanciation and close only.

Can you take another look? Thank.

0
Comment actions Permalink

$statement$.$method$($arg$); matches one method call statement

Dima wrote:

Hi,

I tried everything you suggested and it didn't work.

Maybe the problem is in the definition of inner block (marked bold italic):

MySQLStatement $statement$ = $inst$;

$statement$.$method$($arg$);

$statement$.close();

as w/o it it works on code comprised of instanciation and close only.

Can you take another look? Thank.



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

Please sign in to leave a comment.