-
Bug
-
Resolution: Done
-
Major
-
3.0.1.Final
-
Low
org.jboss.resteasy.specimpl.ResponseBuilderImpl.lastModified does not format date correctly.
This is regression between 2.3.5.Final and 3.0.1.Final.
In 2.3.5.Final the code did date formatting correctly (however null date https://issues.jboss.org/browse/RESTEASY-630 was not handled):
public Response.ResponseBuilder lastModified(Date lastModified) { if (lastModified == null) metadata.remove(HttpHeaderNames.LAST_MODIFIED); metadata.putSingle(HttpHeaderNames.LAST_MODIFIED, DateUtil.formatDate(lastModified)); return this; }
In 3.0.1.Final it does not do formatting correctly, so header value is just a toString of Date object (however null Date https://issues.jboss.org/browse/RESTEASY-630 is fixed):
public Response.ResponseBuilder lastModified(Date lastModified) { if (lastModified == null) { metadata.remove(HttpHeaderNames.LAST_MODIFIED); return this; } metadata.putSingle(HttpHeaderNames.LAST_MODIFIED, lastModified); return this; }
It has been caused by this commit:
https://github.com/resteasy/Resteasy/commit/05ee0510eb80f949fc52700d21cedbfd6f08994d
Fixed code should follow the form of "expires(Date)" method in the same class to both format date correctly and handle null date.
Same bug as this was also in past, in version 1.0.2:
https://issues.jboss.org/browse/RESTEASY-222