maven-m2-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject cvs commit: maven-components/maven-core/src/main/java/org/apache/maven/plugin DefaultPluginManager.java
Date Wed, 30 Mar 2005 08:15:36 GMT
brett       2005/03/30 00:15:36

  Modified:    maven-core/src/main/java/org/apache/maven/plugin
                        DefaultPluginManager.java
  Log:
  don't override existing fields with a null value
  
  Revision  Changes    Path
  1.73      +21 -18    maven-components/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
  
  Index: DefaultPluginManager.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java,v
  retrieving revision 1.72
  retrieving revision 1.73
  diff -u -r1.72 -r1.73
  --- DefaultPluginManager.java	24 Mar 2005 14:52:25 -0000	1.72
  +++ DefaultPluginManager.java	30 Mar 2005 08:15:36 -0000	1.73
  @@ -544,30 +544,33 @@
               String key = (String) i.next();
               Object value = map.get( key );
   
  -            Class clazz = plugin.getClass();
  -            try
  +            if ( value != null )
               {
  -                Field f = findPluginField( clazz, key );
  -                boolean accessible = f.isAccessible();
  -                if ( !accessible )
  +                Class clazz = plugin.getClass();
  +                try
                   {
  -                    f.setAccessible( true );
  -                }
  +                    Field f = findPluginField( clazz, key );
  +                    boolean accessible = f.isAccessible();
  +                    if ( !accessible )
  +                    {
  +                        f.setAccessible( true );
  +                    }
   
  -                f.set( plugin, value );
  +                    f.set( plugin, value );
   
  -                if ( !accessible )
  +                    if ( !accessible )
  +                    {
  +                        f.setAccessible( false );
  +                    }
  +                }
  +                catch ( NoSuchFieldException e )
                   {
  -                    f.setAccessible( false );
  +                    throw new PluginConfigurationException( "Unable to set field '" + key
+ "' on '" + clazz + "'" );
  +                }
  +                catch ( IllegalAccessException e )
  +                {
  +                    throw new PluginConfigurationException( "Unable to set field '" + key
+ "' on '" + clazz + "'" );
                   }
  -            }
  -            catch ( NoSuchFieldException e )
  -            {
  -                throw new PluginConfigurationException( "Unable to set field '" + key +
"' on '" + clazz + "'" );
  -            }
  -            catch ( IllegalAccessException e )
  -            {
  -                throw new PluginConfigurationException( "Unable to set field '" + key +
"' on '" + clazz + "'" );
               }
           }
       }
  
  
  

Mime
View raw message