Bug Hunting Session
Bug 82743 - insertDocumentFromURL no longer works
Summary: insertDocumentFromURL no longer works
Status: RESOLVED DUPLICATE of bug 81113
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.3.0.4 release
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-18 05:59 UTC by Paul
Modified: 2014-08-19 07:14 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
main ODT document (9.46 KB, application/vnd.oasis.opendocument.text)
2014-08-18 15:09 UTC, Paul
Details
second document (to insert into the first) (8.95 KB, application/vnd.oasis.opendocument.text)
2014-08-18 15:09 UTC, Paul
Details
working code (1.45 KB, text/plain)
2014-08-18 16:07 UTC, Maxim Monastirsky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul 2014-08-18 05:59:11 UTC
Programmatically inserting a Document using the following code works in 4.2.6.2, but not in 4.3.0.4.

This code is Java & UNO:

  XDocumentInsertable xDocumentInsertable = (XDocumentInsertable) UnoRuntime
                   .queryInterface(XDocumentInsertable.class, xTextCursor);
  PropertyValue[] insertProps = new PropertyValue[0];
  xDocumentInsertable.insertDocumentFromURL(documentUrl, insertProps);

The operation is not throwing an exception, just not inserting the sub-document.
Comment 1 Maxim Monastirsky 2014-08-18 09:03:59 UTC
Hi Paul,

I'm not able to reproduce with 4.3.0.4 & master under Fedora 20.

What's the format of the file you're trying to insert, and what's the extension of that file? Is it possible to attach a sample file that not working? (I'm asking because 4.3.0.4 has a known bug that may prevent this from working properly, in case a file has a wrong extension.)
Comment 2 Paul 2014-08-18 15:08:38 UTC
Hi Maxim.

Thanks for checking.  I get the problem trying to insert ODT into ODT or DOC into DOC (the extensions are lower case to match).  For example main.odt and sub.odt or main.doc and sub.doc all behave the same - the insert doesn't seem to do anything.  

I created a new pair of ODT files to be sure the file name and file format were definitely ODT.  Same problem.

If I do it manually no problem with these files it works.  The same code and files work ok using UNO and Libre Office 4.2.6.2.  

I will attach two files (main.odt and sub.odt).  I can try creating a cut-down test - but there's a fair bit of code.


Regards,
Paul.
Comment 3 Paul 2014-08-18 15:09:22 UTC
Created attachment 104832 [details]
main ODT document
Comment 4 Paul 2014-08-18 15:09:51 UTC
Created attachment 104833 [details]
second document (to insert into the first)
Comment 5 Maxim Monastirsky 2014-08-18 16:07:35 UTC
Created attachment 104835 [details]
working code

(In reply to comment #2)
> I can try creating a cut-down test - but there's a fair bit of code.
That would be great, because I can't reproduce it locally. Attached my working code.
Comment 6 Paul 2014-08-19 05:04:16 UTC
Hello Maxim.

Thanks very much for the simple sample - that helped me diagnose the problem very quickly and then relate back to my code to find out what was wrong.

Your initial comment was spot-on - it was the file-extension of the inserted document.  My code was creating a temp file with no extension and that file won't insert unless an extension is added.

Could you please point me to that bug?  This issue should be closed now.


Thank you again.
Paul.
Comment 7 Maxim Monastirsky 2014-08-19 07:14:38 UTC

*** This bug has been marked as a duplicate of bug 81113 ***