2nd Answer's Result (Last paragraph) of Chapter 6
IllegalStateException is thrown before it reach the isNew() method on session. Since session.setMaxInactiveInterval(0) will cause the session invalidated immediately, the next line of code session.getAttribute("foo") method will throw IllegalStateException before it reach session.isNew() method.
Note from the Author or Editor:
Remove the line of code that reads "String foo = (String) session.getAttribute("foo");
On pg 249: also remove that line