Skip to content

Commit 75dd906

Browse files
committed
fix spotbugs possible null deference
1 parent 918b80e commit 75dd906

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/main/java/io/jenkins/plugins/pipelinegraphview/utils/PipelineNodeUtil.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,21 @@ public static boolean isStep(FlowNode node) {
7272
}
7373

7474
public static boolean isStage(FlowNode node) {
75-
if (node != null && node instanceof StepStartNode) {
76-
StepStartNode stepStartNode = (StepStartNode) node;
77-
if (stepStartNode.getDescriptor() != null) {
78-
StepDescriptor sd = stepStartNode.getDescriptor();
79-
return sd != null && StageStep.DescriptorImpl.class.equals(sd.getClass()) && stepStartNode.isBody();
75+
if (node != null) {
76+
if (node instanceof StepStartNode) {
77+
StepStartNode stepStartNode = (StepStartNode) node;
78+
if (stepStartNode.getDescriptor() != null) {
79+
StepDescriptor sd = stepStartNode.getDescriptor();
80+
return sd != null && StageStep.DescriptorImpl.class.equals(sd.getClass()) && stepStartNode.isBody();
81+
}
8082
}
83+
LabelAction labelAction = node.getAction(LabelAction.class);
84+
ThreadNameAction threadNameAction = node.getAction(ThreadNameAction.class);
85+
return labelAction != null
86+
&& PARALLEL_SYNTHETIC_STAGE_NAME.equals(labelAction.getDisplayName())
87+
&& threadNameAction == null;
8188
}
82-
LabelAction labelAction = node.getAction(LabelAction.class);
83-
ThreadNameAction threadNameAction = node.getAction(ThreadNameAction.class);
84-
return labelAction != null
85-
&& PARALLEL_SYNTHETIC_STAGE_NAME.equals(labelAction.getDisplayName())
86-
&& threadNameAction == null;
89+
return false;
8790
}
8891

8992
public static boolean isSyntheticStage(@Nullable FlowNode node) {

0 commit comments

Comments
 (0)