Skip to content

Print a link to Pipeline Executions in Datadog in the build logs

ci.jenkins.io / SpotBugs failed Feb 2, 2024 in 0s

1 new issue

Total New Outstanding Fixed Trend
1 1 0 0 👎

Reference build: Plugins » datadog-plugin » master #133

Details

Severity distribution of new issues

Error Warning High Warning Normal Warning Low
0 0 1 0

Annotations

Check warning on line 351 in src/main/java/org/datadog/jenkins/plugins/datadog/listeners/DatadogBuildListener.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / SpotBugs

REC_CATCH_EXCEPTION

NORMAL:
Exception is caught when Exception is not thrown in org.datadog.jenkins.plugins.datadog.listeners.DatadogBuildListener.onCompleted(Run, TaskListener)
Raw output
<p> This method uses a try-catch block that catches Exception objects, but Exception is not thrown within the try block, and RuntimeException is not explicitly caught. It is a common bug pattern to say try { ... } catch (Exception e) { something } as a shorthand for catching a number of types of exception each of whose catch blocks is identical, but this construct also accidentally catches RuntimeException as well, masking potential bugs. </p> <p>A better approach is to either explicitly catch the specific exceptions that are thrown, or to explicitly catch RuntimeException exception, rethrow it, and then catch all non-Runtime Exceptions, as shown below:</p> <pre><code>try { ... } catch (RuntimeException e) { throw e; } catch (Exception e) { ... deal with all non-runtime exceptions ... } </code></pre>