GeeCON Prague 2014*
The moose likes Servlets and the fly likes session invalidate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "session invalidate" Watch "session invalidate" New topic
Author

session invalidate

Amol Dongre
Greenhorn

Joined: Sep 17, 2010
Posts: 11
when invalidate is called on HttpSession object what happens to session will it become null?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61314
    
  66

What happened when you tried it?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Amol Dongre
Greenhorn

Joined: Sep 17, 2010
Posts: 11
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

Joined: Aug 01, 2007
Posts: 485

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()


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61314
    
  66

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?
 
 
subject: session invalidate