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

MockHttpSession does not implement invalidate() properly [SPR-9686] #14320

Closed
spring-issuemaster opened this issue Aug 9, 2012 · 1 comment
Assignees
Milestone

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Aug 9, 2012

Carl Holmes opened SPR-9686 and commented

Status Quo

The invalidate() method in MockHttpSession is implemented incorrectly, according to the contract of the method:

Throws: java.lang.IllegalStateException if this method is called on an already invalidated session

However, invoking invalidate() on the same MockHttpSession instance twice does not do this.

Proposal

This can be fixed easily by including a check on the invalid field, and throwing an IllegalStateException if it is true before setting it to true for the first time.


Affects: 3.1.2

Issue Links:

  • #12315 MockHttpSession methods should throw IllegalStateException if invalid
@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Aug 16, 2012

Sam Brannen commented

This has been completed as described in the comments for GitHub commit 8059625670aedbdb1f5b9689ef1a9cbc41b050ec.

Implement invalidate() properly in MockHttpSession

The invalidate() method in MockHttpSession is currently implemented
incorrectly. According to the Servlet specification, the method should
throw an IllegalStateException if it is invoked on an already
invalidated session. However, invoking invalidate() on the same
MockHttpSession instance multiple times does not throw an exception.

This commits addresses this issue by checking the invalid field and
throwing an IllegalStateException if it has already been set to true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.