You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2009/02/27 01:28:58 UTC

svn commit: r748359 - /qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java

Author: robbie
Date: Fri Feb 27 00:28:58 2009
New Revision: 748359

URL: http://svn.apache.org/viewvc?rev=748359&view=rev
Log:
QPID-1697: for mbeans that are not queues, connections or exchanges, check the MBeanInfo can be retrieved before adding it to the navigation tree. Prevents showing the admin-only mbeans to users who cant view them anyway

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

Modified: qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java?rev=748359&r1=748358&r2=748359&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java (original)
+++ qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java Fri Feb 27 00:28:58 2009
@@ -446,6 +446,21 @@
             }
         }
     }
+    
+    //check if the MBeanInfo can be retrieved.
+    private boolean haveAccessPermission(ManagedBean mbean)
+    {
+        try
+        {                
+            MBeanUtility.getMBeanInfo(mbean);     
+        }
+        catch(Exception ex)
+        {
+            return false;
+        }
+        
+        return true;
+    }
 
     /**
      * Queries the Qpid Server and populates the given domain node with all MBeans undser that domain.
@@ -469,7 +484,11 @@
             // manually by selecting from MBeanView
             if (!(mbean.isConnection() || mbean.isExchange() || mbean.isQueue()))
             {
-                addManagedBean(domain, mbean);
+                //if we cant get the MBeanInfo then we cant display the mbean, so dont add it to the tree
+                if (haveAccessPermission(mbean))
+                {
+                    addManagedBean(domain, mbean);
+                }
             }
         }
         // To make it work with the broker without virtual host implementation.



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org