This commit is contained in:
Phillip Webb 2013-12-18 22:39:37 -08:00
parent dbec81cabe
commit d6dbbebc88
2 changed files with 12 additions and 9 deletions

View File

@ -59,12 +59,15 @@ public class EndpointMBean {
if (result == null) { if (result == null) {
return null; return null;
} }
else if (result instanceof String) {
if (result instanceof String) {
return result; return result;
} }
else if (result.getClass().isArray() || result instanceof List) {
if (result.getClass().isArray() || result instanceof List) {
return this.mapper.convertValue(result, List.class); return this.mapper.convertValue(result, List.class);
} }
return this.mapper.convertValue(result, Map.class); return this.mapper.convertValue(result, Map.class);
} }
} }

View File

@ -77,7 +77,7 @@ public class EndpointMBeanExporter implements SmartLifecycle, ApplicationContext
} }
public void setDomainName(String domainName) { public void setDomainName(String domainName) {
Assert.notNull(domainName, "DomainName should not be null"); Assert.notNull(domainName, "DomainName must not be null");
this.domainName = domainName; this.domainName = domainName;
} }
@ -96,7 +96,7 @@ public class EndpointMBeanExporter implements SmartLifecycle, ApplicationContext
@SuppressWarnings({ "rawtypes" }) @SuppressWarnings({ "rawtypes" })
protected void locateAndRegisterEndpoints(MBeanExporter mbeanExporter) { protected void locateAndRegisterEndpoints(MBeanExporter mbeanExporter) {
Assert.notNull(mbeanExporter, "MBeanExporter should not be null"); Assert.notNull(mbeanExporter, "MBeanExporter must not be null");
Map<String, Endpoint> endpoints = this.applicationContext Map<String, Endpoint> endpoints = this.applicationContext
.getBeansOfType(Endpoint.class); .getBeansOfType(Endpoint.class);
for (Map.Entry<String, Endpoint> endpointEntry : endpoints.entrySet()) { for (Map.Entry<String, Endpoint> endpointEntry : endpoints.entrySet()) {
@ -114,11 +114,11 @@ public class EndpointMBeanExporter implements SmartLifecycle, ApplicationContext
mbeanExporter.registerManagedResource(new EndpointMBean(endpoint), mbeanExporter.registerManagedResource(new EndpointMBean(endpoint),
getObjectName(beanKey, endpoint)); getObjectName(beanKey, endpoint));
} }
catch (MBeanExportException e) { catch (MBeanExportException ex) {
logger.error("Could not register MBean for endpoint [" + beanKey + "]", e); logger.error("Could not register MBean for endpoint [" + beanKey + "]", ex);
} }
catch (MalformedObjectNameException e) { catch (MalformedObjectNameException ex) {
logger.error("Could not register MBean for endpoint [" + beanKey + "]", e); logger.error("Could not register MBean for endpoint [" + beanKey + "]", ex);
} }
} }