ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/converter Resources.properties DefaultMasterConverter.java
Date Sat, 29 Dec 2001 21:13:07 GMT
donaldp     01/12/29 13:13:07

  Modified:    proposal/myrmidon/src/java/org/apache/myrmidon/components/converter
                        Resources.properties DefaultMasterConverter.java
  Log:
  Made sure that the MasterConverter verified that the slave converters return the correct
type. If not then it will raise an exception.
  
  Revision  Changes    Path
  1.3       +1 -0      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/Resources.properties,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Resources.properties	19 Nov 2001 12:37:25 -0000	1.2
  +++ Resources.properties	29 Dec 2001 21:13:07 -0000	1.3
  @@ -4,3 +4,4 @@
   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}.
  
  
  
  1.11      +14 -1     jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/DefaultMasterConverter.java
  
  Index: DefaultMasterConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/DefaultMasterConverter.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DefaultMasterConverter.java	29 Dec 2001 21:07:18 -0000	1.10
  +++ DefaultMasterConverter.java	29 Dec 2001 21:13:07 -0000	1.11
  @@ -106,7 +106,20 @@
                   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 )
           {
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message