diff --git a/src/main/java/org/datadog/jenkins/plugins/datadog/listeners/DatadogGraphListener.java b/src/main/java/org/datadog/jenkins/plugins/datadog/listeners/DatadogGraphListener.java index dee696bc..05f31473 100644 --- a/src/main/java/org/datadog/jenkins/plugins/datadog/listeners/DatadogGraphListener.java +++ b/src/main/java/org/datadog/jenkins/plugins/datadog/listeners/DatadogGraphListener.java @@ -51,6 +51,7 @@ of this software and associated documentation files (the "Software"), to deal import org.datadog.jenkins.plugins.datadog.model.node.StatusAction; import org.datadog.jenkins.plugins.datadog.traces.write.TraceWriter; import org.datadog.jenkins.plugins.datadog.traces.write.TraceWriterFactory; +import org.datadog.jenkins.plugins.datadog.util.SuppressFBWarnings; import org.datadog.jenkins.plugins.datadog.util.TagsUtil; import org.jenkinsci.plugins.workflow.actions.ThreadNameAction; import org.jenkinsci.plugins.workflow.actions.TimingAction; @@ -73,6 +74,7 @@ public class DatadogGraphListener implements GraphListener { private static final Logger logger = Logger.getLogger(DatadogGraphListener.class.getName()); + @SuppressFBWarnings("REC_CATCH_EXCEPTION") @Override public void onNewHead(FlowNode flowNode) { WorkflowRun run = getRun(flowNode); diff --git a/src/main/java/org/datadog/jenkins/plugins/datadog/listeners/DatadogStepListener.java b/src/main/java/org/datadog/jenkins/plugins/datadog/listeners/DatadogStepListener.java index e87acc6c..83a16802 100644 --- a/src/main/java/org/datadog/jenkins/plugins/datadog/listeners/DatadogStepListener.java +++ b/src/main/java/org/datadog/jenkins/plugins/datadog/listeners/DatadogStepListener.java @@ -31,6 +31,7 @@ import org.datadog.jenkins.plugins.datadog.model.node.NodeInfoAction; import org.datadog.jenkins.plugins.datadog.traces.BuildSpanAction; import org.datadog.jenkins.plugins.datadog.traces.GitInfoUtils; +import org.datadog.jenkins.plugins.datadog.util.SuppressFBWarnings; import org.datadog.jenkins.plugins.datadog.util.git.GitUtils; import org.jenkinsci.plugins.workflow.cps.nodes.StepAtomNode; import org.jenkinsci.plugins.workflow.flow.StepListener; @@ -133,6 +134,7 @@ private static String getNodeName(StepContext stepContext) { * @param stepContext * @return hostname of the remote node. */ + @SuppressFBWarnings("REC_CATCH_EXCEPTION") private static String getNodeHostname(final StepContext stepContext) { try { EnvVars envVars = stepContext.get(EnvVars.class); diff --git a/src/main/java/org/datadog/jenkins/plugins/datadog/model/BuildData.java b/src/main/java/org/datadog/jenkins/plugins/datadog/model/BuildData.java index b89802ad..afd930aa 100644 --- a/src/main/java/org/datadog/jenkins/plugins/datadog/model/BuildData.java +++ b/src/main/java/org/datadog/jenkins/plugins/datadog/model/BuildData.java @@ -44,6 +44,7 @@ of this software and associated documentation files (the "Software"), to deal import hudson.model.Job; import hudson.model.ParameterValue; import hudson.model.ParametersAction; +import hudson.model.Result; import hudson.model.Run; import hudson.model.StringParameterValue; import hudson.model.TaskListener; @@ -135,7 +136,7 @@ public class BuildData implements Serializable { private String traceId; private String spanId; - public BuildData(Run run, @Nullable TaskListener listener) throws IOException, InterruptedException { + public BuildData(Run run, @Nullable TaskListener listener) throws IOException, InterruptedException { if (run == null) { return; } @@ -180,8 +181,14 @@ public BuildData(Run run, @Nullable TaskListener listener) throws IOException, I } // Set Result and completed status - this.result = run.getResult() == null ? null : run.getResult().toString(); - this.isCompleted = run.getResult() != null && run.getResult().completeBuild; + Result runResult = run.getResult(); + if (runResult != null) { + this.result = runResult.toString(); + this.isCompleted = runResult.completeBuild; + } else { + this.result = null; + this.isCompleted = false; + } // Set Build Number this.buildNumber = String.valueOf(run.getNumber()); diff --git a/src/main/java/org/datadog/jenkins/plugins/datadog/model/GitCommitAction.java b/src/main/java/org/datadog/jenkins/plugins/datadog/model/GitCommitAction.java index 5311d244..1046a6bd 100644 --- a/src/main/java/org/datadog/jenkins/plugins/datadog/model/GitCommitAction.java +++ b/src/main/java/org/datadog/jenkins/plugins/datadog/model/GitCommitAction.java @@ -224,6 +224,9 @@ public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext co case "committerDate": committerDate = (String) context.convertAnother(null, String.class); break; + default: + // unknown tag, could be something serialized by a different version of the plugin + break; } reader.moveUp(); } diff --git a/src/main/java/org/datadog/jenkins/plugins/datadog/model/GitRepositoryAction.java b/src/main/java/org/datadog/jenkins/plugins/datadog/model/GitRepositoryAction.java index d0145c8f..d9c97893 100644 --- a/src/main/java/org/datadog/jenkins/plugins/datadog/model/GitRepositoryAction.java +++ b/src/main/java/org/datadog/jenkins/plugins/datadog/model/GitRepositoryAction.java @@ -117,6 +117,9 @@ public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext co case "branch": gitRepositoryAction.setBranch((String) context.convertAnother(null, String.class)); break; + default: + // unknown tag, could be something serialized by a different version of the plugin + break; } reader.moveUp(); } diff --git a/src/main/java/org/datadog/jenkins/plugins/datadog/model/PipelineNodeInfoAction.java b/src/main/java/org/datadog/jenkins/plugins/datadog/model/PipelineNodeInfoAction.java index 8ec2cd3a..abafd869 100644 --- a/src/main/java/org/datadog/jenkins/plugins/datadog/model/PipelineNodeInfoAction.java +++ b/src/main/java/org/datadog/jenkins/plugins/datadog/model/PipelineNodeInfoAction.java @@ -112,6 +112,9 @@ public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext co case "workspace": workspace = (String) context.convertAnother(null, String.class); break; + default: + // unknown tag, could be something serialized by a different version of the plugin + break; } reader.moveUp(); } diff --git a/src/main/java/org/datadog/jenkins/plugins/datadog/model/PipelineQueueInfoAction.java b/src/main/java/org/datadog/jenkins/plugins/datadog/model/PipelineQueueInfoAction.java index 343dfbf4..c7f79e7f 100644 --- a/src/main/java/org/datadog/jenkins/plugins/datadog/model/PipelineQueueInfoAction.java +++ b/src/main/java/org/datadog/jenkins/plugins/datadog/model/PipelineQueueInfoAction.java @@ -96,6 +96,9 @@ public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext co case "propagatedQueueTimeMillis": propagatedQueueTimeMillis = (long) context.convertAnother(null, long.class); break; + default: + // unknown tag, could be something serialized by a different version of the plugin + break; } reader.moveUp(); } diff --git a/src/main/java/org/datadog/jenkins/plugins/datadog/model/node/NodeInfoAction.java b/src/main/java/org/datadog/jenkins/plugins/datadog/model/node/NodeInfoAction.java index fcda54a3..9eabab81 100644 --- a/src/main/java/org/datadog/jenkins/plugins/datadog/model/node/NodeInfoAction.java +++ b/src/main/java/org/datadog/jenkins/plugins/datadog/model/node/NodeInfoAction.java @@ -115,6 +115,9 @@ public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext co case "nodeWorkspace": nodeWorkspace = (String) context.convertAnother(null, String.class); break; + default: + // unknown tag, could be something serialized by a different version of the plugin + break; } reader.moveUp(); }