Skip to content

Commit effac4f

Browse files
takezoedain
authored andcommitted
Remove unreachable code in OrderedPeriodParser
1 parent e8cc8e3 commit effac4f

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

core/trino-main/src/main/java/io/trino/util/DateTimeUtils.java

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,6 @@ public int parseInto(ReadWritablePeriod period, String text, int position, Local
408408
int bestValidPos = position;
409409
ReadWritablePeriod bestValidPeriod = null;
410410

411-
int bestInvalidPos = position;
412-
413411
for (PeriodParser parser : parsers) {
414412
ReadWritablePeriod parsedPeriod = new MutablePeriod();
415413
int parsePos = parser.parseInto(parsedPeriod, text, position, locale);
@@ -422,23 +420,13 @@ public int parseInto(ReadWritablePeriod period, String text, int position, Local
422420
}
423421
}
424422
}
425-
else if (parsePos < 0) {
426-
parsePos = ~parsePos;
427-
if (parsePos > bestInvalidPos) {
428-
bestInvalidPos = parsePos;
429-
}
430-
}
431423
}
432424

433-
if (bestValidPos > position || (bestValidPos == position)) {
434-
// Restore the state to the best valid parse.
435-
if (bestValidPeriod != null) {
436-
period.setPeriod(bestValidPeriod);
437-
}
438-
return bestValidPos;
425+
// Restore the state to the best valid parse.
426+
if (bestValidPeriod != null) {
427+
period.setPeriod(bestValidPeriod);
439428
}
440-
441-
return ~bestInvalidPos;
429+
return bestValidPos;
442430
}
443431
}
444432
}

0 commit comments

Comments
 (0)