Structural Search Problem
I am trying to find all calls to Throwable.printStackTrace() in my
project, so I am using the structural search template:
$Instance$.$MethodCall$($Parameter$)
With $MethodCall$'s text constraints as "printStackTrace".
However it appears to only find the calls that aren't in catch blocks -
it ignores the ones that are.
Am I doing anything stupid? It's my first foray into using S.S. so
forgive any ignorance.
Oh and it's build 3378 by the way.
Cheers,
N.
Please sign in to leave a comment.
Seems to be a bug.
Nathan Brown wrote:
--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"
Maxim Mossienko wrote:
>> I am trying to find all calls to Throwable.printStackTrace() in my
>> project, so I am using the structural search template:
>>
>> $Instance$.$MethodCall$($Parameter$)
>>
>> With $MethodCall$'s text constraints as "printStackTrace".
>>
>> However it appears to only find the calls that aren't in catch blocks
>> - it ignores the ones that are.
>>
>> Am I doing anything stupid? It's my first foray into using S.S. so
>> forgive any ignorance.
>>
>> Oh and it's build 3378 by the way.
>>
>> Cheers,
>> N.
Drat. Any workaround that you can think of?
N.
Use the inspection that does exactly the same thing. You can find it on "Code Maturity Issues", "Call to printStackTrace()".
Marcus Brito wrote:
Good idea, but I actually needed structural replace here to convert
bad printStackTrace() calls to good logger service calls.
I ended up making a template like this, which appeared to work:
try {
$Statements$;
} catch ($Class$ $Instance$) {
$Comments1$;
$Instance$.$MethodCall$($Parameter$);
$Comments2$;
}
Anyone need anymore info on it, drop me a line.
N.