Skip to content

Commit

Permalink
YAAbstractReader: Flatten nested if statements.
Browse files Browse the repository at this point in the history
  • Loading branch information
kingjon3377 committed Nov 29, 2024
1 parent 815287b commit bf5dedf
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions model/src/main/java/legacy/xmlio/yaxml/YAAbstractReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bf5dedf

Please sign in to comment.