mirror of https://github.com/apache/maven.git
don't override existing fields with a null value
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163717 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0ee892dfdc
commit
92600f4e55
|
@ -544,30 +544,33 @@ public class DefaultPluginManager
|
||||||
String key = (String) i.next();
|
String key = (String) i.next();
|
||||||
Object value = map.get( key );
|
Object value = map.get( key );
|
||||||
|
|
||||||
Class clazz = plugin.getClass();
|
if ( value != null )
|
||||||
try
|
|
||||||
{
|
{
|
||||||
Field f = findPluginField( clazz, key );
|
Class clazz = plugin.getClass();
|
||||||
boolean accessible = f.isAccessible();
|
try
|
||||||
if ( !accessible )
|
|
||||||
{
|
{
|
||||||
f.setAccessible( true );
|
Field f = findPluginField( clazz, key );
|
||||||
|
boolean accessible = f.isAccessible();
|
||||||
|
if ( !accessible )
|
||||||
|
{
|
||||||
|
f.setAccessible( true );
|
||||||
|
}
|
||||||
|
|
||||||
|
f.set( plugin, value );
|
||||||
|
|
||||||
|
if ( !accessible )
|
||||||
|
{
|
||||||
|
f.setAccessible( false );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
catch ( NoSuchFieldException e )
|
||||||
f.set( plugin, value );
|
|
||||||
|
|
||||||
if ( !accessible )
|
|
||||||
{
|
{
|
||||||
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 + "'" );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue