SonarLint 1.0.0 for
Eclipse标记了我的代码中的一个关键问题,我无法理解为什么以及如何解决它.这真的对我来说是假的 – 或者我错过了什么?
import org.apache.log4j.Logger; [...] public final class Foo { private static final Logger logger = Logger.getLogger(Foo.class); [...] public static void foo() { MyCommand command = new MyCommand(foo,bar); try { commandService.executeCommand(command); } catch (CommandException e) { logger.error("My command execution Failed",e); } } [...]
以下是匹配SonarLint rule description的摘录:@H_502_5@
When handling a caught exception,the original exception’s message and
stack trace should be logged or passed forward.@H_502_5@Noncompliant Code Example
06001@H_502_5@
Compliant Solution
06002@H_502_5@
在我看来,我的代码符合给定的兼容解决方案的第一个变体,但SonarLint不接受它.@H_502_5@
不久之前有another discussion of Sonar rule S1166,但它并不是真的与我有同样的问题.@H_502_5@