donaldp 02/02/18 00:36:07
Modified:
proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer
ClassicConfigurer.java
Log:
Clean up some audit warnings
Revision Changes Path
1.2 +29 -23
jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/ClassicConfigurer.java
Index: ClassicConfigurer.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/ClassicConfigurer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ClassicConfigurer.java 14 Feb 2002 09:38:57 -0000 1.1
+++ ClassicConfigurer.java 18 Feb 2002 08:36:06 -0000 1.2
@@ -40,16 +40,7 @@
ResourceManager.getPackageResources( DefaultConfigurer.class );
///Compile time constant to turn on extreme debugging
- private final static boolean DEBUG = false;
-
- /*
- * TODO: Should reserved names be "configurable" ?
- */
- ///Element names that are reserved
- private final static String[] RESERVED_ELEMENTS = new String[]
- {
- "content"
- };
+ private static final boolean DEBUG = false;
///Converter to use for converting between values
private MasterConverter m_converter;
@@ -81,7 +72,7 @@
if( DEBUG )
{
final String message = REZ.getString(
"configuring-object.notice", object );
- getLogger().debug( "Configuring " + object );
+ getLogger().debug( message );
}
if( object instanceof Configurable )
@@ -89,7 +80,7 @@
if( DEBUG )
{
final String message = REZ.getString( "configurable.notice"
);
- getLogger().debug( "Configuring object via Configurable
interface" );
+ getLogger().debug( message );
}
( (Configurable)object ).configure( configuration );
@@ -221,7 +212,7 @@
private void setValue( final Object object,
final String value,
final Context context,
- final Method methods[] )
+ final Method[] methods )
throws ConfigurationException
{
try
@@ -241,7 +232,7 @@
private void setValue( final Object object,
Object value,
- final Method methods[],
+ final Method[] methods,
final Context context )
throws ConfigurationException
{
@@ -250,7 +241,7 @@
for( int i = 0; i < methods.length; i++ )
{
- if( setValue( object, value, methods[ i ], sourceClass, source,
context ) )
+ if( setValue( object, value, methods[ i ], context ) )
{
return;
}
@@ -262,10 +253,8 @@
}
private boolean setValue( final Object object,
- Object value,
+ final Object originalValue,
final Method method,
- final Class sourceClass,
- final String source,
final Context context )
throws ConfigurationException
{
@@ -275,6 +264,7 @@
parameterType = getComplexTypeFor( parameterType );
}
+ Object value = originalValue;
try
{
value = m_converter.convert( parameterType, value, context );
@@ -323,21 +313,37 @@
private Class getComplexTypeFor( final Class clazz )
{
if( String.class == clazz )
+ {
return String.class;
+ }
else if( Integer.TYPE.equals( clazz ) )
+ {
return Integer.class;
+ }
else if( Long.TYPE.equals( clazz ) )
+ {
return Long.class;
+ }
else if( Short.TYPE.equals( clazz ) )
+ {
return Short.class;
+ }
else if( Byte.TYPE.equals( clazz ) )
+ {
return Byte.class;
+ }
else if( Boolean.TYPE.equals( clazz ) )
+ {
return Boolean.class;
+ }
else if( Float.TYPE.equals( clazz ) )
+ {
return Float.class;
+ }
else if( Double.TYPE.equals( clazz ) )
+ {
return Double.class;
+ }
else
{
final String message = REZ.getString( "no-complex-type.error",
clazz.getName() );
@@ -347,7 +353,7 @@
private Method[] getMethodsFor( final Class clazz, final String
methodName )
{
- final Method methods[] = clazz.getMethods();
+ final Method[] methods = clazz.getMethods();
final ArrayList matches = new ArrayList();
for( int i = 0; i < methods.length; i++ )
@@ -358,7 +364,7 @@
{
if( method.getReturnType().equals( Void.TYPE ) )
{
- final Class parameters[] = method.getParameterTypes();
+ final Class[] parameters = method.getParameterTypes();
if( 1 == parameters.length )
{
matches.add( method );
@@ -372,7 +378,7 @@
private Method[] getCreateMethodsFor( final Class clazz, final String
methodName )
{
- final Method methods[] = clazz.getMethods();
+ final Method[] methods = clazz.getMethods();
final ArrayList matches = new ArrayList();
for( int i = 0; i < methods.length; i++ )
@@ -385,7 +391,7 @@
if( !returnType.equals( Void.TYPE ) &&
!returnType.isPrimitive() )
{
- final Class parameters[] = method.getParameterTypes();
+ final Class[] parameters = method.getParameterTypes();
if( 0 == parameters.length )
{
matches.add( method );
@@ -437,7 +443,7 @@
// OMFG the rest of this is soooooooooooooooooooooooooooooooo
// slow. Need to cache results per class etc.
final Class clazz = object.getClass();
- Method methods[] = getMethodsFor( clazz, "add" + javaName );
+ Method[] methods = getMethodsFor( clazz, "add" + javaName );
if( 0 != methods.length )
{
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>