Bug 144625 - Regression: a macro stopped working with upgrade of LO.
Summary: Regression: a macro stopped working with upgrade of LO.
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
7.0.6.2 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-20 13:46 UTC by Aaron Gerber
Modified: 2022-02-02 13:43 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Writer Document containing the macro at the center of the problem (11.47 KB, application/vnd.oasis.opendocument.text)
2021-09-20 13:49 UTC, Aaron Gerber
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron Gerber 2021-09-20 13:46:43 UTC
Description:
Error message: "com.mysql.jdbc.Driver could not be loaded".  The macro worked well in previous version.  

Steps to Reproduce:
1.Open Attached Document
2.Run the "IssueDocument" macro from the DocumentControl_Module
3.Note Results

Actual Results:
Error message: "com.mysql.jdbc.Driver could not be loaded"

Expected Results:
The macro should have allowed for document issue, while enforcing our internal document control procedures.


Reproducible: Always


User Profile Reset: No



Additional Info:
Apologies that the macro is not well commented. This worked great with version 5.3.7.2.
Comment 1 Aaron Gerber 2021-09-20 13:49:41 UTC
Created attachment 175142 [details]
Writer Document containing the macro at the center of the problem
Comment 2 Michael Warner 2021-09-20 17:22:44 UTC
In 7.2.0.4, I get the error message: "Error! Built-in path for documents is incorrect" instead.
Comment 3 Aaron Gerber 2021-09-20 18:41:37 UTC
Sorry, I copied the error message from the wrong forum thread.  It should have said:
cannot find /org.openoffice.Office.Common/Path/Info

@MichaelW
Yes, that error message is built into the macro for the purpose of troubleshooting.  The built-in path for the documents is built into the macro. 
 That message was designed to indicate that the built-in path doesn't exist on the system where it is runnning.  The path is supposed to be"L:\QMS Documents\Working".  I wonder if the problem is the backslash in that path.  Thanks for drawing my attention to it.
Comment 4 Aaron Gerber 2021-09-20 19:09:31 UTC
Actually, it worked on my system before, even with that backslash.  That probably came up on your system because that path doesn't exist on your system.
Comment 5 Aaron Gerber 2021-09-20 19:29:41 UTC
I just upgraded to 7.1.6.2 (the newest stable release).  The error still comes up.

@Michael Warner got to my built-in path message on 7.2.0.4, which is not stable yet.  To do that, he got past where "cannot find /org.openoffice.Office.Common/Path/Info" comes up.

If the bug has been fixed in a fresh release, why was that bug fix not applied to a stable release?
Comment 6 Aaron Gerber 2021-10-28 15:07:47 UTC
What does a person have to do to get their bug confirmed?
Comment 7 Michael Warner 2021-10-28 17:01:52 UTC
You will need to reduce your test case down to the smallest possible thing that demonstrates the issue. It can't be reliant on the existence of other paths or system configuration that doesn't contribute to testing this specific issue at hand.
Comment 8 Aaron Gerber 2021-10-29 15:27:10 UTC
Interesting.  I tried to do this, copying the module that was failing into an empty and inconsequential Writer document, intending to modify the paths referencing server locations to local locations.  I forgot to make the modifications, which left the macros doing exactly what they're supposed to.  I can't for the life of me figure out why they work from within the Writer file, but not when contained in and launched by an event in the Base file.
Comment 9 Aaron Gerber 2021-10-29 15:40:32 UTC
All I can think of that might make a difference is that in the Base file I created a "DocumentTools" library that my "DocumentControl_Module" is a part of, and in my Writer file, it's just a "DocumentTools" module.  Oh, and now I tried launching the EditDocument() macro directly from the LO Basic IDE, and it works as intended, but if I use a Form with a Push Button that triggers the EditDocument() macro, I get the runtime error: "cannot find /org.openoffice.Office.Common/Path/Info".  Why would it make a difference where the macro was launched from?
Comment 10 Robert Großkopf 2021-10-29 16:58:32 UTC
Seem you try to connect to a MySQL or MariaDB database. This is what the error describes.

