GeeCON Prague 2014*
The moose likes Servlets and the fly likes The puzzle of out.flush() and IllegalStateException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "The puzzle of out.flush() and IllegalStateException" Watch "The puzzle of out.flush() and IllegalStateException" New topic
Author

The puzzle of out.flush() and IllegalStateException

Wei Geng
Greenhorn

Joined: Dec 10, 2004
Posts: 28
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

Joined: Dec 11, 2004
Posts: 13410

It's already sent the response to the browser.

put:

in the catch block and you will see the exception in the logs.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Wei Geng
Greenhorn

Joined: Dec 10, 2004
Posts: 28

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

Joined: Oct 11, 2004
Posts: 3830
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...
 
GeeCON Prague 2014
 
subject: The puzzle of out.flush() and IllegalStateException