Author: robbie
Date: Thu Dec  3 23:07:26 2009
New Revision: 886975

URL: http://svn.apache.org/viewvc?rev=886975&view=rev
Log:
QPID-2233: convey the exception messsage to provide useful feedback to users 
during connection failure

Modified:
    
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java

Modified: 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java?rev=886975&r1=886974&r2=886975&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java
 (original)
+++ 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java
 Thu Dec  3 23:07:26 2009
@@ -49,8 +49,6 @@
     
     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 @@
                     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;



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to