Skip to content

Commit 7155001

Browse files
author
Emmanuel Hugonnet
committed
Bug #4346 : fixing problem introduced for libreOffice
1 parent 4973b32 commit 7155001

File tree

3 files changed

+13
-23
lines changed

3 files changed

+13
-23
lines changed

src/main/java/org/silverpeas/openoffice/OfficeFinder.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@
2121
* You should have received a copy of the GNU Affero General Public License
2222
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2323
*/
24-
25-
/*
26-
* To change this template, choose Tools | Templates
27-
* and open the template in the editor.
28-
*/
2924
package org.silverpeas.openoffice;
3025

3126
/**

src/main/java/org/silverpeas/openoffice/OfficeLauncher.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,26 @@ public class OfficeLauncher {
5858
public static int launch(MsOfficeType type, String url, AuthenticationInfo authInfo,
5959
boolean useDeconnectedMode) throws IOException, InterruptedException, OfficeNotFoundException {
6060
OfficeFinder finder = FinderFactory.getFinder(type);
61-
logger.log(Level.INFO, "Are we using Office : {0}", finder.isMicrosoftOffice());
6261
logger.log(Level.INFO, "We are on {0} OS", OsEnum.getOS());
62+
String webdavUrl = url;
6363
boolean modeDisconnected = ((OsEnum.isWindows() && useDeconnectedMode) || OsEnum.getOS()
6464
== OsEnum.MAC_OSX) && finder.isMicrosoftOffice();
65+
if (!modeDisconnected) {
66+
if (finder.isMicrosoftOffice() && (OsEnum.getOS() == OsEnum.WINDOWS_XP || (OsEnum
67+
.isWindows() && MsOfficeVersion.isOldOffice(type)))) {
68+
webdavUrl = webdavUrl.replace("/repository/", "/repository2000/");
69+
}
70+
}
6571
switch (type) {
6672
case EXCEL:
67-
return launch(type, finder.findSpreadsheet(), url, modeDisconnected, authInfo);
73+
return launch(type, finder.findSpreadsheet(), webdavUrl, modeDisconnected, authInfo);
6874
case POWERPOINT:
69-
return launch(type, finder.findPresentation(), url, modeDisconnected, authInfo);
75+
return launch(type, finder.findPresentation(), webdavUrl, modeDisconnected, authInfo);
7076
case WORD:
71-
return launch(type, finder.findWordEditor(), url, modeDisconnected, authInfo);
77+
return launch(type, finder.findWordEditor(), webdavUrl, modeDisconnected, authInfo);
7278
case NONE:
7379
default:
74-
return launch(type, finder.findOther(), url, modeDisconnected, authInfo);
80+
return launch(type, finder.findOther(), webdavUrl, modeDisconnected, authInfo);
7581
}
7682
}
7783

@@ -90,7 +96,6 @@ protected static int launch(MsOfficeType type, String path, String url, boolean
9096
AuthenticationInfo auth) throws IOException, InterruptedException {
9197
logger.log(Level.INFO, "The path: {0}", path);
9298
logger.log(Level.INFO, "The url: {0}", url);
93-
logger.log(Level.INFO, "The command line: {0} {1}", new Object[]{path, url});
9499
if (modeDisconnected) {
95100
try {
96101
String webdavUrl = url;
@@ -114,13 +119,8 @@ protected static int launch(MsOfficeType type, String path, String url, boolean
114119
}
115120
} else {
116121
// Standard mode : just open it
117-
String webdavUrl = url;
118-
if (OsEnum.getOS() == OsEnum.WINDOWS_XP || (OsEnum.isWindows() && MsOfficeVersion.isOldOffice(
119-
type))) {
120-
webdavUrl = webdavUrl.replace("/repository/", "/repository2000/");
121-
}
122-
logger.log(Level.INFO, "The exact exec line: {0} {2}", new Object[]{path, webdavUrl});
123-
Process process = Runtime.getRuntime().exec(path + ' ' + webdavUrl);
122+
logger.log(Level.INFO, "The exact exec line: {0} {1}", new Object[]{path, url});
123+
Process process = Runtime.getRuntime().exec(path + ' ' + url);
124124
return process.waitFor();
125125
}
126126
}

src/main/java/org/silverpeas/openoffice/OpenOfficeFinder.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@
2121
* You should have received a copy of the GNU Affero General Public License
2222
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2323
*/
24-
25-
/*
26-
* To change this template, choose Tools | Templates
27-
* and open the template in the editor.
28-
*/
2924
package org.silverpeas.openoffice;
3025

3126
/**

0 commit comments

Comments
 (0)