I have opened the attached file with LO 7.2.2.2, 7.1.5.2, 7.0.5.2 and also 6.4.7.2 - nothing special happens there. Will always get an empty page under OpenSUSE 15.2 64bit rpm Linux.
Comment 11 Alex Thurgood 2021-11-03 11:12:25 UTC
I downloaded the Writer file and opened it in 

Version: 7.2.1.2 / LibreOffice Community
Build ID: 87b77fad49947c1441b67c559c339af8f3517e22
CPU threads: 8; OS: Mac OS X 10.16; UI render: default; VCL: osx
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Calc: threaded

nothing happens on document load, other than being asked whether to activate / deactivate macro execution.

If I allow macros to be executed, I just see a blank Writer document.

If then go to the macro execution menu via Tools > Macros > Run macro, I can choose one of the macro modules from the list of modules that are integrated into the document under Standard > DocumentTools.

If I choose "EditDocument", and click on Run, I get the error message "Error! Built-in path for documents is incorrect" (same as comment 2).

In order for the behaviour to be confirmed, we would need detailed step by step instructions on how to do that (load this, run this, etc) with a test document (or ODB file) that demonstrates the erroneous behaviour. So far, that doesn't appear to be the case.
Comment 12 Alex Thurgood 2021-11-03 11:15:12 UTC
(In reply to Aaron Gerber from comment #5)
> 
> If the bug has been fixed in a fresh release, why was that bug fix not
> applied to a stable release?

This might only happen if the fix can be identified and a request for backporting to the older branch was made. Even then, some bug fixes might not get backported if they are considered to possibly introduce other unwanted side effects in the previous release branch.
Comment 13 Alex Thurgood 2021-11-03 11:28:44 UTC
@Aaron : reading through the macro code provided in the Writer document, I don't see any calls to establish a DatabaseContext or a connection to an existing database source, so not really certain why you should be getting a "driver not loaded" error message.
Comment 14 Alex Thurgood 2021-11-03 11:35:51 UTC
If I change the 	

sInitPath = convertToURL 

to a valid directory on my system, save the modified macro, and then re-run from the Basic IDE, I get the following error message :

Erreur d'exécution BASIC.
Une exception s'est produite : 
Type: com.sun.star.uno.RuntimeException
Message: cannot find /org.openoffice.Office.Common/Path/Info.


@Aaron : can you confirm that this is the error you are encountering (seems so, if I've understood comment 3 correctly) ?
Comment 15 Alex Thurgood 2021-11-03 11:46:03 UTC
If the error message I reported is indeed the confirmation of Aaron's problem, then I guess that someone more knowledgeable than me about manipulating the Configuration Provider would need to look at this block:

	oConfigProvider = createUnoService("com.sun.star.configuration.ConfigurationProvider")
	
	AddFiltersToDialog(FilterNames(), oFileDialog)
	
	If oUCB.Exists(sInitPath) Then
		oFileDialog.setDisplayDirectory(sInitPath)
		With aNodePath(0)
			.Name = "nodepath"
			.Value = "/org.openoffice.Office.Common/Path/Info"
		End With
		oRegistryKeyContent = oConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess", aNodePath())
		With oRegistryKeyContent
			.WorkPathChanged = true
			.commitChanges
		End With
	Else
		msgBox "Error! Built-in path for documents is incorrect"
		Exit Function
Comment 16 Aaron Gerber 2022-02-02 13:15:59 UTC
Apologies.  I think there was a problem on my end, because the macro in question is working, now.  It may have been that a Windows update fixed it, but I forgot that it wasn't working and some time after I posted the bug, I started using it again.  I haven't updated LibreOffice, so that couldn't be what fixed it, but Windows has been updated since then.