Skip to content

Commit

Permalink
fix(core): More accurate stage defintion builder lookup in DefaultSta…
Browse files Browse the repository at this point in the history
…geResolver (#3890)
  • Loading branch information
jonsie committed Sep 2, 2020
1 parent f3299f6 commit 09e41f7
Showing 1 changed file with 12 additions and 6 deletions.
Expand Up @@ -110,13 +110,19 @@ public StageDefinitionBuilder getStageDefinitionBuilder(@Nonnull String type, St
}

/**
* {@link ConcurrentHashMap#get)} throws an NPE if the parameter is null, so first ensure
* typeAlias is not null and then perform the necessary get.
* {@link ConcurrentHashMap#get)} throws an NPE if the parameter is null, so first check if
* typeAlias is null and then perform the necessary lookups.
*/
private StageDefinitionBuilder getOrDefault(@Nonnull String type, String typeAlias) {
return typeAlias != null
? stageDefinitionBuilderByAlias.getOrDefault(
type, stageDefinitionBuilderByAlias.get(typeAlias))
: stageDefinitionBuilderByAlias.get(type);
StageDefinitionBuilder stageDefinitionBuilder = null;
if (typeAlias == null) {
stageDefinitionBuilder = stageDefinitionBuilderByAlias.get(type);
}

if (stageDefinitionBuilder == null && typeAlias != null) {
stageDefinitionBuilder = stageDefinitionBuilderByAlias.get(typeAlias);
}

return stageDefinitionBuilder;
}
}

0 comments on commit 09e41f7

Please sign in to comment.