Browse Source

Made sure that the MasterConverter verified that the slave converters return the correct type. If not then it will raise an exception.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270396 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
ce85ba9cfe
2 changed files with 15 additions and 1 deletions
  1. +14
    -1
      proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/DefaultMasterConverter.java
  2. +1
    -0
      proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/Resources.properties

+ 14
- 1
proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/DefaultMasterConverter.java View File

@@ -106,7 +106,20 @@ public class DefaultMasterConverter
getLogger().debug( message );
}

return converter.convert( destination, original, context );
final Object object = converter.convert( destination, original, context );
if( destination.isInstance( object ) )
{
return object;
}
else
{
final String message =
REZ.getString( "bad-return-type.error",
name,
object,
destination.getName() );
throw new ConverterException( message );
}
}
catch( final TypeException te )
{


+ 1
- 0
proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/Resources.properties View File

@@ -4,3 +4,4 @@ found-converter.notice=Found Converter: {0}.
no-converter-factory.error=Unable to retrieve Converter factory from TypeManager.
no-converter.error=Unable to find converter for {0} to {1} conversion.
bad-typemanager.error=Badly configured TypeManager missing converter definition.
bad-return-type.error=The TypeManager for {0} returned "{1}" which is not of the expected type {2}.

Loading…
Cancel
Save