Skip to content

Commit 3e9580b

Browse files
committed
Fix the one lgtm.com warning
1 parent 2144ef9 commit 3e9580b

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

src/main/java/com/fasterxml/jackson/datatype/joda/deser/PeriodDeserializer.java

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,32 +74,27 @@ protected ReadablePeriod _fromObject(final JsonParser p, final DeserializationCo
7474
int periodValue = treeNode.path(periodType).asInt();
7575

7676
ReadablePeriod rp;
77-
77+
78+
// !!! 05-Jan-2021, tatu: Change to switch for 2.13 or later (Java 8)
7879
if (periodName.equals( "Seconds" )) {
7980
rp = Seconds.seconds( periodValue );
80-
}
81-
else if (periodName.equals( "Minutes" )) {
81+
} else if (periodName.equals( "Minutes" )) {
8282
rp = Minutes.minutes( periodValue );
83-
}
84-
else if (periodName.equals( "Hours" )) {
83+
} else if (periodName.equals( "Hours" )) {
8584
rp = Hours.hours( periodValue );
86-
}
87-
else if (periodName.equals( "Days" )) {
85+
} else if (periodName.equals( "Days" )) {
8886
rp = Days.days( periodValue );
89-
}
90-
else if (periodName.equals( "Weeks" )) {
87+
} else if (periodName.equals( "Weeks" )) {
9188
rp = Weeks.weeks( periodValue );
92-
}
93-
else if (periodName.equals( "Months" )) {
89+
} else if (periodName.equals( "Months" )) {
9490
rp = Months.months( periodValue );
95-
}
96-
else if (periodName.equals( "Years" )) {
91+
} else if (periodName.equals( "Years" )) {
9792
rp = Years.years( periodValue );
9893
} else {
9994
ctxt.reportInputMismatch(handledType(),
10095
"Don't know how to deserialize %s using periodName '%s'",
10196
handledType().getName(), periodName);
102-
rp = null; // never gets here
97+
return null; // never gets here
10398
}
10499

105100
if (_requireFullPeriod && !(rp instanceof Period)) {

0 commit comments

Comments
 (0)