Browse Source

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
master
Peter Donald 23 years ago
parent
commit
5151a3152d
1 changed files with 11 additions and 12 deletions
  1. +11
    -12
      proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/DefaultObjectConfigurer.java

+ 11
- 12
proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/DefaultObjectConfigurer.java View File

@@ -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


Loading…
Cancel
Save