Bug 162094 - UCB FileContent getPropertySetInfo command returns sometimes an exotic array
Summary: UCB FileContent getPropertySetInfo command returns sometimes an exotic array
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
24.2.5.2 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Macro
  Show dependency treegraph
 
Reported: 2024-07-18 23:03 UTC by Corneloup
Modified: 2024-12-13 06:02 UTC (History)
2 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 Corneloup 2024-07-18 23:03:58 UTC
The UCB FileContent getPropertySetInfo command returns most of the time a correct array of 15 structures com.sun.star.beans.Property.
From time to time, it returns a strange array of only 5 properties, named "sfCR", "sfCRLF", "srLF", "sfNEWLINE", "sfTAB".

The code is (simplified) :
URL         = "file:///D:/OVH/afile.ods"
ucbBroker   = CreateUnoService("com.sun.star.ucb.UniversalContentBroker")
fileID      = ucbBroker.createContentIdentifier(URL)
ucbContent  = ucbBroker.queryContent(fileID) 

Dim command as new com.sun.star.ucb.Command
command.Name     = "getPropertySetInfo"
command.Handle   = -1
command.Argument = Nothing
propSet          = ucbContent.execute(command, 0, Nothing)
properties       = propSet.getProperties()

I have observed the anomaly randomly several times, on LibreOffice 7.5 first, and now on LibreOffice 24.2.5.2, but have been enable to reproduce it.

When the error occurs once, it then repeats each time I run the program until I quit and reload LibreOffice.
Comment 1 Corneloup 2024-07-20 07:24:12 UTC
I still observe this bug while developping and testing a macro to experiment the UCB file provider. Though I'm unable to reproduce it voluntarily, it seems that it occurs after an exception occured during a former run of this macro. For instance an invalid parameter exception.
Comment 2 Corneloup 2024-07-20 21:27:13 UTC
I have finally identified the origin, which is connected with the ScriptForge Library. Here is the code to get the bug.

Sub Test
'If the ScriptForge Library is not loaded, the variable "properties"
'is an array of 15 com.sun.star.beans.Property => normal behaviour
'If the library is loaded, "properties" is an array of 5 strings :
'      "sfCR", "sfCRLF", "srLF", "sfNEWLINE", "sfTAB"
	
'Uncomment the following line to get the bug
'GlobalScope.BasicLibraries.LoadLibrary("ScriptForge")

URL         = "file:///C:/Users/Public"
ucbBroker   = CreateUnoService("com.sun.star.ucb.UniversalContentBroker")
fileID      = ucbBroker.createContentIdentifier(URL)
ucbContent  = ucbBroker.queryContent(fileID)         	

Dim command as new com.sun.star.ucb.Command
command.Name     = "getPropertySetInfo"
command.Argument = Nothing
propSet          = ucbContent.execute(command, 0, Nothing) 
properties       = propSet.getProperties()
	
MsgBox("Number of Properties : " & (UBOUND(properties)+1))
End Sub

I first thought it was connected with an exception for I use a personal tool to debug exceptions, and this tool uses the ScriptForge library.
Comment 3 Jean-Pierre Ledure 2024-08-03 13:02:46 UTC
I confirm the bug under

Version: 24.2.4.2 (X86_64) / LibreOffice Community
Build ID: 51a6219feb6075d9a4c46691dcfe0cd9c4fff3c2
CPU threads: 6; OS: Linux 5.15; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fr-BE (en_US.UTF-8); UI: en-US
Calc: threaded

Additional infos:

- the 5 undesired property names ("sfCR", "sfCRLF", "sfLF", "sfNEWLINE", "sfTAB") are described in the SF_String module of the ScriptForge Basic library:
https://opengrok.libreoffice.org/xref/core/wizards/source/scriptforge/SF_String.xba?r=30a6bf39#105

- if I make the same test (after a LO restart and ...) after having replaced "ScriptForge" by "Access2Base", the execution of the script stops in the middle of the Access2Base library code with an "Object variable not set" error. Even more strange.

Both libraries have in common to contain Basic class modules ...

I tested a few other libraries without trouble.