Skip to content

MockHttpServletResponse.getDateHeader fails with NPE for non-existing header [SPR-16160] #20708

Closed

Description

@spring-projects-issues

Juergen Hoeller opened SPR-16160 and commented

MockHttpServletResponse.getDateHeader doesn't check for the existence of the corresponding header and ends up calling DateFormat.parse with a null value. Aligned with HttpServletRequest.getDateHeader(), it should simply return -1 in such a case.


Affects: 4.3.12, 5.0.1

Issue Links:

Referenced from: commits a75dd2d, 80a0cf7, dc0a934

Backported to: 4.3.13

Activity

  1. spring-projects-issues commented on Nov 5, 2017

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    As far as possible, we're also using MockHttpServletResponse.getDateHeader within our own tests now instead of trying to match the concrete date presentation in the textual header value.

  2. added
    type: bug
    in: test
    status: backported
    on Jan 11, 2019
  3. added this to the 5.0.2 milestone on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: teststatus: backportedtype: bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions