I am using Jersey 1.21.1 and am getting strange behavior when unmarshalling dates.
Simplified version of my POJO:
@XmlRootElement
public class Invoice {
private Date invoiceDate;
private Date invoiceDate2;
}
My resource method:
@PUT
@Consumes(MediaType.APPLICATION_JSON)
public Response putInvoice(Invoice invoice) { .. }
The JavaScript code that calls this service uses JSON.stringify
to produce the following HTTP request payload (this is what was actually sent, according to the Chrome debugger):
{"invoiceDate":"2015-10-27T04:00:00.000Z","invoiceDate2":"2015-10-27T08:00:00.000Z"}
So far so good. But when I stop at a breakpoint inside of putInvoice
and examine the Java dates invoice.invoiceDate and invoice.invoiceDate2, they both have the same fastTime:
1445904000000
(which equals October 27, 2015 12:00:00 AM UTC).
I am at a loss why Jersey/MOXy are seemingly unable to parse what looks to me like a standard ISO UTC date. I can only assume I'm doing something wrong or making a bad assumption. Help would be greatly appreciated.