Uploaded image for project: 'OpenWebBeans'
  1. OpenWebBeans
  2. OWB-1066

Stack overflow on firing parameterized event

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.0
    • Fix Version/s: 1.6.0
    • Component/s: Events
    • Labels:
      None

      Description

      Firing Arrays.asList(1, 4, 9, 16) as an event of type List<Integer> results in a stack overflow:

      javax.enterprise.event.ObserverException: Caught Exception while handling event object with type : java.lang.Object
      	at org.apache.webbeans.event.NotificationManager.fireEvent(NotificationManager.java:641)
      	at org.apache.webbeans.container.BeanManagerImpl.fireEvent(BeanManagerImpl.java:481)
      	at org.apache.webbeans.container.BeanManagerImpl.fireEvent(BeanManagerImpl.java:466)
      	at org.apache.webbeans.container.BeanManagerImpl.fireEvent(BeanManagerImpl.java:456)
      	at org.apache.webbeans.lifecycle.StandaloneLifeCycle.afterStartApplication(StandaloneLifeCycle.java:62)
      	at org.apache.webbeans.lifecycle.AbstractLifeCycle.bootstrapApplication(AbstractLifeCycle.java:141)
      	at org.apache.webbeans.lifecycle.AbstractLifeCycle.startApplication(AbstractLifeCycle.java:104)
      	at org.apache.deltaspike.cdise.owb.OpenWebBeansContainerControl.boot(OpenWebBeansContainerControl.java:68)
      	at demo.LifecycleEventTest.shouldNotFireInitializedTwice(LifecycleEventTest.java:34)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
      	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
      Caused by: org.apache.webbeans.exception.WebBeansException: java.lang.reflect.InvocationTargetException
      	at org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:314)
      	at org.apache.webbeans.event.NotificationManager.fireEvent(NotificationManager.java:610)
      	... 31 more
      Caused by: java.lang.reflect.InvocationTargetException
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.apache.webbeans.event.ObserverMethodImpl.invoke(ObserverMethodImpl.java:343)
      	at org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:308)
      	... 32 more
      Caused by: java.lang.StackOverflowError
      	at java.lang.Class.getInterfaces(Class.java:845)
      	at org.apache.webbeans.util.GenericsUtil.getDirectSubclass(GenericsUtil.java:1000)
      	at org.apache.webbeans.util.GenericsUtil.getDirectSubclass(GenericsUtil.java:1011)
      	at org.apache.webbeans.util.GenericsUtil.getDirectSubclass(GenericsUtil.java:1011)
      	at org.apache.webbeans.util.GenericsUtil.getDirectSubclass(GenericsUtil.java:1011)
      	at org.apache.webbeans.util.GenericsUtil.getDirectSubclass(GenericsUtil.java:1011)
      

      To reproduce, take the test case attached to OWB-1065 and uncomment a line in the Sender class:

          public void onInitialized(@Observes @Initialized(ApplicationScoped.class) Object object) {
              List<Integer> list = new ArrayList<>(Arrays.asList(1, 4, 9, 16));
              list = Arrays.asList(1, 4, 9, 16);
              event.fire(list);
          }
      

        Attachments

          Activity

            People

            • Assignee:
              struberg Mark Struberg
              Reporter:
              hwellmann Harald Wellmann
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: