From 5151a3152de887e4dccf485a437dea64cc49afa3 Mon Sep 17 00:00:00 2001 From: Peter Donald Date: Mon, 28 Jan 2002 00:09:13 +0000 Subject: [PATCH] Reverse logic so that if duplicated typed adders are present then a different message is issued git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270975 13f79535-47bb-0310-9956-ffa450edef68 --- .../configurer/DefaultObjectConfigurer.java | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/DefaultObjectConfigurer.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/DefaultObjectConfigurer.java index a5f0f7376..4f00d7db5 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/DefaultObjectConfigurer.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/DefaultObjectConfigurer.java @@ -20,7 +20,6 @@ import java.util.Set; import org.apache.avalon.excalibur.i18n.ResourceManager; import org.apache.avalon.excalibur.i18n.Resources; import org.apache.avalon.framework.configuration.ConfigurationException; -import org.apache.avalon.framework.configuration.Configuration; /** * An object configurer which uses reflection to determine the properties @@ -191,7 +190,17 @@ class DefaultObjectConfigurer final Class currentType = candidate.getParameterTypes()[ 0 ]; // Ditch the string version, if any - if( currentType != String.class && type == String.class ) + if( isTypedAdder ) + { + // Both are string, or both are not string + final String message = + REZ.getString( "multiple-typed-adder-methods-for-element.error", + m_class.getName(), + type.getName(), + currentType.getName() ); + throw new ConfigurationException( message ); + } + else if( currentType != String.class && type == String.class ) { // New type is string, and current type is not. Ignore // the new method @@ -206,16 +215,6 @@ class DefaultObjectConfigurer propName ); throw new ConfigurationException( message ); } - else if( isTypedAdder ) - { - // Both are string, or both are not string - final String message = - REZ.getString( "multiple-typed-adder-methods-for-element.error", - m_class.getName(), - type.getName(), - currentType.getName() ); - throw new ConfigurationException( message ); - } // Else, current type is string, and new type is not, so // continue below, and overwrite the current method