This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Question 19 of HFSJ Final mocktest Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "Question 19 of HFSJ Final mocktest" Watch "Question 19 of HFSJ Final mocktest" New topic
Author

Question 19 of HFSJ Final mocktest

geeta vemula
Ranch Hand

Joined: Jul 18, 2008
Posts: 208
A Classic tag handler exists in legacy code. The author wrote a handler that evaluates its tag body a hundred times, to be used in testing other tags that produce random content.
What is incorrect about the code?
A. Tag handlers are not thread safe, so the iterationCount can become out of sync if multiple users are reaching the page at the same time.
B. The doAfterBody method is never being called because it is not part of the tag handler lifecycle. The developer should have extended the IterationTagSupport class to include this method in the lifecycle.
C. The doTag method should be doStartTag. As written, the default doStartTag of TagSupport is called which simply returns SKIP_BODY, causing doAfterBody to never be called.
D. When doAfterBody returns EVAL_BODY_AGAIN the doTag method is called again. The doTag method resets iterationCount to 0, resulting in an infinite loop and a java.lang.OutOfMemoryError is thrown.


Answer is C.

here we need to choose correct one or incorrect one??
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
There is something wrong with this question.

TagSupport does not have a 'doTag' method, only SimpleTagSupport has. There should be a doStartTag method involved.


JDBCSupport - An easy to use, light-weight JDBC framework -
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Question 19 of HFSJ Final mocktest
 
Similar Threads
Question and answer from j2eecertificate.
Classic tag error
doStartTag() retun Type
Question from HFJS 2nd Edition
Question 19 in mock exam