forked from phoedos/pmd
#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>
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
* [#1332](https://sourceforge.net/p/pmd/bugs/1332/): False Positive: UnusedPrivateMethod
|
||||
* [#1333](https://sourceforge.net/p/pmd/bugs/1333/): Error while processing Java file with Lambda expressions
|
||||
* [#1337](https://sourceforge.net/p/pmd/bugs/1337/): False positive "Avoid throwing raw exception types" when exception is not thrown
|
||||
* [#1338](https://sourceforge.net/p/pmd/bugs/1338/): The pmd-java8 POM bears the wrong parent module version
|
||||
|
||||
**API Changes:**
|
||||
|
Reference in New Issue
Block a user