Asiri Rathnayake
unread,Mar 5, 2009, 11:38:23 PM3/5/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to jodcon...@googlegroups.com
Hi Mirko and List :)
I noticed that when creating an instance of ManagedOfficeProcess class, an IllegalArgumentException is thrown if either of the officehome or the offieprofile paths does not exists. But still when ManagedOfficeProcess class creates an internal OfficeProcess instance it doesn't check whether the excutable files exists:
<code>
public class OfficeProcess {
/*...*/
public OfficeProcess(File officeHome, String acceptString, File profileDir) {
this.officeHome = officeHome;
this.acceptString = acceptString;
this.profileDir = profileDir;
}
public void start() throws IOException {
List<String> command = new ArrayList<String>();
command.add(new File(officeHome, getExecutablePath()).getAbsolutePath());
/*.....*/
}
private String getExecutablePath() {
if (OsUtils.isMac()) {
return "MacOS/soffice.bin";
} else {
return "program/soffice.bin";
}
}
<code>
I think it would be nice if OfficeProcess constructor could also throw an IllegalArgumentException if the soffice.bin file does not exist. Such situations can occur because these information are taken from configuration files most of the time. Same concept could be applied to validating officeprofile path but I'm not sure if there is a unque way to do it.
WDYT?
Thanks.
- Asiri