-
Bug
-
Resolution: Done
-
Major
-
3.0.0.Alpha16
-
None
When you are doing in your extension something like:
void observesABD(@Observes AfterBeanDiscovery abd) throws NoSuchMethodException { Method melonMethod = FruitObserver.class.getMethod("observesMelon", Melon.class); abd.addObserverMethod().read(melonMethod) ... }
and "observesMelon" doesn't have any @Observes param then Weld fails with NPE:
java.lang.NullPointerException at org.jboss.weld.bootstrap.events.builder.ObserverMethodConfiguratorImpl.read(ObserverMethodConfiguratorImpl.java:94) at org.jboss.cdi.tck.tests.extensions.configurators.observerMethod.AfterBeanDiscoveryObserver.observesABD(AfterBeanDiscoveryObserver.java:62) 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.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:96) at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:86) at org.jboss.weld.injection.MethodInvocationStrategy$SimpleMethodInvocationStrategy.invoke(MethodInvocationStrategy.java:129) at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:344) at org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(ExtensionObserverMethodImpl.java:123) at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:322) at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:300) at org.jboss.weld.util.Observers.notify(Observers.java:140) at org.jboss.weld.event.ObserverNotifier.notifySyncObservers(ObserverNotifier.java:300) at org.jboss.weld.event.ObserverNotifier.notify(ObserverNotifier.java:288) at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:165) at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:159) at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:53) at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:44) at org.jboss.weld.bootstrap.events.AfterBeanDiscoveryImpl.fire(AfterBeanDiscoveryImpl.java:74) at org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:419) at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83) at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:95) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:74