[jbossseam-issues] [JBoss JIRA] Closed: (JBSEAM-808) StatckOverflowError if factory specifies it's component

Shane Bryzak (JIRA) jira-events at lists.jboss.org
Mon Sep 15 23:26:30 EDT 2008


     [ https://jira.jboss.org/jira/browse/JBSEAM-808?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shane Bryzak closed JBSEAM-808.
-------------------------------

    Resolution: Done


Fixed, exception is now thrown at deployment time.

> StatckOverflowError if factory specifies it's component
> -------------------------------------------------------
>
>                 Key: JBSEAM-808
>                 URL: https://jira.jboss.org/jira/browse/JBSEAM-808
>             Project: Seam
>          Issue Type: Bug
>          Components: Core
>         Environment: Latest from CVS
>            Reporter: John Ray
>            Assignee: Shane Bryzak
>             Fix For: 2.1.0.CR1
>
>
> I accidently specified the name of my component instead of a context variable and this resulted in a StatckOverflowError. For example
> @Stateful
> @Name("foo")
> @Scope(ScopeType.EVENT)
> public class FooAction implements Foo {
>     @Out("bar")
>     private String bar;
>     @Factory("foo")
>     public void initBar() {
>         ...
>     } 
> }
> I'd sugest changing the code in org.jboss.seam.Component at line 490 to include an if/throw. I highlighted the 2 new lines with an asterisk
>             if ( method.isAnnotationPresent(org.jboss.seam.annotations.Factory.class) )
>             {
>                Init init = (Init) applicationContext.get( Seam.getComponentName(Init.class) ); //can't use Init.instance() here 'cos of unit tests
>                String contextVariable = toName( method.getAnnotation(org.jboss.seam.annotations.Factory.class).value(), method );
> *               if (contextVariable.equals(name))
> *                   throw new IllegalStateException("@Factory method can not be for it's own component: " + name);
>                init.addFactoryMethod(contextVariable, method, this);
>             }

-- 
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