qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhupend...@apache.org
Subject svn commit: r531458 - /incubator/qpid/branches/M2/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java
Date Mon, 23 Apr 2007 13:13:36 GMT
Author: bhupendrab
Date: Mon Apr 23 06:13:28 2007
New Revision: 531458

URL: http://svn.apache.org/viewvc?view=rev&rev=531458
Log:
QPID-445 : Fixed the ClassCastException

Modified:
    incubator/qpid/branches/M2/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java

Modified: incubator/qpid/branches/M2/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java?view=diff&rev=531458&r1=531457&r2=531458
==============================================================================
--- incubator/qpid/branches/M2/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java
(original)
+++ incubator/qpid/branches/M2/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java
Mon Apr 23 06:13:28 2007
@@ -17,8 +17,7 @@
  */
 package org.apache.qpid.server.management;
 
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.security.access.AMQUserManagementMBean;
+import org.apache.qpid.server.security.access.UserManagement;
 import org.apache.log4j.Logger;
 
 import javax.management.remote.MBeanServerForwarder;
@@ -37,12 +36,6 @@
 import java.security.AccessControlContext;
 import java.util.Set;
 import java.util.Properties;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ConcurrentHashMap;
-import java.io.File;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.FileInputStream;
 
 /**
  * This class can be used by the JMXConnectorServer as an InvocationHandler for the mbean
operations. This implements
@@ -110,6 +103,7 @@
         // Restrict access to "createMBean" and "unregisterMBean" to any user
         if (methodName.equals("createMBean") || methodName.equals("unregisterMBean"))
         {
+            _logger.debug("User trying to create or unregister an MBean");
             throw new SecurityException("Access denied");
         }
 
@@ -155,29 +149,12 @@
     {
         if (args[0] instanceof ObjectName)
         {
-            String mbeanMethod = (args.length > 1) ? (String) args[1] : null;
-            if (mbeanMethod == null)
+            if (args[0] instanceof ObjectName)
             {
-                if (args[0] instanceof ObjectName)
-                {
-                    ObjectName object = (ObjectName) args[0];
-                    return object.getCanonicalName().contains("UserManagement");
-                }
-                else
-                {
-                    return false;
-                }
+                ObjectName object = (ObjectName) args[0];
+                return UserManagement.TYPE.equals(object.getKeyProperty("type"));
             }
-
-            try
-            {
-                MBeanInfo mbeanInfo = mbs.getMBeanInfo((ObjectName) args[0]);
-                if (mbeanInfo != null)
-                {
-                    return mbeanInfo.getClassName().equals("org.apache.qpid.server.security.access.AMQUserManagementMBean");
-                }
-            }
-            catch (JMException ex)
+            else
             {
                 return false;
             }



Mime
View raw message