From bf5dedfd2f388ba0f49f6578c128374172d0988d Mon Sep 17 00:00:00 2001 From: Jonathan Lovelace Date: Thu, 28 Nov 2024 23:23:26 -0500 Subject: [PATCH] YAAbstractReader: Flatten nested if statements. --- .../legacy/xmlio/yaxml/YAAbstractReader.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/model/src/main/java/legacy/xmlio/yaxml/YAAbstractReader.java b/model/src/main/java/legacy/xmlio/yaxml/YAAbstractReader.java index 3d668f273..76461af5e 100644 --- a/model/src/main/java/legacy/xmlio/yaxml/YAAbstractReader.java +++ b/model/src/main/java/legacy/xmlio/yaxml/YAAbstractReader.java @@ -486,16 +486,14 @@ protected final boolean getBooleanParameter(final StartElement element, final @N final Attribute attr = getAttributeByName(element, parameter); if (Objects.nonNull(attr)) { final String val = attr.getValue(); - if (Objects.nonNull(val) && !val.isEmpty()) { // TODO: Convert (inverted) to 'else' below - if ("true".equalsIgnoreCase(val)) { - return true; - } else if ("false".equalsIgnoreCase(val)) { - return false; - } else { - warner.handle(new MissingPropertyException(element, path, parameter, - new IllegalArgumentException( - "Boolean can only be true or false"))); - } + if ("true".equalsIgnoreCase(val)) { + return true; + } else if ("false".equalsIgnoreCase(val)) { + return false; + } else if (Objects.nonNull(val) && !val.isEmpty()) { + warner.handle(new MissingPropertyException(element, path, parameter, + new IllegalArgumentException( + "Boolean can only be true or false"))); } } return defaultValue;