To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=57049
Issue #:|57049
Summary:|XDocumentInsertable.insertDocumentFromURL() causes
|OOo to freeze if the provides URL can't be resolved.
Component:|api
Version:|OOO 2.0 Beta2
Platform:|All
URL:|
OS/Version:|Windows 2000
Status:|UNCONFIRMED
Status whiteboard:|
Keywords:|
Resolution:|
Issue type:|DEFECT
Priority:|P3
Subcomponent:|code
Assigned to:|sw
Reported by:|clutz
------- Additional comments from [EMAIL PROTECTED] Mon Oct 31 06:48:40 -0800
2005 -------
In some cases the XDocumentInsertable.insertDocumentFromURL() causes OOo to
freeze if the provided URL can't be resolved. The problem only occurs when using
insertDocumentFromURL() from Java. Using StarBasic, there is a correct error
message that tells you that the provided URL can't be resolved.
Here is a code-examples:
import com.sun.star.beans.PropertyValue;
import com.sun.star.comp.helper.Bootstrap;
import com.sun.star.document.XDocumentInsertable;
import com.sun.star.frame.FrameSearchFlag;
import com.sun.star.frame.XComponentLoader;
import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.text.XText;
import com.sun.star.text.XTextCursor;
import com.sun.star.text.XTextDocument;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
public class InsertDocumentFromURLTest {
public static void main(String[] args) throws Exception {
PropertyValue[] insertProps;
// bootstrap and create Desktop
XComponentContext xContext = Bootstrap.bootstrap();
XMultiComponentFactory xMCF = xContext.getServiceManager();
Object desktop = xMCF.createInstanceWithContext(
"com.sun.star.frame.Desktop", xContext);
// create empty document
XComponentLoader xLoader = (XComponentLoader) UnoRuntime
.queryInterface(XComponentLoader.class, desktop);
XComponent doc = xLoader.loadComponentFromURL(
"private:factory/swriter", "_blank", FrameSearchFlag.CREATE,
new PropertyValue[0]);
// create insertion-textcursor
XTextDocument xTextDoc = (XTextDocument) UnoRuntime.queryInterface(
XTextDocument.class, doc);
XText xText = xTextDoc.getText();
XTextCursor cursor = xText.createTextCursor();
XDocumentInsertable xInsert = (XDocumentInsertable) UnoRuntime
.queryInterface(XDocumentInsertable.class, cursor);
System.out.println("test 1");
// trying to insert a document with a non-existing file-URL
// causes OOo to freeze IF the URL start with a drive letter "c:"
insertProps = new PropertyValue[] {};
xInsert.insertDocumentFromURL(
"file:///c:/aFolder/aNonExistingFile", insertProps);
System.out.println("test 2");
// trying to insert a document with a non-existing file-URL
// causes OOo to freeze IF the URL is an unresolved http-url.
insertProps = new PropertyValue[] {};
xInsert.insertDocumentFromURL(
"http://www.michgibtswirklichnichtglaubichauchnicht.de/index.odt",
insertProps);
System.out.println("finished!");
System.exit(0);
}
}
---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]