Some code cleanup and make sure StandaloneServletClient actually works by avoiding NullPointerExceptions and calling Server.init().

This commit is contained in:
hns 2008-10-15 14:49:08 +00:00
parent fc8ce41184
commit 5217132767
3 changed files with 6 additions and 14 deletions

View file

@ -32,10 +32,6 @@ import java.io.*;
import java.rmi.registry.*;
import java.rmi.server.*;
import java.util.*;
import java.net.Socket;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.net.InetSocketAddress;
import helma.util.ResourceProperties;
@ -109,8 +105,10 @@ public class Server implements Runnable {
// create system properties
sysProps = new ResourceProperties();
if (config.hasPropFile()) {
sysProps.addResource(new FileResource(config.getPropFile()));
}
}
/**
@ -304,13 +302,6 @@ public class Server implements Runnable {
if (!config.hasHomeDir()) {
throw new Exception ("couldn't determine helma directory");
}
// try to transform hopHome directory to its canonical representation
try {
config.setHomeDir(config.getHomeDir().getCanonicalFile());
} catch (IOException iox) {
config.setHomeDir(config.getHomeDir().getAbsoluteFile());
}
}

View file

@ -93,7 +93,7 @@ public class ServerConfig {
}
public void setPropFile(File propFile) {
this.propFile = propFile;
this.propFile = propFile == null ? null : propFile.getAbsoluteFile();
}
public File getHomeDir() {
@ -101,6 +101,6 @@ public class ServerConfig {
}
public void setHomeDir(File homeDir) {
this.homeDir = homeDir;
this.homeDir = homeDir == null ? null : homeDir.getAbsoluteFile();
}
}

View file

@ -159,6 +159,7 @@ public final class StandaloneServletClient extends AbstractServletClient {
ServerConfig config = new ServerConfig();
config.setHomeDir(hopHome);
Server server = new Server(config);
server.init();
app = new Application(appName, server, repositories, appHome, dbHome);
app.init();