Remaining polishing

This commit is contained in:
Juergen Hoeller
2014-07-08 00:21:17 +02:00
parent 7eee7d2e30
commit adb73d5f35

View File

@@ -762,22 +762,22 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
protected DynamicMBean adaptMBeanIfPossible(Object bean) throws JMException {
Class<?> targetClass = AopUtils.getTargetClass(bean);
if (targetClass != bean.getClass()) {
Class<Object> ifc = (Class<Object>) JmxUtils.getMXBeanInterface(targetClass);
Class<?> ifc = JmxUtils.getMXBeanInterface(targetClass);
if (ifc != null) {
if (!(ifc.isInstance(bean))) {
if (!ifc.isInstance(bean)) {
throw new NotCompliantMBeanException("Managed bean [" + bean +
"] has a target class with an MXBean interface but does not expose it in the proxy");
}
return new StandardMBean(bean, ifc, true);
return new StandardMBean(bean, ((Class<Object>) ifc), true);
}
else {
ifc = (Class<Object>) JmxUtils.getMBeanInterface(targetClass);
ifc = JmxUtils.getMBeanInterface(targetClass);
if (ifc != null) {
if (!(ifc.isInstance(bean))) {
if (!ifc.isInstance(bean)) {
throw new NotCompliantMBeanException("Managed bean [" + bean +
"] has a target class with an MBean interface but does not expose it in the proxy");
}
return new StandardMBean(bean, ifc);
return new StandardMBean(bean, ((Class<Object>) ifc));
}
}
}