@ -129,7 +129,7 @@ Avoid empty try blocks - what's the point?
|
|||||||
<property name="xpath">
|
<property name="xpath">
|
||||||
<value>
|
<value>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
//TryStatement/Block[1][count(*) = 0]
|
//TryStatement[not(ResourceSpecification)]/Block[1][count(*) = 0]
|
||||||
]]>
|
]]>
|
||||||
</value>
|
</value>
|
||||||
</property>
|
</property>
|
||||||
|
@ -46,6 +46,19 @@ public class EmptyTryBlock3 {
|
|||||||
int x = 5;
|
int x = 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
]]></code>
|
||||||
|
</test-code>
|
||||||
|
<test-code>
|
||||||
|
<description>#432 false positive for empty try-with-resource</description>
|
||||||
|
<expected-problems>0</expected-problems>
|
||||||
|
<code><![CDATA[
|
||||||
|
class X {
|
||||||
|
void method() {
|
||||||
|
try (ClientResponse response = execute(() -> target.request(mediaTypes).delete(), DELETE, new ExpectedResponse(status, required))) {
|
||||||
|
// false positive
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]]></code>
|
]]></code>
|
||||||
</test-code>
|
</test-code>
|
||||||
|
Reference in New Issue
Block a user