Thanks,


I am not explicitly calling the dispose method . Here is an overview of what I 
am doing.



1.       opening a XSpreadsheetDocument (called temp_doc)  by calling after 
creating an object using  XMultiComponentFactory::createInstanceWithContext.

a.       The document is a .ots file which opens as "Untitled 1".

2.       XComponent  temp_comp = UnoRuntime.queryInterface(XComponent.class, 
temp_doc);

3.       XStoreable store = UnoRuntime.queryInterface(XStoreable.class, 
temp_comp);

a.        exporting "Unititled 1",  to an "ODF Spreadsheet", "StarOffice XML 
(Calc)" format by setting the PropertyValue FilterName property.  Once the 
properties are set, I use XStoreable::stopToURL to save "Untitled 1" to 
"RawData.ods"

4.       Then I close the document:

a.       XModel model = UnoRuntime.queryInterface(XModel.class, document);

b.      If model not null then, XCloseable closeable = 
UnoRuntime.queryInterface(XCloseable.class, model);

                                                               i.      
closeable.close(); (This is always the case that happens)

c.       If model null then,  XComponent disposable = 
UnoRuntime.queryInterface(Xcomponent.class,  model);

                                                               i.      
disposable.dispose(); (My code never gets into this condition)

5.       I then immediately open the file I exported in step three above by 
creating a new XSpreadsheetDocument (called doc), using the same methods 
defined in step one above,  but when I do a

a.       document = UnoRuntime.queryInterface(XpreadsheetDocument.class, 
xCalcComponent);

I receive: com.sun.star.lang.DisposedExcpetion

                at 
com.sun.star.lib.uno.environments.remote.JobQueue.removeJob(JobQueue.java: 210)





Hopefully, this provides some context. Basically, I am opening an .ots file, 
saving(exporting) it as an .ods file and closing it. Then  I open the .ods file 
so that I can populate the cells with data, but right after 
loadComponentFromURL, I try to query the XComponent returned from 
loadComponentFromURL to get the XSpreadsheetDocument.  That is when I get the 
DisposedException.





-----Original Message-----
From: Andre Fischer [mailto:awf....@gmail.com]
Sent: Tuesday, February 25, 2014 1:26 AM
To: Steele, Raymond; api@openoffice.apache.org
Cc: awf....@gmail.com
Subject: Re: EXTERNAL: Re: DisposedException



On 24.02.2014 20:56, Steele, Raymond wrote:

> Thanks for responding. How can I determine what called dispose()?



If you want to know who calls dispose() then you have to place a breakpoint in 
the dispose() method of xCalcComponent.



If you want to know when dispose() is called then register a 
com::sun::star::lang::XEventListener at the xCalcComponent object. When it is 
disposed, it will call disposing(...) at the listener.

I am just not sure if it calls disposing() when the object is already disposed 
when the listener is registered.  Probably not.



>   This is working in version AOO 3.3. Has something changed?



Without knowing the context this can easily be a timing problem in a 
multi-threaded environment: in AOO 3.3 some operation took longer resulting in 
the dispose() call made a few milliseconds later (or anything to this effect.)



-Andre



>

> -----Original Message-----

> From: Andre Fischer [mailto:awf....@gmail.com]

> Sent: Monday, February 24, 2014 3:54 AM

> To: api@openoffice.apache.org<mailto:api@openoffice.apache.org>

> Subject: EXTERNAL: Re: DisposedException

>

> On 21.02.2014 19:20, Steele, Raymond wrote:

>> While running my application using AOO 4.0.1 on Solaris 11,  a 
>> star.lang.DisposedException is thrown  inconsistently (sometimes it works) 
>> when I use UnoRuntime.queryInterface.

>>

>> The line of code causing the issue:

>>

>> XSpreadsheetDocument  document =

>> UnoRuntime.queryInterface(XSpreadsheetDocument.class,

>> xCalcCompinent);

> The DisposedException means that the throwing object has been marked by its 
> owner for destruction in the near future.  Any access after that results in 
> the DisposedException being thrown.

>

> That means, that the line above is executed after xCalcCompinent has received 
> a dispose() call.

>

> -Andre

>

>> This works perfectly when I use AOO 3.3, but not since upgrading to 4.0.1.

>>

>> Any help would be appreciated.

>>

>> Thanks,

>> Raymond

>>

>>

>

> ---------------------------------------------------------------------

> To unsubscribe, e-mail: 
> api-unsubscr...@openoffice.apache.org<mailto:api-unsubscr...@openoffice.apache.org>

> For additional commands, e-mail: 
> api-h...@openoffice.apache.org<mailto:api-h...@openoffice.apache.org>

>


Reply via email to