[weld-issues] [JBoss JIRA] Commented: (WELD-782) Better exception message when bean creation fails in EL resolver

Dan Allen (JIRA) jira-events at lists.jboss.org
Tue Dec 7 18:29:01 EST 2010


    [ https://jira.jboss.org/browse/WELD-782?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568358#comment-12568358 ] 

Dan Allen commented on WELD-782:
--------------------------------

Here's the stub of an Arquillian test that demonstrates this scenario:

@Named
public class OrderBean {
   @Inject
   public void init()
   {
      throw new RuntimeException("bean initialization failure");
   }

   public Long getOrderId()
   {
      return 1L;
   }
}

@RunWith(Arquillian.class)
public class Weld782Test {
   @Deployment
   public static Archive<?> createDeployment()
   {
      return ShrinkWrap.create(WebArchive.class).addClass(OrderBean.class)
         .addLibrary(MavenArtifactResolver("org.jboss.weld:weld-extensions:1.0.0.Beta1"))
         .addWebResource(EmptyAsset.INSTANCE, "beans.xml"); 
   }  

   @Inject Expressions expressions;

   @Test
   public void demonstrateProblem()
   {
      expressions.evaluateValueExpression("#{orderBean.orderId}");      
   } 
}

> Better exception message when bean creation fails in EL resolver
> ----------------------------------------------------------------
>
>                 Key: WELD-782
>                 URL: https://jira.jboss.org/browse/WELD-782
>             Project: Weld
>          Issue Type: Bug
>          Components: Web Tier integration (JSF, JSP, EL and Servlet) 
>    Affects Versions: 1.1.0.Beta2
>            Reporter: Dan Allen
>
> When bean creation fails in the EL resolver, Weld reports a misleading error message (defined by ElMessages.RESOLUTION_ERROR)
> WELD-001000 Error resolving property orderBean against base null
> The problem is that the EL resolver just wraps the bean creation in a try/catch block and reports this message if it fails (near end of AbstractWeldELResolver#getValue()). The includes any failures that come from a post-construct/initializer method.
> At this point in the code, base is always null because a bean is being resolved by name (the bean name is in the propertyString).
> Weld should clarify that bean creation failed during bean creation and remove the null reference in the message.   

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the weld-issues mailing list