[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-2437) @In(create=true, value="#{...}") throws exceptions if required = false is not specified

Ajay Gupta (JIRA) jira-events at lists.jboss.org
Mon Dec 31 00:11:43 EST 2007


@In(create=true, value="#{...}") throws exceptions if required = false is not specified
---------------------------------------------------------------------------------------

                 Key: JBSEAM-2437
                 URL: http://jira.jboss.com/jira/browse/JBSEAM-2437
             Project: JBoss Seam
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.0.1.CR1
            Reporter: Ajay Gupta


I have a SEAM component as follows:

@Name("customer")
@Scope(CONVERSATION)
public class Customer
{
   @In (create=true)
   private Address address;

   @Factory(value="address")
   public void getAddress()
   {
       this.address = ....//logic to populate address attribute in Customer.
   }

   public void doSomething() {
   ....
   }
}

In this case, when Customer.doSomething() is called and if customer.address = null, then the code as shown above fails with an exception stating:  "non-null address value should not be null".  To make the code above to work, I have to add required = false to the @In annotation.  SEAM still calls the factory method for address to populate the Address attribute in Customer before calling Customer.doSomething().  

I would think that if create=true is specified on an @In annotation and required attribute is not specified on @In, then an exception should only be thrown if the attribute is truly null (if the attribute can be given a non-null value using a @Factory method, then required=true should not be enforced).  


   

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list