aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/gnu/javax/management/Server.java
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2007-02-15 14:42:23 +0000
committerGary Benson <gary@gcc.gnu.org>2007-02-15 14:42:23 +0000
commit02bba3c4176fe3c6055a149d75ad8694a9c01e51 (patch)
tree1dc69dc91ab2e6bc77def8d3e640ba6689bde95c /libjava/classpath/gnu/javax/management/Server.java
parentb102a4f7e8915a66d95c104bcfa443f60f792261 (diff)
downloadgcc-02bba3c4176fe3c6055a149d75ad8694a9c01e51.zip
gcc-02bba3c4176fe3c6055a149d75ad8694a9c01e51.tar.gz
gcc-02bba3c4176fe3c6055a149d75ad8694a9c01e51.tar.bz2
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 preRegister before using it. From-SVN: r121995
Diffstat (limited to 'libjava/classpath/gnu/javax/management/Server.java')
-rw-r--r--libjava/classpath/gnu/javax/management/Server.java28
1 files changed, 18 insertions, 10 deletions
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"));