java - DateTimeFormatter.parseLocalDate throws UnsupportedOperationException -
the api parselocaldate says throw unsupportedoperationexception
"if parsing not supported". mean 'if parsing not supported'? i'm looking through source , can not find anywhere throws unsupportedoperationexception
. has ever been in scenario exception thrown calling parselocaldate
?
datetimeformatter have 2 usages:
- print dates;
- parse dates;
when create datetimeformatter instance, pass datetimeprinter , datetimeparser.
if formatter has printer, , want parse date - unsupportedoperationexception
thrown.
if formatter has parser, , want print date - unsupportedoperationexception
thrown.
example
datetimeformatter formatter = new datetimeformatter(new datetimeprinter() { // implements abstract methods }, null); // instance has printer , hasn't parser formatter.print(new datetime()); // works formatter.parsedatetime("datetimestring"); // throws exeption
Comments
Post a Comment