Fix message

This commit is contained in:
Clément Fournier committed 2021-05-15 20:29:40 +02:00
1 parent 3e94623971
commit 987da9a6c8
2 files changed
+21 -1

No files matched your search

@@ -1066,7 +1066,7 @@ String name,
<rule name="PreserveStackTrace"
language="java"
since="3.7"
message="Thrown exception does not preserve the stack trace of exception '{0}' on all code paths"
message="Thrown exception does not preserve the stack trace of exception ''{0}'' on all code paths"
class="net.sourceforge.pmd.lang.java.rule.bestpractices.PreserveStackTraceRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_bestpractices.html#preservestacktrace">
<description>
@@ -1115,5 +1115,25 @@ public class SomeOtherUserDefinedException extends Exception {
}
]]></code>
</test-code>
<test-code>
<description>Test the message</description>
<expected-problems>1</expected-problems>
<expected-messages>
<message>Thrown exception does not preserve the stack trace of exception 'ex' on all code paths</message>
</expected-messages>
<code><![CDATA[
public abstract class AbstractNamedValueMethodArgumentResolver {
protected void setThrowingNameNoCheck(String name) {
try {
// this.discoveredThrowingType = ClassUtils.forName(name, getAspectClassLoader());
} catch (Throwable ex) {
throw new IllegalArgumentException("Throwing name '" + name +
"' is neither a valid argument name nor the fully-qualified " +
"name of a Java type on the classpath. Root cause: " + ex);
}
}
}
]]></code>
</test-code>
</test-data>