Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MockHttpServletResponse.setIntHeader throws exception for 'Content-Length' header [SPR-13752] #18325

Closed
spring-projects-issues opened this issue Dec 2, 2015 · 1 comment
Assignees
Labels
in: test Issues in the test module status: backported An issue that has been backported to maintenance branches type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Dec 2, 2015

Dmitry Bedrin opened SPR-13752 and commented

MockHttpServletResponse.setIntHeader("Content-Length", 42) throws an Exception due to a bug in following code:

private boolean setSpecialHeader(String name, Object value) {
     if (CONTENT_TYPE_HEADER.equalsIgnoreCase(name)) {
          setContentType((String) value);
          return true;
     }
     else if (CONTENT_LENGTH_HEADER.equalsIgnoreCase(name)) {
          setContentLength(Integer.parseInt((String) value));
          return true;
     }
     else {
          return false;
     }
}

Affects: 4.1.8, 4.2.3

Issue Links:

Referenced from: pull request #929, and commits a4f5c46, 79ded1c

Backported to: 4.1.9

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Good catch! Fixed for 4.2.4 and 4.1.9 now.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: test Issues in the test module status: backported An issue that has been backported to maintenance branches type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants