Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

session invalidate

 
Amol Dongre
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when invalidate is called on HttpSession object what happens to session will it become null?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happened when you tried it?
 
Amol Dongre
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when i called method on session for ex. getAttribute() it throws IllegalStateException so if session is null it should throw nullpointerException
 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Illegal state exception occurs when the session has been invalidated/expired, and you try to access it.

Throws IllegalStateException - if Object getAttribute(String name) is called on an invalidated session

HttpSession-getAttribute()
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which answers the question "does it become null"? Doesn't it?

In fact, if you think about it, how could it become null? Do you think that something is going to reach into your code and change variable values out of the blue?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic