struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Darren Boyd <dar...@bitcraft.ca>
Subject [shale] ShalePhaseListener behaviour when ViewController throws exceptions
Date Wed, 21 Dec 2005 16:53:56 GMT

I've come across an issue with the ShalePhaseListener that occurs 
whenever a ViewController throws an exception.

We are using MyFaces 1.1.1 in a project but have also included 
shale-core.jar and shale-spring.jar to take advantage of the shale's 
ViewController functionality (which is a lifesaver for us, btw, thanks!).

We are encountering a problem whenever our ViewController throws an 
exception from a ViewController.prerender() call.  The exception makes 
its way to the container which is configured to forward to a custom 
error page.  This error page is a JSF page (which is not mapped to a 
ViewController) and the PhaseListener calls the same 
ViewController.prerender() a second time which generates the same 
exception.  At this point the container (Tomcat) simply generates the 
default 'Error 500' page.

The problem seems to be a simple piece of code in the ShaleViewHandler. 
  In the beforeRenderResponse(PhaseEvent) method we have the following...

     Map map =
       event.getFacesContext().getExternalContext().getRequestMap();
     ViewController vc = (ViewController)
     map.get(ShaleConstants.VIEW_RENDERED);
     if (vc == null) {
         return;
     }
     vc.prerender();
     map.remove(ShaleConstants.VIEW_RENDERED);


I believe that the map.remove() statement should be called before the 
vc.prerender().  That should ensure that the prerender is only called 
once in a request.  This same issue might exist for preprocess() as 
well, but I'm not that familiar with the code to completely understand 
it.  I am confident it isn't an issue for init() or destroy().

Is this a bug?  If so, I can open a bugzilla ticket for it, provide a 
diff, etc.

Thanks,
Darren


-- 
Darren Boyd
Bitcraft Enterprises Inc.
darren@bitcraft.ca
403-816-1670
http://bitcraft.ca/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message