BeansXmlHandler indirectly causes NPE in Wildfly
by Maxim Frolov
recently I found a bug in Wildfly: https://issues.jboss.org/browse/WFLY-3147
After looking at the source code I found that the BeansXmlHandler always
calls interpolate() method, even if the argument is null.
Does it make sence?
In my opinion, BeansXmlHandler must not call interpolate() method if the
String value is null (i.e. absent).
My questions to this mailing list are:
1) Is this really bug in weld and I should report a JIRA bug / make a pull
2) Does this work as expected/designed and the bug is in Wildfly?
AfterBeanDiscovery and observer resolver cache
by Christian Sadilek
CDI extensions can observe the AfterBeanDiscovery event to register observer methods (addObserverMethod). However, when an event is first fired, the observers for that event are resolved and then cached (in TypeSafeResolver). All future calls to addObserverMethod for an already fired event with corresponding qualifiers will have no effect because the observer result is read from cache and not recomputed.
>From an API perspective that's unfortunate because addObserverMethod will only work until an event (with corresponding qualifiers) is fired and there is no indication to the caller of that method that it didn't have any effect when invoked after that.
- Provide some public API to clear/recompute that part the observer cache. Maybe that exists? I couldn't find it which is why I am using the private API and Reflection :(. Also let AfterBeanDiscovery.addObserverMethod fail in that case with the advice to reset the cache.
- Recompute the corresponding part of the cache when addObserverMethod is called (seems preferable).
OpenWebBeans doesn't have this issue as their NotificationManager will simply add the new ObserverMethod to a ConcurrentHashMap that is also accessed when an event is fired.
What do you think? Can this already be done or is there another solution?