Apache OpenOffice (AOO) Bugzilla – Issue 24015
regression: getSubstituteVariableValue broken in 680_m17
Last modified: 2013-02-24 21:06:59 UTC
the Basic call to a com.sun.star.PathSubstitution service, which worked fine in 1.1, has stopped working in 680_m17. As an example, try code like this Sub wontwork dim oPathSub oPathSub=createUnoService("com.sun.star.PathSubstitution") msgBox oPathSub.getVariableValue( "$(work)") end sub works fine in 1.1, though
knocked down to P4 by reporter, since it's not that important.
forwarding to responsible engineer
First of all your example cannot work as is doesn't provide the correct service name and uses a non-existing method at the com.sun.star.util.XStringSubstitution interface. Please look at the following code snippet which is correct: Sub test dim oPathSub oPathSub=createUnoService("com.sun.star.util.PathSubstitution") msgbox oPathSub.getSubstituteVariableValue( "$(work)" ) end sub I have checked this code snippet with a new src680_m17 installation and the function returns a correct path to the working directory of the user. If this service is not useable, OOo won't start as it is mandatory for many functions. Please verify if the corrected code snippet works with your version. May be your installation is somewhat broken, but I doubt it as OOo is not able to startup without this service! Try to open the path tab dialog accessible through "Tools - Options - OpenOffice - Paths" which uses the PathSubstitution service intensely,
I asked our API testing to verify your regression report. I hope that someone from them will also add a comment.
OK. I see what this is. But I don't understand it. First of all, apologies for the typo on my bug report. I was trying to use the right service (and it had worked) I just misremembered its name. What I had been trying was this: (cut and pasted) Function getHome ' attempts to return the my documents location dim oPathSub dim sMyDocs as string oPathSub=createUnoService("com.sun.star.util.PathSubstitution") sMyDocs= oPathSub.getSubstituteVariableValue( "$(work)" ) getHome= sMyDocs end Function It returns nothing. However, your test code, which looks exactly the same, except for being a sub not a function -- Sub test dim oPathSub oPathSub=createUnoService("com.sun.star.util.PathSubstitution") msgbox oPathSub.getSubstituteVariableValue( "$(work)" ) end sub returns what it should. So I tried this: sub werble msgbox("The function returns " + mytest) end sub Function mytest dim oPathSub dim smytest as string oPathSub=createUnoService("com.sun.star.util.PathSubstitution") msgbox ("The sub gives "+ oPathSub.getSubstituteVariableValue( "$(work)" )) smytest=oPathSub.getSubstituteVariableValue( "$(work)" ) end Function this gives me one properly filled out message box that says 'The sub returns ... ' and one message box that says 'The function returns [blank]) So the problem seems to be that getSubstituteVariableValue returns something that only the msgbox function understands. Or else that I'm doing something _really_ stupid. Either way, I don't understand it.
SW: I just downloaded and installed the version from http://download.openoffice.org/680/ and the code-snippet Sub test msgbox getHome end sub Function getHome ' attempts to return the my documents location dim oPathSub dim sMyDocs as string oPathSub=createUnoService("com.sun.star.util.PathSubstitution") sMyDocs=oPathSub.getSubstituteVariableValue( "$(work)" ) getHome=sMyDocs end Function shows a messagebox with the working directory.
OK. does for me too. Now. I still don't know what was going on, but thanks for your efforts.
The Issue you raised has been marked as 'Resolved' and not updated within the last 1 year+. I am therefore setting this issue to 'Verified' as the first step towards Closing it. If you feel this is incorrect, please re-open the issue and add any comments. Many thanks, Andrew Cleaning-up and Closing old Issues ~ The Grand Bug Squash, pre v3 ~ http://marketing.openoffice.org/3.0/announcementbeta.html
As per previous posting: Verified -> Closed. A Closed Issue is a Happy Issue (TM). Regards, Andrew