• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mock Exam/Chap-5/Bryan Basham

 
Vivek Kinra
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to book and also I think the answer to question 1 is B only

when using a RequestDispatcher, the use of which methods can often lead to an IllegalStateException?

A) read
B) flush
c) write
D) getOutputStream
E) getResourceStream

but the errata of book on oreilly website says
[215] Answer to question 1;
Option C should also be checked. i.s write is also true

I am also adding a response by Bryan Basham in one of the post By Bryan

Any answers???
 
Ernesto Leyva
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this is a semantic problem.

For instance this other link explains how to throw and exception when invoking a getOutputStream and a request dispatcher.

But I believe both links exemplifies extraordinary circumstances.

While the question refers to the common case when a RequestDispatcher
will throw the exception. The question says

when using a RequestDispatcher, the use of which methods can often lead to an IllegalStateException?


in that context flush() is the most common case.
if you are rigorous write() and getOutputStream may potentially throw an IlegalStateException, as well.
 
Vivek Kinra
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That means this answer in errata is wrong???
 
Akshay Kiran
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ernest,

can you provide an example where write and getOutputStream trigger an exception?
 
Madhu Sudhana
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please provide an example where write can through the IllegalStateException

Thanks in advance
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic