Your exception was caused by your specified parsing format "MMM dd, yyyy" not matching the input 2002-10-01.
You commented:
I would need to have it as an LocalDate object in MMM dd, yyyy format
A LocalDate does not have a “format”. Text has a format, but LocalDate is not text.
The LocalDate class can parse an incoming string to produce a LocalDate object. And a LocalDate object can generate a string that represents its value. But a LocalDate object itself is neither of those strings. LocalDate has its own internal representation of a date, the details of which do not concern us.
You said:
I would like to parse a date format YYYY-MM-DD
That format complies with the ISO 8601 standard. The java.time classes use those standard formats by default when parsing/generating text. So no need to specify a formatting pattern.
LocalDate ld = LocalDate.parse( "2002-10-01" ) ;
You said
… into the following MMM dd, yyyy.
Generally better to let java.time automatically localize rather than you hard-code a specific format.
Locale locale = Locale.US ;
DateTimeFormatter f = DateTimeFormatter.ofLocalizedDate( FormatStyle.MEDIUM ).withLocale( locale ) ;
String output = ld.format( f ) ;