From d31b9ee581628c92370b4c8ee3fb54802ae50f2f Mon Sep 17 00:00:00 2001 From: Ingo Bauersachs Date: Sat, 10 Aug 2013 18:12:59 +0200 Subject: [PATCH] Show the error message from the server on an account creation attempt --- resources/languages/resources.properties | 2 +- .../jabberaccregwizz/JabberAccountCreationForm.java | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties index aa3252a7e..b6ca141ef 100644 --- a/resources/languages/resources.properties +++ b/resources/languages/resources.properties @@ -997,7 +997,7 @@ plugin.jabberaccregwizz.RESOURCE=Resource plugin.jabberaccregwizz.AUTORESOURCE=Auto generate resource plugin.jabberaccregwizz.PRIORITY=Priority plugin.jabberaccregwizz.XMPP_ERROR=XMPP Error -plugin.jabberaccregwizz.UNKNOWN_XMPP_ERROR=Unknown XMPP error. Verify that the server name is correct. +plugin.jabberaccregwizz.UNKNOWN_XMPP_ERROR=Unknown XMPP error ({0}). Verify that the server name is correct. plugin.jabberaccregwizz.NOT_SAME_PASSWORD=Your passwords did not match. plugin.jabberaccregwizz.OVERRIDE_SERVER_DEFAULT_OPTIONS=Override server default options plugin.jabberaccregwizz.ADVANCED_OPTIONS=Advanced options diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountCreationForm.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountCreationForm.java index db934ac1a..34710f33a 100644 --- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountCreationForm.java +++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountCreationForm.java @@ -168,6 +168,7 @@ private boolean createJabberAccount(String server, int port, String username, } catch (XMPPException exc) { + logger.error(exc); if (exc.getXMPPError().getCode() == 409) { showErrorMessage(Resources.getString( @@ -179,9 +180,12 @@ private boolean createJabberAccount(String server, int port, String username, } else { - showErrorMessage(Resources.getString( - "plugin.jabberaccregwizz.UNKNOWN_XMPP_ERROR")); + showErrorMessage(Resources.getResources().getI18NString( + "plugin.jabberaccregwizz.UNKNOWN_XMPP_ERROR", + new String[]{exc.getMessage()} + )); } + return false; } } @@ -274,7 +278,9 @@ private void showErrorMessage(String text) if (errorPane.getParent() == null) userIDPassPanel.add(errorPane, BorderLayout.NORTH); - SwingUtilities.getWindowAncestor(this).pack(); + Window ancestor = SwingUtilities.getWindowAncestor(this); + if (ancestor != null) + ancestor.pack(); } /**