Commit 02bba3c4 by Gary Benson Committed by Gary Benson

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
parent b102a4f7
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.
......
......@@ -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"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment