diff options
author | Martin Polden <mpolden@mpolden.no> | 2022-01-04 13:50:47 +0100 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2022-01-07 11:03:13 +0100 |
commit | e11472ccb26601fe74004a2400b44ea000c88d6f (patch) | |
tree | 2a3b08dd205967ad2b2b419229adb8798e55b7f2 /config-model-api | |
parent | ea8199921bb9b46e86ef7f2c715c2e00b0708ade (diff) |
Simplify
Diffstat (limited to 'config-model-api')
-rw-r--r-- | config-model-api/src/main/java/com/yahoo/config/application/api/xml/DeploymentSpecXmlReader.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/config-model-api/src/main/java/com/yahoo/config/application/api/xml/DeploymentSpecXmlReader.java b/config-model-api/src/main/java/com/yahoo/config/application/api/xml/DeploymentSpecXmlReader.java index aa985cd48bd..493a72b2018 100644 --- a/config-model-api/src/main/java/com/yahoo/config/application/api/xml/DeploymentSpecXmlReader.java +++ b/config-model-api/src/main/java/com/yahoo/config/application/api/xml/DeploymentSpecXmlReader.java @@ -361,7 +361,7 @@ public class DeploymentSpecXmlReader { */ private long longAttribute(String attributeName, Element tag) { String value = tag.getAttribute(attributeName); - if (value == null || value.isEmpty()) return 0; + if (value.isEmpty()) return 0; try { return Long.parseLong(value); } @@ -376,7 +376,7 @@ public class DeploymentSpecXmlReader { */ private Optional<Integer> optionalIntegerAttribute(String attributeName, Element tag) { String value = tag.getAttribute(attributeName); - if (value == null || value.isEmpty()) return Optional.empty(); + if (value.isEmpty()) return Optional.empty(); try { return Optional.of(Integer.parseInt(value)); } @@ -389,7 +389,7 @@ public class DeploymentSpecXmlReader { /** Returns the given non-blank attribute of tag as a string, if any */ private static Optional<String> stringAttribute(String attributeName, Element tag) { String value = tag.getAttribute(attributeName); - return Optional.ofNullable(value).filter(s -> !s.isBlank()); + return Optional.of(value).filter(s -> !s.isBlank()); } /** Returns the given non-blank attribute of tag or throw */ @@ -407,7 +407,7 @@ public class DeploymentSpecXmlReader { private Optional<String> readGlobalServiceId(Element environmentTag) { String globalServiceId = environmentTag.getAttribute("global-service-id"); - if (globalServiceId == null || globalServiceId.isEmpty()) return Optional.empty(); + if (globalServiceId.isEmpty()) return Optional.empty(); deprecate(environmentTag, List.of("global-service-id"), "See https://cloud.vespa.ai/en/reference/routing#deprecated-syntax"); return Optional.of(globalServiceId); } |