Skip to content

Commit

Permalink
Fix the one lgtm.com warning
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jan 5, 2021
1 parent 2144ef9 commit 3e9580b
Showing 1 changed file with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,32 +74,27 @@ protected ReadablePeriod _fromObject(final JsonParser p, final DeserializationCo
int periodValue = treeNode.path(periodType).asInt();

ReadablePeriod rp;


// !!! 05-Jan-2021, tatu: Change to switch for 2.13 or later (Java 8)
if (periodName.equals( "Seconds" )) {
rp = Seconds.seconds( periodValue );
}
else if (periodName.equals( "Minutes" )) {
} else if (periodName.equals( "Minutes" )) {
rp = Minutes.minutes( periodValue );
}
else if (periodName.equals( "Hours" )) {
} else if (periodName.equals( "Hours" )) {
rp = Hours.hours( periodValue );
}
else if (periodName.equals( "Days" )) {
} else if (periodName.equals( "Days" )) {
rp = Days.days( periodValue );
}
else if (periodName.equals( "Weeks" )) {
} else if (periodName.equals( "Weeks" )) {
rp = Weeks.weeks( periodValue );
}
else if (periodName.equals( "Months" )) {
} else if (periodName.equals( "Months" )) {
rp = Months.months( periodValue );
}
else if (periodName.equals( "Years" )) {
} else if (periodName.equals( "Years" )) {
rp = Years.years( periodValue );
} else {
ctxt.reportInputMismatch(handledType(),
"Don't know how to deserialize %s using periodName '%s'",
handledType().getName(), periodName);
rp = null; // never gets here
return null; // never gets here
}

if (_requireFullPeriod && !(rp instanceof Period)) {
Expand Down

0 comments on commit 3e9580b

Please sign in to comment.