Apache OpenOffice (AOO) Bugzilla – Issue 25615
Spaces in username mean that LocalOfficeConnection won't connect
Last modified: 2013-02-24 21:07:32 UTC
I'm using LocalOfficeConnection to connect to staroffice. On Windows it is possible to have a user name that contains spaces. i.e. the value returned by java.lang.System.getProperty("user.name") can contain spaces. LocalOfficeConnection uses this value to construct a URL for the pipe connection, but of course if there are spaces in the URL then you have a malformed url and an exception is thrown (which gets "swallowed" silently by LocalOfficeConnection. The LocalOfficeConnection is created but is not instantiated properly and the instance of soffice is not launched. You can test this by running java -Duser.name="user name" on any application that instantiated LocalOfficeConnection
Created attachment 13234 [details] Run this application with the command line java -Duser.name="user name" to reproduce issue 25615
SW->MI: OfficeBean, sounds like something for you
SW: reassigned
SW->MI: something seems to go wrong in the method setUnoUrl. If the name contains a space the returned url is NULL. If I set mURL = url; at the beginning of this method all seems to work just fine.
accepting
verified in Linux (pro) + Windows (non-pro) version
of course, its also fixed
root cause: wrong API usage (format)
reopening for forwarding to QA
forwarding to QA
SW: spaces are replaced by valid characters so that the gained url is valid. The name "user name" in the given sample is transformed to "user_20name_25B7Office"
SW: checked with the Bean-example that uses this class for connection => verified
SW: ok in src680_m40 => closed
Regression.
.
changed version to 2.0. OOo 1.x did not contain the OfficeBean. Then it was in the SDK.
suggested fix: change in function LocalOfficeConnection.getPipeName return replaceAll( replaceAll( java.net.URLEncoder.encode(aPipeName), "\\+", "%20" ), "%", "_" ); to return replaceAll( replaceAll( java.net.URLEncoder.encode(aPipeName), "+", "%20" ), "%", "_" );
Although the code worked before, the code that creates the pipename was slightly wrong
Verified on m180.
Created attachment 73328