Skip to content

Commit

Permalink
Refactor PipelineConfiguration#getVersion (elastic#115423)
Browse files Browse the repository at this point in the history
  • Loading branch information
joegallo authored and jfreden committed Nov 4, 2024
1 parent 9f4f7f9 commit 9b92294
Showing 1 changed file with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,13 @@ BytesReference getConfig() {
}

public Integer getVersion() {
var configMap = getConfigAsMap();
if (configMap.containsKey("version")) {
Object o = configMap.get("version");
if (o == null) {
return null;
} else if (o instanceof Number number) {
return number.intValue();
} else {
throw new IllegalStateException("unexpected version type [" + o.getClass().getName() + "]");
}
} else {
Object o = getConfigAsMap().get("version");
if (o == null) {
return null;
} else if (o instanceof Number number) {
return number.intValue();
} else {
throw new IllegalStateException("unexpected version type [" + o.getClass().getName() + "]");
}
}

Expand Down

0 comments on commit 9b92294

Please sign in to comment.