Re: [dev] Buggy insertDocumentFromURL
Christoph Lutz wrote: Hi Mathias, I currently have no idea why you don't get the error message from Java. OTOH I think that the error message in an API call is a bug, so the behavior in Java is correct, why ever. A message box shouldn't be shown if no InteractionHandler set set. thats right, but OTOH a unresolved URL should not cause OOo to freeze... As I already wrote: if this was reproducable it surely would be a bug - but only if it's not the file system that freezes. This has to be verified. The idl-ref says: void insertDocumentFromURL( [in] string aURL, [in] sequence ::com::sun::star::beans::PropertyValue aOptions ) raises( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException ); I think that's all I need!? The problem is that the IOException is never thrown. You are right, I must have been dreaming. :-) Then of course there's something wrong in the implementation of this interface that can be fixed without a change in the API. Ciao, Mathias -- Mathias Bauer - OpenOffice.org Application Framework Project Lead Please reply to the list only, [EMAIL PROTECTED] is a spam sink. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Buggy insertDocumentFromURL
Christoph Lutz wrote: Hi Christian, 2005/10/27, Christian Junker [EMAIL PROTECTED]: I tested all the small examples on Mac OS X with OOo 2.0 using Starbasic and I can only reproduce Bug 1 (it's probably not a bug here). Bug 2: That's also my experience using Starbasic. In Starbasic the insertDocumentFromURL throws an corresponding exception *immediately* (a dialogbox with the error message pops up). It's the different behaviour in Java that makes me wonder. The way basic bahaves lets me come to the following guess: I don't get any exception in Basic, I get an error message, but no exception (that's a difference!). I currently have no idea why you don't get the error message from Java. OTOH I think that the error message in an API call is a bug, so the behavior in Java is correct, why ever. A message box shouldn't be shown if no InteractionHandler set set. Of course it still is an API bug that no suitable exception is thrown, but as I already wrote it can't be fixed in the method insertDocumentFromURL, it can be fixed only by providing a new method (and so a new interface). I also tried to provide a different InteractionHandler in the MediaDescriptor props, but (that's the reason why I wrote the Bug 1-example) it seems that insertDocumentFromURL throws an IllegalArgumentException everytime the MediaDescriptor is not empty. This also sounds like a bug to me. Ciao, Mathias -- Mathias Bauer - OpenOffice.org Application Framework Project Lead Please reply to the list only, [EMAIL PROTECTED] is a spam sink. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Buggy insertDocumentFromURL
Hi Mathias, I currently have no idea why you don't get the error message from Java. OTOH I think that the error message in an API call is a bug, so the behavior in Java is correct, why ever. A message box shouldn't be shown if no InteractionHandler set set. thats right, but OTOH a unresolved URL should not cause OOo to freeze... http://qa.openoffice.org/issues/show_bug.cgi?id=57049 Of course it still is an API bug that no suitable exception is thrown, but as I already wrote it can't be fixed in the method insertDocumentFromURL, it can be fixed only by providing a new method (and so a new interface). The idl-ref says: void insertDocumentFromURL( [in] string aURL, [in] sequence ::com::sun::star::beans::PropertyValue aOptions ) raises( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException ); I think that's all I need!? The problem is that the IOException is never thrown. I also tried to provide a different InteractionHandler in the MediaDescriptor props, but (that's the reason why I wrote the Bug 1-example) it seems that insertDocumentFromURL throws an IllegalArgumentException everytime the MediaDescriptor is not empty. This also sounds like a bug to me. http://qa.openoffice.org/issues/show_bug.cgi?id=57047 best regards, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Buggy insertDocumentFromURL
Hi Christian, 2005/10/27, Christian Junker [EMAIL PROTECTED]: I tested all the small examples on Mac OS X with OOo 2.0 using Starbasic and I can only reproduce Bug 1 (it's probably not a bug here). Bug 2: That's also my experience using Starbasic. In Starbasic the insertDocumentFromURL throws an corresponding exception *immediately* (a dialogbox with the error message pops up). It's the different behaviour in Java that makes me wonder. The way basic bahaves lets me come to the following guess: 1) the problem is NOT a problem of system timeouts. 2) is it possible that there is a kind of default behaviour that tries to create a message-box even with java? The message-box can't be shown because of a missing parent frame but is still there and modal so it blocks the rest of the application? I also tried to provide a different InteractionHandler in the MediaDescriptor props, but (that's the reason why I wrote the Bug 1-example) it seems that insertDocumentFromURL throws an IllegalArgumentException everytime the MediaDescriptor is not empty. best regards, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[dev] Buggy insertDocumentFromURL
Hi, in the following example-code I found some bugs in the XDocumentInsertable.insertDocumentFromURL() method. Can you confirm these bugs, so I can report an issue? Are there known workarounds? 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); // Bug 1: // providing a non-empty MediaDescriptor throws an // IllegalArgumentException. try { insertProps = new PropertyValue[] { new PropertyValue() }; insertProps[0].Name = Author; insertProps[0].Value = itsMe; xInsert.insertDocumentFromURL( file:///W:/aFolder/thisFileDoesNotExist, insertProps); } catch (IllegalArgumentException e) { e.printStackTrace(); } System.out.println(test 2); // Bug ?: // trying to insert a document with a non-existing file-URL // does nothing (not even an exception) insertProps = new PropertyValue[] {}; xInsert.insertDocumentFromURL( file:///aFolder/thisFileDoesNotExist, insertProps); System.out.println(test 3); // Bug 2: // 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 4); // 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); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Buggy insertDocumentFromURL
Hi Christoph, 2005/10/27, Christoph Lutz [EMAIL PROTECTED]: Hi, // Bug 1: // providing a non-empty MediaDescriptor throws an // IllegalArgumentException. try { insertProps = new PropertyValue[] { new PropertyValue() }; insertProps[0].Name = Author; insertProps[0].Value = itsMe; xInsert.insertDocumentFromURL( file:///W:/aFolder/thisFileDoesNotExist, insertProps); } catch (IllegalArgumentException e) { e.printStackTrace(); I tested all the small examples on Mac OS X with OOo 2.0 using Starbasic and I can only reproduce Bug 1 (it's probably not a bug here). -- Best Regards Christian Junker - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Buggy insertDocumentFromURL
Christoph Lutz wrote: // Bug 1: // providing a non-empty MediaDescriptor throws an // IllegalArgumentException. try { insertProps = new PropertyValue[] { new PropertyValue() }; insertProps[0].Name = Author; insertProps[0].Value = itsMe; xInsert.insertDocumentFromURL( file:///W:/aFolder/thisFileDoesNotExist, insertProps); } catch (IllegalArgumentException e) { e.printStackTrace(); } This is not a bug, the argument Author it not allowed here, so the exception is correct. Author is for saving versions only. System.out.println(test 2); // Bug ?: // trying to insert a document with a non-existing file-URL // does nothing (not even an exception) insertProps = new PropertyValue[] {}; xInsert.insertDocumentFromURL( file:///aFolder/thisFileDoesNotExist, insertProps); You don't get an exception (IoException is expected) because no suitable exception is allowed here. The API was designed wrongly, but it's unfortunately not possible to change it because this would break existing code. So it's a bug, but it can be fixed only by introducing an additional interface. System.out.println(test 3); // Bug 2: // 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); If it was reproducable it would be a bug. System.out.println(test 4); // 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); Ditto. In both cases it's possible that the hanging office could be caused by very long timeouts in the file system or http access. In this case it's not a bug in OOo, it's just bad luck. Best regards, Mathias -- Mathias Bauer - OpenOffice.org Application Framework Project Lead Please reply to the list only, [EMAIL PROTECTED] is a spam sink. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]