Is it possible to turn off sonar (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
//NOSONAR on the line triggering the warning. I prefer using the FindBugs mechanism though, which consists in adding the @SuppressFBWarnings annotation:
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings( value = "NAME_OF_THE_FINDBUGS_RULE_TO_IGNORE", justification = "Why you choose to ignore it")