Apache OpenOffice (AOO) Bugzilla – Issue 57049
XDocumentInsertable.insertDocumentFromURL() causes OOo to freeze if the provides URL can't be resolved.
Last modified: 2013-02-24 21:06:34 UTC
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); } }
sw->tl: reproducible on Solaris
.
The problem does not seem to exist anymore in 680 m173. Please run the following Basic macro to check ============================== Sub Main ' create insertion-textcursor xTextDoc = ThisComponent xInsert = xTextDoc.getText().createTextCursor() 'msgbox "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 = DimArray() xInsert.insertDocumentFromURL("file:///c:/aFolder/aNonExistingFile", insertProps) 'msgbox "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 = DimArray() xInsert.insertDocumentFromURL("http://www.michgibtswirklichnichtglaubichauchnicht.de/index.odt", insertProps) msgbox "finished!" End Sub ============================== There will be proper messages about a non-existing file/directory and the second one will report a time-out. Thus everything seems fine here. TL->CN: Please confirm. Thanks!
please note: one can't reproduce this bug with basic (as already mentioned above)! the bug only occurs when using java! Please try my java-example code instead of the basic code!!!
cn->tl: This bug is reproducable with Java. I have adopted the UNO-API-Tests. To reproduce just do a checkapi -o sw.SwXTextCursor::com::sun::star::document::XDocumentInsertable Note: since cws qadev27 is not integrated please run the test inside a qadev27 environment on windows.
Duplicate to internal issue 136993. Fixed in CWS jl40 and in CWS jl40_OOD680. Already integrated in SRC680m182 and OOD680m1. Thus it will be fine in OOo 2.0.4. TL->CN: please confirm and close. Thanks!
cn->tl: in src680_m189 I get no freeze anymore but a message box appears. This in the view of API development also a freeze.
Note: qadev27 is already integrated in SRC680 m195
In SRC680 m200 I see two message boxes popping up. And in essence this issue is the same as issue 73992. Thus closing this one as duplicate. *** This issue has been marked as a duplicate of 73992 ***
The Issue you raised has been marked as 'Resolved' and not updated within the last 1 year+. I am therefore setting this issue to 'Verified' as the first step towards Closing it. If you feel this is incorrect, please re-open the issue and add any comments. Many thanks, Andrew Cleaning-up and Closing old Issues ~ The Grand Bug Squash, pre v3 ~ http://marketing.openoffice.org/3.0/announcementbeta.html
As per previous posting: Verified -> Closed. A Closed Issue is a Happy Issue (TM). Regards, Andrew