Issue 52831 - OOoBean: NoConnectionException
Summary: OOoBean: NoConnectionException
Status: CLOSED FIXED
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P3 Trivial
Target Milestone: ---
Assignee: joachim.lingner
QA Contact: issues@api
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-03 14:32 UTC by joachim.lingner
Modified: 2013-02-24 21:07 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description joachim.lingner 2005-08-03 14:32:06 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.
Comment 1 joachim.lingner 2005-08-22 09:51:51 UTC
.
Comment 2 Stephan Bergmann 2005-08-22 10:13:03 UTC
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.)
Comment 3 joachim.lingner 2005-08-29 12:07:01 UTC
.

re-open issue and reassign to jl@openoffice.org
Comment 4 joachim.lingner 2005-08-29 12:07:08 UTC
reassign to jl@openoffice.org
Comment 5 joachim.lingner 2005-08-29 12:07:17 UTC
reset resolution to FIXED
Comment 6 joachim.lingner 2005-08-29 12:09:01 UTC
.
Comment 7 joachim.lingner 2005-11-21 16:21:46 UTC
.
Comment 8 Unknown 2010-10-22 19:38:08 UTC
Created attachment 72234