Added checks to make sure expected system properties are present.

This commit is contained in:
Veebs 2011-11-13 14:42:59 +11:00
parent 3b0eb64f1c
commit 9461b31edd

View File

@ -59,6 +59,18 @@ public class WebSocketSslServer {
Logger.getLogger("").addHandler(ch);
Logger.getLogger("").setLevel(Level.FINE);
String keyStoreFilePath = System.getProperty("keystore.file.path");
if (keyStoreFilePath == null || keyStoreFilePath.isEmpty()) {
System.out.println("ERROR: System property keystore.file.path not set. Exiting now!");
System.exit(1);
}
String keyStoreFilePassword = System.getProperty("keystore.file.password");
if (keyStoreFilePassword == null || keyStoreFilePassword.isEmpty()) {
System.out.println("ERROR: System property keystore.file.password not set. Exiting now!");
System.exit(1);
}
// Configure the server.
ServerBootstrap bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(
Executors.newCachedThreadPool(), Executors.newCachedThreadPool()));