Exception when removing wrong bean #209

Closed
hendrikebbers opened this Issue Jul 12, 2016 · 0 comments

Projects

None yet

1 participant

@hendrikebbers
Member
hendrikebbers commented Jul 12, 2016 edited

I think it would be better to only log a warning method in this case instead of throwing an exception.

Example:

List<MyBean> toRemove = new ArryaList<MyBean>(myObservableList);
myObservableList.clear();
beanManager.removeAll(toRemove);

In this case the GC will already mark all beans that are in the list as removable by calling myObservableList.clear(). The next line (beanManager.removeAll(toRemove)) wants to mark the beans again. This ends in in an exception:

Caused by: java.lang.IllegalArgumentException: Bean is not managed by GC
       at com.canoo.dolphin.server.impl.gc.GarbageCollector.onBeanRemoved(GarbageCollector.java:109) [dolphin-platform-server-0.8.6.jar:0.8.6]
       at com.canoo.dolphin.server.impl.ServerBeanRepositoryImpl.delete(ServerBeanRepositoryImpl.java:39) [dolphin-platform-server-0.8.6.jar:0.8.6]
       at com.canoo.dolphin.impl.BeanManagerImpl.remove(BeanManagerImpl.java:51) [dolphin-platform-core-0.8.6.jar:0.8.6]
       at com.canoo.dolphin.impl.BeanManagerImpl.removeAll(BeanManagerImpl.java:71) [dolphin-platform-core-0.8.6.jar:0.8.6]
       at org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:45) [weld-core-1.1.31.Final-redhat-1.jar:1.1.31.Final-redhat-1]
       at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105) [weld-core-1.1.31.Final-redhat-1.jar:1.1.31.Final-redhat-1]
       at org.jboss.weld.proxies.BeanManager$Serializable$848835708$Proxy$_$$_WeldClientProxy.removeAll(BeanManager$Serializable$848835708$Proxy$_$$_WeldClientProxy.java) [weld-core-1.1.31.Final-redhat-1.jar:]
       at ch.irix.decos.controller.DealDetailController.destroy(DealDetailController.java:207) [classes:]
       ... 39 more

It looks like the error depends on the type of the list. The list is defined as ObservableList<String> and calling beanManager.removeAll(list) for a list with Strings end in this exception.

@hendrikebbers hendrikebbers added this to the 0.8.7 milestone Jul 12, 2016
@hendrikebbers hendrikebbers changed the title from Calling beanManager.remove for a bean that is marked by GC as removed ends in Excepting to Exception when removing wrong bean Aug 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment