donaldp 01/08/29 09:14:00
Modified: proposal/myrmidon/src/java/org/apache/myrmidon/converter
AbstractConverter.java
Added: proposal/myrmidon/src/java/org/apache/myrmidon/converter
Resources.properties
Log:
i18n'ed Converter APIs.
Revision Changes Path
1.2 +11 -4
jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/converter/AbstractConverter.java
Index: AbstractConverter.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/converter/AbstractConverter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractConverter.java 2001/06/02 14:28:43 1.1
+++ AbstractConverter.java 2001/08/29 16:14:00 1.2
@@ -7,6 +7,8 @@
*/
package org.apache.myrmidon.converter;
+import org.apache.avalon.excalibur.i18n.ResourceManager;
+import org.apache.avalon.excalibur.i18n.Resources;
import org.apache.avalon.framework.context.Context;
/**
@@ -17,6 +19,9 @@
public abstract class AbstractConverter
implements Converter
{
+ private static final Resources REZ =
+ ResourceManager.getPackageResources( AbstractConverter.class );
+
private final Class m_source;
private final Class m_destination;
@@ -46,14 +51,16 @@
{
if( m_destination != destination )
{
- throw new IllegalArgumentException( "Destination type " +
destination.getName() +
- " is not equal to " +
m_destination );
+ final String message =
+ REZ.getString( "bad-destination.error",
destination.getName(), m_destination );
+ throw new IllegalArgumentException( message );
}
if( !m_source.isInstance( original ) )
{
- throw new IllegalArgumentException( "Object '" + original + "'
is not an " +
- "instance of " +
m_source.getName() );
+ final String message =
+ REZ.getString( "bad-instance.error", original,
m_source.getName() );
+ throw new IllegalArgumentException( message );
}
return convert( original, context );
1.1
jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/converter/Resources.properties
Index: Resources.properties
===================================================================
bad-destination.error=Destination type ({0}) is not equal to {1}.
bad-instance.error=Object {0} is not an instance of {1}.