This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
This will not compile under Java 1.4. The second parameter must be an object. If you are using Java 1.5, this may be ok since the 0 may auto-box to an Integer. I'm not sure since I'm still using 1.4.
int errorFlag = (int) session.getAttribute("errorflag", 0);
First, getAttribute() does not take a second parameter.
Second, since you cannot cast anything to something that it is not, you cannot cast the return value of type Object to int, since int is not an Object. If an Integer is being returned, you could use the intValue() method to obtain the int value of the Integer.
Again, I'm not certain what the auto-boxing behavior of Java 1.5 would be -- it could be that your only issue is the spurious 2nd parameter. [ October 27, 2005: Message edited by: Bear Bibeault ]