[jbossseam-issues] [JBoss JIRA] Updated: (JBSEAM-2539) SeamTest - NonFacesRequest "eats" exceptions
Pete Muir (JIRA)
jira-events at lists.jboss.org
Tue Jul 29 17:44:53 EDT 2008
[ https://jira.jboss.org/jira/browse/JBSEAM-2539?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pete Muir updated JBSEAM-2539:
------------------------------
Fix Version/s: 2.1.0.BETA2
(was: 2.1.0.GA)
> SeamTest - NonFacesRequest "eats" exceptions
> --------------------------------------------
>
> Key: JBSEAM-2539
> URL: https://jira.jboss.org/jira/browse/JBSEAM-2539
> Project: Seam
> Issue Type: Bug
> Components: Test Harness
> Affects Versions: 2.0.1.CR2
> Reporter: Darryl Smith
> Fix For: 2.1.0.BETA2
>
>
> @Name("failComp")
> public class FailComp {
> public void failMethod(){
> throw new NullPointerException();
> }
> }
> Test
> ----
> public class FailCompTests extends SeamTest {
> @Test
> public void facesRequest() throws Exception{
> new FacesRequest("/failComp.xhtml"){
> @Override
> protected void invokeApplication() throws Exception {
> invokeMethod( "#{failComp.failMethod}");
> }
> }.run();
> }
> @Test
> public void nonFacesRequest() throws Exception{
> new NonFacesRequest("/failComp.xhtml"){
> }.run();
> }
> }
> failComp.page.xhtml
> -------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <page xmlns="http://jboss.com/products/seam/pages"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd">
> <action execute="#{failComp.failMethod}"/>
> </page>
> With this setup facesRequest() will fail correctly, but nonFacesRequest() will pass
> [01/26 15:44:23] ERROR [seam.jsf.SeamPhaseListener] - <uncaught exception>
> javax.el.ELException: java.lang.NullPointerException
> at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:333)
> at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
> at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
> at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
> at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
> at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:173)
> at org.jboss.seam.navigation.Page.preRender(Page.java:264)
> at org.jboss.seam.navigation.Pages.preRender(Pages.java:309)
> at org.jboss.seam.jsf.SeamPhaseListener.preRenderPage(SeamPhaseListener.java:549)
> at org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:460)
> at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:144)
> at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:114)
> at org.jboss.seam.mock.BaseSeamTest$Request.renderResponsePhase(BaseSeamTest.java:629)
> at org.jboss.seam.mock.BaseSeamTest$Request.emulateJsfLifecycle(BaseSeamTest.java:622)
> at org.jboss.seam.mock.BaseSeamTest$Request.access$300(BaseSeamTest.java:184)
> at org.jboss.seam.mock.BaseSeamTest$Request$2.doFilter(BaseSeamTest.java:530)
> at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
> at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
> at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
> at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
> at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
> at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
> at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
> at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
> at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
> at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
> at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
> at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
> at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
> at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
> at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
> at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
> at org.jboss.seam.mock.BaseSeamTest$Request.run(BaseSeamTest.java:524)
> at test.FailCompTests.nonFacesRequest(FailCompTests.java:22)
> There is no way to detect the exception throw from nonFacesRequest as SeamPhaseListener's error handler infastructure "eats" the exception due to a rule that most people will have in their pages.xml
> <exception>
> <redirect view-id="/pages/error.xhtml">
> <message>Unexpected error, please try again</message>
> </redirect>
> </exception>
> If you where to remove this rule SeamPhaseListener would really eat the exception.
> A work around is to roll your own Exceptions component e.g.
> @Scope( ScopeType.APPLICATION )
> @BypassInterceptors
> @Install( precedence = Install.MOCK, classDependencies = "javax.faces.context.FacesContext" )
> @Name( "org.jboss.seam.exception.exceptions" )
> public class Exceptions extends org.jboss.seam.exception.Exceptions {
> @Override
> public void handle( Exception e ) throws Exception {
> throw new AssertionError(e);
> }
> }
> but this is something I should not have to do. see http://jira.jboss.org/jira/browse/JBSEAM-2138
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the seam-issues
mailing list