2007-02-15 Gary Benson <gbenson@redhat.com>
authorgary <gary@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 15 Feb 2007 16:40:44 +0000 (16:40 +0000)
committergary <gary@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 15 Feb 2007 16:40:44 +0000 (16:40 +0000)
* javax/management/AttributeList.java: Updated.
* javax/management/MBeanServerDelegate.java: Likewise.
* javax/management/MBeanServerFactory.java: Likewise.
* javax/management/StandardMBean.java: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122004 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/classpath/ChangeLog.gcj
libjava/classpath/javax/management/AttributeList.java
libjava/classpath/javax/management/MBeanServerDelegate.java
libjava/classpath/javax/management/MBeanServerFactory.java
libjava/classpath/javax/management/StandardMBean.java
libjava/classpath/lib/javax/management/AttributeList.class
libjava/classpath/lib/javax/management/MBeanServerDelegate.class
libjava/classpath/lib/javax/management/MBeanServerFactory.class
libjava/classpath/lib/javax/management/StandardMBean.class

index a4faec8..e4a71a8 100644 (file)
@@ -1,5 +1,12 @@
 2007-02-15  Gary Benson  <gbenson@redhat.com>
 
+       * javax/management/AttributeList.java: Updated.
+       * javax/management/MBeanServerDelegate.java: Likewise.
+       * javax/management/MBeanServerFactory.java: Likewise.
+       * javax/management/StandardMBean.java: Likewise.
+
+2007-02-15  Gary Benson  <gbenson@redhat.com>
+
        * gnu/javax/management/Server.java
        (registerMBean): Always register objects that implement the
        MBeanRegistration interface, and check the name returned by
index 6823df3..09db9b6 100644 (file)
@@ -49,7 +49,7 @@ import java.util.ArrayList;
  * @since 1.5
  */
 public class AttributeList
-  extends ArrayList
+  extends ArrayList<Object>
 {
 
   /**
index bf3f5f8..347e51f 100644 (file)
@@ -69,7 +69,7 @@ public class MBeanServerDelegate
   /**
    * The listeners registered with the delegate.
    */
-  private List listeners;
+  private final List listeners = new ArrayList();
 
   /**
    * The sequence identifier used by the delegate.
@@ -120,8 +120,6 @@ public class MBeanServerDelegate
   {
     if (listener == null)
       throw new IllegalArgumentException("A null listener was supplied.");
-    if (listeners == null)
-      listeners = new ArrayList();
     listeners.add(new ListenerData(listener, filter, passback));
   }
 
index 8b27c46..5419563 100644 (file)
@@ -1,5 +1,5 @@
 /* MBeanServerFactory.java -- Manages server instances.
-   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -89,7 +89,7 @@ public class MBeanServerFactory
   /**
    * The map of registered servers (identifiers to servers).
    */
-  private static Map servers = new HashMap();
+  private static final Map<Object,MBeanServer> servers = new HashMap();
 
   /**
    * Private constructor to prevent instance creation.
@@ -206,15 +206,15 @@ public class MBeanServerFactory
    *                           caller's permissions don't imply {@link
    *                           MBeanServerPermission(String)}("findMBeanServer")
    */
-  public static ArrayList findMBeanServer(String id)
+  public static ArrayList<MBeanServer> findMBeanServer(String id)
   {
     SecurityManager sm = System.getSecurityManager();
     if (sm != null)
       sm.checkPermission(new MBeanServerPermission("findMBeanServer"));
     if (id == null)
       return new ArrayList(servers.values());
-    ArrayList list = new ArrayList();
-    MBeanServer server = (MBeanServer) servers.get(id);
+    ArrayList<MBeanServer> list = new ArrayList<MBeanServer>();
+    MBeanServer server = servers.get(id);
     if (server != null)
       list.add(servers.get(id));
     return list;
@@ -334,7 +334,8 @@ public class MBeanServerFactory
            builder.getClass() != MBeanServerBuilder.class)
          builder = new MBeanServerBuilder();
       }
-    else if (!(builderClass.equals(builder.getClass().getName())))
+    else if (!(builder != null &&
+              builderClass.equals(builder.getClass().getName())))
       {
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        if (cl == null)
@@ -394,10 +395,10 @@ public class MBeanServerFactory
     SecurityManager sm = System.getSecurityManager();
     if (sm != null)
       sm.checkPermission(new MBeanServerPermission("releaseMBeanServer"));
-    Iterator i = servers.values().iterator();
+    Iterator<MBeanServer> i = servers.values().iterator();
     while (i.hasNext())
       {
-       MBeanServer s = (MBeanServer) i.next();
+       MBeanServer s = i.next();
        if (server == s)
          {
            i.remove();
index 16b6f0b..0434a40 100644 (file)
@@ -107,8 +107,9 @@ public class StandardMBean
        catch (ClassNotFoundException e)
          {
            throw (NotCompliantMBeanException) 
-             (new NotCompliantMBeanException("An interface for the class " +
-                                             className + " was not found.").initCause(e));
+             (new NotCompliantMBeanException("An interface, " + className +
+                                             "MBean, for the class " + className +
+                                             " was not found.").initCause(e));
          }
       }
     if (!(iface.isInstance(this)))
@@ -142,13 +143,15 @@ public class StandardMBean
        String className = impl.getClass().getName();
        try
          {
-           iface = Class.forName(className + "MBean");
+           iface = Class.forName(className + "MBean", true,
+                                 impl.getClass().getClassLoader());
          }
        catch (ClassNotFoundException e)
          {
            throw (NotCompliantMBeanException) 
-             (new NotCompliantMBeanException("An interface for the class " +
-                                             className + " was not found.").initCause(e));
+             (new NotCompliantMBeanException("An interface, " + className +
+                                             "MBean, for the class " + className +
+                                             " was not found.").initCause(e));
          }
       }
     if (!(iface.isInstance(impl)))
@@ -665,7 +668,10 @@ public class StandardMBean
                         ainfo, cinfo, oinfo, null);
     String cname = getClassName(info);
     String desc = getDescription(info);
-    info = new MBeanInfo(cname, desc, ainfo, cinfo, oinfo, null);
+    MBeanNotificationInfo[] ninfo = null;
+    if (impl instanceof NotificationBroadcaster)
+      ninfo = ((NotificationBroadcaster) impl).getNotificationInfo();
+    info = new MBeanInfo(cname, desc, ainfo, cinfo, oinfo, ninfo);
     cacheMBeanInfo(info);
     return info;
   }
index 528918c..b2402e9 100644 (file)
Binary files a/libjava/classpath/lib/javax/management/AttributeList.class and b/libjava/classpath/lib/javax/management/AttributeList.class differ
index 325af96..9013098 100644 (file)
Binary files a/libjava/classpath/lib/javax/management/MBeanServerDelegate.class and b/libjava/classpath/lib/javax/management/MBeanServerDelegate.class differ
index b64a82f..4b73417 100644 (file)
Binary files a/libjava/classpath/lib/javax/management/MBeanServerFactory.class and b/libjava/classpath/lib/javax/management/MBeanServerFactory.class differ
index 7657a32..29ed9db 100644 (file)
Binary files a/libjava/classpath/lib/javax/management/StandardMBean.class and b/libjava/classpath/lib/javax/management/StandardMBean.class differ