From 02bba3c4176fe3c6055a149d75ad8694a9c01e51 Mon Sep 17 00:00:00 2001 From: Gary Benson Date: Thu, 15 Feb 2007 14:42:23 +0000 Subject: [PATCH] 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 +++++ .../gnu/javax/management/Server.java | 28 +++++++++++------- .../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(-) diff --git a/libjava/classpath/ChangeLog.gcj b/libjava/classpath/ChangeLog.gcj index 4aac14f38ab..a4faec8c89b 100644 --- a/libjava/classpath/ChangeLog.gcj +++ b/libjava/classpath/ChangeLog.gcj @@ -1,3 +1,10 @@ +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: diff --git a/libjava/classpath/gnu/javax/management/Server.java b/libjava/classpath/gnu/javax/management/Server.java index 5501b4af7c0..aa39c75ad46 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 644d5a40574d8c5c322608bd4c224d0783b0fed8..0840244605904cdac09ef5d8b2b3455be6da784e 100644 GIT binary patch delta 37 scmZo-Z(`rDn~67?ft4eifs-SWfsZ3<@(HE@#`wvS%r=ZElf#&G0Hy*6n*aa+ delta 37 scmZo-Z(`rDn~67=ftACbfs-SUfsZ3-@(HE@#_-9K%r=ZMlf#&G0HUG@YXATM diff --git a/libjava/classpath/lib/gnu/javax/management/Server$ServerInputStream.class b/libjava/classpath/lib/gnu/javax/management/Server$ServerInputStream.class index 536ac420c8134dbce10ac7ee4c0a12c5d3f0f021..134351e7b96ec1f766671e563b7f055b8e15a995 100644 GIT binary patch delta 35 qcmX@id6;tp2Meby11pC$0~d$QWI>ii&Y delta 47 zcmZqTYU0{pz#`bnz{*k2z{%0Xz{k B3VHwl diff --git a/libjava/classpath/lib/gnu/javax/management/Server.class b/libjava/classpath/lib/gnu/javax/management/Server.class index 54552f005855f8e5f08b2ffb23aa4d303abcfa75..41154ad8bf3bb4be9db9c0beb276d0ff11effd9d 100644 GIT binary patch delta 2135 zcmaJ@YfzNe8Gg>o?l~XJBI0`C14X=5*c*_v(b6R2B{oc(MFJvjG#Hc(VsNnwm}qQB zEdg)wb~F)h(P$*t7_ZqaZW}=2y;j>evE!IbS|^?9blT}<`peez{T8B4r_*2Wd(L;x z^FHT!FY|r+fw&tLj?4GXd%kp5M`A+`B48XD>u#7Rr2PB(hS%NLwfPs{Xf zkK1Sv$S943d^){wc&Y=%;$a86@Q^```p=#mu|lVLCmPN4k`r09QtzAeP2J$Nr@U+} zR|}NqKDBjdmfq!^YJ}(&C$&)BsasyV5bO2lzWgEWDL6;3JE@&E3ApuvNiJR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