Browse Source

Error message tidy-ups.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271566 13f79535-47bb-0310-9956-ffa450edef68
master
adammurdoch 23 years ago
parent
commit
4d3eebbdb6
4 changed files with 43 additions and 36 deletions
  1. +3
    -3
      proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/Resources.properties
  2. +7
    -6
      proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/AspectAwareExecutor.java
  3. +24
    -14
      proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/DefaultExecutor.java
  4. +9
    -13
      proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/Resources.properties

+ 3
- 3
proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/Resources.properties View File

@@ -9,11 +9,11 @@ pending-property-value.error=An object created using the creator method has not
must-be-element.error=This property must be configured using a nested element. must-be-element.error=This property must be configured using a nested element.
too-many-values.error=Too many values for this property. too-many-values.error=Too many values for this property.
no-complex-type.error=Can not get complex type for non-primitive type {0}. no-complex-type.error=Can not get complex type for non-primitive type {0}.
no-such-attribute.error=Attribute "{1}" is not supported for element <{0}>.
no-such-attribute.error=Element <{0}> does not support attribute "{1}".
bad-set-attribute.error=Could not set attribute "{1}" for element <{0}>. bad-set-attribute.error=Could not set attribute "{1}" for element <{0}>.
bad-set-class-attribute.error=Could not set attribute "{0}" for object of class {1}. bad-set-class-attribute.error=Could not set attribute "{0}" for object of class {1}.
no-such-element.error=Nested <{1}> elements are not supported for element <{0}>.
no-content.error=Text content is not supported in element <{0}>.
no-such-element.error=Element <{0}> does not support nested <{1}> elements.
no-content.error=Element <{0} does not support text content.
bad-set-content.error=Could not set text content for element <{0}>. bad-set-content.error=Could not set text content for element <{0}>.
typed-adder-non-interface.error=The typed adder for class "{0}" must have a single parameter that is an interface rather than {1} which defines a class. typed-adder-non-interface.error=The typed adder for class "{0}" must have a single parameter that is an interface rather than {1} which defines a class.
create-typed-object.error=Could not create an object of type "{0}" of class {1}. create-typed-object.error=Could not create an object of type "{0}" of class {1}.


+ 7
- 6
proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/AspectAwareExecutor.java View File

@@ -78,23 +78,24 @@ public class AspectAwareExecutor
Configuration taskModel = getAspectManager().preCreate( model ); Configuration taskModel = getAspectManager().preCreate( model );
taskModel = prepareAspects( taskModel ); taskModel = prepareAspects( taskModel );


debug( "creating.notice" );
final Task task = createTask( taskModel.getName(), frame );
final String taskName = taskModel.getName();
debug( "creating.notice", taskName );
final Task task = createTask( taskName, frame );
getAspectManager().postCreate( task ); getAspectManager().postCreate( task );


debug( "logger.notice" );
debug( "logger.notice", taskName );
final Logger logger = frame.getLogger(); final Logger logger = frame.getLogger();
getAspectManager().preLogEnabled( logger ); getAspectManager().preLogEnabled( logger );
doLogEnabled( task, taskModel, logger ); doLogEnabled( task, taskModel, logger );


debug( "contextualizing.notice" );
debug( "contextualizing.notice", taskName );
doContextualize( task, taskModel, frame.getContext() ); doContextualize( task, taskModel, frame.getContext() );


debug( "configuring.notice" );
debug( "configuring.notice", taskName );
getAspectManager().preConfigure( taskModel ); getAspectManager().preConfigure( taskModel );
doConfigure( task, taskModel, frame.getContext() ); doConfigure( task, taskModel, frame.getContext() );


debug( "executing.notice" );
debug( "executing.notice", taskName );
getAspectManager().preExecute(); getAspectManager().preExecute();
doExecute( taskModel, task ); doExecute( taskModel, task );
getAspectManager().preDestroy(); getAspectManager().preDestroy();


+ 24
- 14
proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/DefaultExecutor.java View File

@@ -55,31 +55,35 @@ public class DefaultExecutor
public void execute( final Configuration taskModel, final ExecutionFrame frame ) public void execute( final Configuration taskModel, final ExecutionFrame frame )
throws TaskException throws TaskException
{ {
debug( "creating.notice" );
final Task task = createTask( taskModel.getName(), frame );
final String taskName = taskModel.getName();
debug( "creating.notice", taskName );
final Task task = createTask( taskName, frame );


debug( "logger.notice" );
debug( "logger.notice", taskName );
doLogEnabled( task, taskModel, frame.getLogger() ); doLogEnabled( task, taskModel, frame.getLogger() );


debug( "contextualizing.notice" );
debug( "contextualizing.notice", taskName );
doContextualize( task, taskModel, frame.getContext() ); doContextualize( task, taskModel, frame.getContext() );


debug( "configuring.notice" );
debug( "configuring.notice", taskName );
doConfigure( task, taskModel, frame.getContext() ); doConfigure( task, taskModel, frame.getContext() );


debug( "executing.notice" );
debug( "executing.notice", taskName );
task.execute(); task.execute();
} }


