Fixed entering offline mode

This commit is contained in:
Kai S. K. Engelbart 2020-02-12 22:22:29 +01:00
parent b3101e2418
commit 84fd222956
2 changed files with 2 additions and 6 deletions

View File

@ -101,8 +101,7 @@ public class LoginDialog extends JDialog {
// Listen to handshake rejections // Listen to handshake rejections
EventBus.getInstance().register(HandshakeRejectionEvent.class, evt -> { EventBus.getInstance().register(HandshakeRejectionEvent.class, evt -> {
for (Component c : contentPanel.getComponents()) if (errorMessage != null) contentPanel.remove(errorMessage);
if (c == errorMessage) contentPanel.remove(errorMessage);
clearPasswordFields(); clearPasswordFields();
errorMessage = new JLabel(evt.get()); errorMessage = new JLabel(evt.get());
gbc_errorMessage = new GridBagConstraints(); gbc_errorMessage = new GridBagConstraints();
@ -135,9 +134,7 @@ public class LoginDialog extends JDialog {
client.initReceiver(localDb, receivedMessageCache); client.initReceiver(localDb, receivedMessageCache);
dispose(); dispose();
} }
} catch (IOException | InterruptedException e) { } catch (IOException | InterruptedException | TimeLimitExceededException e) {
e.printStackTrace();
} catch (TimeLimitExceededException e) {
logger.warning("Could not connect to server. Trying offline mode..."); logger.warning("Could not connect to server. Trying offline mode...");
e.printStackTrace(); e.printStackTrace();
try { try {

View File

@ -101,7 +101,6 @@ public class Startup {
// Set client user in local database // Set client user in local database
localDb.setUser(client.getSender()); localDb.setUser(client.getSender());
// Initialize chats in local database // Initialize chats in local database
try { try {
localDb.initializeUserStorage(); localDb.initializeUserStorage();