Is it possible to turn off sonar (http://www.sonarsource.org) measurements for specific blocks of code, which one doesn’t want to be measured?
An example is the “Preserve Stack Trace” warning which Findbugs outputs. When leaving the server, I might well want to only pass the message back to the client, not including the actual exception which I just caught, if that exception is unknown to the client (because the client doesn’t have the JAR in which that exception was contained for example).
This is a FAQ. You can put
//NOSONARat the end of the line triggering the warning.I prefer using the FindBugs mechanism though, which consists in adding the @SuppressFBWarnings annotation: