Uploaded image for project: 'Seam 2'
  1. Seam 2
  2. JBSEAM-808

StatckOverflowError if factory specifies it's component

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 2.1.0.CR1
    • Component/s: Core
    • Labels:
      None
    • Environment:

      Latest from CVS

      Description

      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); }

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                shane.bryzak Shane Bryzak
                Reporter:
                johnray John Ray
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: