You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by br...@apache.org on 2005/06/07 03:33:42 UTC
svn commit: r188656 -
/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
Author: brett
Date: Mon Jun 6 18:33:41 2005
New Revision: 188656
URL: http://svn.apache.org/viewcvs?rev=188656&view=rev
Log:
only test the expressions if the field is required
Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=188656&r1=188655&r2=188656&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java Mon Jun 6 18:33:41 2005
@@ -472,27 +472,16 @@
{
Parameter parameter = (Parameter) parameters.get( i );
- // the key for the configuration map we're building.
- String key = parameter.getName();
-
- Object fieldValue = null;
- String expression = null;
- PlexusConfiguration value = configuration.getChild( key, false );
- try
+ if ( parameter.isRequired() )
{
- if ( value != null )
- {
- expression = value.getValue( null );
- fieldValue = expressionEvaluator.evaluate( expression );
- if ( fieldValue == null )
- {
- fieldValue = value.getAttribute( "default-value", null );
- }
- }
+ // the key for the configuration map we're building.
+ String key = parameter.getName();
- if ( fieldValue == null && StringUtils.isNotEmpty( parameter.getAlias() ) )
+ Object fieldValue = null;
+ String expression = null;
+ PlexusConfiguration value = configuration.getChild( key, false );
+ try
{
- value = configuration.getChild( parameter.getAlias(), false );
if ( value != null )
{
expression = value.getValue( null );
@@ -502,49 +491,63 @@
fieldValue = value.getAttribute( "default-value", null );
}
}
+
+ if ( fieldValue == null && StringUtils.isNotEmpty( parameter.getAlias() ) )
+ {
+ value = configuration.getChild( parameter.getAlias(), false );
+ if ( value != null )
+ {
+ expression = value.getValue( null );
+ fieldValue = expressionEvaluator.evaluate( expression );
+ if ( fieldValue == null )
+ {
+ fieldValue = value.getAttribute( "default-value", null );
+ }
+ }
+ }
+ }
+ catch ( ExpressionEvaluationException e )
+ {
+ throw new PluginConfigurationException( "Bad expression", e );
}
- }
- catch ( ExpressionEvaluationException e )
- {
- throw new PluginConfigurationException( "Bad expression", e );
- }
- if ( fieldValue == null && goal.getComponentConfigurator() == null )
- {
- try
+ if ( fieldValue == null && goal.getComponentConfigurator() == null )
{
- // TODO: remove in beta-1
- Field field = findPluginField( plugin.getClass(), parameter.getName() );
- boolean accessible = field.isAccessible();
- if ( !accessible )
+ try
{
- field.setAccessible( true );
+ // TODO: remove in beta-1
+ Field field = findPluginField( plugin.getClass(), parameter.getName() );
+ boolean accessible = field.isAccessible();
+ if ( !accessible )
+ {
+ field.setAccessible( true );
+ }
+ fieldValue = field.get( plugin );
+ if ( !accessible )
+ {
+ field.setAccessible( false );
+ }
+ if ( fieldValue != null )
+ {
+ getLogger().warn( "DEPRECATED: using default-value to set the default value of field '" +
+ parameter.getName() + "'" );
+ }
}
- fieldValue = field.get( plugin );
- if ( !accessible )
+ catch ( NoSuchFieldException e )
{
- field.setAccessible( false );
+ throw new PluginConfigurationException( "Unable to find field to check default value", e );
}
- if ( fieldValue != null )
+ catch ( IllegalAccessException e )
{
- getLogger().warn( "DEPRECATED: using default-value to set the default value of field '" +
- parameter.getName() + "'" );
+ throw new PluginConfigurationException( "Unable to read field to check default value", e );
}
}
- catch ( NoSuchFieldException e )
- {
- throw new PluginConfigurationException( "Unable to find field to check default value", e );
- }
- catch ( IllegalAccessException e )
+
+ if ( fieldValue == null )
{
- throw new PluginConfigurationException( "Unable to read field to check default value", e );
+ parameter.setExpression( expression );
+ invalidParameters.add( parameter );
}
- }
-
- if ( parameter.isRequired() && fieldValue == null )
- {
- parameter.setExpression( expression );
- invalidParameters.add( parameter );
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org