java.time
I always recommend that you use java.time, the modern Java date and time API, for your date work. In addition it so happens that java.time will give you the exception you asked for.
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("MM/dd/uuuu")
.withResolverStyle(ResolverStyle.LENIENT);
LocalDate date = LocalDate.parse("10/20/20128", dateFormatter);
Result:
Exception in thread "main" java.time.format.DateTimeParseException:
Text '10/20/20128' could not be parsed at index 6
The mentioned index 6 is where the 5-digit year is in your string.
This said, the range check suggested by others could still be a good idea. With java.time this is easy. Say for example that we don’t want to accept any future date:
LocalDate date = LocalDate.parse("10/20/8012", dateFormatter);
if (date.isAfter(LocalDate.now(ZoneId.systemDefault()))) {
System.err.println("Date must not be in the future, was " + date);
}
Date must not be in the future, was 8012-10-20
Tutorial link: Trail: Date Time (The Java™ Tutorials) explaining how to use java.time.