protected final void debug( final String key )
protected final void debug( final String key, final String taskName )
{ {
if( getLogger().isDebugEnabled() ) if( getLogger().isDebugEnabled() )
{ {
final String message = REZ.getString( key );
final String message = REZ.getString( key, taskName );
getLogger().debug( message ); getLogger().debug( message );
} }
} }


/**
* Creates a task instance.
*/
protected final Task createTask( final String name, final ExecutionFrame frame ) protected final Task createTask( final String name, final ExecutionFrame frame )
throws TaskException throws TaskException
{ {
@@ -95,6 +99,9 @@ public class DefaultExecutor
} }
} }


/**
* Configures a task instance.
*/
protected final void doConfigure( final Task task, protected final void doConfigure( final Task task,
final Configuration taskModel, final Configuration taskModel,
final TaskContext taskContext ) final TaskContext taskContext )
@@ -109,12 +116,14 @@ public class DefaultExecutor
final String message = final String message =
REZ.getString( "config.error", REZ.getString( "config.error",
taskModel.getName(), taskModel.getName(),
taskModel.getLocation(),
throwable.getMessage() );
taskModel.getLocation() );
throw new TaskException( message, throwable ); throw new TaskException( message, throwable );
} }
} }


/**
* Sets the context for a task.
*/
protected final void doContextualize( final Task task, protected final void doContextualize( final Task task,
final Configuration taskModel, final Configuration taskModel,
final TaskContext context ) final TaskContext context )
@@ -129,12 +138,14 @@ public class DefaultExecutor
final String message = final String message =
REZ.getString( "contextualize.error", REZ.getString( "contextualize.error",
taskModel.getName(), taskModel.getName(),
taskModel.getLocation(),
throwable.getMessage() );
taskModel.getLocation() );
throw new TaskException( message, throwable ); throw new TaskException( message, throwable );
} }
} }


/**
* Sets the logger for a task.
*/
protected final void doLogEnabled( final Task task, protected final void doLogEnabled( final Task task,
final Configuration taskModel, final Configuration taskModel,
final Logger logger ) final Logger logger )
@@ -151,8 +162,7 @@ public class DefaultExecutor
final String message = final String message =
REZ.getString( "logger.error", REZ.getString( "logger.error",
taskModel.getName(), taskModel.getName(),
taskModel.getLocation(),
throwable.getMessage() );
taskModel.getLocation() );
throw new TaskException( message, throwable ); throw new TaskException( message, throwable );
} }
} }


+ 9
- 13
proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/Resources.properties View File

@@ -1,17 +1,13 @@
creating.notice=Creating.
logger.notice=Setting Logger.
contextualizing.notice=Contextualizing.
configuring.notice=Configuring.
initializing.notice=Initializing.
executing.notice=Executing.
disposing.notice=Disposing.
creating.notice=Creating {0}.
logger.notice=Setting Logger {0}.
contextualizing.notice=Contextualizing {0}.
configuring.notice=Configuring {0}.
executing.notice=Executing {0}.


no-create.error=Unable to create task {0}.
config.error=Error configuring task {0} at {1} (Reason: {2}).
contextualize.error=Error contextualizing task {0} at {1} (Reason: {2}).
dispose.error=Error disposing task {0} at {1} (Reason: {2}).
init.error=Error initializing task {0} at {1} (Reason: {2}).
logger.error=Error setting logger for task {0} at {1} (Reason: {2}).
no-create.error=Could not create task "{0}".
config.error={1}: Could not configure task "{0}".
contextualize.error={1}: Could not set the context for task "{0}".
logger.error={1}: Could not set the logger for task "{0}".


unused-settings.error=Unused aspect settings for namespace {0} (parameterCount={1} elementCount={2}). unused-settings.error=Unused aspect settings for namespace {0} (parameterCount={1} elementCount={2}).
dispatch-settings.notice=Dispatching Aspect Settings to namespace {0} (parameterCount={1} elementCount={2}). dispatch-settings.notice=Dispatching Aspect Settings to namespace {0} (parameterCount={1} elementCount={2}).

Loading…
Cancel
Save