Bug - Fixed Date Formatting Problem

fronobulax

Developer
Staff member
I'm getting a debug log on login with 26684

Unexpected error, debug log printed.
class java.lang.IllegalArgumentException: Cannot format given Object as a Date
java.lang.IllegalArgumentException: Cannot format given Object as a Date
at java.base/java.text.DateFormat.format(DateFormat.java:342)
at java.base/java.text.Format.format(Format.java:159)
at net.sourceforge.kolmafia.textui.command.ShowDataCommand.show(ShowDataCommand.java:101)
at net.sourceforge.kolmafia.textui.command.ShowDataCommand.show(ShowDataCommand.java:76)
at net.sourceforge.kolmafia.textui.command.PlayerSnapshotCommand.snapshot(PlayerSnapshotCommand.java:47)
at net.sourceforge.kolmafia.textui.command.PlayerSnapshotCommand.run(PlayerSnapshotCommand.java:14)

Posting now in case someone can get to it before I can.
 

heeheehee

Developer
Staff member
I believe ShowDataCommand.java:101 should read:
Code:
today.format(DateTimeFormatter.ofPattern(CalendarFrame.LONG_FORMAT.toPattern()))
(also needs an import for java.time.format.DateTimeFormatter)

SimpleDateFormatter#format expects a Date, not a ZonedDateTime.

(I don't have time right now for a PR, or to check that this outputs what we want, but at least it compiles)
 
Top