From 02bba3c4176fe3c6055a149d75ad8694a9c01e51 Mon Sep 17 00:00:00 2001 From: Gary Benson Date: Thu, 15 Feb 2007 14:42:23 +0000 Subject: 2007-02-15 Gary Benson * gnu/javax/management/Server.java (registerMBean): Always register objects that implement the MBeanRegistration interface, and check the name returned by preRegister before using it. From-SVN: r121995 --- libjava/classpath/ChangeLog.gcj | 7 ++++++ libjava/classpath/gnu/javax/management/Server.java | 28 +++++++++++++-------- .../gnu/javax/management/Server$ServerInfo.class | Bin 898 -> 898 bytes .../management/Server$ServerInputStream.class | Bin 1219 -> 1219 bytes .../Server$ServerNotificationListener.class | Bin 1282 -> 1282 bytes .../lib/gnu/javax/management/Server.class | Bin 23261 -> 23419 bytes 6 files changed, 25 insertions(+), 10 deletions(-) (limited to 'libjava/classpath') diff --git a/libjava/classpath/ChangeLog.gcj b/libjava/classpath/ChangeLog.gcj index 4aac14f..a4faec8 100644 --- a/libjava/classpath/ChangeLog.gcj +++ b/libjava/classpath/ChangeLog.gcj @@ -1,5 +1,12 @@ 2007-02-15 Gary Benson + * gnu/javax/management/Server.java + (registerMBean): Always register objects that implement the + MBeanRegistration interface, and check the name returned by + preRegister before using it. + +2007-02-15 Gary Benson + * javax/management/ObjectName.java: (getKeyPropertyList()): Remove cast and call to UnmodifiableMap. diff --git a/libjava/classpath/gnu/javax/management/Server.java b/libjava/classpath/gnu/javax/management/Server.java index 5501b4a..aa39c75 100644 --- a/libjava/classpath/gnu/javax/management/Server.java +++ b/libjava/classpath/gnu/javax/management/Server.java @@ -1657,19 +1657,27 @@ public class Server MBeanRegistration register = null; if (obj instanceof MBeanRegistration) register = (MBeanRegistration) obj; - if (name == null) + if (name == null && register == null) + { + RuntimeException e = + new IllegalArgumentException("The name was null and " + + "the bean does not implement " + + "MBeanRegistration."); + throw new RuntimeOperationsException(e); + } + if (register != null) { - if (register == null) - { - RuntimeException e = - new IllegalArgumentException("The name was null and " + - "the bean does not implement " + - "MBeanRegistration."); - throw new RuntimeOperationsException(e); - } try { - name = register.preRegister(this, null); + name = register.preRegister(this, name); + if (name == null) + { + RuntimeException e = + new NullPointerException("The name returned by " + + "MBeanRegistration.preRegister() " + + "was null"); + throw e; + } if (sm != null) sm.checkPermission(new MBeanPermission(className, null, name, "registerMBean")); diff --git a/libjava/classpath/lib/gnu/javax/management/Server$ServerInfo.class b/libjava/classpath/lib/gnu/javax/management/Server$ServerInfo.class index 644d5a4..0840244 100644 Binary files a/libjava/classpath/lib/gnu/javax/management/Server$ServerInfo.class and b/libjava/classpath/lib/gnu/javax/management/Server$ServerInfo.class differ diff --git a/libjava/classpath/lib/gnu/javax/management/Server$ServerInputStream.class b/libjava/classpath/lib/gnu/javax/management/Server$ServerInputStream.class index 536ac42..134351e 100644 Binary files a/libjava/classpath/lib/gnu/javax/management/Server$ServerInputStream.class and b/libjava/classpath/lib/gnu/javax/management/Server$ServerInputStream.class differ diff --git a/libjava/classpath/lib/gnu/javax/management/Server$ServerNotificationListener.class b/libjava/classpath/lib/gnu/javax/management/Server$ServerNotificationListener.class index 769500c..dd98c5b 100644 Binary files a/libjava/classpath/lib/gnu/javax/management/Server$ServerNotificationListener.class and b/libjava/classpath/lib/gnu/javax/management/Server$ServerNotificationListener.class differ diff --git a/libjava/classpath/lib/gnu/javax/management/Server.class b/libjava/classpath/lib/gnu/javax/management/Server.class index 54552f0..41154ad 100644 Binary files a/libjava/classpath/lib/gnu/javax/management/Server.class and b/libjava/classpath/lib/gnu/javax/management/Server.class differ -- cgit v1.1