Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

Commit 581fa5f

Browse files
author
Emmanuel Hugonnet
committed
Fxing bug #4143 and changing the parameters order
1 parent 0fbdb7b commit 581fa5f

File tree

1 file changed

+33
-37
lines changed

1 file changed

+33
-37
lines changed

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

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
11
/**
22
* Copyright (C) 2000 - 2009 Silverpeas
33
*
4-
* This program is free software: you can redistribute it and/or modify
5-
* it under the terms of the GNU Affero General Public License as
6-
* published by the Free Software Foundation, either version 3 of the
7-
* License, or (at your option) any later version.
4+
* This program is free software: you can redistribute it and/or modify it under the terms of the
5+
* GNU Affero General Public License as published by the Free Software Foundation, either version 3
6+
* of the License, or (at your option) any later version.
87
*
9-
* As a special exception to the terms and conditions of version 3.0 of
10-
* the GPL, you may redistribute this Program in connection with Free/Libre
11-
* Open Source Software ("FLOSS") applications as described in Silverpeas's
12-
* FLOSS exception. You should have received a copy of the text describing
13-
* the FLOSS exception, and it is also available here:
8+
* As a special exception to the terms and conditions of version 3.0 of the GPL, you may
9+
* redistribute this Program in connection with Free/Libre Open Source Software ("FLOSS")
10+
* applications as described in Silverpeas's FLOSS exception. You should have received a copy of the
11+
* text describing the FLOSS exception, and it is also available here:
1412
* "http://repository.silverpeas.com/legal/licensing"
1513
*
16-
* This program is distributed in the hope that it will be useful,
17-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19-
* GNU Affero General Public License for more details.
14+
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
15+
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16+
* Affero General Public License for more details.
2017
*
21-
* You should have received a copy of the GNU Affero General Public License
22-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
* You should have received a copy of the GNU Affero General Public License along with this program.
19+
* If not, see <http://www.gnu.org/licenses/>.
2320
*/
24-
2521
package org.silverpeas.openoffice;
2622

2723
import org.silverpeas.openoffice.util.MessageDisplayer;
@@ -48,36 +44,36 @@ public class Launcher {
4844
static final String LAUNCHER_VERSION = "2.12";
4945
static final MimetypesFileTypeMap mimeTypes = new MimetypesFileTypeMap();
5046
static final Logger logger = Logger.getLogger(Launcher.class.getName());
51-
47+
5248
/**
5349
* @param args the command line arguments
54-
* @throws OfficeNotFoundException
50+
* @throws OfficeNotFoundException
5551
*/
5652
public static void main(final String[] args) throws OfficeNotFoundException {
57-
logger.log(Level.INFO, "{0} version {1}", new Object[] { MessageUtil.getMessage("app.title"),
58-
LAUNCHER_VERSION });
59-
logger.log(Level.INFO, "{0}{1}", new Object[] { MessageUtil.getMessage("info.url.encoded"),
60-
args[0] });
53+
logger.log(Level.INFO, "{0} version {1}", new Object[]{MessageUtil.getMessage("app.title"),
54+
LAUNCHER_VERSION});
55+
logger.log(Level.INFO, "{0}{1}", new Object[]{MessageUtil.getMessage("info.url.encoded"),
56+
args[0]});
6157
try {
6258
String url = UrlExtractor.extractUrl(args[0]);
63-
logger.log(Level.INFO, "{0}{1}", new Object[] { MessageUtil.getMessage("info.url.decoded"),
64-
url });
59+
logger.log(Level.INFO, "{0}{1}", new Object[]{MessageUtil.getMessage("info.url.decoded"),
60+
url});
6561
if (args[1] != null && !"".equals(args[1].trim())) {
66-
logger.log(Level.INFO, "{0} {1}", new Object[] {
67-
MessageUtil.getMessage("info.default.path"), UrlExtractor.decodePath(args[1]) });
62+
logger.log(Level.INFO, "{0} {1}", new Object[]{
63+
MessageUtil.getMessage("info.default.path"), UrlExtractor.decodePath(args[1])});
6864
MsOfficePathFinder.basePath = UrlExtractor.decodePath(args[1]);
6965
}
66+
boolean useDeconnectedMode = false;
67+
if (args.length >= 3) {
68+
useDeconnectedMode = getBooleanValue(args[2]);
69+
}
7070
AuthenticationInfo authInfo = null;
71-
if (args.length >= 4) {
72-
authInfo = PasswordManager.extractAuthenticationInfo(args[2], args[3]);
71+
if (args.length >= 5) {
72+
authInfo = PasswordManager.extractAuthenticationInfo(args[3], args[4]);
7373
}
74-
boolean useDeconnectedMode = false;
75-
if(args.length >= 5) {
76-
useDeconnectedMode = getBooleanValue(args[4]);
77-
}
7874
MsOfficeType contentType = getContentType(UrlExtractor.decodeUrl(args[0]));
79-
logger.log(Level.FINE, "{0}{1}", new Object[] { MessageUtil.getMessage("info.document.type"),
80-
contentType });
75+
logger.log(Level.FINE, "{0}{1}", new Object[]{MessageUtil.getMessage("info.document.type"),
76+
contentType});
8177
defineLookAndFeel();
8278
System.exit(OfficeLauncher.launch(contentType, url, authInfo, useDeconnectedMode));
8379
} catch (IOException ex) {
@@ -95,11 +91,11 @@ public static void main(final String[] args) throws OfficeNotFoundException {
9591
System.exit(0);
9692
}
9793
}
98-
94+
9995
protected static boolean getBooleanValue(final String expression) {
10096
return "true".equalsIgnoreCase(expression) || "yes".equalsIgnoreCase(expression)
101-
|| "y".equalsIgnoreCase(expression) || "oui".equalsIgnoreCase(expression)
102-
|| "1".equalsIgnoreCase(expression);
97+
|| "y".equalsIgnoreCase(expression) || "oui".equalsIgnoreCase(expression)
98+
|| "1".equalsIgnoreCase(expression);
10399
}
104100

105101
protected static void defineLookAndFeel() {

0 commit comments

Comments
 (0)