Some code cleanup and make sure StandaloneServletClient actually works by avoiding NullPointerExceptions and calling Server.init().
This commit is contained in:
parent
fc8ce41184
commit
5217132767
3 changed files with 6 additions and 14 deletions
|
@ -32,10 +32,6 @@ import java.io.*;
|
||||||
import java.rmi.registry.*;
|
import java.rmi.registry.*;
|
||||||
import java.rmi.server.*;
|
import java.rmi.server.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.net.Socket;
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.net.UnknownHostException;
|
|
||||||
import java.net.InetSocketAddress;
|
|
||||||
|
|
||||||
import helma.util.ResourceProperties;
|
import helma.util.ResourceProperties;
|
||||||
|
|
||||||
|
@ -109,7 +105,9 @@ public class Server implements Runnable {
|
||||||
|
|
||||||
// create system properties
|
// create system properties
|
||||||
sysProps = new ResourceProperties();
|
sysProps = new ResourceProperties();
|
||||||
sysProps.addResource(new FileResource(config.getPropFile()));
|
if (config.hasPropFile()) {
|
||||||
|
sysProps.addResource(new FileResource(config.getPropFile()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -304,13 +302,6 @@ public class Server implements Runnable {
|
||||||
if (!config.hasHomeDir()) {
|
if (!config.hasHomeDir()) {
|
||||||
throw new Exception ("couldn't determine helma directory");
|
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());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class ServerConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPropFile(File propFile) {
|
public void setPropFile(File propFile) {
|
||||||
this.propFile = propFile;
|
this.propFile = propFile == null ? null : propFile.getAbsoluteFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getHomeDir() {
|
public File getHomeDir() {
|
||||||
|
@ -101,6 +101,6 @@ public class ServerConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHomeDir(File homeDir) {
|
public void setHomeDir(File homeDir) {
|
||||||
this.homeDir = homeDir;
|
this.homeDir = homeDir == null ? null : homeDir.getAbsoluteFile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,6 +159,7 @@ public final class StandaloneServletClient extends AbstractServletClient {
|
||||||
ServerConfig config = new ServerConfig();
|
ServerConfig config = new ServerConfig();
|
||||||
config.setHomeDir(hopHome);
|
config.setHomeDir(hopHome);
|
||||||
Server server = new Server(config);
|
Server server = new Server(config);
|
||||||
|
server.init();
|
||||||
|
|
||||||
app = new Application(appName, server, repositories, appHome, dbHome);
|
app = new Application(appName, server, repositories, appHome, dbHome);
|
||||||
app.init();
|
app.init();
|
||||||
|
|
Loading…
Add table
Reference in a new issue