From e11472ccb26601fe74004a2400b44ea000c88d6f Mon Sep 17 00:00:00 2001 From: Martin Polden Date: Tue, 4 Jan 2022 13:50:47 +0100 Subject: Simplify --- .../yahoo/config/application/api/xml/DeploymentSpecXmlReader.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'config-model-api/src') 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 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 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 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); } -- cgit v1.2.3