Hi guys and girls,
I'm doing a rather primitive thing: load and close a document.
Question: why does it make OO grow 50Mb/minute?
Code:
import com.sun.star.beans.PropertyValue;
import com.sun.star.frame.XComponentLoader;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
import com.sun.star.util.CloseVetoException;
import com.sun.star.util.XCloseable;
public class Test2 {
public static void main(String[] args) throws Exception {
XComponentContext xCompContext =
com.sun.star.comp.helper.Bootstrap.bootstrap();
XMultiComponentFactory xMCF = xCompContext.getServiceManager();
Object xDesktop =
xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", xCompContext);
XComponentLoader aLoader =
UnoRuntime.queryInterface(XComponentLoader.class, xDesktop);
PropertyValue[] loadProps = new PropertyValue[]{new
PropertyValue("Hidden", 0, true, null)};
while (true) {
XComponent xComponent =
aLoader.loadComponentFromURL("file:///tmp/demo.ods", "_blank", 0,
loadProps);
close(xComponent);
}
}
private static void close(XComponent xComponent) {
XCloseable xCloseable =
UnoRuntime.queryInterface(XCloseable.class,
xComponent);
if (xCloseable != null) {
try {
xCloseable.close(false);
} catch (CloseVetoException e) {}
} else xComponent.dispose();
}
}
-
To unsubscribe, e-mail: dev-unsubscr...@openoffice.org
For additional commands, e-mail: dev-h...@openoffice.org