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

Commit 63ad119

Browse files
author
Emmanuel Hugonnet
committed
Adding support for LibreOffice 3.6
1 parent c32bd49 commit 63ad119

File tree

5 files changed

+18
-9
lines changed

5 files changed

+18
-9
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<artifactId>office-online</artifactId>
1818
<packaging>jar</packaging>
1919
<version>5.11.1-SNAPSHOT</version>
20-
<name>Online Office Editor</name>
20+
<name>Online Office Editor - ${project.version}</name>
2121
<build>
2222
<finalName>OpenOfficeLauncher</finalName>
2323
</build>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ public static void main(final String[] args) throws OfficeNotFoundException {
7272
AuthenticationInfo authInfo = null;
7373
if (args.length >= 5) {
7474
authInfo = PasswordManager.extractAuthenticationInfo(args[3], args[4]);
75+
} else if (args.length >= 4 ) {
76+
authInfo = PasswordManager.extractAuthenticationInfo(args[3], null);
7577
}
7678
MsOfficeType contentType = getContentType(UrlExtractor.decodeUrl(args[0]));
7779
logger.log(Level.FINE, "{0}{1}", new Object[]{MessageUtil.getMessage("info.document.type"),

src/main/java/org/silverpeas/openoffice/util/PasswordManager.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ public static AuthenticationInfo extractAuthenticationInfo(String login, String
100100
if (encodedPassword != null && !encodedPassword.isEmpty()) {
101101
clearPwd = decodePassword(encodedPassword);
102102
} else {
103-
clearPwd = new char[0];
103+
clearPwd = null;
104104
}
105-
if (clearPwd.length <= 0) {
105+
if (clearPwd == null || clearPwd.length <= 0) {
106106
clearPwd = promptForpassword();
107107
}
108108
String decodedLogin = URLDecoder.decode(login, "UTF-8");
@@ -118,6 +118,8 @@ public static AuthenticationInfo extractAuthenticationInfo(String login, String
118118
}
119119

120120
private static char[] promptForpassword() {
121+
Logger.getLogger(Launcher.class.getName()).log(Level.INFO,
122+
"No password provided, need to ask for one");
121123
return MessageDisplayer.displayPromptPassword();
122124
}
123125
}

src/main/java/org/silverpeas/openoffice/windows/FileWebDavAccessManager.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,13 @@ public class FileWebDavAccessManager {
5151
* @param auth authentication info
5252
*/
5353
public FileWebDavAccessManager(AuthenticationInfo auth) {
54-
this.userName = auth.getLogin();
55-
this.password = auth.getPassword();
54+
if (auth != null) {
55+
this.userName = auth.getLogin();
56+
this.password = auth.getPassword();
57+
} else {
58+
this.userName = "";
59+
this.password = new char[0];
60+
}
5661
}
5762

5863
/**
@@ -69,10 +74,10 @@ public String retrieveFile(String url) throws HttpException, IOException {
6974
// Let's lock the file
7075
lockToken = webdav.lockFile(uri, userName);
7176
logger.log(Level.INFO, "{0}{1}{2}", new Object[]{MessageUtil.getMessage("info.webdav.locked"),
72-
' ', lockToken});
77+
' ', lockToken});
7378
String tmpFile = webdav.getFile(uri, lockToken);
7479
logger.log(Level.INFO, "{0}{1}{2}", new Object[]{MessageUtil.getMessage(
75-
"info.webdav.file.locally.saved"), ' ', tmpFile});
80+
"info.webdav.file.locally.saved"), ' ', tmpFile});
7681
return tmpFile;
7782
}
7883

@@ -88,7 +93,7 @@ public void pushFile(String tmpFilePath, String url) throws HttpException, IOExc
8893
URI uri = getURI(url);
8994
WebdavManager webdav = new WebdavManager(uri.getHost(), userName, new String(password));
9095
logger.log(Level.INFO, "{0}{1}{2}", new Object[]{MessageUtil.getMessage("info.webdav.put"), ' ',
91-
tmpFilePath});
96+
tmpFilePath});
9297
webdav.putFile(uri, tmpFilePath, lockToken);
9398
logger.log(Level.INFO, "{0}{1}{2}",
9499
new Object[]{MessageUtil.getMessage("info.webdav.unlocking"), ' ', uri.getEscapedURI()});

src/main/java/org/silverpeas/openoffice/windows/WindowsLibreOfficeFinder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
public class WindowsLibreOfficeFinder extends OpenOfficeFinder {
3333

3434
static final Logger logger = Logger.getLogger(WindowsLibreOfficeFinder.class.getName());
35-
private static final String[] VERSIONS = new String[]{"3.5"};
35+
private static final String[] VERSIONS = new String[]{"3.5", "3.6"};
3636
private static final String GLOBAL_LIBRE_OFFICE_FOLDER =
3737
"\"HKEY_LOCAL_MACHINE\\SOFTWARE\\LibreOffice\\LibreOffice\\";
3838
private static final String GLOBAL_LIBRE_OFFICE_FOLDER_64 =

0 commit comments

Comments
 (0)