• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Mock Exam/Chap-5/Bryan Basham

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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???
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That means this answer in errata is wrong???
 
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ernest,

can you provide an example where write and getOutputStream trigger an exception?
 
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please provide an example where write can through the IllegalStateException

Thanks in advance
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic