@@ -58,20 +58,26 @@ public class OfficeLauncher {
58
58
public static int launch (MsOfficeType type , String url , AuthenticationInfo authInfo ,
59
59
boolean useDeconnectedMode ) throws IOException , InterruptedException , OfficeNotFoundException {
60
60
OfficeFinder finder = FinderFactory .getFinder (type );
61
- logger .log (Level .INFO , "Are we using Office : {0}" , finder .isMicrosoftOffice ());
62
61
logger .log (Level .INFO , "We are on {0} OS" , OsEnum .getOS ());
62
+ String webdavUrl = url ;
63
63
boolean modeDisconnected = ((OsEnum .isWindows () && useDeconnectedMode ) || OsEnum .getOS ()
64
64
== 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
+ }
65
71
switch (type ) {
66
72
case EXCEL :
67
- return launch (type , finder .findSpreadsheet (), url , modeDisconnected , authInfo );
73
+ return launch (type , finder .findSpreadsheet (), webdavUrl , modeDisconnected , authInfo );
68
74
case POWERPOINT :
69
- return launch (type , finder .findPresentation (), url , modeDisconnected , authInfo );
75
+ return launch (type , finder .findPresentation (), webdavUrl , modeDisconnected , authInfo );
70
76
case WORD :
71
- return launch (type , finder .findWordEditor (), url , modeDisconnected , authInfo );
77
+ return launch (type , finder .findWordEditor (), webdavUrl , modeDisconnected , authInfo );
72
78
case NONE :
73
79
default :
74
- return launch (type , finder .findOther (), url , modeDisconnected , authInfo );
80
+ return launch (type , finder .findOther (), webdavUrl , modeDisconnected , authInfo );
75
81
}
76
82
}
77
83
@@ -90,7 +96,6 @@ protected static int launch(MsOfficeType type, String path, String url, boolean
90
96
AuthenticationInfo auth ) throws IOException , InterruptedException {
91
97
logger .log (Level .INFO , "The path: {0}" , path );
92
98
logger .log (Level .INFO , "The url: {0}" , url );
93
- logger .log (Level .INFO , "The command line: {0} {1}" , new Object []{path , url });
94
99
if (modeDisconnected ) {
95
100
try {
96
101
String webdavUrl = url ;
@@ -114,13 +119,8 @@ protected static int launch(MsOfficeType type, String path, String url, boolean
114
119
}
115
120
} else {
116
121
// 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 );
124
124
return process .waitFor ();
125
125
}
126
126
}
0 commit comments