Apache OpenOffice (AOO) Bugzilla – Issue 52831
OOoBean: NoConnectionException
Last modified: 2013-02-24 21:07:27 UTC
Using the complex text in the bean project one may receive NoConnectionExceptions. The exception is thrown because the java bridge is already disposed. This happens in com/sun/star/comp/beans/Wrapper.java in the constructor xComponent = (com.sun.star.lang.XComponent) UnoRuntime.queryInterface( com.sun.star.lang.XComponent.class, xProxy ); This will cause a disposed exception thrown by the bridge. Every instance of OOoBean uses its own bridge. In the complex test, there is a loop which creates a OOoBean in each pass. The bridge is correctly disposed. The curious thing is, that the OOoBean in which the exception is thrown seems to use a bridge which has been used by one of the previous instances. The message of the DisposedException says that the bridge (which is used by xProxy) has been disposed.
.
The problem is as follows: Each bean instance executes OOoBean.loadFromURL, which obtains an XFrame object xFrame from soffice, wraps it in a Wrapper (class Frame) as aFrame, and passes the Wrapper aFrame back to soffice (xFrames.append(aFrame)). The aFrame Wrapper behaves somewhat like a proxy for xFrame (implements IQueryInterface), but is not detected as a proxy by the java_remote_bridge. Hence, in xFrames.append(aFrame), the java_remote_bridge registers aFrame with the OID of xFrame as a local object in the java_environment. Now, a following bean instance may obtain an xFrame with the same OID as a previous bean instance (because the bridge from the first bean instance has been disposed, and the old XFrame object at soffice side destroyed; the binary UNO remote bridge re-uses OIDs based on memory addresses). If the aFrame Wrapper from the first bean instance has not yet been garbage-collected, mapping in the new xFrame will find the local Wrapper object in the java_environment and use it. But calling any method on that Wrapper object leads to a DisposedException, as it forwards all methods to a proxy belonging to a disposed bridge. The solution is to make the bean Wrapper implement com.sun.star.lib.uno.Proxy, so thate the java_remote_bridge detectes it as a kind of proxy. (This is a little fragile, see the comments in com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge and com.sun.star.lib.uno.bridges.java_remote.ProxyFactory.)
. re-open issue and reassign to jl@openoffice.org
reassign to jl@openoffice.org
reset resolution to FIXED
Created attachment 72234