From 40b06b5f19228782e57a5e91beecd0edade428cd Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Thu, 26 Mar 2009 13:49:21 +0000 Subject: [PATCH] fixed broken "setManagedInterfaces" interface assertion (SPR-5615) --- .../assembler/InterfaceBasedMBeanInfoAssembler.java | 12 ++++++------ .../InterfaceBasedMBeanInfoAssemblerCustomTests.java | 5 ++--- .../InterfaceBasedMBeanInfoAssemblerMappedTests.java | 3 +-- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/org.springframework.context/src/main/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssembler.java b/org.springframework.context/src/main/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssembler.java index 9d30cbb10f..8fff035714 100644 --- a/org.springframework.context/src/main/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssembler.java +++ b/org.springframework.context/src/main/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssembler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,7 +75,7 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI /** * Stores the mappings of bean keys to an array of Classes. */ - private Map resolvedInterfaceMappings; + private Map resolvedInterfaceMappings; /** @@ -89,7 +89,7 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI public void setManagedInterfaces(Class[] managedInterfaces) { if (managedInterfaces != null) { for (Class ifc : managedInterfaces) { - if (ifc.isInterface()) { + if (!ifc.isInterface()) { throw new IllegalArgumentException("Management interface [" + ifc.getName() + "] is no interface"); } } @@ -99,7 +99,7 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI /** * Set the mappings of bean keys to a comma-separated list of interface names. - * The property key should match the bean key and the property value should match + *

The property key should match the bean key and the property value should match * the list of interface names. When searching for interfaces for a bean, Spring * will check these mappings first. * @param mappings the mappins of bean keys to interface names @@ -124,7 +124,7 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI * @param mappings the specified interface mappings * @return the resolved interface mappings (with Class objects as values) */ - private Map resolveInterfaceMappings(Properties mappings) { + private Map resolveInterfaceMappings(Properties mappings) { Map resolvedMappings = new HashMap(mappings.size()); for (Enumeration en = mappings.propertyNames(); en.hasMoreElements();) { String beanKey = (String) en.nextElement(); @@ -217,7 +217,7 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI Class[] ifaces = null; if (this.resolvedInterfaceMappings != null) { - ifaces = (Class[]) this.resolvedInterfaceMappings.get(beanKey); + ifaces = this.resolvedInterfaceMappings.get(beanKey); } if (ifaces == null) { diff --git a/org.springframework.context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerCustomTests.java b/org.springframework.context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerCustomTests.java index 3c46d772fe..713263171b 100644 --- a/org.springframework.context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerCustomTests.java +++ b/org.springframework.context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerCustomTests.java @@ -1,11 +1,11 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT @@ -24,7 +24,6 @@ import org.junit.Ignore; /** * @author Rob Harrop */ -@Ignore public class InterfaceBasedMBeanInfoAssemblerCustomTests extends AbstractJmxAssemblerTests { protected static final String OBJECT_NAME = "bean:name=testBean5"; diff --git a/org.springframework.context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerMappedTests.java b/org.springframework.context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerMappedTests.java index e44e0203c1..d7db96a961 100644 --- a/org.springframework.context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerMappedTests.java +++ b/org.springframework.context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerMappedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,7 +59,6 @@ public class InterfaceBasedMBeanInfoAssemblerMappedTests extends AbstractJmxAsse } } - @Ignore public void ignoreTestWithFallThrough() throws Exception { InterfaceBasedMBeanInfoAssembler assembler = getWithMapping("foobar", "org.springframework.jmx.export.assembler.ICustomJmxBean"); -- GitLab