From 095d573ebd5c1a3f6cec3e9c6425f6282e343be7 Mon Sep 17 00:00:00 2001 From: Robert Gemmell Date: Thu, 3 Dec 2009 23:07:26 +0000 Subject: QPID-2233: convey the exception messsage to provide useful feedback to users during connection failure git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@886975 13f79535-47bb-0310-9956-ffa450edef68 --- .../qpid/management/ui/actions/AbstractAction.java | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'java/management/eclipse-plugin/src') diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java index 12906d1ff4..5d892f5503 100644 --- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java +++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java @@ -49,8 +49,6 @@ public class AbstractAction protected IWorkbenchWindow _window; - public static final String SECURITY_FAILURE = "User authentication failed"; - public static final String SERVER_UNAVAILABLE = "Unable to connect to the specified Qpid JMX server"; public static final String INVALID_PERSPECTIVE = "Invalid Perspective"; public static final String CHANGE_PERSPECTIVE = "Please use the Qpid Management Perspective"; @@ -153,18 +151,16 @@ public class AbstractAction return; } } - else if (ex instanceof IOException) + else if (ex instanceof IOException || ex instanceof SecurityException ) { - //uncaught IOException, eg when trying to connect to a server/port with no JMX server running - msg = SERVER_UNAVAILABLE; - //Display error dialogue and return - displayErrorDialogue(msg, title); - return; - } - else if (ex instanceof SecurityException) - { - //SecurityException when providing incorrect login credentials - msg = SECURITY_FAILURE; + msg = ex.getMessage(); + + //if msg is still null, try reporting the cause. + if ((msg == null) && (ex.getCause() != null)) + { + msg = ex.getCause().getMessage(); + } + //Display error dialogue and return displayErrorDialogue(msg, title); return; -- cgit v1.2.1