diff --git a/libjava/classpath/ChangeLog.gcj b/libjava/classpath/ChangeLog.gcj index a4faec8c89b9..e4a71a829a52 100644 --- a/libjava/classpath/ChangeLog.gcj +++ b/libjava/classpath/ChangeLog.gcj @@ -1,3 +1,10 @@ +2007-02-15 Gary Benson + + * 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 * gnu/javax/management/Server.java diff --git a/libjava/classpath/javax/management/AttributeList.java b/libjava/classpath/javax/management/AttributeList.java index 6823df3f28a5..09db9b621baa 100644 --- a/libjava/classpath/javax/management/AttributeList.java +++ b/libjava/classpath/javax/management/AttributeList.java @@ -49,7 +49,7 @@ import java.util.ArrayList; * @since 1.5 */ public class AttributeList - extends ArrayList + extends ArrayList { /** diff --git a/libjava/classpath/javax/management/MBeanServerDelegate.java b/libjava/classpath/javax/management/MBeanServerDelegate.java index bf3f5f894202..347e51fc97c6 100644 --- a/libjava/classpath/javax/management/MBeanServerDelegate.java +++ b/libjava/classpath/javax/management/MBeanServerDelegate.java @@ -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)); } diff --git a/libjava/classpath/javax/management/MBeanServerFactory.java b/libjava/classpath/javax/management/MBeanServerFactory.java index 8b27c46e8d7f..54195635bd26 100644 --- a/libjava/classpath/javax/management/MBeanServerFactory.java +++ b/libjava/classpath/javax/management/MBeanServerFactory.java @@ -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 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 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 list = new ArrayList(); + 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 i = servers.values().iterator(); while (i.hasNext()) { - MBeanServer s = (MBeanServer) i.next(); + MBeanServer s = i.next(); if (server == s) { i.remove(); diff --git a/libjava/classpath/javax/management/StandardMBean.java b/libjava/classpath/javax/management/StandardMBean.java index 16b6f0b66876..0434a40b8cc3 100644 --- a/libjava/classpath/javax/management/StandardMBean.java +++ b/libjava/classpath/javax/management/StandardMBean.java @@ -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; } diff --git a/libjava/classpath/lib/javax/management/AttributeList.class b/libjava/classpath/lib/javax/management/AttributeList.class index 528918c72bf3..b2402e989b50 100644 Binary files a/libjava/classpath/lib/javax/management/AttributeList.class and b/libjava/classpath/lib/javax/management/AttributeList.class differ diff --git a/libjava/classpath/lib/javax/management/MBeanServerDelegate.class b/libjava/classpath/lib/javax/management/MBeanServerDelegate.class index 325af96c49c3..90130982041f 100644 Binary files a/libjava/classpath/lib/javax/management/MBeanServerDelegate.class and b/libjava/classpath/lib/javax/management/MBeanServerDelegate.class differ diff --git a/libjava/classpath/lib/javax/management/MBeanServerFactory.class b/libjava/classpath/lib/javax/management/MBeanServerFactory.class index b64a82f29096..4b73417d78c7 100644 Binary files a/libjava/classpath/lib/javax/management/MBeanServerFactory.class and b/libjava/classpath/lib/javax/management/MBeanServerFactory.class differ diff --git a/libjava/classpath/lib/javax/management/StandardMBean.class b/libjava/classpath/lib/javax/management/StandardMBean.class index 7657a32b7574..29ed9dbc1f39 100644 Binary files a/libjava/classpath/lib/javax/management/StandardMBean.class and b/libjava/classpath/lib/javax/management/StandardMBean.class differ