Bug 115710 - Use of WEBSERVICE within a macro in CALC raises an "Illegal argument" exception
Summary: Use of WEBSERVICE within a macro in CALC raises an "Illegal argument" exception
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
5.4.5.1 release
Hardware: All All
: medium normal
Assignee: Eike Rathke
URL:
Whiteboard: target:6.1.0 target:5.4.6 target:6.0.2
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2018-02-14 09:44 UTC by Albatros
Modified: 2021-03-21 07:57 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Albatros 2018-02-14 09:44:23 UTC
Since the last update (security update on the WEBSERVICE function), I cannot use it within a macro like I used to.

It was working nicely prior to the update and I get now an "Illegal Argument" exception on the call to WEBSERVICE. If I try manually to call WEBSERVICE with the built URL, it works... The symptom are very similar to #104989.

More details in : https://ask.libreoffice.org/en/question/146230/use-of-webservice-within-a-macro-in-libreoffice-6011/
Comment 1 Stang 2018-02-15 15:05:34 UTC
I can confirm the problem.  Please refer to the previous link containing my test results.

From link:

There was a bug report (#104989) filed & fixed a while back. Using this code from the bug report:

Sub Main
svc = createUnoService( "com.sun.star.sheet.FunctionAccess" ) 'Create a service to use Calc functions
XML_String = svc.callFunction("WEBSERVICE",array("http://www.lipsum.com/feed/xml?amount=2&what=paras&start=Yes"))
Lipsum = svc.callFunction("FILTERXML", array(XML_String, "/feed/lipsum" ))
Print Lipsum
End Sub
Does work in LO v5.4.3.2 but causes an error in v5.4.5.1 and this dev version:

    Version: 6.0.1.0.0+
Build ID: d51c01846afb9bea5a39fd48fbb30b9fd02c2870
CPU threads: 4; OS: Linux 4.13; UI render: default; VCL: gtk2; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:libreoffice-6-0, Time: 2018-02-08_10:01:18
Locale: en-US (en_US.UTF-8); Calc: group
with the error being:

BASIC runtime error.
An exception occurred 
Type: com.sun.star.lang.IllegalArgumentException
Message: .
pointing to line:

 XML_String = svc.callFunction("WEBSERVICE",array("http://www.lipsum.com/feed/xml?amount=2&what=paras&start=Yes"))
Comment 2 Aron Budea 2018-02-18 05:32:32 UTC
Confirmed in LO 6.0.1.1 / Windows 7.
No error in 6.0.0.3.
=> regression

Debugging pointed to the following piece of code:
https://opengrok.libreoffice.org/xref/core/sc/source/core/tool/interpr7.cxx#280
if (!mpLinkManager)
{
    PushError(FormulaError::NoValue);
    return;
}

mpLinkManager is empty in this case.

This code was introduced in the following commit. Caolán, can you please take a look?

https://cgit.freedesktop.org/libreoffice/core/commit/?id=93ea7cb6b5ab3c9b964b2b38e8f4a3bde71dbadf
author		Caolán McNamara <caolanm@redhat.com>	2018-01-11 20:43:28 +0000
committer	Caolán McNamara <caolanm@redhat.com>	2018-01-12 16:19:37 +0100

handle ocWebservice similarly to ocDde
Comment 3 Eike Rathke 2018-02-19 12:29:53 UTC
A LinkManager is available only in a "real" spreadsheet document, which we don't have for the stripped down FunctionAccess service's interim document. Not sure if that can be solved satisfactorily, certainly we don't want to execute the function without it being able to add the link and retrieve data from it in a normal document, but I'll investigate.
Comment 4 Commit Notification 2018-02-19 22:54:34 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=121fda77b0cc16d54607a1f5f7b26c0f1050284f

Resolves: tdf#115710 let css::sheet::FunctionAccess execute WEBSERVICE

It will be available in 6.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Eike Rathke 2018-02-19 23:51:01 UTC
Pending review
https://gerrit.libreoffice.org/50019 for 6-0
https://gerrit.libreoffice.org/50020 for 5-4
Comment 6 Stang 2018-02-20 12:53:17 UTC
Tested with:

Version: 6.1.0.0.alpha0+
Build ID: 60ae5f530c3123341a8c2d49793693c2cd4521c2
CPU threads: 4; OS: Linux 4.13; UI render: default; VCL: gtk2; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2018-02-20_01:02:16
Locale: en-US (en_US.UTF-8); Calc: group


Confirmed as working.
Comment 7 Commit Notification 2018-02-21 14:53:47 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-5-4":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=4a412bdf0387cc2cb59d656d0738a63a286ec497&h=libreoffice-5-4

Resolves: tdf#115710 let css::sheet::FunctionAccess execute WEBSERVICE

It will be available in 5.4.6.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Commit Notification 2018-02-21 14:53:58 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-6-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=ac36e5b90787338c5ebdbd942ad3b12b6831af3f&h=libreoffice-6-0

Resolves: tdf#115710 let css::sheet::FunctionAccess execute WEBSERVICE

It will be available in 6.0.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Albatros 2018-03-03 11:18:08 UTC
I can confirm it's working now in 6.0.2.
Thanks for the support!

Version: 6.0.2.1.0+
Build ID: 1:6.0.2-1
Threads CPU : 4; OS : Linux 4.9; UI Render : par défaut; VCL: gtk2; 
Locale : fr-FR (fr_FR.UTF-8); Calc: group
Comment 10 Aron Budea 2018-03-03 14:12:45 UTC
Thanks for the feedback, setting status to VERIFIED, then.
Comment 11 Nikolai Grigoriev 2019-03-07 02:18:02 UTC
Sorry, but this is still happening. Tried in 6.0.6 and just tried in 6.1.5.2

Version: 6.1.5.2
Build ID: 90f8dcf33c87b3705e78202e3df5142b201bd805
CPU threads: 8; OS: Mac OS X 10.13.6; UI render: default; 
Locale: en-CA (en_CA.UTF-8); Calc: group threaded


Sample code:

        boc_url = "https://www.bankofcanada.ca/valet/observations/FXUSDCAD/csv?start_date=2018-10-30&end_date=2018-10-30"
	svc = createUnoService( "com.sun.star.sheet.FunctionAccess" ) 'Create a service to use Calc functions

	resp_text = svc.callFunction("WEBSERVICE", array(boc_url))


This code crashes on calling WEBSERVICE. I think it was never fixed or fixed and reintroduced again. It's been 3 years this code does not work (anymore).

I get this error:

BASIC runtime error.
An exception occurred 
Type: com.sun.star.lang.IllegalArgumentException
Message: .
Comment 12 Caolán McNamara 2019-03-07 08:54:44 UTC
its a terrible idea to reopen a bug closed a year ago, it could be a new bug with the same symptoms, and if not, then the assignee could have left libreoffice so the bug never gets seen by the right people
Comment 13 Aron Budea 2019-03-08 01:55:13 UTC
Agreed. I couldn't even repro this newly mentioned issue in LO 6.2.1.2 and 6.1.4.2 / Windows 7. Nikolai, if you have this issue, please open a new bug report.