pprint a GregorianCalendar results in Arity exception

Description

What I was doing: attempting to pretty-print nested structures from Things mac app, which include instances of java.util.GregorianCalendar.
What I expected to happen: output should have an #inst very much like printing java.util.Date.
What happened instead: ArityException Wrong number of args (4) passed to: pprint$pretty-writer$fn

Cause: clojure.pprint/pretty-writer does not fully implement the Writer interface used in printing the calendar.

Approach: Better implement Writer interface.

Patch: CLJ-1390-pprint-GregorianCalendar.patch

Screened by: Alex Miller

Environment

None

Attachments

4

Activity

Alex Miller December 28, 2014 at 4:53 PM

Agreed with Steve on approach.

Steve Miner April 10, 2014 at 10:38 PM

CLJ-1390-pprint-GregorianCalendar.patch fixes the pretty_writer.clj proxy to support the missing version of the write method. Includes the same test as the previous patch.

Steve Miner April 10, 2014 at 10:23 PM

I would rather fix the actual bug in pretty_writer.clj. The proxy needs to support more of the java.io.Writer interface. I think adding another arity to the write method would work. Something like:

Norman Richards April 7, 2014 at 4:49 PM

Ok - here's an alternative test case. I'm less happy with this test case, since I have to add the TimeZone and make assumptions about how the specifics of how the pretty printer formats. But, it does test the fix adequately, so if you like the test2 patch better, that's perfectly fine with me.

Andy Fingerhut April 6, 2014 at 9:32 PM

It would be better if the "is" were of the form:

rather than just (is calculated-value "string to show if test fails"). The second form will fail if calculating the value throws an exception, but only the first form will calculate it, and then verify that the value is the expected one (and fail if it is not the expected one).

Completed

Details

Assignee

Reporter

Labels

Approval

Patch

Priority

Fix versions

Created March 26, 2014 at 5:23 AM
Updated July 31, 2015 at 9:39 PM
Resolved July 31, 2015 at 9:39 PM