#1337 False positive "Avoid throwing raw exception types" when exception is not thrown
This commit is contained in:
@ -125,7 +125,7 @@ Exception, or Error, use a subclassed exception or error instead.
|
||||
<property name="xpath">
|
||||
<value>
|
||||
<![CDATA[
|
||||
//AllocationExpression
|
||||
//ThrowStatement//AllocationExpression
|
||||
/ClassOrInterfaceType[
|
||||
(@Image='Throwable' and count(//ImportDeclaration/Name[ends-with(@Image,'Throwable')]) = 0)
|
||||
or
|
||||
|
@ -40,4 +40,17 @@ public class PmdTest {
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description>#1337: False positive "Avoid throwing raw exception types" when exception is not thrown</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class PmdTest {
|
||||
private Throwable cause;
|
||||
|
||||
public void setUp() {
|
||||
cause = new Throwable();
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
</test-data>
|
||||
|
Reference in New Issue
Block a user