Commit 46f780b9 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Improve error logging to console (JM-258).


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1246 b35dd754-fafc-0310-a699-88a17e54d16e
parent cae5ee0d
...@@ -172,6 +172,7 @@ public class AdminConsolePlugin implements Plugin { ...@@ -172,6 +172,7 @@ public class AdminConsolePlugin implements Plugin {
} }
} }
catch (Exception e) { catch (Exception e) {
System.err.println("Error starting admin console: " + e.getMessage());
Log.error("Trouble initializing admin console", e); Log.error("Trouble initializing admin console", e);
} }
} }
......
...@@ -20,7 +20,6 @@ import java.io.IOException; ...@@ -20,7 +20,6 @@ import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.ServerSocket; import java.net.ServerSocket;
import java.net.Socket; import java.net.Socket;
import java.net.UnknownHostException;
/** /**
* Implements a network front end with a dedicated thread reading * Implements a network front end with a dedicated thread reading
...@@ -57,22 +56,18 @@ public class SocketAcceptThread extends Thread { ...@@ -57,22 +56,18 @@ public class SocketAcceptThread extends Thread {
private ConnectionManager connManager; private ConnectionManager connManager;
public SocketAcceptThread(ConnectionManager connManager) { public SocketAcceptThread(ConnectionManager connManager) throws IOException {
super("Socket Listener"); super("Socket Listener");
this.connManager = connManager; this.connManager = connManager;
port = JiveGlobals.getIntProperty("xmpp.socket.plain.port", DEFAULT_PORT); port = JiveGlobals.getIntProperty("xmpp.socket.plain.port", DEFAULT_PORT);
String interfaceName = JiveGlobals.getProperty("xmpp.socket.plain.interface"); String interfaceName = JiveGlobals.getProperty("xmpp.socket.plain.interface");
bindInterface = null; bindInterface = null;
if (interfaceName != null) { if (interfaceName != null) {
try {
if (interfaceName.trim().length() > 0) { if (interfaceName.trim().length() > 0) {
bindInterface = InetAddress.getByName(interfaceName); bindInterface = InetAddress.getByName(interfaceName);
} }
} }
catch (UnknownHostException e) { serverSocket = new ServerSocket(port, -1, bindInterface);
Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
}
}
} }
/** /**
...@@ -108,8 +103,6 @@ public class SocketAcceptThread extends Thread { ...@@ -108,8 +103,6 @@ public class SocketAcceptThread extends Thread {
* call getting sockets and handing them to the SocketManager. * call getting sockets and handing them to the SocketManager.
*/ */
public void run() { public void run() {
try {
serverSocket = new ServerSocket(port, -1, bindInterface);
while (notTerminated) { while (notTerminated) {
try { try {
Socket sock = serverSocket.accept(); Socket sock = serverSocket.accept();
...@@ -128,10 +121,7 @@ public class SocketAcceptThread extends Thread { ...@@ -128,10 +121,7 @@ public class SocketAcceptThread extends Thread {
Log.error(LocaleUtils.getLocalizedString("admin.error.accept"), e); Log.error(LocaleUtils.getLocalizedString("admin.error.accept"), e);
} }
} }
}
catch (IOException e) {
Log.error(LocaleUtils.getLocalizedString("admin.error.socket-setup"), e);
}
try { try {
ServerSocket sSock = serverSocket; ServerSocket sSock = serverSocket;
serverSocket = null; serverSocket = null;
......
...@@ -65,7 +65,26 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana ...@@ -65,7 +65,26 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
localIPAddress = "Unknown"; localIPAddress = "Unknown";
} }
} }
// Start plain socket unless it's been disabled.
if (JiveGlobals.getBooleanProperty("xmpp.socket.plain.active", true)) {
try {
socketThread = new SocketAcceptThread(this);
ports.add(new ServerPort(socketThread.getPort(),
serverName, localIPAddress, false, null));
socketThread.setDaemon(true);
socketThread.start();
List params = new ArrayList();
params.add(Integer.toString(socketThread.getPort()));
Log.info(LocaleUtils.getLocalizedString("startup.plain", params));
}
catch (Exception e) {
System.err.println("Error starting XMPP listener on port " +
JiveGlobals.getIntProperty("xmpp.socket.plain.port", SocketAcceptThread.DEFAULT_PORT) +
": " + e.getMessage());
Log.error(LocaleUtils.getLocalizedString("admin.error.socket-setup"), e);
}
}
// Start SSL unless it's been disabled. // Start SSL unless it's been disabled.
if (JiveGlobals.getBooleanProperty("xmpp.socket.ssl.active", true)) { if (JiveGlobals.getBooleanProperty("xmpp.socket.ssl.active", true)) {
try { try {
...@@ -84,21 +103,12 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana ...@@ -84,21 +103,12 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
Log.info(LocaleUtils.getLocalizedString("startup.ssl", params)); Log.info(LocaleUtils.getLocalizedString("startup.ssl", params));
} }
catch (Exception e) { catch (Exception e) {
System.err.println("Error starting SSL XMPP listener on port " +
JiveGlobals.getIntProperty("xmpp.socket.ssl.port", SSLSocketAcceptThread.DEFAULT_PORT) +
": " + e.getMessage());
Log.error(LocaleUtils.getLocalizedString("admin.error.ssl"), e); Log.error(LocaleUtils.getLocalizedString("admin.error.ssl"), e);
} }
} }
// Start plain socket unless it's been disabled.
if (JiveGlobals.getBooleanProperty("xmpp.socket.plain.active", true)) {
socketThread = new SocketAcceptThread(this);
ports.add(new ServerPort(socketThread.getPort(),
serverName, localIPAddress, false, null));
socketThread.setDaemon(true);
socketThread.start();
List params = new ArrayList();
params.add(Integer.toString(socketThread.getPort()));
Log.info(LocaleUtils.getLocalizedString("startup.plain", params));
}
} }
public Iterator<ServerPort> getPorts() { public Iterator<ServerPort> getPorts() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment