OSDN Git Service

2007-02-15 Gary Benson <gbenson@redhat.com>
authorgary <gary@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 15 Feb 2007 14:42:23 +0000 (14:42 +0000)
committergary <gary@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 15 Feb 2007 14:42:23 +0000 (14:42 +0000)
* gnu/javax/management/Server.java
(registerMBean): Always register objects that implement the
MBeanRegistration interface, and check the name returned by
preRegister before using it.

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

libjava/classpath/ChangeLog.gcj
libjava/classpath/gnu/javax/management/Server.java
libjava/classpath/lib/gnu/javax/management/Server$ServerInfo.class
libjava/classpath/lib/gnu/javax/management/Server$ServerInputStream.class
libjava/classpath/lib/gnu/javax/management/Server$ServerNotificationListener.class
libjava/classpath/lib/gnu/javax/management/Server.class

index 4aac14f..a4faec8 100644 (file)
@@ -1,5 +1,12 @@
 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.
+
+2007-02-15  Gary Benson  <gbenson@redhat.com>
+
        * javax/management/ObjectName.java:
        (getKeyPropertyList()): Remove cast and call
        to UnmodifiableMap.
index 5501b4a..aa39c75 100644 (file)
@@ -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"));
index 644d5a4..0840244 100644 (file)
Binary files a/libjava/classpath/lib/gnu/javax/management/Server$ServerInfo.class and b/libjava/classpath/lib/gnu/javax/management/Server$ServerInfo.class differ
index 536ac42..134351e 100644 (file)
Binary files a/libjava/classpath/lib/gnu/javax/management/Server$ServerInputStream.class and b/libjava/classpath/lib/gnu/javax/management/Server$ServerInputStream.class differ
index 769500c..dd98c5b 100644 (file)
Binary files a/libjava/classpath/lib/gnu/javax/management/Server$ServerNotificationListener.class and b/libjava/classpath/lib/gnu/javax/management/Server$ServerNotificationListener.class differ
index 54552f0..41154ad 100644 (file)
Binary files a/libjava/classpath/lib/gnu/javax/management/Server.class and b/libjava/classpath/lib/gnu/javax/management/Server.class differ