Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The puzzle of out.flush() and IllegalStateException

 
Wei Geng
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There was a puzzle about the IllegalStateException with the out.flush().


The result is that the page display "Hello" but not an error-page.
Even though I am sure that IllegalStateException was threw out, the error-page did not appear.


What did lead to the different results with the existence of the "out.flush()"?
Who can give me an explanation about this puzzle?
Thanks very much.

[ July 20, 2006: Message edited by: Wei GENG ]

[ July 20, 2006: Message edited by: Wei GENG ]
[ July 20, 2006: Message edited by: Wei GENG ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's already sent the response to the browser.

put:

in the catch block and you will see the exception in the logs.
 
Wei Geng
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

in the catch block and you will see the exception in the logs.[/qb]<hr></blockquote>

As you said, I did catch the IllegalStateException with the try-catch block.
But when I removed the try-catch block, the error-page were not be displayed either.

What is the mechanism about the out.flush() and IllegalStateException?
May I suppose that once the response was committed to the browser, it will be ignored whether the Exception was threw out, and error-page would never appear?
[ July 20, 2006: Message edited by: Wei GENG ]
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Wei GENG:
There was a puzzle about the IllegalStateException with the out.flush().


The result is that the page display "Hello" but not an error-page.
Even though I am sure that IllegalStateException was threw out, the error-page did not appear.


What did lead to the different results with the existence of the "out.flush()"?
Who can give me an explanation about this puzzle?
Thanks very much.

[ July 20, 2006: Message edited by: Wei GENG ]

[ July 20, 2006: Message edited by: Wei GENG ]

[ July 20, 2006: Message edited by: Wei GENG ]



Exception do come but at the BE (Back End), and response is already commited/sent to the user so...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic