From 669a7eae15ea1cf4d43f78955eb15a1b757717f5 Mon Sep 17 00:00:00 2001 From: Peter Donald Date: Sun, 23 Dec 2001 14:25:02 +0000 Subject: [PATCH] Start updating logging to myrmidon style logging git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270367 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/java/org/apache/antlib/core/Log.java | 3 +- .../java/org/apache/antlib/core/Property.java | 18 +- .../antlib/core/StringToByteConverter.java | 5 +- .../antlib/core/StringToClassConverter.java | 5 +- .../antlib/core/StringToDoubleConverter.java | 5 +- .../antlib/core/StringToFloatConverter.java | 5 +- .../antlib/core/StringToIntegerConverter.java | 5 +- .../antlib/core/StringToLongConverter.java | 5 +- .../antlib/core/StringToShortConverter.java | 5 +- .../antlib/core/StringToURLConverter.java | 5 +- .../java/org/apache/antlib/cvslib/Cvs.java | 1 - .../apache/antlib/runtime/ConverterDef.java | 17 +- .../org/apache/antlib/runtime/Facility.java | 19 +- .../org/apache/antlib/runtime/Import.java | 8 +- .../org/apache/antlib/runtime/TypeDef.java | 3 +- .../apache/antlib/xml/XMLValidateTask.java | 40 ++-- .../org/apache/antlib/xml/XSLTProcess.java | 5 +- .../org/apache/tools/ant/AntClassLoader.java | 42 ++-- .../main/org/apache/tools/ant/Project.java | 14 +- .../apache/tools/ant/ProjectComponent.java | 12 +- .../src/main/org/apache/tools/ant/Task.java | 4 +- .../org/apache/tools/ant/TaskAdapter.java | 8 +- .../apache/tools/ant/taskdefs/Available.java | 27 ++- .../apache/tools/ant/taskdefs/Checksum.java | 4 +- .../apache/tools/ant/taskdefs/DependSet.java | 27 +-- .../org/apache/tools/ant/taskdefs/Ear.java | 9 +- .../apache/tools/ant/taskdefs/ExecuteOn.java | 10 +- .../org/apache/tools/ant/taskdefs/Expand.java | 11 +- .../org/apache/tools/ant/taskdefs/Filter.java | 3 +- .../apache/tools/ant/taskdefs/FixCRLF.java | 29 ++- .../org/apache/tools/ant/taskdefs/Input.java | 7 +- .../org/apache/tools/ant/taskdefs/Jar.java | 26 +-- .../org/apache/tools/ant/taskdefs/Java.java | 11 +- .../org/apache/tools/ant/taskdefs/Javac.java | 18 +- .../tools/ant/taskdefs/PathConvert.java | 3 +- .../apache/tools/ant/taskdefs/Property.java | 14 +- .../tools/ant/taskdefs/RecorderEntry.java | 23 ++- .../apache/tools/ant/taskdefs/Replace.java | 7 +- .../org/apache/tools/ant/taskdefs/Rmic.java | 35 ++-- .../apache/tools/ant/taskdefs/SQLExec.java | 40 ++-- .../apache/tools/ant/taskdefs/SendEmail.java | 3 +- .../org/apache/tools/ant/taskdefs/Sleep.java | 6 +- .../org/apache/tools/ant/taskdefs/Tar.java | 17 +- .../org/apache/tools/ant/taskdefs/Touch.java | 5 +- .../org/apache/tools/ant/taskdefs/Untar.java | 5 +- .../apache/tools/ant/taskdefs/UpToDate.java | 7 +- .../org/apache/tools/ant/taskdefs/War.java | 7 +- .../org/apache/tools/ant/taskdefs/Zip.java | 13 +- .../compilers/CompilerAdapterFactory.java | 10 +- .../compilers/DefaultCompilerAdapter.java | 189 +++++++++--------- .../tools/ant/taskdefs/compilers/Gcj.java | 29 ++- .../tools/ant/taskdefs/compilers/Javac12.java | 4 +- .../tools/ant/taskdefs/compilers/Javac13.java | 3 +- .../ant/taskdefs/compilers/JavacExternal.java | 3 +- .../tools/ant/taskdefs/compilers/Jikes.java | 45 +++-- .../tools/ant/taskdefs/compilers/Jvc.java | 25 ++- .../tools/ant/taskdefs/compilers/Kjc.java | 29 ++- .../tools/ant/taskdefs/compilers/Sj.java | 5 +- .../tools/ant/taskdefs/condition/Http.java | 5 +- .../tools/ant/taskdefs/condition/Socket.java | 3 +- .../tools/ant/taskdefs/exec/Execute.java | 2 +- .../apache/tools/ant/taskdefs/file/Copy.java | 5 +- .../tools/ant/taskdefs/file/Delete.java | 3 +- .../apache/tools/ant/taskdefs/file/Move.java | 3 +- .../tools/ant/taskdefs/javadoc/Javadoc.java | 2 +- .../tools/ant/taskdefs/optional/ANTLR.java | 17 +- .../tools/ant/taskdefs/optional/Cab.java | 3 +- .../ant/taskdefs/optional/IContract.java | 7 +- .../tools/ant/taskdefs/optional/Javah.java | 5 +- .../ant/taskdefs/optional/Native2Ascii.java | 3 +- .../tools/ant/taskdefs/optional/NetRexxC.java | 16 +- .../ant/taskdefs/optional/ReplaceRegExp.java | 32 +-- .../ant/taskdefs/optional/depend/Depend.java | 31 ++- .../ant/taskdefs/optional/dotnet/Ilasm.java | 3 +- .../taskdefs/optional/dotnet/NetCommand.java | 9 +- .../optional/ejb/BorlandDeploymentTool.java | 24 +-- .../optional/ejb/BorlandGenerateClient.java | 7 +- .../optional/ejb/DescriptorHandler.java | 37 +++- .../ant/taskdefs/optional/ejb/EjbJar.java | 8 +- .../optional/ejb/GenericDeploymentTool.java | 40 ++-- .../optional/ejb/IPlanetDeploymentTool.java | 14 +- .../optional/ejb/JbossDeploymentTool.java | 3 +- .../optional/ejb/WeblogicDeploymentTool.java | 34 ++-- .../ejb/WeblogicTOPLinkDeploymentTool.java | 6 +- .../optional/ejb/WebsphereDeploymentTool.java | 46 ++--- .../ant/taskdefs/optional/i18n/Translate.java | 20 +- .../taskdefs/optional/ide/VAJLocalUtil.java | 12 +- .../taskdefs/optional/ide/VAJRemoteUtil.java | 8 +- .../optional/ide/VAJToolsServlet.java | 2 +- .../ant/taskdefs/optional/javacc/JJTree.java | 2 +- .../ant/taskdefs/optional/javacc/JavaCC.java | 3 +- .../optional/jdepend/JDependTask.java | 4 +- .../taskdefs/optional/jlink/JlinkTask.java | 7 +- .../tools/ant/taskdefs/optional/jsp/JspC.java | 23 +-- .../ant/taskdefs/optional/jsp/WLJspc.java | 9 +- .../jsp/compilers/DefaultCompilerAdapter.java | 10 +- .../optional/jsp/compilers/JasperC.java | 3 +- .../optional/junit/AggregateTransformer.java | 3 +- .../taskdefs/optional/junit/JUnitTask.java | 28 ++- .../optional/junit/XMLResultAggregator.java | 11 +- .../metamata/AbstractMetamataTask.java | 6 +- .../taskdefs/optional/metamata/MAudit.java | 2 +- .../metamata/MAuditStreamHandler.java | 7 +- .../metamata/MMetricsStreamHandler.java | 3 +- .../taskdefs/optional/metamata/MParse.java | 2 +- .../tools/ant/taskdefs/optional/net/FTP.java | 38 ++-- .../ant/taskdefs/optional/net/MimeMail.java | 10 +- .../ant/taskdefs/optional/net/TelnetTask.java | 5 +- .../ant/taskdefs/optional/perforce/P4Add.java | 5 +- .../taskdefs/optional/perforce/P4Base.java | 3 +- .../taskdefs/optional/perforce/P4Change.java | 4 +- .../taskdefs/optional/perforce/P4Counter.java | 2 +- .../taskdefs/optional/perforce/P4Label.java | 27 ++- .../taskdefs/optional/perforce/P4Submit.java | 3 +- .../taskdefs/optional/perforce/P4Sync.java | 3 +- .../perforce/SimpleP4OutputHandler.java | 3 +- .../ant/taskdefs/optional/pvcs/Pvcs.java | 24 +-- .../taskdefs/optional/sitraka/CovMerge.java | 2 +- .../taskdefs/optional/sitraka/CovReport.java | 10 +- .../taskdefs/optional/sitraka/Coverage.java | 6 +- .../taskdefs/optional/sitraka/XMLReport.java | 3 +- .../optional/sound/AntSoundPlayer.java | 6 +- .../taskdefs/optional/sound/SoundTask.java | 7 +- .../ant/taskdefs/rmic/DefaultRmicAdapter.java | 38 ++-- .../tools/ant/taskdefs/rmic/KaffeRmic.java | 3 +- .../tools/ant/taskdefs/rmic/SunRmic.java | 2 +- .../tools/ant/taskdefs/rmic/WLRmic.java | 3 +- .../org/apache/tools/ant/types/FileSet.java | 8 +- .../org/apache/tools/ant/types/FilterSet.java | 5 +- .../main/org/apache/tools/ant/types/Path.java | 11 +- .../tools/ant/util/SourceFileScanner.java | 20 +- .../org/apache/tools/ant/AntClassLoader.java | 42 ++-- .../todo/org/apache/tools/ant/Project.java | 14 +- .../apache/tools/ant/ProjectComponent.java | 12 +- .../src/todo/org/apache/tools/ant/Task.java | 4 +- .../org/apache/tools/ant/TaskAdapter.java | 8 +- .../apache/tools/ant/taskdefs/Available.java | 27 ++- .../apache/tools/ant/taskdefs/Checksum.java | 4 +- .../apache/tools/ant/taskdefs/DependSet.java | 27 +-- .../org/apache/tools/ant/taskdefs/Ear.java | 9 +- .../apache/tools/ant/taskdefs/ExecuteOn.java | 10 +- .../org/apache/tools/ant/taskdefs/Expand.java | 11 +- .../org/apache/tools/ant/taskdefs/Filter.java | 3 +- .../apache/tools/ant/taskdefs/FixCRLF.java | 29 ++- .../org/apache/tools/ant/taskdefs/Input.java | 7 +- .../org/apache/tools/ant/taskdefs/Jar.java | 26 +-- .../org/apache/tools/ant/taskdefs/Java.java | 11 +- .../org/apache/tools/ant/taskdefs/Javac.java | 18 +- .../tools/ant/taskdefs/PathConvert.java | 3 +- .../apache/tools/ant/taskdefs/Property.java | 14 +- .../tools/ant/taskdefs/RecorderEntry.java | 23 ++- .../apache/tools/ant/taskdefs/Replace.java | 7 +- .../org/apache/tools/ant/taskdefs/Rmic.java | 35 ++-- .../apache/tools/ant/taskdefs/SQLExec.java | 40 ++-- .../apache/tools/ant/taskdefs/SendEmail.java | 3 +- .../org/apache/tools/ant/taskdefs/Sleep.java | 6 +- .../org/apache/tools/ant/taskdefs/Tar.java | 17 +- .../org/apache/tools/ant/taskdefs/Touch.java | 5 +- .../org/apache/tools/ant/taskdefs/Untar.java | 5 +- .../apache/tools/ant/taskdefs/UpToDate.java | 7 +- .../org/apache/tools/ant/taskdefs/War.java | 7 +- .../org/apache/tools/ant/taskdefs/Zip.java | 13 +- .../compilers/CompilerAdapterFactory.java | 10 +- .../compilers/DefaultCompilerAdapter.java | 189 +++++++++--------- .../tools/ant/taskdefs/compilers/Gcj.java | 29 ++- .../tools/ant/taskdefs/compilers/Javac12.java | 4 +- .../tools/ant/taskdefs/compilers/Javac13.java | 3 +- .../ant/taskdefs/compilers/JavacExternal.java | 3 +- .../tools/ant/taskdefs/compilers/Jikes.java | 45 +++-- .../tools/ant/taskdefs/compilers/Jvc.java | 25 ++- .../tools/ant/taskdefs/compilers/Kjc.java | 29 ++- .../tools/ant/taskdefs/compilers/Sj.java | 5 +- .../tools/ant/taskdefs/condition/Http.java | 5 +- .../tools/ant/taskdefs/condition/Socket.java | 3 +- .../tools/ant/taskdefs/exec/Execute.java | 2 +- .../apache/tools/ant/taskdefs/file/Copy.java | 5 +- .../tools/ant/taskdefs/file/Delete.java | 3 +- .../apache/tools/ant/taskdefs/file/Move.java | 3 +- .../tools/ant/taskdefs/javadoc/Javadoc.java | 2 +- .../tools/ant/taskdefs/optional/ANTLR.java | 17 +- .../tools/ant/taskdefs/optional/Cab.java | 3 +- .../ant/taskdefs/optional/IContract.java | 7 +- .../tools/ant/taskdefs/optional/Javah.java | 5 +- .../ant/taskdefs/optional/Native2Ascii.java | 3 +- .../tools/ant/taskdefs/optional/NetRexxC.java | 16 +- .../ant/taskdefs/optional/ReplaceRegExp.java | 32 +-- .../ant/taskdefs/optional/depend/Depend.java | 31 ++- .../ant/taskdefs/optional/dotnet/Ilasm.java | 3 +- .../taskdefs/optional/dotnet/NetCommand.java | 9 +- .../optional/ejb/BorlandDeploymentTool.java | 24 +-- .../optional/ejb/BorlandGenerateClient.java | 7 +- .../optional/ejb/DescriptorHandler.java | 37 +++- .../ant/taskdefs/optional/ejb/EjbJar.java | 8 +- .../optional/ejb/GenericDeploymentTool.java | 40 ++-- .../optional/ejb/IPlanetDeploymentTool.java | 14 +- .../optional/ejb/JbossDeploymentTool.java | 3 +- .../optional/ejb/WeblogicDeploymentTool.java | 34 ++-- .../ejb/WeblogicTOPLinkDeploymentTool.java | 6 +- .../optional/ejb/WebsphereDeploymentTool.java | 46 ++--- .../ant/taskdefs/optional/i18n/Translate.java | 20 +- .../taskdefs/optional/ide/VAJLocalUtil.java | 12 +- .../taskdefs/optional/ide/VAJRemoteUtil.java | 8 +- .../optional/ide/VAJToolsServlet.java | 2 +- .../ant/taskdefs/optional/javacc/JJTree.java | 2 +- .../ant/taskdefs/optional/javacc/JavaCC.java | 3 +- .../optional/jdepend/JDependTask.java | 4 +- .../taskdefs/optional/jlink/JlinkTask.java | 7 +- .../tools/ant/taskdefs/optional/jsp/JspC.java | 23 +-- .../ant/taskdefs/optional/jsp/WLJspc.java | 9 +- .../jsp/compilers/DefaultCompilerAdapter.java | 10 +- .../optional/jsp/compilers/JasperC.java | 3 +- .../optional/junit/AggregateTransformer.java | 3 +- .../taskdefs/optional/junit/JUnitTask.java | 28 ++- .../optional/junit/XMLResultAggregator.java | 11 +- .../metamata/AbstractMetamataTask.java | 6 +- .../taskdefs/optional/metamata/MAudit.java | 2 +- .../metamata/MAuditStreamHandler.java | 7 +- .../metamata/MMetricsStreamHandler.java | 3 +- .../taskdefs/optional/metamata/MParse.java | 2 +- .../tools/ant/taskdefs/optional/net/FTP.java | 38 ++-- .../ant/taskdefs/optional/net/MimeMail.java | 10 +- .../ant/taskdefs/optional/net/TelnetTask.java | 5 +- .../ant/taskdefs/optional/perforce/P4Add.java | 5 +- .../taskdefs/optional/perforce/P4Base.java | 3 +- .../taskdefs/optional/perforce/P4Change.java | 4 +- .../taskdefs/optional/perforce/P4Counter.java | 2 +- .../taskdefs/optional/perforce/P4Label.java | 27 ++- .../taskdefs/optional/perforce/P4Submit.java | 3 +- .../taskdefs/optional/perforce/P4Sync.java | 3 +- .../perforce/SimpleP4OutputHandler.java | 3 +- .../ant/taskdefs/optional/pvcs/Pvcs.java | 24 +-- .../taskdefs/optional/sitraka/CovMerge.java | 2 +- .../taskdefs/optional/sitraka/CovReport.java | 10 +- .../taskdefs/optional/sitraka/Coverage.java | 6 +- .../taskdefs/optional/sitraka/XMLReport.java | 3 +- .../optional/sound/AntSoundPlayer.java | 6 +- .../taskdefs/optional/sound/SoundTask.java | 7 +- .../ant/taskdefs/rmic/DefaultRmicAdapter.java | 38 ++-- .../tools/ant/taskdefs/rmic/KaffeRmic.java | 3 +- .../tools/ant/taskdefs/rmic/SunRmic.java | 2 +- .../tools/ant/taskdefs/rmic/WLRmic.java | 3 +- .../org/apache/tools/ant/types/FileSet.java | 8 +- .../org/apache/tools/ant/types/FilterSet.java | 5 +- .../todo/org/apache/tools/ant/types/Path.java | 11 +- .../tools/ant/util/SourceFileScanner.java | 20 +- 245 files changed, 1579 insertions(+), 1721 deletions(-) diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/Log.java b/proposal/myrmidon/src/java/org/apache/antlib/core/Log.java index fad1cae47..14424478e 100644 --- a/proposal/myrmidon/src/java/org/apache/antlib/core/Log.java +++ b/proposal/myrmidon/src/java/org/apache/antlib/core/Log.java @@ -18,8 +18,7 @@ import org.apache.myrmidon.api.TaskException; public class Log extends AbstractTask { - private String m_message; - + private String m_message; public void setMessage( final String message ) { diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/Property.java b/proposal/myrmidon/src/java/org/apache/antlib/core/Property.java index 4e5bfba59..605569f47 100644 --- a/proposal/myrmidon/src/java/org/apache/antlib/core/Property.java +++ b/proposal/myrmidon/src/java/org/apache/antlib/core/Property.java @@ -11,17 +11,16 @@ import org.apache.avalon.excalibur.i18n.ResourceManager; import org.apache.avalon.excalibur.i18n.Resources; import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.component.ComponentManager; -import org.apache.avalon.framework.component.Composable; import org.apache.avalon.framework.configuration.Configurable; import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.myrmidon.api.TaskContext; import org.apache.myrmidon.api.TaskException; +import org.apache.myrmidon.framework.AbstractContainerTask; +import org.apache.myrmidon.framework.DataType; import org.apache.myrmidon.interfaces.type.TypeException; import org.apache.myrmidon.interfaces.type.TypeFactory; import org.apache.myrmidon.interfaces.type.TypeManager; -import org.apache.myrmidon.framework.AbstractContainerTask; -import org.apache.myrmidon.framework.DataType; /** * This is the property "task" to declare a binding of a datatype to a name. @@ -37,10 +36,10 @@ public class Property private static final Resources REZ = ResourceManager.getPackageResources( Property.class ); - private String m_name; - private Object m_value; - private boolean m_localScope = true; - private TypeFactory m_factory; + private String m_name; + private Object m_value; + private boolean m_localScope = true; + private TypeFactory m_factory; public void compose( final ComponentManager componentManager ) throws ComponentException @@ -48,7 +47,10 @@ public class Property super.compose( componentManager ); final TypeManager typeManager = (TypeManager)componentManager.lookup( TypeManager.ROLE ); - try { m_factory = typeManager.getFactory( DataType.ROLE ); } + try + { + m_factory = typeManager.getFactory( DataType.ROLE ); + } catch( final TypeException te ) { final String message = REZ.getString( "property.bad-factory.error" ); diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/StringToByteConverter.java b/proposal/myrmidon/src/java/org/apache/antlib/core/StringToByteConverter.java index 2997bfbfc..a09743f9d 100644 --- a/proposal/myrmidon/src/java/org/apache/antlib/core/StringToByteConverter.java +++ b/proposal/myrmidon/src/java/org/apache/antlib/core/StringToByteConverter.java @@ -32,7 +32,10 @@ public class StringToByteConverter public Object convert( final Object object, final Context context ) throws ConverterException { - try { return new Byte( (String)object ); } + try + { + return new Byte( (String)object ); + } catch( final NumberFormatException nfe ) { final String message = REZ.getString( "convert.bad-byte.error", object ); diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/StringToClassConverter.java b/proposal/myrmidon/src/java/org/apache/antlib/core/StringToClassConverter.java index d902c3282..ace997e1c 100644 --- a/proposal/myrmidon/src/java/org/apache/antlib/core/StringToClassConverter.java +++ b/proposal/myrmidon/src/java/org/apache/antlib/core/StringToClassConverter.java @@ -33,7 +33,10 @@ public class StringToClassConverter throws ConverterException { //TODO: Should we use ContextClassLoader here??? - try { return Class.forName( (String)object ); } + try + { + return Class.forName( (String)object ); + } catch( final Exception e ) { final String message = REZ.getString( "convert.bad-class.error", object ); diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/StringToDoubleConverter.java b/proposal/myrmidon/src/java/org/apache/antlib/core/StringToDoubleConverter.java index 1d1e82fe5..1ae3b1a63 100644 --- a/proposal/myrmidon/src/java/org/apache/antlib/core/StringToDoubleConverter.java +++ b/proposal/myrmidon/src/java/org/apache/antlib/core/StringToDoubleConverter.java @@ -32,7 +32,10 @@ public class StringToDoubleConverter public Object convert( final Object object, final Context context ) throws ConverterException { - try { return new Double( (String)object ); } + try + { + return new Double( (String)object ); + } catch( final NumberFormatException nfe ) { final String message = REZ.getString( "convert.bad-double.error", object ); diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/StringToFloatConverter.java b/proposal/myrmidon/src/java/org/apache/antlib/core/StringToFloatConverter.java index ec4ac102e..913bd4ea1 100644 --- a/proposal/myrmidon/src/java/org/apache/antlib/core/StringToFloatConverter.java +++ b/proposal/myrmidon/src/java/org/apache/antlib/core/StringToFloatConverter.java @@ -32,7 +32,10 @@ public class StringToFloatConverter public Object convert( final Object object, final Context context ) throws ConverterException { - try { return new Float( (String)object ); } + try + { + return new Float( (String)object ); + } catch( final NumberFormatException nfe ) { final String message = REZ.getString( "convert.bad-float.error", object ); diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/StringToIntegerConverter.java b/proposal/myrmidon/src/java/org/apache/antlib/core/StringToIntegerConverter.java index 2e2d421e4..35af9258c 100644 --- a/proposal/myrmidon/src/java/org/apache/antlib/core/StringToIntegerConverter.java +++ b/proposal/myrmidon/src/java/org/apache/antlib/core/StringToIntegerConverter.java @@ -32,7 +32,10 @@ public class StringToIntegerConverter public Object convert( final Object object, final Context context ) throws ConverterException { - try { return new Integer( (String)object ); } + try + { + return new Integer( (String)object ); + } catch( final NumberFormatException nfe ) { final String message = REZ.getString( "convert.bad-integer.error", object ); diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/StringToLongConverter.java b/proposal/myrmidon/src/java/org/apache/antlib/core/StringToLongConverter.java index 4f9185580..59ab8e8c5 100644 --- a/proposal/myrmidon/src/java/org/apache/antlib/core/StringToLongConverter.java +++ b/proposal/myrmidon/src/java/org/apache/antlib/core/StringToLongConverter.java @@ -32,7 +32,10 @@ public class StringToLongConverter public Object convert( final Object object, final Context context ) throws ConverterException { - try { return new Long( (String)object ); } + try + { + return new Long( (String)object ); + } catch( final NumberFormatException nfe ) { final String message = REZ.getString( "convert.bad-long.error", object ); diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/StringToShortConverter.java b/proposal/myrmidon/src/java/org/apache/antlib/core/StringToShortConverter.java index 129c791b2..90f5d413a 100644 --- a/proposal/myrmidon/src/java/org/apache/antlib/core/StringToShortConverter.java +++ b/proposal/myrmidon/src/java/org/apache/antlib/core/StringToShortConverter.java @@ -32,7 +32,10 @@ public class StringToShortConverter public Object convert( final Object object, final Context context ) throws ConverterException { - try { return new Short( (String)object ); } + try + { + return new Short( (String)object ); + } catch( final NumberFormatException nfe ) { final String message = REZ.getString( "convert.bad-short.error", object ); diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/StringToURLConverter.java b/proposal/myrmidon/src/java/org/apache/antlib/core/StringToURLConverter.java index a11202e04..f21be4756 100644 --- a/proposal/myrmidon/src/java/org/apache/antlib/core/StringToURLConverter.java +++ b/proposal/myrmidon/src/java/org/apache/antlib/core/StringToURLConverter.java @@ -34,7 +34,10 @@ public class StringToURLConverter public Object convert( final Object object, final Context context ) throws ConverterException { - try { return new URL( (String)object ); } + try + { + return new URL( (String)object ); + } catch( final MalformedURLException mue ) { final String message = REZ.getString( "convert.bad-url.error", object ); diff --git a/proposal/myrmidon/src/java/org/apache/antlib/cvslib/Cvs.java b/proposal/myrmidon/src/java/org/apache/antlib/cvslib/Cvs.java index a53fd92b2..8c8dca311 100644 --- a/proposal/myrmidon/src/java/org/apache/antlib/cvslib/Cvs.java +++ b/proposal/myrmidon/src/java/org/apache/antlib/cvslib/Cvs.java @@ -13,7 +13,6 @@ import org.apache.myrmidon.api.AbstractTask; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.exec.Execute; -import org.apache.tools.ant.taskdefs.exec.LogStreamHandler; import org.apache.tools.ant.taskdefs.exec.LogOutputStream; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.EnvironmentData; diff --git a/proposal/myrmidon/src/java/org/apache/antlib/runtime/ConverterDef.java b/proposal/myrmidon/src/java/org/apache/antlib/runtime/ConverterDef.java index c5b149b8a..8436d87b1 100644 --- a/proposal/myrmidon/src/java/org/apache/antlib/runtime/ConverterDef.java +++ b/proposal/myrmidon/src/java/org/apache/antlib/runtime/ConverterDef.java @@ -8,7 +8,6 @@ package org.apache.antlib.runtime; import java.io.File; -import java.net.MalformedURLException; import java.net.URL; import org.apache.avalon.excalibur.i18n.ResourceManager; import org.apache.avalon.excalibur.i18n.Resources; @@ -17,10 +16,10 @@ import org.apache.avalon.framework.component.ComponentManager; import org.apache.avalon.framework.component.Composable; import org.apache.myrmidon.api.AbstractTask; import org.apache.myrmidon.api.TaskException; +import org.apache.myrmidon.converter.Converter; import org.apache.myrmidon.interfaces.converter.ConverterRegistry; import org.apache.myrmidon.interfaces.type.DefaultTypeFactory; import org.apache.myrmidon.interfaces.type.TypeManager; -import org.apache.myrmidon.converter.Converter; /** * Task to define a converter. @@ -34,12 +33,12 @@ public class ConverterDef private static final Resources REZ = ResourceManager.getPackageResources( ConverterDef.class ); - private String m_sourceType; - private String m_destinationType; - private File m_lib; - private String m_classname; - private ConverterRegistry m_converterRegistry; - private TypeManager m_typeManager; + private String m_sourceType; + private String m_destinationType; + private File m_lib; + private String m_classname; + private ConverterRegistry m_converterRegistry; + private TypeManager m_typeManager; public void compose( final ComponentManager componentManager ) throws ComponentException @@ -97,7 +96,7 @@ public class ConverterDef m_converterRegistry.registerConverter( m_classname, m_sourceType, m_destinationType ); final URL url = m_lib.toURL(); - final DefaultTypeFactory factory = new DefaultTypeFactory( new URL[] { url } ); + final DefaultTypeFactory factory = new DefaultTypeFactory( new URL[]{url} ); factory.addNameClassMapping( m_classname, m_classname ); m_typeManager.registerType( Converter.ROLE, m_classname, factory ); diff --git a/proposal/myrmidon/src/java/org/apache/antlib/runtime/Facility.java b/proposal/myrmidon/src/java/org/apache/antlib/runtime/Facility.java index 16cea7f08..a7977ee94 100644 --- a/proposal/myrmidon/src/java/org/apache/antlib/runtime/Facility.java +++ b/proposal/myrmidon/src/java/org/apache/antlib/runtime/Facility.java @@ -7,9 +7,6 @@ */ package org.apache.antlib.runtime; -import java.io.File; -import java.net.MalformedURLException; -import java.net.URL; import org.apache.avalon.excalibur.i18n.ResourceManager; import org.apache.avalon.excalibur.i18n.Resources; import org.apache.avalon.framework.component.ComponentException; @@ -18,14 +15,13 @@ import org.apache.avalon.framework.component.Composable; import org.apache.avalon.framework.configuration.Configurable; import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; -import org.apache.myrmidon.api.AbstractTask; import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.aspects.AspectHandler; +import org.apache.myrmidon.framework.AbstractContainerTask; import org.apache.myrmidon.interfaces.aspect.AspectManager; import org.apache.myrmidon.interfaces.type.TypeException; import org.apache.myrmidon.interfaces.type.TypeFactory; import org.apache.myrmidon.interfaces.type.TypeManager; -import org.apache.myrmidon.framework.AbstractContainerTask; /** * Task that definesMethod to register a single converter. @@ -39,11 +35,11 @@ public class Facility private static final Resources REZ = ResourceManager.getPackageResources( Facility.class ); - private String m_namespace; - private AspectHandler m_aspectHandler; + private String m_namespace; + private AspectHandler m_aspectHandler; - private AspectManager m_aspectManager; - private TypeFactory m_factory; + private AspectManager m_aspectManager; + private TypeFactory m_factory; public void compose( final ComponentManager componentManager ) throws ComponentException @@ -53,7 +49,10 @@ public class Facility m_aspectManager = (AspectManager)componentManager.lookup( AspectManager.ROLE ); final TypeManager typeManager = (TypeManager)componentManager.lookup( TypeManager.ROLE ); - try { m_factory = typeManager.getFactory( AspectHandler.ROLE ); } + try + { + m_factory = typeManager.getFactory( AspectHandler.ROLE ); + } catch( final TypeException te ) { final String message = REZ.getString( "facility.no-factory.error" ); diff --git a/proposal/myrmidon/src/java/org/apache/antlib/runtime/Import.java b/proposal/myrmidon/src/java/org/apache/antlib/runtime/Import.java index 67ba1bb6e..c2ac018f6 100644 --- a/proposal/myrmidon/src/java/org/apache/antlib/runtime/Import.java +++ b/proposal/myrmidon/src/java/org/apache/antlib/runtime/Import.java @@ -7,11 +7,9 @@ */ package org.apache.antlib.runtime; +import java.io.File; import org.apache.avalon.excalibur.i18n.ResourceManager; import org.apache.avalon.excalibur.i18n.Resources; -import java.io.File; -import java.net.MalformedURLException; -import java.net.URL; import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.component.ComponentManager; import org.apache.avalon.framework.component.Composable; @@ -32,8 +30,8 @@ public class Import private static final Resources REZ = ResourceManager.getPackageResources( Import.class ); - private File m_lib; - private Deployer m_deployer; + private File m_lib; + private Deployer m_deployer; public void compose( final ComponentManager componentManager ) throws ComponentException diff --git a/proposal/myrmidon/src/java/org/apache/antlib/runtime/TypeDef.java b/proposal/myrmidon/src/java/org/apache/antlib/runtime/TypeDef.java index 59655ac13..147d4ebc2 100644 --- a/proposal/myrmidon/src/java/org/apache/antlib/runtime/TypeDef.java +++ b/proposal/myrmidon/src/java/org/apache/antlib/runtime/TypeDef.java @@ -7,7 +7,6 @@ */ package org.apache.antlib.runtime; -import org.apache.myrmidon.api.Task; import org.apache.myrmidon.framework.AbstractTypeDef; /** @@ -18,7 +17,7 @@ import org.apache.myrmidon.framework.AbstractTypeDef; public class TypeDef extends AbstractTypeDef { - private String m_type; + private String m_type; public void setType( final String type ) { diff --git a/proposal/myrmidon/src/java/org/apache/antlib/xml/XMLValidateTask.java b/proposal/myrmidon/src/java/org/apache/antlib/xml/XMLValidateTask.java index 32e908e2e..85913b131 100644 --- a/proposal/myrmidon/src/java/org/apache/antlib/xml/XMLValidateTask.java +++ b/proposal/myrmidon/src/java/org/apache/antlib/xml/XMLValidateTask.java @@ -252,7 +252,7 @@ public class XMLValidateTask if( failOnError ) throw new TaskException( errorMsg ); else - log( errorMsg, Project.MSG_ERR ); + getLogger().error( errorMsg ); } } @@ -301,19 +301,19 @@ public class XMLValidateTask } catch( SAXNotRecognizedException e ) { + final String message = "Could not set feature '" + feature + "' because the parser doesn't recognize it"; if( warn ) - log( "Could not set feature '" - + feature - + "' because the parser doesn't recognize it", - Project.MSG_WARN ); + { + getLogger().warn( message ); + } } catch( SAXNotSupportedException e ) { + final String message = "Could not set feature '" + feature + "' because the parser doesn't support it"; if( warn ) - log( "Could not set feature '" - + feature - + "' because the parser doesn't support it", - Project.MSG_WARN ); + { + getLogger().warn( message ); + } } return toReturn; } @@ -326,7 +326,7 @@ public class XMLValidateTask { try { - log( "Validating " + afile.getName() + "... ", Project.MSG_VERBOSE ); + getLogger().debug( "Validating " + afile.getName() + "... " ); errorHandler.init( afile ); InputSource is = new InputSource( new FileReader( afile ) ); String uri = "file:" + afile.getAbsolutePath().replace( '\\', '/' ); @@ -353,7 +353,7 @@ public class XMLValidateTask if( failOnError ) throw new TaskException( afile + " is not a valid XML document." ); else - log( afile + " is not a valid XML document", Project.MSG_ERR ); + getLogger().error( afile + " is not a valid XML document" ); } } @@ -386,7 +386,7 @@ public class XMLValidateTask { xmlReader = (XMLReader)readerClass.newInstance(); - log( "Using SAX2 reader " + readerClassName, Project.MSG_VERBOSE ); + getLogger().debug( "Using SAX2 reader " + readerClassName ); } else { @@ -396,7 +396,7 @@ public class XMLValidateTask { Parser parser = (Parser)readerClass.newInstance(); xmlReader = new ParserAdapter( parser ); - log( "Using SAX1 parser " + readerClassName, Project.MSG_VERBOSE ); + getLogger().debug( "Using SAX1 parser " + readerClassName ); } else { @@ -541,7 +541,6 @@ public class XMLValidateTask private void doLog( SAXParseException e, int logLevel ) { - log( getMessage( e ), logLevel ); } } @@ -570,7 +569,7 @@ public class XMLValidateTask if( publicId != null ) { fileDTDs.put( publicId, fileDTD ); - log( "Mapped publicId " + publicId + " to file " + fileDTD, Project.MSG_VERBOSE ); + getLogger().debug( "Mapped publicId " + publicId + " to file " + fileDTD ); } return; } @@ -580,7 +579,7 @@ public class XMLValidateTask if( publicId != null ) { resourceDTDs.put( publicId, location ); - log( "Mapped publicId " + publicId + " to resource " + location, Project.MSG_VERBOSE ); + getLogger().debug( "Mapped publicId " + publicId + " to resource " + location ); } } @@ -611,7 +610,7 @@ public class XMLValidateTask { try { - log( "Resolved " + publicId + " to local file " + dtdFile, Project.MSG_VERBOSE ); + getLogger().debug( "Resolved " + publicId + " to local file " + dtdFile ); return new InputSource( new FileInputStream( dtdFile ) ); } catch( FileNotFoundException ex ) @@ -626,7 +625,7 @@ public class XMLValidateTask InputStream is = this.getClass().getResourceAsStream( dtdResourceName ); if( is != null ) { - log( "Resolved " + publicId + " to local resource " + dtdResourceName, Project.MSG_VERBOSE ); + getLogger().debug( "Resolved " + publicId + " to local resource " + dtdResourceName ); return new InputSource( is ); } } @@ -637,7 +636,7 @@ public class XMLValidateTask try { InputStream is = dtdUrl.openStream(); - log( "Resolved " + publicId + " to url " + dtdUrl, Project.MSG_VERBOSE ); + getLogger().debug( "Resolved " + publicId + " to url " + dtdUrl ); return new InputSource( is ); } catch( IOException ioe ) @@ -646,8 +645,7 @@ public class XMLValidateTask } } - log( "Could not resolve ( publicId: " + publicId + ", systemId: " + systemId + ") to a local entity", - Project.MSG_INFO ); + getLogger().info( "Could not resolve ( publicId: " + publicId + ", systemId: " + systemId + ") to a local entity" ); return null; } diff --git a/proposal/myrmidon/src/java/org/apache/antlib/xml/XSLTProcess.java b/proposal/myrmidon/src/java/org/apache/antlib/xml/XSLTProcess.java index dcd046cd5..811902b44 100644 --- a/proposal/myrmidon/src/java/org/apache/antlib/xml/XSLTProcess.java +++ b/proposal/myrmidon/src/java/org/apache/antlib/xml/XSLTProcess.java @@ -13,7 +13,6 @@ import java.util.Iterator; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.AntClassLoader; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Reference; @@ -218,7 +217,7 @@ public class XSLTProcess // check if liaison wants to log errors using us as logger setupLogger( m_liaison ); - log( "Using " + m_liaison.getClass().toString(), Project.MSG_VERBOSE ); + getLogger().debug( "Using " + m_liaison.getClass().toString() ); File stylesheet = resolveFile( m_xslFile ); // if we have an in file and out then process them @@ -239,7 +238,7 @@ public class XSLTProcess throw new TaskException( msg ); } scanner = getDirectoryScanner( m_baseDir ); - log( "Transforming into " + m_destDir, Project.MSG_INFO ); + getLogger().info( "Transforming into " + m_destDir ); // Process all the files marked for styling list = scanner.getIncludedFiles(); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/AntClassLoader.java b/proposal/myrmidon/src/main/org/apache/tools/ant/AntClassLoader.java index b839d74e9..88d5d4983 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/AntClassLoader.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/AntClassLoader.java @@ -23,6 +23,8 @@ import java.util.Iterator; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import org.apache.avalon.excalibur.io.FileUtil; +import org.apache.avalon.framework.logger.LogEnabled; +import org.apache.avalon.framework.logger.Logger; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.types.Path; @@ -38,7 +40,7 @@ import org.apache.tools.ant.types.Path; */ public class AntClassLoader extends ClassLoader - implements BuildListener + implements BuildListener, LogEnabled { /** * The size of buffers to be used in this classloader. @@ -50,6 +52,23 @@ public class AntClassLoader private static Method getContextClassLoader; private static Method setContextClassLoader; + private Logger m_logger; + + /** + * Provide component with a logger. + * + * @param logger the logger + */ + public void enableLogging( Logger logger ) + { + m_logger = logger; + } + + protected final Logger getLogger() + { + return m_logger; + } + /** * The components of the classpath that the classloader searches for classes */ @@ -336,7 +355,7 @@ public class AntClassLoader if( url == null ) { - log( "Couldn't load Resource " + name, Project.MSG_DEBUG ); + getLogger().debug( "Couldn't load Resource " + name ); } return url; @@ -477,7 +496,7 @@ public class AntClassLoader public Class findClass( String name ) throws ClassNotFoundException { - log( "Finding class " + name, Project.MSG_DEBUG ); + getLogger().debug( "Finding class " + name ); return findClassInComponents( name ); } @@ -495,7 +514,7 @@ public class AntClassLoader public Class forceLoadClass( String classname ) throws ClassNotFoundException { - log( "force loading " + classname, Project.MSG_DEBUG ); + getLogger().debug( "force loading " + classname ); Class theClass = findLoadedClass( classname ); @@ -521,7 +540,7 @@ public class AntClassLoader public Class forceLoadSystemClass( String classname ) throws ClassNotFoundException { - log( "force system loading " + classname, Project.MSG_DEBUG ); + getLogger().debug( "force system loading " + classname ); Class theClass = findLoadedClass( classname ); @@ -622,12 +641,12 @@ public class AntClassLoader try { theClass = findBaseClass( classname ); - log( "Class " + classname + " loaded from parent loader", Project.MSG_DEBUG ); + getLogger().debug( "Class " + classname + " loaded from parent loader" ); } catch( ClassNotFoundException cnfe ) { theClass = findClass( classname ); - log( "Class " + classname + " loaded from ant loader", Project.MSG_DEBUG ); + getLogger().debug( "Class " + classname + " loaded from ant loader" ); } } else @@ -635,7 +654,7 @@ public class AntClassLoader try { theClass = findClass( classname ); - log( "Class " + classname + " loaded from ant loader", Project.MSG_DEBUG ); + getLogger().debug( "Class " + classname + " loaded from ant loader" ); } catch( ClassNotFoundException cnfe ) { @@ -644,7 +663,7 @@ public class AntClassLoader throw cnfe; } theClass = findBaseClass( classname ); - log( "Class " + classname + " loaded from parent loader", Project.MSG_DEBUG ); + getLogger().debug( "Class " + classname + " loaded from parent loader" ); } } @@ -793,8 +812,7 @@ public class AntClassLoader } catch( Exception e ) { - log( "Ignoring Exception " + e.getClass().getName() + ": " + e.getMessage() + - " reading resource " + resourceName + " from " + file, Project.MSG_VERBOSE ); + getLogger().debug( "Ignoring Exception " + e.getClass().getName() + ": " + e.getMessage() + " reading resource " + resourceName + " from " + file ); } return null; @@ -948,7 +966,7 @@ public class AntClassLoader catch( IOException ioe ) { // ioe.printStackTrace(); - log( "Exception reading component " + pathComponent, Project.MSG_VERBOSE ); + getLogger().debug( "Exception reading component " + pathComponent ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/Project.java b/proposal/myrmidon/src/main/org/apache/tools/ant/Project.java index 6381a0420..d278cbad6 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/Project.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/Project.java @@ -12,6 +12,8 @@ import java.util.ArrayList; import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; +import org.apache.avalon.framework.logger.AbstractLogEnabled; +import org.apache.avalon.framework.logger.Logger; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.types.FilterSet; import org.apache.tools.ant.types.FilterSetCollection; @@ -28,6 +30,7 @@ import org.apache.tools.ant.types.FilterSetCollection; * @author duncan@x180.com */ public class Project + extends AbstractLogEnabled { public final static int MSG_ERR = 0; public final static int MSG_WARN = 1; @@ -106,6 +109,11 @@ public class Project } } + public Logger hackGetLogger() + { + return super.getLogger(); + } + /** * static query of the java version * @@ -183,9 +191,9 @@ public class Project throw new TaskException( "Ant cannot work on Java 1.0" ); } - log( "Detected Java version: " + javaVersion + " in: " + System.getProperty( "java.home" ), MSG_VERBOSE ); + getLogger().debug( "Detected Java version: " + javaVersion + " in: " + System.getProperty( "java.home" ) ); - log( "Detected OS: " + System.getProperty( "os.name" ), MSG_VERBOSE ); + getLogger().debug( "Detected OS: " + System.getProperty( "os.name" ) ); } /** @@ -373,7 +381,7 @@ public class Project String propertyName = (String)j.next(); if( !keys.containsKey( propertyName ) ) { - project.log( "Property ${" + propertyName + "} has not been set", Project.MSG_VERBOSE ); + project.getLogger().debug( "Property ${" + propertyName + "} has not been set" ); } fragment = ( keys.containsKey( propertyName ) ) ? (String)keys.get( propertyName ) : "${" + propertyName + "}"; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/ProjectComponent.java b/proposal/myrmidon/src/main/org/apache/tools/ant/ProjectComponent.java index 96121b2ed..3fab29ed8 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/ProjectComponent.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/ProjectComponent.java @@ -7,6 +7,7 @@ */ package org.apache.tools.ant; +import org.apache.avalon.framework.logger.Logger; import org.apache.myrmidon.api.AbstractTask; import org.apache.myrmidon.api.TaskException; @@ -20,7 +21,12 @@ import org.apache.myrmidon.api.TaskException; public abstract class ProjectComponent extends AbstractTask { - private Project project; + private Project m_project; + + public Logger hackGetLogger() + { + return super.getLogger(); + } /** * Sets the project object of this component. This method is used by project @@ -31,7 +37,7 @@ public abstract class ProjectComponent */ public void setProject( Project project ) { - this.project = project; + this.m_project = project; } /** @@ -41,7 +47,7 @@ public abstract class ProjectComponent */ public Project getProject() { - return project; + return m_project; } public void execute() diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/Task.java b/proposal/myrmidon/src/main/org/apache/tools/ant/Task.java index 79118546b..babf6db9e 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/Task.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/Task.java @@ -13,12 +13,12 @@ public abstract class Task { protected void handleErrorOutput( String line ) { - log( line, Project.MSG_ERR ); + getLogger().error( line ); } protected void handleOutput( String line ) { - log( line, Project.MSG_INFO ); + getLogger().info( line ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/TaskAdapter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/TaskAdapter.java index 73e379c1a..91151d8ba 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/TaskAdapter.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/TaskAdapter.java @@ -61,8 +61,8 @@ public class TaskAdapter extends Task } catch( Exception ex ) { - log( "Error setting project in " + proxy.getClass(), - Project.MSG_ERR ); + final String message = "Error setting project in " + proxy.getClass(); + getLogger().error( message, ex ); throw new TaskException( "Error", ex ); } @@ -73,7 +73,7 @@ public class TaskAdapter extends Task executeM = c.getMethod( "execute", new Class[ 0 ] ); if( executeM == null ) { - log( "No public execute() in " + proxy.getClass(), Project.MSG_ERR ); + getLogger().error( "No public execute() in " + proxy.getClass() ); throw new TaskException( "No public execute() in " + proxy.getClass() ); } executeM.invoke( proxy, null ); @@ -81,7 +81,7 @@ public class TaskAdapter extends Task } catch( Exception ex ) { - log( "Error in " + proxy.getClass(), Project.MSG_ERR ); + getLogger().error( "Error in " + proxy.getClass() ); throw new TaskException( "Error", ex ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Available.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Available.java index 18f6b2530..0c759289d 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Available.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Available.java @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs; import java.io.File; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.AntClassLoader; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.condition.Condition; import org.apache.tools.ant.types.EnumeratedAttribute; @@ -136,7 +135,7 @@ public class Available if( ( classname != null ) && !checkClass( classname ) ) { - log( "Unable to load class " + classname + " to set property " + property, Project.MSG_VERBOSE ); + getLogger().debug( "Unable to load class " + classname + " to set property " + property ); return false; } @@ -144,18 +143,18 @@ public class Available { if( type != null ) { - log( "Unable to find " + type + " " + file + " to set property " + property, Project.MSG_VERBOSE ); + getLogger().debug( "Unable to find " + type + " " + file + " to set property " + property ); } else { - log( "Unable to find " + file + " to set property " + property, Project.MSG_VERBOSE ); + getLogger().debug( "Unable to find " + file + " to set property " + property ); } return false; } if( ( resource != null ) && !checkResource( resource ) ) { - log( "Unable to load resource " + resource + " to set property " + property, Project.MSG_VERBOSE ); + getLogger().debug( "Unable to load resource " + resource + " to set property " + property ); return false; } @@ -232,7 +231,7 @@ public class Available String[] paths = filepath.list(); for( int i = 0; i < paths.length; ++i ) { - log( "Searching " + paths[ i ], Project.MSG_DEBUG ); + getLogger().debug( "Searching " + paths[ i ] ); /* * filepath can be a list of directory and/or * file names (gen'd via ) @@ -254,19 +253,19 @@ public class Available { if( type == null ) { - log( "Found: " + path, Project.MSG_VERBOSE ); + getLogger().debug( "Found: " + path ); return true; } else if( type.isDir() && path.isDirectory() ) { - log( "Found directory: " + path, Project.MSG_VERBOSE ); + getLogger().debug( "Found directory: " + path ); return true; } else if( type.isFile() && path.isFile() ) { - log( "Found file: " + path, Project.MSG_VERBOSE ); + getLogger().debug( "Found file: " + path ); return true; } // not the requested type @@ -280,12 +279,12 @@ public class Available { if( type == null ) { - log( "Found: " + parent, Project.MSG_VERBOSE ); + getLogger().debug( "Found: " + parent ); return true; } else if( type.isDir() ) { - log( "Found directory: " + parent, Project.MSG_VERBOSE ); + getLogger().debug( "Found directory: " + parent ); return true; } // not the requested type @@ -338,7 +337,7 @@ public class Available { if( f.isDirectory() ) { - log( "Found directory: " + text, Project.MSG_VERBOSE ); + getLogger().debug( "Found directory: " + text ); } return f.isDirectory(); } @@ -346,14 +345,14 @@ public class Available { if( f.isFile() ) { - log( "Found file: " + text, Project.MSG_VERBOSE ); + getLogger().debug( "Found file: " + text ); } return f.isFile(); } } if( f.exists() ) { - log( "Found: " + text, Project.MSG_VERBOSE ); + getLogger().debug( "Found: " + text ); } return f.exists(); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Checksum.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Checksum.java index 821e2fedc..412ee5b72 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Checksum.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Checksum.java @@ -22,7 +22,6 @@ import java.util.Enumeration; import java.util.Hashtable; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.condition.Condition; import org.apache.tools.ant.types.FileSet; @@ -215,8 +214,7 @@ public class Checksum extends MatchingTask implements Condition } else { - log( file + " omitted as " + dest + " is up to date.", - Project.MSG_VERBOSE ); + getLogger().debug( file + " omitted as " + dest + " is up to date." ); } } else diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/DependSet.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/DependSet.java index cb85d81ed..d0c522617 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/DependSet.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/DependSet.java @@ -14,7 +14,6 @@ import java.util.Iterator; import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.framework.Os; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.FileList; import org.apache.tools.ant.types.FileSet; @@ -166,8 +165,7 @@ public class DependSet extends MatchingTask if( dest.lastModified() > now ) { - log( "Warning: " + targetFiles[ i ] + " modified in the future.", - Project.MSG_WARN ); + getLogger().warn( "Warning: " + targetFiles[ i ] + " modified in the future." ); } } } @@ -189,7 +187,7 @@ public class DependSet extends MatchingTask File dest = new File( targetFL.getDir( getProject() ), targetFiles[ i ] ); if( !dest.exists() ) { - log( targetFiles[ i ] + " does not exist.", Project.MSG_VERBOSE ); + getLogger().debug( targetFiles[ i ] + " does not exist." ); upToDate = false; continue; } @@ -199,8 +197,7 @@ public class DependSet extends MatchingTask } if( dest.lastModified() > now ) { - log( "Warning: " + targetFiles[ i ] + " modified in the future.", - Project.MSG_WARN ); + getLogger().warn( "Warning: " + targetFiles[ i ] + " modified in the future." ); } } } @@ -224,8 +221,7 @@ public class DependSet extends MatchingTask if( src.lastModified() > now ) { - log( "Warning: " + sourceFiles[ i ] + " modified in the future.", - Project.MSG_WARN ); + getLogger().warn( "Warning: " + sourceFiles[ i ] + " modified in the future." ); } Iterator enumTargets = allTargets.iterator(); @@ -235,8 +231,7 @@ public class DependSet extends MatchingTask File dest = (File)enumTargets.next(); if( src.lastModified() > dest.lastModified() ) { - log( dest.getPath() + " is out of date with respect to " + - sourceFiles[ i ], Project.MSG_VERBOSE ); + getLogger().debug( dest.getPath() + " is out of date with respect to " + sourceFiles[ i ] ); upToDate = false; } @@ -264,13 +259,12 @@ public class DependSet extends MatchingTask if( src.lastModified() > now ) { - log( "Warning: " + sourceFiles[ i ] + " modified in the future.", - Project.MSG_WARN ); + getLogger().warn( "Warning: " + sourceFiles[ i ] + " modified in the future." ); } if( !src.exists() ) { - log( sourceFiles[ i ] + " does not exist.", Project.MSG_VERBOSE ); + getLogger().debug( sourceFiles[ i ] + " does not exist." ); upToDate = false; break; } @@ -283,8 +277,7 @@ public class DependSet extends MatchingTask if( src.lastModified() > dest.lastModified() ) { - log( dest.getPath() + " is out of date with respect to " + - sourceFiles[ i ], Project.MSG_VERBOSE ); + getLogger().debug( dest.getPath() + " is out of date with respect to " + sourceFiles[ i ] ); upToDate = false; } @@ -295,11 +288,11 @@ public class DependSet extends MatchingTask if( !upToDate ) { - log( "Deleting all target files. ", Project.MSG_VERBOSE ); + getLogger().debug( "Deleting all target files. " ); for( Iterator e = allTargets.iterator(); e.hasNext(); ) { File fileToRemove = (File)e.next(); - log( "Deleting file " + fileToRemove.getAbsolutePath(), Project.MSG_VERBOSE ); + getLogger().debug( "Deleting file " + fileToRemove.getAbsolutePath() ); fileToRemove.delete(); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Ear.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Ear.java index e4c4569db..6ccc25405 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Ear.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Ear.java @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs; import java.io.File; import java.io.IOException; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.ZipFileSet; import org.apache.tools.zip.ZipOutputStream; @@ -52,7 +51,7 @@ public class Ear extends Jar { // We just set the prefix for this fileset, and pass it up. // Do we need to do this? LH - log( "addArchives called", Project.MSG_DEBUG ); + getLogger().debug( "addArchives called" ); fs.setPrefix( "/" ); super.addFileset( fs ); } @@ -90,8 +89,10 @@ public class Ear extends Jar { if( deploymentDescriptor == null || !deploymentDescriptor.equals( file ) || descriptorAdded ) { - log( "Warning: selected " + archiveType + " files include a META-INF/application.xml which will be ignored " + - "(please use appxml attribute to " + archiveType + " task)", Project.MSG_WARN ); + final String message = "Warning: selected " + archiveType + + " files include a META-INF/application.xml which will be ignored " + + "(please use appxml attribute to " + archiveType + " task)"; + getLogger().warn( message ); } else { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java index 235bc4e8c..b6282598f 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java @@ -13,7 +13,6 @@ import java.util.ArrayList; import java.util.Hashtable; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.exec.ExecTask; import org.apache.tools.ant.taskdefs.exec.Execute; import org.apache.tools.ant.types.Commandline; @@ -412,8 +411,7 @@ public class ExecuteOn extends ExecTask if( fileNames.size() == 0 && skipEmpty ) { - log( "Skipping fileset for directory " - + base + ". It is empty.", Project.MSG_INFO ); + getLogger().info( "Skipping fileset for directory " + base + ". It is empty." ); continue; } @@ -424,8 +422,7 @@ public class ExecuteOn extends ExecTask for( int j = 0; j < s.length; j++ ) { String[] command = getCommandline( s[ j ], base ); - log( "Executing " + Commandline.toString( command ), - Project.MSG_VERBOSE ); + getLogger().debug( "Executing " + Commandline.toString( command ) ); exe.setCommandline( command ); runExecute( exe ); } @@ -441,8 +438,7 @@ public class ExecuteOn extends ExecTask File[] b = new File[ baseDirs.size() ]; b = (File[])baseDirs.toArray( b ); String[] command = getCommandline( s, b ); - log( "Executing " + Commandline.toString( command ), - Project.MSG_VERBOSE ); + getLogger().debug( "Executing " + Commandline.toString( command ) ); exe.setCommandline( command ); runExecute( exe ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Expand.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Expand.java index 1d9c776b3..3d4146e0d 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Expand.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Expand.java @@ -20,7 +20,6 @@ import java.util.zip.ZipInputStream; import org.apache.avalon.excalibur.io.FileUtil; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.PatternSet; @@ -166,7 +165,7 @@ public class Expand extends MatchingTask ze.isDirectory() ); } - log( "expand complete", Project.MSG_VERBOSE ); + getLogger().debug( "expand complete" ); } catch( IOException ioe ) { @@ -241,13 +240,11 @@ public class Expand extends MatchingTask if( !overwrite && f.exists() && f.lastModified() >= entryDate.getTime() ) { - log( "Skipping " + f + " as it is up-to-date", - Project.MSG_DEBUG ); + getLogger().debug( "Skipping " + f + " as it is up-to-date" ); return; } - log( "expanding " + entryName + " to " + f, - Project.MSG_VERBOSE ); + getLogger().debug( "expanding " + entryName + " to " + f ); // create intermediary directories - sometimes zip don't add them File dirF = f.getParentFile(); dirF.mkdirs(); @@ -293,7 +290,7 @@ public class Expand extends MatchingTask } catch( FileNotFoundException ex ) { - log( "Unable to expand to file " + f.getPath(), Project.MSG_WARN ); + getLogger().warn( "Unable to expand to file " + f.getPath() ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Filter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Filter.java index a192f7ff6..68edf3845 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Filter.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Filter.java @@ -9,7 +9,6 @@ package org.apache.tools.ant.taskdefs; import java.io.File; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; /** @@ -69,7 +68,7 @@ public class Filter extends Task protected void readFilters() throws TaskException { - log( "Reading filters from " + filtersFile, Project.MSG_VERBOSE ); + getLogger().debug( "Reading filters from " + filtersFile ); getProject().getGlobalFilterSet().readFiltersFromFile( filtersFile ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java index 55815bcd4..af7582581 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java @@ -23,7 +23,6 @@ import java.util.Iterator; import java.util.NoSuchElementException; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.util.FileUtils; @@ -321,14 +320,13 @@ public class FixCRLF extends MatchingTask } // log options used - log( "options:" + - " eol=" + - ( eol == ASIS ? "asis" : eol == CR ? "cr" : eol == LF ? "lf" : "crlf" ) + - " tab=" + ( tabs == TABS ? "add" : tabs == ASIS ? "asis" : "remove" ) + - " eof=" + ( ctrlz == ADD ? "add" : ctrlz == ASIS ? "asis" : "remove" ) + - " tablength=" + tablength + - " encoding=" + ( encoding == null ? "default" : encoding ), - Project.MSG_VERBOSE ); + getLogger().debug( "options:" + + " eol=" + + ( eol == ASIS ? "asis" : eol == CR ? "cr" : eol == LF ? "lf" : "crlf" ) + + " tab=" + ( tabs == TABS ? "add" : tabs == ASIS ? "asis" : "remove" ) + + " eof=" + ( ctrlz == ADD ? "add" : ctrlz == ASIS ? "asis" : "remove" ) + + " tablength=" + tablength + + " encoding=" + ( encoding == null ? "default" : encoding ) ); DirectoryScanner ds = super.getDirectoryScanner( srcDir ); String[] files = ds.getIncludedFiles(); @@ -758,10 +756,10 @@ public class FixCRLF extends MatchingTask if( destFile.exists() ) { // Compare the destination with the temp file - log( "destFile exists", Project.MSG_DEBUG ); + getLogger().debug( "destFile exists" ); if( !FileUtils.contentEquals( destFile, tmpFile ) ) { - log( destFile + " is being written", Project.MSG_DEBUG ); + getLogger().debug( destFile + " is being written" ); if( !destFile.delete() ) { throw new TaskException( "Unable to delete " @@ -779,9 +777,7 @@ public class FixCRLF extends MatchingTask } else {// destination is equal to temp file - log( destFile + - " is not written, as the contents are identical", - Project.MSG_DEBUG ); + getLogger().debug( destFile + " is not written, as the contents are identical" ); if( !tmpFile.delete() ) { throw new TaskException( "Unable to delete " @@ -791,7 +787,8 @@ public class FixCRLF extends MatchingTask } else {// destFile does not exist - write the temp file - log( "destFile does not exist", Project.MSG_DEBUG ); + ///XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + getLogger().debug( "destFile does not exist" ); if( !tmpFile.renameTo( destFile ) ) { throw new TaskException( @@ -820,7 +817,7 @@ public class FixCRLF extends MatchingTask } catch( IOException io ) { - log( "Error closing " + srcFile, Project.MSG_ERR ); + getLogger().error( "Error closing " + srcFile ); }// end of catch if( tmpFile != null ) diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Input.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Input.java index 927b37f93..1685549df 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Input.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Input.java @@ -13,7 +13,6 @@ import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; /** @@ -110,7 +109,7 @@ public class Input extends Task accept.add( stok.nextToken() ); } } - log( message, Project.MSG_WARN ); + getLogger().warn( message ); if( input == null ) { try @@ -121,7 +120,7 @@ public class Input extends Task { while( !accept.contains( input ) ) { - log( message, Project.MSG_WARN ); + getLogger().warn( message ); input = in.readLine(); } } @@ -149,7 +148,7 @@ public class Input extends Task } else { - log( "Override ignored for " + addproperty, Project.MSG_VERBOSE ); + getLogger().debug( "Override ignored for " + addproperty ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Jar.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Jar.java index c4c5b096c..96463c325 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Jar.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Jar.java @@ -21,7 +21,6 @@ import java.util.Enumeration; import java.util.Iterator; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.FileScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.ZipFileSet; import org.apache.tools.zip.ZipOutputStream; @@ -96,7 +95,7 @@ public class Jar extends Zip } catch( ManifestException e ) { - log( "Manifest is invalid: " + e.getMessage(), Project.MSG_ERR ); + getLogger().error( "Manifest is invalid: " + e.getMessage() ); throw new TaskException( "Invalid Manifest: " + manifestFile, e ); } catch( IOException e ) @@ -121,8 +120,8 @@ public class Jar extends Zip public void setWhenempty( WhenEmpty we ) { - log( "JARs are never empty, they contain at least a manifest file", - Project.MSG_WARN ); + final String message = "JARs are never empty, they contain at least a manifest file"; + getLogger().warn( message ); } public void addConfiguredManifest( Manifest newManifest ) @@ -165,7 +164,7 @@ public class Jar extends Zip java.util.zip.ZipEntry entry = theZipFile.getEntry( "META-INF/MANIFEST.MF" ); if( entry == null ) { - log( "Updating jar since the current jar has no manifest", Project.MSG_VERBOSE ); + getLogger().debug( "Updating jar since the current jar has no manifest" ); return false; } Manifest currentManifest = new Manifest( new InputStreamReader( theZipFile.getInputStream( entry ) ) ); @@ -175,15 +174,14 @@ public class Jar extends Zip } if( !currentManifest.equals( manifest ) ) { - log( "Updating jar since jar manifest has changed", Project.MSG_VERBOSE ); + getLogger().debug( "Updating jar since jar manifest has changed" ); return false; } } catch( Exception e ) { // any problems and we will rebuild - log( "Updating jar since cannot read current jar manifest: " + e.getClass().getName() + e.getMessage(), - Project.MSG_VERBOSE ); + getLogger().debug( "Updating jar since cannot read current jar manifest: " + e.getClass().getName() + e.getMessage() ); return false; } finally @@ -245,7 +243,7 @@ public class Jar extends Zip } for( Iterator e = execManifest.getWarnings(); e.hasNext(); ) { - log( "Manifest warning: " + (String)e.next(), Project.MSG_WARN ); + getLogger().warn( "Manifest warning: " + (String)e.next() ); } zipDir( null, zOut, "META-INF/" ); @@ -261,7 +259,7 @@ public class Jar extends Zip } catch( ManifestException e ) { - log( "Manifest is invalid: " + e.getMessage(), Project.MSG_ERR ); + getLogger().error( "Manifest is invalid: " + e.getMessage() ); throw new TaskException( "Invalid Manifest", e ); } } @@ -275,8 +273,10 @@ public class Jar extends Zip // a element. if( vPath.equalsIgnoreCase( "META-INF/MANIFEST.MF" ) ) { - log( "Warning: selected " + archiveType + " files include a META-INF/MANIFEST.MF which will be ignored " + - "(please use manifest attribute to " + archiveType + " task)", Project.MSG_WARN ); + final String message = "Warning: selected " + archiveType + + " files include a META-INF/MANIFEST.MF which will be ignored " + + "(please use manifest attribute to " + archiveType + " task)"; + getLogger().warn( message ); } else { @@ -388,7 +388,7 @@ public class Jar extends Zip } catch( ManifestException e ) { - log( "Manifest is invalid: " + e.getMessage(), Project.MSG_ERR ); + getLogger().error( "Manifest is invalid: " + e.getMessage() ); throw new TaskException( "Invalid Manifest", e ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java index ba7258f53..7b47a45b8 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java @@ -226,7 +226,7 @@ public class Java extends Task } else { - log( "Java Result: " + err, Project.MSG_ERR ); + getLogger().error( "Java Result: " + err ); } } } @@ -253,7 +253,7 @@ public class Java extends Task if( fork ) { - log( "Forking " + cmdl.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "Forking " + cmdl.toString() ); return run( cmdl.getCommandline() ); } @@ -261,15 +261,14 @@ public class Java extends Task { if( cmdl.getVmCommand().size() > 1 ) { - log( "JVM args ignored when same JVM is used.", Project.MSG_WARN ); + getLogger().warn( "JVM args ignored when same JVM is used." ); } if( dir != null ) { - log( "Working directory ignored when same JVM is used.", Project.MSG_WARN ); + getLogger().warn( "Working directory ignored when same JVM is used." ); } - log( "Running in same VM " + cmdl.getJavaCommand().toString(), - Project.MSG_VERBOSE ); + getLogger().debug( "Running in same VM " + cmdl.getJavaCommand().toString() ); run( cmdl ); return 0; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javac.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javac.java index 78a3c117c..025a2eadb 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javac.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javac.java @@ -772,11 +772,11 @@ public class Javac extends MatchingTask { CompilerAdapter adapter = CompilerAdapterFactory.getCompiler( - compiler, this ); - getLogger().info( "Compiling " + compileList.length + - " source file" - + ( compileList.length == 1 ? "" : "s" ) - + ( destDir != null ? " to " + destDir : "" ) ); + compiler, getLogger() ); + final String message = "Compiling " + compileList.length + " source file" + + ( compileList.length == 1 ? "" : "s" ) + + ( destDir != null ? " to " + destDir : "" ); + getLogger().info( message ); // now we need to populate the compiler adapter adapter.setJavac( this ); @@ -790,7 +790,7 @@ public class Javac extends MatchingTask } else { - log( FAIL_MSG, Project.MSG_ERR ); + getLogger().error( FAIL_MSG ); } } } @@ -877,13 +877,13 @@ public class Javac extends MatchingTask { if( isJdkCompiler( compiler ) ) { - log( "Since fork is true, ignoring build.compiler setting.", - Project.MSG_WARN ); + final String message = "Since fork is true, ignoring build.compiler setting."; + getLogger().warn( message ); compiler = "extJavac"; } else { - log( "Since build.compiler setting isn't classic or modern, ignoring fork setting.", Project.MSG_WARN ); + getLogger().warn( "Since build.compiler setting isn't classic or modern, ignoring fork setting." ); } } else diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PathConvert.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PathConvert.java index 8abfa9fce..9c3cf9758 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PathConvert.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PathConvert.java @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs; import java.io.File; import java.util.ArrayList; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Path; @@ -224,7 +223,7 @@ public class PathConvert extends Task // Place the result into the specified property String value = rslt.toString(); - log( "Set property " + property + " = " + value, Project.MSG_VERBOSE ); + getLogger().debug( "Set property " + property + " = " + value ); setProperty( property, value ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Property.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Property.java index 4f9417204..58f74c258 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Property.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Property.java @@ -18,7 +18,6 @@ import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.framework.exec.Environment; import org.apache.myrmidon.framework.exec.ExecException; import org.apache.tools.ant.AntClassLoader; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Reference; @@ -214,7 +213,7 @@ public class Property extends Task if( !prefix.endsWith( "." ) ) prefix += "."; - log( "Loading EnvironmentData " + prefix, Project.MSG_VERBOSE ); + getLogger().debug( "Loading EnvironmentData " + prefix ); try { final Properties environment = Environment.getNativeEnvironment(); @@ -225,7 +224,7 @@ public class Property extends Task if( value.equals( "" ) ) { - log( "Ignoring: " + key, Project.MSG_WARN ); + getLogger().warn( "Ignoring: " + key ); } else { @@ -249,7 +248,7 @@ public class Property extends Task throws TaskException { Properties props = new Properties(); - log( "Loading " + file.getAbsolutePath(), Project.MSG_VERBOSE ); + getLogger().debug( "Loading " + file.getAbsolutePath() ); try { if( file.exists() ) @@ -270,8 +269,7 @@ public class Property extends Task } else { - log( "Unable to find property file: " + file.getAbsolutePath(), - Project.MSG_VERBOSE ); + getLogger().debug( "Unable to find property file: " + file.getAbsolutePath() ); } } catch( IOException ex ) @@ -284,7 +282,7 @@ public class Property extends Task throws TaskException { Properties props = new Properties(); - log( "Resource Loading " + name, Project.MSG_VERBOSE ); + getLogger().debug( "Resource Loading " + name ); try { ClassLoader cL = null; @@ -315,7 +313,7 @@ public class Property extends Task } else { - log( "Unable to find resource " + name, Project.MSG_WARN ); + getLogger().warn( "Unable to find resource " + name ); } } catch( IOException ex ) diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java index 3e14f9d02..1fd7cf65e 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java @@ -8,6 +8,7 @@ package org.apache.tools.ant.taskdefs; import java.io.PrintStream; +import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.tools.ant.BuildEvent; import org.apache.tools.ant.BuildLogger; import org.apache.tools.ant.Project; @@ -19,7 +20,9 @@ import org.apache.tools.ant.Project; * @author J D Glanville * @version 0.5 */ -public class RecorderEntry implements BuildLogger +public class RecorderEntry + extends AbstractLogEnabled + implements BuildLogger { /** * the line separator for this OS @@ -126,7 +129,7 @@ public class RecorderEntry implements BuildLogger public void buildFinished( BuildEvent event ) { - log( "< BUILD FINISHED", Project.MSG_DEBUG ); + getLogger().debug( "< BUILD FINISHED" ); Throwable error = event.getException(); if( error == null ) @@ -144,12 +147,12 @@ public class RecorderEntry implements BuildLogger public void buildStarted( BuildEvent event ) { - log( "> BUILD STARTED", Project.MSG_DEBUG ); + getLogger().debug( "> BUILD STARTED" ); } public void messageLogged( BuildEvent event ) { - log( "--- MESSAGE LOGGED", Project.MSG_DEBUG ); + getLogger().debug( "--- MESSAGE LOGGED" ); StringBuffer buf = new StringBuffer(); if( event.getTask() != null ) @@ -171,28 +174,28 @@ public class RecorderEntry implements BuildLogger public void targetFinished( BuildEvent event ) { - log( "<< TARGET FINISHED -- " + event.getTarget(), Project.MSG_DEBUG ); + getLogger().debug( "<< TARGET FINISHED -- " + event.getTarget() ); String time = formatTime( System.currentTimeMillis() - targetStartTime ); - log( event.getTarget() + ": duration " + time, Project.MSG_VERBOSE ); + getLogger().debug( event.getTarget() + ": duration " + time ); out.flush(); } public void targetStarted( BuildEvent event ) { - log( ">> TARGET STARTED -- " + event.getTarget(), Project.MSG_DEBUG ); - log( LINE_SEP + event.getTarget().getName() + ":", Project.MSG_INFO ); + getLogger().debug( ">> TARGET STARTED -- " + event.getTarget() ); + getLogger().info( LINE_SEP + event.getTarget().getName() + ":" ); targetStartTime = System.currentTimeMillis(); } public void taskFinished( BuildEvent event ) { - log( "<<< TASK FINISHED -- " + event.getTask(), Project.MSG_DEBUG ); + getLogger().debug( "<<< TASK FINISHED -- " + event.getTask() ); out.flush(); } public void taskStarted( BuildEvent event ) { - log( ">>> TASK STARTED -- " + event.getTask(), Project.MSG_DEBUG ); + getLogger().debug( ">>> TASK STARTED -- " + event.getTask() ); } /** diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Replace.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Replace.java index ccdd0e06e..bad4fa8f5 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Replace.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Replace.java @@ -24,7 +24,6 @@ import java.util.ArrayList; import java.util.Properties; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; /** * Replaces all occurrences of one or more string tokens with given values in @@ -225,7 +224,7 @@ public class Replace extends MatchingTask if( summary ) { - log( "Replaced " + replaceCount + " occurrences in " + fileCount + " files.", Project.MSG_INFO ); + getLogger().info( "Replaced " + replaceCount + " occurrences in " + fileCount + " files." ); } } @@ -350,7 +349,7 @@ public class Replace extends MatchingTask String tok = stringReplace( token.getText(), "\n", linesep ); // for each found token, replace with value - log( "Replacing in " + src.getPath() + ": " + token.getText() + " --> " + value.getText(), Project.MSG_VERBOSE ); + getLogger().debug( "Replacing in " + src.getPath() + ": " + token.getText() + " --> " + value.getText() ); newString = stringReplace( newString, tok, val ); } @@ -426,7 +425,7 @@ public class Replace extends MatchingTask Replacefilter filter = (Replacefilter)replacefilters.get( i ); //for each found token, replace with value - log( "Replacing in " + filename + ": " + filter.getToken() + " --> " + filter.getReplaceValue(), Project.MSG_VERBOSE ); + getLogger().debug( "Replacing in " + filename + ": " + filter.getToken() + " --> " + filter.getReplaceValue() ); newString = stringReplace( newString, filter.getToken(), filter.getReplaceValue() ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Rmic.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Rmic.java index 8fb94c6b8..5ec4fd0b7 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Rmic.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Rmic.java @@ -15,7 +15,6 @@ import org.apache.avalon.excalibur.io.FileUtil; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.AntClassLoader; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.rmic.RmicAdapter; import org.apache.tools.ant.taskdefs.rmic.RmicAdapterFactory; import org.apache.tools.ant.types.FilterSetCollection; @@ -474,19 +473,22 @@ public class Rmic extends MatchingTask } catch( ClassNotFoundException e ) { - log( "Unable to verify class " + classname + - ". It could not be found.", Project.MSG_WARN ); + final String message = "Unable to verify class " + classname + + ". It could not be found."; + getLogger().warn( message ); } catch( NoClassDefFoundError e ) { - log( "Unable to verify class " + classname + - ". It is not defined.", Project.MSG_WARN ); + final String message = "Unable to verify class " + classname + + ". It is not defined."; + getLogger().warn( message ); } catch( Throwable t ) { - log( "Unable to verify class " + classname + - ". Loading caused Exception: " + - t.getMessage(), Project.MSG_WARN ); + final String message = "Unable to verify class " + classname + + ". Loading caused Exception: " + + t.getMessage(); + getLogger().warn( message ); } // we only get here if an exception has been thrown return false; @@ -536,7 +538,7 @@ public class Rmic extends MatchingTask if( verify ) { - log( "Verify has been turned on.", Project.MSG_INFO ); + getLogger().info( "Verify has been turned on." ); } String compiler = getProject().getProperty( "build.rmic" ); @@ -567,9 +569,7 @@ public class Rmic extends MatchingTask int fileCount = compileList.size(); if( fileCount > 0 ) { - log( "RMI Compiling " + fileCount + - " class" + ( fileCount > 1 ? "es" : "" ) + " to " + baseDir, - Project.MSG_INFO ); + getLogger().info( "RMI Compiling " + fileCount + " class" + ( fileCount > 1 ? "es" : "" ) + " to " + baseDir ); // finally, lets execute the compiler!! if( !adapter.execute() ) @@ -587,9 +587,8 @@ public class Rmic extends MatchingTask { if( idl ) { - log( "Cannot determine sourcefiles in idl mode, ", - Project.MSG_WARN ); - log( "sourcebase attribute will be ignored.", Project.MSG_WARN ); + getLogger().warn( "Cannot determine sourcefiles in idl mode, " ); + getLogger().warn( "sourcebase attribute will be ignored." ); } else { @@ -620,14 +619,12 @@ public class Rmic extends MatchingTask String[] newFiles = files; if( idl ) { - log( "will leave uptodate test to rmic implementation in idl mode.", - Project.MSG_VERBOSE ); + getLogger().debug( "will leave uptodate test to rmic implementation in idl mode." ); } else if( iiop && iiopopts != null && iiopopts.indexOf( "-always" ) > -1 ) { - log( "no uptodate test as -always option has been specified", - Project.MSG_VERBOSE ); + getLogger().debug( "no uptodate test as -always option has been specified" ); } else { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SQLExec.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SQLExec.java index 6644e3dfa..a667f18de 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SQLExec.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SQLExec.java @@ -33,7 +33,6 @@ import java.util.StringTokenizer; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.AntClassLoader; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.FileSet; @@ -456,15 +455,14 @@ public class SQLExec extends Task Class dc; if( classpath != null ) { - log( "Loading " + driver + " using AntClassLoader with classpath " + classpath, - Project.MSG_VERBOSE ); + getLogger().debug( "Loading " + driver + " using AntClassLoader with classpath " + classpath ); loader = new AntClassLoader( getProject(), classpath ); dc = loader.loadClass( driver ); } else { - log( "Loading " + driver + " using system loader.", Project.MSG_VERBOSE ); + getLogger().debug( "Loading " + driver + " using system loader." ); dc = Class.forName( driver ); } driverInstance = (Driver)dc.newInstance(); @@ -484,7 +482,7 @@ public class SQLExec extends Task try { - log( "connecting to " + url, Project.MSG_VERBOSE ); + getLogger().debug( "connecting to " + url ); Properties info = new Properties(); info.put( "user", userId ); info.put( "password", password ); @@ -508,7 +506,7 @@ public class SQLExec extends Task { if( output != null ) { - log( "Opening PrintStream to output file " + output, Project.MSG_VERBOSE ); + getLogger().debug( "Opening PrintStream to output file " + output ); out = new PrintStream( new BufferedOutputStream( new FileOutputStream( output ) ) ); } @@ -520,7 +518,7 @@ public class SQLExec extends Task ( (Transaction)e.next() ).runTransaction( out ); if( !autocommit ) { - log( "Commiting transaction", Project.MSG_VERBOSE ); + getLogger().debug( "Commiting transaction" ); conn.commit(); } } @@ -602,10 +600,10 @@ public class SQLExec extends Task { String theVendor = dmd.getDatabaseProductName().toLowerCase(); - log( "RDBMS = " + theVendor, Project.MSG_VERBOSE ); + getLogger().debug( "RDBMS = " + theVendor ); if( theVendor == null || theVendor.indexOf( rdbms ) < 0 ) { - log( "Not the required RDBMS: " + rdbms, Project.MSG_VERBOSE ); + getLogger().debug( "Not the required RDBMS: " + rdbms ); return false; } } @@ -614,12 +612,12 @@ public class SQLExec extends Task { String theVersion = dmd.getDatabaseProductVersion().toLowerCase(); - log( "Version = " + theVersion, Project.MSG_VERBOSE ); + getLogger().debug( "Version = " + theVersion ); if( theVersion == null || !( theVersion.startsWith( version ) || theVersion.indexOf( " " + version ) >= 0 ) ) { - log( "Not the required version: \"" + version + "\"", Project.MSG_VERBOSE ); + getLogger().debug( "Not the required version: \"" + version + "\"" ); return false; } } @@ -627,7 +625,7 @@ public class SQLExec extends Task catch( SQLException e ) { // Could not get the required information - log( "Failed to obtain required RDBMS information", Project.MSG_ERR ); + getLogger().error( "Failed to obtain required RDBMS information" ); return false; } @@ -653,8 +651,7 @@ public class SQLExec extends Task totalSql++; if( !statement.execute( sql ) ) { - log( statement.getUpdateCount() + " rows affected", - Project.MSG_VERBOSE ); + getLogger().debug( statement.getUpdateCount() + " rows affected" ); } else { @@ -667,7 +664,7 @@ public class SQLExec extends Task SQLWarning warning = conn.getWarnings(); while( warning != null ) { - log( warning + " sql warning", Project.MSG_VERBOSE ); + getLogger().debug( warning + " sql warning" ); warning = warning.getNextWarning(); } conn.clearWarnings(); @@ -675,10 +672,10 @@ public class SQLExec extends Task } catch( SQLException e ) { - log( "Failed to execute: " + sql, Project.MSG_ERR ); + getLogger().error( "Failed to execute: " + sql ); if( !onError.equals( "continue" ) ) throw e; - log( e.toString(), Project.MSG_ERR ); + getLogger().error( e.toString() ); } } @@ -697,7 +694,7 @@ public class SQLExec extends Task rs = statement.getResultSet(); if( rs != null ) { - log( "Processing new result set.", Project.MSG_VERBOSE ); + getLogger().debug( "Processing new result set." ); ResultSetMetaData md = rs.getMetaData(); int columnCount = md.getColumnCount(); StringBuffer line = new StringBuffer(); @@ -781,7 +778,7 @@ public class SQLExec extends Task if( delimiterType.equals( DelimiterType.NORMAL ) && sql.endsWith( delimiter ) || delimiterType.equals( DelimiterType.ROW ) && line.equals( delimiter ) ) { - log( "SQL: " + sql, Project.MSG_VERBOSE ); + getLogger().debug( "SQL: " + sql ); execSQL( sql.substring( 0, sql.length() - delimiter.length() ), out ); sql = ""; } @@ -852,14 +849,13 @@ public class SQLExec extends Task { if( tSqlCommand.length() != 0 ) { - log( "Executing commands", Project.MSG_INFO ); + getLogger().info( "Executing commands" ); runStatements( new StringReader( tSqlCommand ), out ); } if( tSrcFile != null ) { - log( "Executing file: " + tSrcFile.getAbsolutePath(), - Project.MSG_INFO ); + getLogger().info( "Executing file: " + tSrcFile.getAbsolutePath() ); Reader reader = ( encoding == null ) ? new FileReader( tSrcFile ) : new InputStreamReader( new FileInputStream( tSrcFile ), encoding ); runStatements( reader, out ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SendEmail.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SendEmail.java index 0952e343e..c73f5bd89 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SendEmail.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SendEmail.java @@ -16,7 +16,6 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.StringTokenizer; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.mail.MailMessage; @@ -402,7 +401,7 @@ public class SendEmail extends Task } else { - log( err, Project.MSG_ERR ); + getLogger().error( err ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Sleep.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Sleep.java index 6f0e8fd62..a5c5972f9 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Sleep.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Sleep.java @@ -8,7 +8,6 @@ package org.apache.tools.ant.taskdefs; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; /** @@ -128,8 +127,7 @@ public class Sleep extends Task { validate(); long sleepTime = getSleepTime(); - log( "sleeping for " + sleepTime + " milliseconds", - Project.MSG_VERBOSE ); + getLogger().debug( "sleeping for " + sleepTime + " milliseconds" ); doSleep( sleepTime ); } catch( Exception e ) @@ -141,7 +139,7 @@ public class Sleep extends Task else { String text = e.toString(); - log( text, Project.MSG_ERR ); + getLogger().error( text ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Tar.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Tar.java index f115425f0..40fd19756 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Tar.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Tar.java @@ -163,12 +163,11 @@ public class Tar if( upToDate ) { - log( "Nothing to do: " + tarFile.getAbsolutePath() + " is up to date.", - Project.MSG_INFO ); + getLogger().info( "Nothing to do: " + tarFile.getAbsolutePath() + " is up to date." ); return; } - log( "Building tar: " + tarFile.getAbsolutePath(), Project.MSG_INFO ); + getLogger().info( "Building tar: " + tarFile.getAbsolutePath() ); TarOutputStream tOut = null; try @@ -256,17 +255,19 @@ public class Tar { if( longFileMode.isOmitMode() ) { - log( "Omitting: " + vPath, Project.MSG_INFO ); + getLogger().info( "Omitting: " + vPath ); return; } else if( longFileMode.isWarnMode() ) { - log( "Entry: " + vPath + " longer than " + - TarConstants.NAMELEN + " characters.", Project.MSG_WARN ); + final String message = "Entry: " + vPath + " longer than " + + TarConstants.NAMELEN + " characters."; + getLogger().warn( message ); if( !longWarningGiven ) { - log( "Resulting tar file can only be processed successfully" - + " by GNU compatible tar commands", Project.MSG_WARN ); + final String message2 = "Resulting tar file can only be processed successfully" + + " by GNU compatible tar commands"; + getLogger().warn( message2 ); longWarningGiven = true; } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Touch.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Touch.java index 2b3e7a72c..6850825a8 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Touch.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Touch.java @@ -134,7 +134,7 @@ public class Touch extends Task { if( !file.exists() ) { - log( "Creating " + file, Project.MSG_INFO ); + getLogger().info( "Creating " + file ); try { FileOutputStream fos = new FileOutputStream( file ); @@ -150,8 +150,7 @@ public class Touch extends Task if( millis >= 0 && getProject().getJavaVersion() == Project.JAVA_1_1 ) { - log( "modification time of files cannot be set in JDK 1.1", - Project.MSG_WARN ); + getLogger().warn( "modification time of files cannot be set in JDK 1.1" ); return; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Untar.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Untar.java index a93b0f0d0..ddaf2346e 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Untar.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Untar.java @@ -11,7 +11,6 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.tar.TarEntry; import org.apache.tools.tar.TarInputStream; @@ -30,7 +29,7 @@ public class Untar extends Expand TarInputStream tis = null; try { - log( "Expanding: " + srcF + " into " + dir, Project.MSG_INFO ); + getLogger().info( "Expanding: " + srcF + " into " + dir ); tis = new TarInputStream( new FileInputStream( srcF ) ); TarEntry te = null; @@ -41,7 +40,7 @@ public class Untar extends Expand te.getName(), te.getModTime(), te.isDirectory() ); } - log( "expand complete", Project.MSG_VERBOSE ); + getLogger().debug( "expand complete" ); } catch( IOException ioe ) diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/UpToDate.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/UpToDate.java index 489e36f2e..e21414632 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/UpToDate.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/UpToDate.java @@ -12,7 +12,6 @@ import java.util.ArrayList; import java.util.Iterator; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.condition.Condition; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Mapper; @@ -150,13 +149,11 @@ public class UpToDate extends MatchingTask implements Condition setProperty( _property, this.getValue() ); if( mapperElement == null ) { - log( "File \"" + _targetFile.getAbsolutePath() + "\" is up to date.", - Project.MSG_VERBOSE ); + getLogger().debug( "File \"" + _targetFile.getAbsolutePath() + "\" is up to date." ); } else { - log( "All target files have been up to date.", - Project.MSG_VERBOSE ); + getLogger().debug( "All target files have been up to date." ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/War.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/War.java index 8ac50c00c..19841d440 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/War.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/War.java @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs; import java.io.File; import java.io.IOException; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.ZipFileSet; import org.apache.tools.zip.ZipOutputStream; @@ -101,8 +100,10 @@ public class War extends Jar { if( deploymentDescriptor == null || !deploymentDescriptor.equals( file ) || descriptorAdded ) { - log( "Warning: selected " + archiveType + " files include a WEB-INF/web.xml which will be ignored " + - "(please use webxml attribute to " + archiveType + " task)", Project.MSG_WARN ); + final String message = "Warning: selected " + archiveType + + " files include a WEB-INF/web.xml which will be ignored " + + "(please use webxml attribute to " + archiveType + " task)"; + getLogger().warn( message ); } else { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Zip.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Zip.java index 8e7c1d6ba..ed712a3dd 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Zip.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Zip.java @@ -23,7 +23,6 @@ import java.util.zip.ZipInputStream; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.FileScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.ZipFileSet; @@ -384,8 +383,9 @@ public class Zip extends MatchingTask { if( !renamedFile.delete() ) { - log( "Warning: unable to delete temporary file " + - renamedFile.getName(), Project.MSG_WARN ); + final String message = "Warning: unable to delete temporary file " + + renamedFile.getName(); + getLogger().warn( message ); } } } @@ -420,8 +420,9 @@ public class Zip extends MatchingTask { if( emptyBehavior.equals( "skip" ) ) { - log( "Warning: skipping " + archiveType + " archive " + zipFile + - " because no files were included.", Project.MSG_WARN ); + final String message = "Warning: skipping " + archiveType + " archive " + zipFile + + " because no files were included."; + getLogger().warn( message ); return true; } else if( emptyBehavior.equals( "fail" ) ) @@ -708,7 +709,7 @@ public class Zip extends MatchingTask // In this case using java.util.zip will not work // because it does not permit a zero-entry archive. // Must create it manually. - log( "Note: creating empty " + archiveType + " archive " + zipFile, Project.MSG_INFO ); + getLogger().info( "Note: creating empty " + archiveType + " archive " + zipFile ); try { OutputStream os = new FileOutputStream( zipFile ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java index 448d3f96b..c17ca22a3 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java @@ -7,9 +7,8 @@ */ package org.apache.tools.ant.taskdefs.compilers; +import org.apache.avalon.framework.logger.Logger; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.Task; /** * Creates the necessary compiler adapter, given basic criteria. @@ -51,7 +50,7 @@ public class CompilerAdapterFactory * @throws TaskException if the compiler type could not be resolved into a * compiler adapter. */ - public static CompilerAdapter getCompiler( String compilerType, Task task ) + public static CompilerAdapter getCompiler( String compilerType, Logger logger ) throws TaskException { /* @@ -83,8 +82,9 @@ public class CompilerAdapterFactory } catch( ClassNotFoundException cnfe ) { - task.log( "Modern compiler is not available - using " - + "classic compiler", Project.MSG_WARN ); + final String message = "Modern compiler is not available - using " + + "classic compiler"; + logger.warn( message ); return new Javac12(); } return new Javac13(); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java index 18e337c2d..321a33d1c 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java @@ -11,6 +11,7 @@ import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; +import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Javac; @@ -29,28 +30,30 @@ import org.apache.tools.ant.types.Path; * @author Stefan Bodewig * @author J D Glanville */ -public abstract class DefaultCompilerAdapter implements CompilerAdapter +public abstract class DefaultCompilerAdapter + extends AbstractLogEnabled + implements CompilerAdapter { - protected static String lSep = System.getProperty( "line.separator" ); - protected boolean debug = false; - protected boolean optimize = false; - protected boolean deprecation = false; - protected boolean depend = false; - protected boolean verbose = false; - - protected Javac attributes; - protected Path bootclasspath; - protected Path compileClasspath; - - protected File[] compileList; - protected File destDir; - protected String encoding; - protected Path extdirs; - protected boolean includeAntRuntime; - protected boolean includeJavaRuntime; - protected String memoryInitialSize; - protected String memoryMaximumSize; - protected Project project; + protected static String LINE_SEP = System.getProperty( "line.separator" ); + protected boolean m_debug; + protected boolean m_optimize; + protected boolean m_deprecation; + protected boolean m_depend; + protected boolean m_verbose; + + protected Javac m_attributes; + protected Path m_bootclasspath; + protected Path m_compileClasspath; + + protected File[] m_compileList; + protected File m_destDir; + protected String m_encoding; + protected Path m_extdirs; + protected boolean m_includeAntRuntime; + protected boolean m_includeJavaRuntime; + protected String m_memoryInitialSize; + protected String m_memoryMaximumSize; + protected Project m_project; /* * jdg - TODO - all these attributes are currently protected, but they @@ -61,30 +64,30 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter public void setJavac( Javac attributes ) { - this.attributes = attributes; + this.m_attributes = attributes; src = attributes.getSrcdir(); - destDir = attributes.getDestdir(); - encoding = attributes.getEncoding(); - debug = attributes.getDebug(); - optimize = attributes.getOptimize(); - deprecation = attributes.getDeprecation(); - depend = attributes.getDepend(); - verbose = attributes.getVerbose(); + m_destDir = attributes.getDestdir(); + m_encoding = attributes.getEncoding(); + m_debug = attributes.getDebug(); + m_optimize = attributes.getOptimize(); + m_deprecation = attributes.getDeprecation(); + m_depend = attributes.getDepend(); + m_verbose = attributes.getVerbose(); target = attributes.getTarget(); - bootclasspath = attributes.getBootclasspath(); - extdirs = attributes.getExtdirs(); - compileList = attributes.getFileList(); - compileClasspath = attributes.getClasspath(); - project = attributes.getProject(); - includeAntRuntime = attributes.getIncludeantruntime(); - includeJavaRuntime = attributes.getIncludejavaruntime(); - memoryInitialSize = attributes.getMemoryInitialSize(); - memoryMaximumSize = attributes.getMemoryMaximumSize(); + m_bootclasspath = attributes.getBootclasspath(); + m_extdirs = attributes.getExtdirs(); + m_compileList = attributes.getFileList(); + m_compileClasspath = attributes.getClasspath(); + m_project = attributes.getProject(); + m_includeAntRuntime = attributes.getIncludeantruntime(); + m_includeJavaRuntime = attributes.getIncludejavaruntime(); + m_memoryInitialSize = attributes.getMemoryInitialSize(); + m_memoryMaximumSize = attributes.getMemoryMaximumSize(); } public Javac getJavac() { - return attributes; + return m_attributes; } protected Commandline setupJavacCommand() @@ -128,46 +131,46 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter // has its own parameter format boolean usingJava1_1 = Project.getJavaVersion().equals( Project.JAVA_1_1 ); String memoryParameterPrefix = usingJava1_1 ? "-J-" : "-J-X"; - if( memoryInitialSize != null ) + if( m_memoryInitialSize != null ) { - if( !attributes.isForkedJavac() ) + if( !m_attributes.isForkedJavac() ) { - attributes.log( "Since fork is false, ignoring memoryInitialSize setting.", - Project.MSG_WARN ); + final String message = "Since fork is false, ignoring memoryInitialSize setting."; + getLogger().warn( message ); } else { - cmd.createArgument().setValue( memoryParameterPrefix + "ms" + memoryInitialSize ); + cmd.createArgument().setValue( memoryParameterPrefix + "ms" + m_memoryInitialSize ); } } - if( memoryMaximumSize != null ) + if( m_memoryMaximumSize != null ) { - if( !attributes.isForkedJavac() ) + if( !m_attributes.isForkedJavac() ) { - attributes.log( "Since fork is false, ignoring memoryMaximumSize setting.", - Project.MSG_WARN ); + final String message = "Since fork is false, ignoring memoryMaximumSize setting."; + getLogger().warn( message ); } else { - cmd.createArgument().setValue( memoryParameterPrefix + "mx" + memoryMaximumSize ); + cmd.createArgument().setValue( memoryParameterPrefix + "mx" + m_memoryMaximumSize ); } } - if( attributes.getNowarn() ) + if( m_attributes.getNowarn() ) { cmd.createArgument().setValue( "-nowarn" ); } - if( deprecation == true ) + if( m_deprecation == true ) { cmd.createArgument().setValue( "-deprecation" ); } - if( destDir != null ) + if( m_destDir != null ) { cmd.createArgument().setValue( "-d" ); - cmd.createArgument().setFile( destDir ); + cmd.createArgument().setFile( m_destDir ); } cmd.createArgument().setValue( "-classpath" ); @@ -176,17 +179,17 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter // as well as "bootclasspath" and "extdirs" if( Project.getJavaVersion().startsWith( "1.1" ) ) { - Path cp = new Path( project ); + Path cp = new Path( m_project ); /* * XXX - This doesn't mix very well with build.systemclasspath, */ - if( bootclasspath != null ) + if( m_bootclasspath != null ) { - cp.append( bootclasspath ); + cp.append( m_bootclasspath ); } - if( extdirs != null ) + if( m_extdirs != null ) { - cp.addExtdirs( extdirs ); + cp.addExtdirs( m_extdirs ); } cp.append( classpath ); cp.append( src ); @@ -202,31 +205,31 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter cmd.createArgument().setValue( "-target" ); cmd.createArgument().setValue( target ); } - if( bootclasspath != null ) + if( m_bootclasspath != null ) { cmd.createArgument().setValue( "-bootclasspath" ); - cmd.createArgument().setPath( bootclasspath ); + cmd.createArgument().setPath( m_bootclasspath ); } - if( extdirs != null ) + if( m_extdirs != null ) { cmd.createArgument().setValue( "-extdirs" ); - cmd.createArgument().setPath( extdirs ); + cmd.createArgument().setPath( m_extdirs ); } } - if( encoding != null ) + if( m_encoding != null ) { cmd.createArgument().setValue( "-encoding" ); - cmd.createArgument().setValue( encoding ); + cmd.createArgument().setValue( m_encoding ); } - if( debug ) + if( m_debug ) { if( useDebugLevel && Project.getJavaVersion() != Project.JAVA_1_0 && Project.getJavaVersion() != Project.JAVA_1_1 ) { - String debugLevel = attributes.getDebugLevel(); + String debugLevel = m_attributes.getDebugLevel(); if( debugLevel != null ) { cmd.createArgument().setValue( "-g:" + debugLevel ); @@ -246,12 +249,12 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { cmd.createArgument().setValue( "-g:none" ); } - if( optimize ) + if( m_optimize ) { cmd.createArgument().setValue( "-O" ); } - if( depend ) + if( m_depend ) { if( Project.getJavaVersion().startsWith( "1.1" ) ) { @@ -263,12 +266,12 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter } else { - attributes.log( "depend attribute is not supported by the modern compiler", - Project.MSG_WARN ); + final String message = "depend attribute is not supported by the modern compiler"; + getLogger().warn( message ); } } - if( verbose ) + if( m_verbose ) { cmd.createArgument().setValue( "-verbose" ); } @@ -305,10 +308,10 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter throws TaskException { setupJavacCommandlineSwitches( cmd, true ); - if( attributes.getSource() != null ) + if( m_attributes.getSource() != null ) { cmd.createArgument().setValue( "-source" ); - cmd.createArgument().setValue( attributes.getSource() ); + cmd.createArgument().setValue( m_attributes.getSource() ); } return cmd; } @@ -321,39 +324,39 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter protected Path getCompileClasspath() throws TaskException { - Path classpath = new Path( project ); + Path classpath = new Path( m_project ); // add dest dir to classpath so that previously compiled and // untouched classes are on classpath - if( destDir != null ) + if( m_destDir != null ) { - classpath.setLocation( destDir ); + classpath.setLocation( m_destDir ); } // Combine the build classpath with the system classpath, in an // order determined by the value of build.classpath - if( compileClasspath == null ) + if( m_compileClasspath == null ) { - if( includeAntRuntime ) + if( m_includeAntRuntime ) { classpath.addExisting( Path.systemClasspath ); } } else { - if( includeAntRuntime ) + if( m_includeAntRuntime ) { - classpath.addExisting( compileClasspath.concatSystemClasspath( "last" ) ); + classpath.addExisting( m_compileClasspath.concatSystemClasspath( "last" ) ); } else { - classpath.addExisting( compileClasspath.concatSystemClasspath( "ignore" ) ); + classpath.addExisting( m_compileClasspath.concatSystemClasspath( "ignore" ) ); } } - if( includeJavaRuntime ) + if( m_includeJavaRuntime ) { classpath.addJavaRuntime(); } @@ -435,9 +438,9 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter try { final Execute exe = new Execute(); - exe.setOutput( new LogOutputStream( attributes, Project.MSG_INFO ) ); - exe.setError( new LogOutputStream( attributes, Project.MSG_WARN ) ); - exe.setWorkingDirectory( project.getBaseDir() ); + exe.setOutput( new LogOutputStream( m_attributes, Project.MSG_INFO ) ); + exe.setError( new LogOutputStream( m_attributes, Project.MSG_WARN ) ); + exe.setWorkingDirectory( m_project.getBaseDir() ); exe.setCommandline( commandArray ); return exe.execute(); } @@ -464,27 +467,25 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter */ protected void logAndAddFilesToCompile( Commandline cmd ) { - attributes.log( "Compilation args: " + cmd.toString(), - Project.MSG_VERBOSE ); + getLogger().debug( "Compilation args: " + cmd.toString() ); StringBuffer niceSourceList = new StringBuffer( "File" ); - if( compileList.length != 1 ) + if( m_compileList.length != 1 ) { niceSourceList.append( "s" ); } niceSourceList.append( " to be compiled:" ); - niceSourceList.append( lSep ); + niceSourceList.append( LINE_SEP ); - for( int i = 0; i < compileList.length; i++ ) + for( int i = 0; i < m_compileList.length; i++ ) { - String arg = compileList[ i ].getAbsolutePath(); + String arg = m_compileList[ i ].getAbsolutePath(); cmd.createArgument().setValue( arg ); - niceSourceList.append( " " + arg + lSep ); + niceSourceList.append( " " + arg + LINE_SEP ); } - attributes.log( niceSourceList.toString(), Project.MSG_VERBOSE ); + getLogger().debug( niceSourceList.toString() ); } - } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Gcj.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Gcj.java index a758fb210..3fffbdb03 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Gcj.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Gcj.java @@ -8,7 +8,6 @@ package org.apache.tools.ant.taskdefs.compilers; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; @@ -32,7 +31,7 @@ public class Gcj extends DefaultCompilerAdapter throws TaskException { Commandline cmd; - attributes.log( "Using gcj compiler", Project.MSG_VERBOSE ); + getLogger().debug( "Using gcj compiler" ); cmd = setupGCJCommand(); int firstFileName = cmd.size(); @@ -45,23 +44,23 @@ public class Gcj extends DefaultCompilerAdapter throws TaskException { Commandline cmd = new Commandline(); - Path classpath = new Path( project ); + Path classpath = new Path( m_project ); // gcj doesn't support bootclasspath dir (-bootclasspath) // so we'll emulate it for compatibility and convenience. - if( bootclasspath != null ) + if( m_bootclasspath != null ) { - classpath.append( bootclasspath ); + classpath.append( m_bootclasspath ); } // gcj doesn't support an extension dir (-extdir) // so we'll emulate it for compatibility and convenience. - classpath.addExtdirs( extdirs ); + classpath.addExtdirs( m_extdirs ); - if( ( bootclasspath == null ) || ( bootclasspath.size() == 0 ) ) + if( ( m_bootclasspath == null ) || ( m_bootclasspath.size() == 0 ) ) { // no bootclasspath, therefore, get one from the java runtime - includeJavaRuntime = true; + m_includeJavaRuntime = true; } classpath.append( getCompileClasspath() ); @@ -71,12 +70,12 @@ public class Gcj extends DefaultCompilerAdapter cmd.setExecutable( "gcj" ); - if( destDir != null ) + if( m_destDir != null ) { cmd.createArgument().setValue( "-d" ); - cmd.createArgument().setFile( destDir ); + cmd.createArgument().setFile( m_destDir ); - if( destDir.mkdirs() ) + if( m_destDir.mkdirs() ) { throw new TaskException( "Can't make output directories. Maybe permission is wrong. " ); } @@ -86,15 +85,15 @@ public class Gcj extends DefaultCompilerAdapter cmd.createArgument().setValue( "-classpath" ); cmd.createArgument().setPath( classpath ); - if( encoding != null ) + if( m_encoding != null ) { - cmd.createArgument().setValue( "--encoding=" + encoding ); + cmd.createArgument().setValue( "--encoding=" + m_encoding ); } - if( debug ) + if( m_debug ) { cmd.createArgument().setValue( "-g1" ); } - if( optimize ) + if( m_optimize ) { cmd.createArgument().setValue( "-O" ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Javac12.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Javac12.java index c1a2a1035..923b90760 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Javac12.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Javac12.java @@ -32,10 +32,10 @@ public class Javac12 extends DefaultCompilerAdapter public boolean execute() throws TaskException { - attributes.log( "Using classic compiler", Project.MSG_VERBOSE ); + getLogger().debug( "Using classic compiler" ); Commandline cmd = setupJavacCommand( true ); - OutputStream logstr = new LogOutputStream( attributes, Project.MSG_WARN ); + OutputStream logstr = new LogOutputStream( m_attributes, Project.MSG_WARN ); try { // Create an instance of the compiler, redirecting output to diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Javac13.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Javac13.java index 5152be24b..339dbe883 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Javac13.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Javac13.java @@ -9,7 +9,6 @@ package org.apache.tools.ant.taskdefs.compilers; import java.lang.reflect.Method; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; /** @@ -33,7 +32,7 @@ public class Javac13 extends DefaultCompilerAdapter public boolean execute() throws TaskException { - attributes.log( "Using modern compiler", Project.MSG_VERBOSE ); + getLogger().debug( "Using modern compiler" ); Commandline cmd = setupModernJavacCommand(); // Use reflection to be able to build on all JDKs >= 1.1: diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java index 606b4e1d1..4011f34af 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java @@ -8,7 +8,6 @@ package org.apache.tools.ant.taskdefs.compilers; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; /** @@ -28,7 +27,7 @@ public class JavacExternal extends DefaultCompilerAdapter public boolean execute() throws TaskException { - attributes.log( "Using external javac compiler", Project.MSG_VERBOSE ); + getLogger().debug( "Using external javac compiler" ); Commandline cmd = new Commandline(); cmd.setExecutable( getJavac().getJavacExecutable() ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Jikes.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Jikes.java index 6e980c1ba..d6c3983d6 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Jikes.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Jikes.java @@ -22,7 +22,8 @@ import org.apache.tools.ant.types.Path; * @author Stefan Bodewig * @author J D Glanville */ -public class Jikes extends DefaultCompilerAdapter +public class Jikes + extends DefaultCompilerAdapter { /** @@ -39,25 +40,25 @@ public class Jikes extends DefaultCompilerAdapter public boolean execute() throws TaskException { - attributes.log( "Using jikes compiler", Project.MSG_VERBOSE ); + getLogger().debug( "Using jikes compiler" ); - Path classpath = new Path( project ); + Path classpath = new Path( m_project ); // Jikes doesn't support bootclasspath dir (-bootclasspath) // so we'll emulate it for compatibility and convenience. - if( bootclasspath != null ) + if( m_bootclasspath != null ) { - classpath.append( bootclasspath ); + classpath.append( m_bootclasspath ); } // Jikes doesn't support an extension dir (-extdir) // so we'll emulate it for compatibility and convenience. - classpath.addExtdirs( extdirs ); + classpath.addExtdirs( m_extdirs ); - if( ( bootclasspath == null ) || ( bootclasspath.size() == 0 ) ) + if( ( m_bootclasspath == null ) || ( m_bootclasspath.size() == 0 ) ) { // no bootclasspath, therefore, get one from the java runtime - includeJavaRuntime = true; + m_includeJavaRuntime = true; } else { @@ -76,42 +77,42 @@ public class Jikes extends DefaultCompilerAdapter String jikesPath = System.getProperty( "jikes.class.path" ); if( jikesPath != null ) { - classpath.append( new Path( project, jikesPath ) ); + classpath.append( new Path( m_project, jikesPath ) ); } Commandline cmd = new Commandline(); cmd.setExecutable( "jikes" ); - if( deprecation == true ) + if( m_deprecation == true ) cmd.createArgument().setValue( "-deprecation" ); - if( destDir != null ) + if( m_destDir != null ) { cmd.createArgument().setValue( "-d" ); - cmd.createArgument().setFile( destDir ); + cmd.createArgument().setFile( m_destDir ); } cmd.createArgument().setValue( "-classpath" ); cmd.createArgument().setPath( classpath ); - if( encoding != null ) + if( m_encoding != null ) { cmd.createArgument().setValue( "-encoding" ); - cmd.createArgument().setValue( encoding ); + cmd.createArgument().setValue( m_encoding ); } - if( debug ) + if( m_debug ) { cmd.createArgument().setValue( "-g" ); } - if( optimize ) + if( m_optimize ) { cmd.createArgument().setValue( "-O" ); } - if( verbose ) + if( m_verbose ) { cmd.createArgument().setValue( "-verbose" ); } - if( depend ) + if( m_depend ) { cmd.createArgument().setValue( "-depend" ); } @@ -126,13 +127,13 @@ public class Jikes extends DefaultCompilerAdapter * by emacs, so that emacs can directly set the cursor to the place, * where the error occured. */ - String emacsProperty = project.getProperty( "build.compiler.emacs" ); + String emacsProperty = m_project.getProperty( "build.compiler.emacs" ); if( emacsProperty != null && Project.toBoolean( emacsProperty ) ) { cmd.createArgument().setValue( "+E" ); } - if( attributes.getNowarn() ) + if( m_attributes.getNowarn() ) { /* * FIXME later @@ -146,7 +147,7 @@ public class Jikes extends DefaultCompilerAdapter /** * Jikes can issue pedantic warnings. */ - String pedanticProperty = project.getProperty( "build.compiler.pedantic" ); + String pedanticProperty = m_project.getProperty( "build.compiler.pedantic" ); if( pedanticProperty != null && Project.toBoolean( pedanticProperty ) ) { cmd.createArgument().setValue( "+P" ); @@ -156,7 +157,7 @@ public class Jikes extends DefaultCompilerAdapter * Jikes supports something it calls "full dependency checking", see the * jikes documentation for differences between -depend and +F. */ - String fullDependProperty = project.getProperty( "build.compiler.fulldepend" ); + String fullDependProperty = m_project.getProperty( "build.compiler.fulldepend" ); if( fullDependProperty != null && Project.toBoolean( fullDependProperty ) ) { cmd.createArgument().setValue( "+F" ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Jvc.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Jvc.java index 722d4112f..1d84210cb 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Jvc.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Jvc.java @@ -8,7 +8,6 @@ package org.apache.tools.ant.taskdefs.compilers; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; @@ -28,25 +27,25 @@ public class Jvc extends DefaultCompilerAdapter public boolean execute() throws TaskException { - attributes.log( "Using jvc compiler", Project.MSG_VERBOSE ); + getLogger().debug( "Using jvc compiler" ); - Path classpath = new Path( project ); + Path classpath = new Path( m_project ); // jvc doesn't support bootclasspath dir (-bootclasspath) // so we'll emulate it for compatibility and convenience. - if( bootclasspath != null ) + if( m_bootclasspath != null ) { - classpath.append( bootclasspath ); + classpath.append( m_bootclasspath ); } // jvc doesn't support an extension dir (-extdir) // so we'll emulate it for compatibility and convenience. - classpath.addExtdirs( extdirs ); + classpath.addExtdirs( m_extdirs ); - if( ( bootclasspath == null ) || ( bootclasspath.size() == 0 ) ) + if( ( m_bootclasspath == null ) || ( m_bootclasspath.size() == 0 ) ) { // no bootclasspath, therefore, get one from the java runtime - includeJavaRuntime = true; + m_includeJavaRuntime = true; } else { @@ -64,10 +63,10 @@ public class Jvc extends DefaultCompilerAdapter Commandline cmd = new Commandline(); cmd.setExecutable( "jvc" ); - if( destDir != null ) + if( m_destDir != null ) { cmd.createArgument().setValue( "/d" ); - cmd.createArgument().setFile( destDir ); + cmd.createArgument().setFile( m_destDir ); } // Add the Classpath before the "internal" one. @@ -81,15 +80,15 @@ public class Jvc extends DefaultCompilerAdapter // Do not display Logo cmd.createArgument().setValue( "/nologo" ); - if( debug ) + if( m_debug ) { cmd.createArgument().setValue( "/g" ); } - if( optimize ) + if( m_optimize ) { cmd.createArgument().setValue( "/O" ); } - if( verbose ) + if( m_verbose ) { cmd.createArgument().setValue( "/verbose" ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Kjc.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Kjc.java index e29c87a96..34761ad92 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Kjc.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Kjc.java @@ -9,7 +9,6 @@ package org.apache.tools.ant.taskdefs.compilers; import java.lang.reflect.Method; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; @@ -25,7 +24,7 @@ public class Kjc extends DefaultCompilerAdapter public boolean execute() throws TaskException { - attributes.log( "Using kjc compiler", Project.MSG_VERBOSE ); + getLogger().debug( "Using kjc compiler" ); Commandline cmd = setupKjcCommand(); try @@ -71,31 +70,31 @@ public class Kjc extends DefaultCompilerAdapter // generate classpath, because kjc does't support sourcepath. Path classpath = getCompileClasspath(); - if( deprecation == true ) + if( m_deprecation == true ) { cmd.createArgument().setValue( "-deprecation" ); } - if( destDir != null ) + if( m_destDir != null ) { cmd.createArgument().setValue( "-d" ); - cmd.createArgument().setFile( destDir ); + cmd.createArgument().setFile( m_destDir ); } // generate the clsspath cmd.createArgument().setValue( "-classpath" ); - Path cp = new Path( project ); + Path cp = new Path( m_project ); // kjc don't have bootclasspath option. - if( bootclasspath != null ) + if( m_bootclasspath != null ) { - cp.append( bootclasspath ); + cp.append( m_bootclasspath ); } - if( extdirs != null ) + if( m_extdirs != null ) { - cp.addExtdirs( extdirs ); + cp.addExtdirs( m_extdirs ); } cp.append( classpath ); @@ -105,23 +104,23 @@ public class Kjc extends DefaultCompilerAdapter // kjc-1.5A doesn't support -encoding option now. // but it will be supported near the feature. - if( encoding != null ) + if( m_encoding != null ) { cmd.createArgument().setValue( "-encoding" ); - cmd.createArgument().setValue( encoding ); + cmd.createArgument().setValue( m_encoding ); } - if( debug ) + if( m_debug ) { cmd.createArgument().setValue( "-g" ); } - if( optimize ) + if( m_optimize ) { cmd.createArgument().setValue( "-O2" ); } - if( verbose ) + if( m_verbose ) { cmd.createArgument().setValue( "-verbose" ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Sj.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Sj.java index 8db25bee6..1ac12beda 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Sj.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Sj.java @@ -8,7 +8,6 @@ package org.apache.tools.ant.taskdefs.compilers; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; /** @@ -30,12 +29,12 @@ public class Sj extends DefaultCompilerAdapter public boolean execute() throws TaskException { - attributes.log( "Using symantec java compiler", Project.MSG_VERBOSE ); + getLogger().debug( "Using symantec java compiler" ); Commandline cmd = setupJavacCommand(); cmd.setExecutable( "sj" ); - int firstFileName = cmd.size() - compileList.length; + int firstFileName = cmd.size() - m_compileList.length; return executeExternalCompile( cmd.getCommandline(), firstFileName ) == 0; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Http.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Http.java index a1b217522..25ed4d0ef 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Http.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Http.java @@ -12,7 +12,6 @@ import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.ProjectComponent; /** @@ -39,7 +38,7 @@ public class Http { throw new TaskException( "No url specified in HTTP task" ); } - log( "Checking for " + spec, Project.MSG_VERBOSE ); + getLogger().debug( "Checking for " + spec ); try { URL url = new URL( spec ); @@ -50,7 +49,7 @@ public class Http { HttpURLConnection http = (HttpURLConnection)conn; int code = http.getResponseCode(); - log( "Result code for " + spec + " was " + code, Project.MSG_VERBOSE ); + getLogger().debug( "Result code for " + spec + " was " + code ); if( code > 0 && code < 500 ) { return true; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Socket.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Socket.java index eed6fbdcb..b66cd8254 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Socket.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Socket.java @@ -9,7 +9,6 @@ package org.apache.tools.ant.taskdefs.condition; import java.io.IOException; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.ProjectComponent; /** @@ -46,7 +45,7 @@ public class Socket { throw new TaskException( "No port specified in Socket task" ); } - log( "Checking for listener at " + server + ":" + port, Project.MSG_VERBOSE ); + getLogger().debug( "Checking for listener at " + server + ":" + port ); try { java.net.Socket socket = new java.net.Socket( server, port ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/Execute.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/Execute.java index 485736b0b..91364e481 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/Execute.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/Execute.java @@ -65,7 +65,7 @@ public class Execute { try { - task.log( Commandline.toString( cmdline ), Project.MSG_VERBOSE ); + task.hackGetLogger().debug( Commandline.toString( cmdline ) ); final Execute exe = new Execute(); exe.setOutput( new LogOutputStream( task, Project.MSG_INFO ) ); exe.setError( new LogOutputStream( task, Project.MSG_WARN ) ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Copy.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Copy.java index 19f1459e6..ca570f749 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Copy.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Copy.java @@ -232,8 +232,7 @@ public class Copy } else { - log( m_file + " omitted as " + m_destFile + " is up to date.", - Project.MSG_VERBOSE ); + getLogger().debug( m_file + " omitted as " + m_destFile + " is up to date." ); } } else @@ -395,7 +394,7 @@ public class Copy { if( !d.mkdirs() ) { - log( "Unable to create directory " + d.getAbsolutePath(), Project.MSG_ERR ); + getLogger().error( "Unable to create directory " + d.getAbsolutePath() ); } else { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Delete.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Delete.java index 0c4d0cd73..d37809d55 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Delete.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Delete.java @@ -280,8 +280,7 @@ public class Delete } else { - log( "Could not find file " + file.getAbsolutePath() + " to delete.", - Project.MSG_VERBOSE ); + getLogger().debug( "Could not find file " + file.getAbsolutePath() + " to delete." ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Move.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Move.java index 0786914b3..6c2498627 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Move.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Move.java @@ -13,7 +13,6 @@ import java.util.Enumeration; import java.util.Iterator; import org.apache.avalon.excalibur.io.FileUtil; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.FilterSet; import org.apache.tools.ant.types.FilterSetCollection; @@ -195,7 +194,7 @@ public class Move extends Copy { if( !d.mkdirs() ) { - log( "Unable to create directory " + d.getAbsolutePath(), Project.MSG_ERR ); + getLogger().error( "Unable to create directory " + d.getAbsolutePath() ); } else { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java index d85679c53..e0ab9265e 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java @@ -920,7 +920,7 @@ public class Javadoc if( !Os.isFamily( "netware" ) ) { getLogger().debug( "Unable to locate " + jdocExecutable.getAbsolutePath() + - ". Using \"javadoc\" instead." ); + ". Using \"javadoc\" instead." ); } return "javadoc"; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java index 86d79de34..10c682390 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java @@ -76,13 +76,13 @@ public class ANTLR extends Task public void setOutputdirectory( File outputDirectory ) { - log( "Setting output directory to: " + outputDirectory.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "Setting output directory to: " + outputDirectory.toString() ); this.outputDirectory = outputDirectory; } public void setTarget( File target ) { - log( "Setting target to: " + target.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "Setting target to: " + target.toString() ); this.target = target; } @@ -127,7 +127,7 @@ public class ANTLR extends Task if( fork ) { - log( "Forking " + commandline.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "Forking " + commandline.toString() ); int err = run( commandline.getCommandline() ); if( err == 1 ) { @@ -163,27 +163,24 @@ public class ANTLR extends Task { int pling = u.indexOf( "!" ); String jarName = u.substring( 9, pling ); - log( "Implicitly adding " + jarName + " to classpath", - Project.MSG_DEBUG ); + getLogger().debug( "Implicitly adding " + jarName + " to classpath" ); createClasspath().setLocation( new File( ( new File( jarName ) ).getAbsolutePath() ) ); } else if( u.startsWith( "file:" ) ) { int tail = u.indexOf( resource ); String dirName = u.substring( 5, tail ); - log( "Implicitly adding " + dirName + " to classpath", - Project.MSG_DEBUG ); + getLogger().debug( "Implicitly adding " + dirName + " to classpath" ); createClasspath().setLocation( new File( ( new File( dirName ) ).getAbsolutePath() ) ); } else { - log( "Don\'t know how to handle resource URL " + u, - Project.MSG_DEBUG ); + getLogger().debug( "Don\'t know how to handle resource URL " + u ); } } else { - log( "Couldn\'t find " + resource, Project.MSG_DEBUG ); + getLogger().debug( "Couldn\'t find " + resource ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java index 5b67eb2ce..55c7fdf94 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java @@ -17,7 +17,6 @@ import java.util.Iterator; import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.framework.Os; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.taskdefs.exec.ExecTask; import org.apache.tools.ant.types.FileSet; @@ -118,7 +117,7 @@ public class Cab extends MatchingTask if( !Os.isFamily( "windows" ) ) { - log( "Using listcab/libcabinet", Project.MSG_VERBOSE ); + getLogger().debug( "Using listcab/libcabinet" ); StringBuffer sb = new StringBuffer(); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java index b2094fb6a..c7aa61bff 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java @@ -18,7 +18,6 @@ import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.BuildEvent; import org.apache.tools.ant.BuildListener; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.taskdefs.Javac; import org.apache.tools.ant.taskdefs.MatchingTask; @@ -976,8 +975,8 @@ public class IContract extends MatchingTask if( srcFile.lastModified() > now ) { - log( "Warning: file modified in the future: " + - files[ i ], Project.MSG_WARN ); + final String message = "Warning: file modified in the future: " + files[ i ]; + getLogger().warn( message ); } if( !classFile.exists() || srcFile.lastModified() > classFile.lastModified() ) @@ -1069,7 +1068,7 @@ public class IContract extends MatchingTask if( "jikes".equals( compiler ) ) { icCompiler = compiler; - includeJavaRuntime = true; + m_includeJavaRuntime = true; path.append( getCompileClasspath() ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java index 24616c776..f4c293d59 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java @@ -290,8 +290,7 @@ public class Javah extends Task protected void logAndAddFilesToCompile( Commandline cmd ) { int n = 0; - log( "Compilation args: " + cmd.toString(), - Project.MSG_VERBOSE ); + getLogger().debug( "Compilation args: " + cmd.toString() ); StringBuffer niceClassList = new StringBuffer(); if( cls != null ) @@ -324,7 +323,7 @@ public class Javah extends Task prefix.append( " to be compiled:" ); prefix.append( lSep ); - log( prefix.toString() + niceClassList.toString(), Project.MSG_VERBOSE ); + getLogger().debug( prefix.toString() + niceClassList.toString() ); } /** diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java index 470e263fa..899cee73a 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs.optional; import java.io.File; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Mapper; @@ -225,7 +224,7 @@ public class Native2Ascii extends MatchingTask } } - log( "converting " + srcName, Project.MSG_VERBOSE ); + getLogger().debug( "converting " + srcName ); sun.tools.native2ascii.Main n2a = new sun.tools.native2ascii.Main(); if( !n2a.convert( cmd.getArguments() ) ) diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java index a890cd379..5457dbaf5 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java @@ -20,7 +20,6 @@ import netrexx.lang.Rexx; import org.apache.avalon.excalibur.io.FileUtil; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.MatchingTask; /** @@ -596,8 +595,7 @@ public class NetRexxC extends MatchingTask } else { - log( "Dropping from classpath: " + - f.getAbsolutePath(), Project.MSG_VERBOSE ); + getLogger().debug( "Dropping from classpath: " + f.getAbsolutePath() ); } } @@ -640,7 +638,7 @@ public class NetRexxC extends MatchingTask private void doNetRexxCompile() throws TaskException { - log( "Using NetRexx compiler", Project.MSG_VERBOSE ); + getLogger().debug( "Using NetRexx compiler" ); String classpath = getCompileClasspath(); StringBuffer compileOptions = new StringBuffer(); StringBuffer fileList = new StringBuffer(); @@ -674,7 +672,7 @@ public class NetRexxC extends MatchingTask compileOptions.append( compileOptionsArray[ i ] ); compileOptions.append( " " ); } - log( compileOptions.toString(), Project.MSG_VERBOSE ); + getLogger().debug( compileOptions.toString() ); String eol = System.getProperty( "line.separator" ); StringBuffer niceSourceList = new StringBuffer( "Files to be compiled:" + eol ); @@ -686,7 +684,7 @@ public class NetRexxC extends MatchingTask niceSourceList.append( eol ); } - log( niceSourceList.toString(), Project.MSG_VERBOSE ); + getLogger().debug( niceSourceList.toString() ); // need to set java.class.path property and restore it later // since the NetRexx compiler has no option for the classpath @@ -702,17 +700,17 @@ public class NetRexxC extends MatchingTask if( rc > 1 ) {// 1 is warnings from real NetRexxC - log( out.toString(), Project.MSG_ERR ); + getLogger().error( out.toString() ); String msg = "Compile failed, messages should have been provided."; throw new TaskException( msg ); } else if( rc == 1 ) { - log( out.toString(), Project.MSG_WARN ); + getLogger().warn( out.toString() ); } else { - log( out.toString(), Project.MSG_INFO ); + getLogger().info( out.toString() ); } } finally diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java index ea3967ea5..339ecdfd9 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java @@ -18,7 +18,6 @@ import java.io.PrintWriter; import java.util.ArrayList; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.RegularExpression; @@ -191,14 +190,15 @@ public class ReplaceRegExp extends Task } catch( IOException e ) { - log( "An error occurred processing file: '" + file.getAbsolutePath() + "': " + e.toString(), - Project.MSG_ERR ); + final String message = "An error occurred processing file: '" + + file.getAbsolutePath() + "': " + e.toString(); + getLogger().error( message, e ); } } else if( file != null ) { - log( "The following file is missing: '" + file.getAbsolutePath() + "'", - Project.MSG_ERR ); + final String message = "The following file is missing: '" + file.getAbsolutePath() + "'"; + getLogger().error( message ); } int sz = filesets.size(); @@ -219,14 +219,15 @@ public class ReplaceRegExp extends Task } catch( Exception e ) { - log( "An error occurred processing file: '" + f.getAbsolutePath() + "': " + e.toString(), - Project.MSG_ERR ); + final String message = "An error occurred processing file: '" + f.getAbsolutePath() + + "': " + e.toString(); + getLogger().error( message ); } } else { - log( "The following file is missing: '" + file.getAbsolutePath() + "'", - Project.MSG_ERR ); + final String message = "The following file is missing: '" + file.getAbsolutePath() + "'"; + getLogger().error( message ); } } } @@ -276,12 +277,13 @@ public class ReplaceRegExp extends Task boolean changes = false; - log( "Replacing pattern '" + regex.getPattern( getProject() ) + "' with '" + subs.getExpression( getProject() ) + - "' in '" + f.getPath() + "'" + - ( byline ? " by line" : "" ) + - ( flags.length() > 0 ? " with flags: '" + flags + "'" : "" ) + - ".", - Project.MSG_WARN ); + final String message = "Replacing pattern '" + regex.getPattern( getProject() ) + + "' with '" + subs.getExpression( getProject() ) + + "' in '" + f.getPath() + "'" + + ( byline ? " by line" : "" ) + + ( flags.length() > 0 ? " with flags: '" + flags + "'" : "" ) + + "."; + getLogger().warn( message ); if( byline ) { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java index 4efd69dd2..a0b95ff1a 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java @@ -22,7 +22,6 @@ import java.util.Iterator; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.AntClassLoader; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Reference; @@ -226,33 +225,32 @@ public class Depend extends MatchingTask if( dump ) { - log( "Reverse Dependency Dump for " + affectedClassMap.size() + - " classes:", Project.MSG_DEBUG ); + getLogger().debug( "Reverse Dependency Dump for " + affectedClassMap.size() + " classes:" ); for( Enumeration e = affectedClassMap.keys(); e.hasMoreElements(); ) { String className = (String)e.nextElement(); - log( " Class " + className + " affects:", Project.MSG_DEBUG ); + getLogger().debug( " Class " + className + " affects:" ); Hashtable affectedClasses = (Hashtable)affectedClassMap.get( className ); for( Enumeration e2 = affectedClasses.keys(); e2.hasMoreElements(); ) { String affectedClass = (String)e2.nextElement(); ClassFileInfo info = (ClassFileInfo)affectedClasses.get( affectedClass ); - log( " " + affectedClass + " in " + info.absoluteFile.getPath(), Project.MSG_DEBUG ); + getLogger().debug( " " + affectedClass + " in " + info.absoluteFile.getPath() ); } } if( classpathDependencies != null ) { - log( "Classpath file dependencies (Forward):", Project.MSG_DEBUG ); + getLogger().debug( "Classpath file dependencies (Forward):" ); for( Enumeration e = classpathDependencies.keys(); e.hasMoreElements(); ) { String className = (String)e.nextElement(); - log( " Class " + className + " depends on:", Project.MSG_DEBUG ); + getLogger().debug( " Class " + className + " depends on:" ); Hashtable dependencies = (Hashtable)classpathDependencies.get( className ); for( Enumeration e2 = dependencies.elements(); e2.hasMoreElements(); ) { File classpathFile = (File)e2.nextElement(); - log( " " + classpathFile.getPath(), Project.MSG_DEBUG ); + getLogger().debug( " " + classpathFile.getPath() ); } } } @@ -293,8 +291,7 @@ public class Depend extends MatchingTask File classpathFile = (File)e2.nextElement(); if( classpathFile.lastModified() > info.absoluteFile.lastModified() ) { - log( "Class " + className + - " is out of date with respect to " + classpathFile, Project.MSG_DEBUG ); + getLogger().debug( "Class " + className + " is out of date with respect to " + classpathFile ); outOfDateClasses.put( className, className ); break; } @@ -431,8 +428,7 @@ public class Depend extends MatchingTask ClassFileInfo affectedClassInfo = (ClassFileInfo)affectedClasses.get( affectedClassName ); if( affectedClassInfo.absoluteFile.exists() ) { - log( "Deleting file " + affectedClassInfo.absoluteFile.getPath() + " since " + - className + " out of date", Project.MSG_VERBOSE ); + getLogger().debug( "Deleting file " + affectedClassInfo.absoluteFile.getPath() + " since " + className + " out of date" ); affectedClassInfo.absoluteFile.delete(); count++; if( closure ) @@ -449,14 +445,13 @@ public class Depend extends MatchingTask // need to delete the main class String topLevelClassName = affectedClassName.substring( 0, affectedClassName.indexOf( "$" ) ); - log( "Top level class = " + topLevelClassName, Project.MSG_VERBOSE ); + getLogger().debug( "Top level class = " + topLevelClassName ); ClassFileInfo topLevelClassInfo = (ClassFileInfo)classFileInfoMap.get( topLevelClassName ); if( topLevelClassInfo != null && topLevelClassInfo.absoluteFile.exists() ) { - log( "Deleting file " + topLevelClassInfo.absoluteFile.getPath() + " since " + - "one of its inner classes was removed", Project.MSG_VERBOSE ); + getLogger().debug( "Deleting file " + topLevelClassInfo.absoluteFile.getPath() + " since " + "one of its inner classes was removed" ); topLevelClassInfo.absoluteFile.delete(); count++; if( closure ) @@ -519,7 +514,7 @@ public class Depend extends MatchingTask for( Iterator e = getClassFiles( destPath ).iterator(); e.hasNext(); ) { ClassFileInfo info = (ClassFileInfo)e.next(); - log( "Adding class info for " + info.className, Project.MSG_DEBUG ); + getLogger().debug( "Adding class info for " + info.className ); classFileInfoMap.put( info.className, info ); ArrayList dependencyList = null; @@ -622,9 +617,7 @@ public class Depend extends MatchingTask String classFilePath = classURL.getFile(); classpathFileObject = new File( classFilePath ); } - log( "Class " + className + - " depends on " + classpathFileObject + - " due to " + dependency, Project.MSG_DEBUG ); + getLogger().debug( "Class " + className + " depends on " + classpathFileObject + " due to " + dependency ); } } classpathFileCache.put( dependency, classpathFileObject ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java index afccb54e6..36bb1f30c 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs.optional.dotnet; import java.io.File; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; /** * Task to assemble .net 'Intermediate Language' files. The task will only work @@ -188,7 +187,7 @@ public class Ilasm public void setOwner( String s ) { - log( "This option is not supported by ILASM as of Beta-2, and will be ignored", Project.MSG_WARN ); + getLogger().warn( "This option is not supported by ILASM as of Beta-2, and will be ignored" ); } /** diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java index 785b985ff..82f3fa816 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java @@ -9,6 +9,7 @@ package org.apache.tools.ant.taskdefs.optional.dotnet;// imports import java.io.File; import java.io.IOException; +import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; @@ -29,8 +30,8 @@ import org.apache.tools.ant.types.Commandline; */ public class NetCommand + extends AbstractLogEnabled { - /** * trace flag */ @@ -162,7 +163,7 @@ public class NetCommand } else { - _owner.log( _title + " Result: " + err, Project.MSG_ERR ); + getLogger().error( _title + " Result: " + err ); } } } @@ -179,7 +180,7 @@ public class NetCommand */ protected void logError( String msg ) { - _owner.log( msg, Project.MSG_ERR ); + getLogger().error( msg ); } /** @@ -189,7 +190,7 @@ public class NetCommand */ protected void logVerbose( String msg ) { - _owner.log( msg, Project.MSG_VERBOSE ); + getLogger().debug( msg ); } /** diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java index 7b7107409..f2d1bf3ed 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java @@ -153,7 +153,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec String s = reader.readLine(); if( s != null ) { - log( "[java2iiop] " + s, Project.MSG_DEBUG ); + getLogger().debug( "[java2iiop] " + s ); }// end of if () } @@ -175,13 +175,13 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec String javafile; while( ( javafile = reader.readLine() ) != null ) { - log( "buffer:" + javafile, Project.MSG_DEBUG ); + getLogger().debug( "buffer:" + javafile ); if( javafile.endsWith( ".java" ) ) { String classfile = toClassFile( javafile ); String key = classfile.substring( getConfig().srcDir.getAbsolutePath().length() + 1 ); - log( " generated : " + classfile, Project.MSG_DEBUG ); - log( " key : " + key, Project.MSG_DEBUG ); + getLogger().debug( " generated : " + classfile ); + getLogger().debug( " key : " + key ); _genfiles.put( key, new File( classfile ) ); }// end of if () }// end of while () @@ -278,7 +278,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec File borlandDD = new File( getConfig().descriptorDir, ddPrefix + BAS_DD ); if( borlandDD.exists() ) { - log( "Borland specific file found " + borlandDD, Project.MSG_VERBOSE ); + getLogger().debug( "Borland specific file found " + borlandDD ); ejbFiles.put( META_DIR + BAS_DD, borlandDD ); } else @@ -314,7 +314,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec //remove .class extension String home = toClass( clazz ); homes.add( home ); - log( " Home " + home, Project.MSG_VERBOSE ); + getLogger().debug( " Home " + home ); }// end of if () }// end of while () @@ -391,8 +391,8 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec try { - log( "Calling java2iiop", Project.MSG_VERBOSE ); - log( commandline.toString(), Project.MSG_DEBUG ); + getLogger().debug( "Calling java2iiop" ); + getLogger().debug( commandline.toString() ); execTask.setCommandline( commandline.getCommandline() ); int result = execTask.execute(); if( result != 0 ) @@ -403,7 +403,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec } catch( java.io.IOException e ) { - log( "java2iiop exception :" + e.getMessage(), Project.MSG_ERR ); + getLogger().error( "java2iiop exception :" + e.getMessage() ); throw new TaskException( "Error", e ); } } @@ -421,7 +421,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec //org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient.class ); org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient gentask = null; - log( "generate client for " + sourceJar, Project.MSG_INFO ); + getLogger().info( "generate client for " + sourceJar ); try { String args = verifyArgs; @@ -483,7 +483,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec throws TaskException { org.apache.tools.ant.taskdefs.Java javaTask = null; - log( "verify " + sourceJar, Project.MSG_INFO ); + getLogger().info( "verify " + sourceJar ); try { @@ -501,7 +501,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec javaTask.setFork( true ); } - log( "Calling " + VERIFY + " for " + sourceJar.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "Calling " + VERIFY + " for " + sourceJar.toString() ); javaTask.execute(); } catch( Exception e ) diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java index ad0d585bb..714d685c5 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java @@ -9,7 +9,6 @@ package org.apache.tools.ant.taskdefs.optional.ejb; import java.io.File; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.taskdefs.exec.ExecTask; @@ -121,7 +120,7 @@ public class BorlandGenerateClient extends Task if( clientjarfile == null || clientjarfile.isDirectory() ) { - log( "invalid or missing client jar file.", Project.MSG_VERBOSE ); + getLogger().debug( "invalid or missing client jar file." ); String ejbjarname = ejbjarfile.getAbsolutePath(); //clientname = ejbjarfile+client.jar String clientname = ejbjarname.substring( 0, ejbjarname.lastIndexOf( "." ) ); @@ -181,7 +180,7 @@ public class BorlandGenerateClient extends Task execTask.createArg().setValue( "-clientjarfile" ); execTask.createArg().setValue( clientjarfile.getAbsolutePath() ); - log( "Calling java2iiop", Project.MSG_VERBOSE ); + getLogger().debug( "Calling java2iiop" ); execTask.execute(); } catch( Exception e ) @@ -232,7 +231,7 @@ public class BorlandGenerateClient extends Task execTask.createArg().setValue( "-clientjarfile" ); execTask.createArg().setValue( clientjarfile.getAbsolutePath() ); - log( "Calling EJBUtilities", Project.MSG_VERBOSE ); + getLogger().debug( "Calling EJBUtilities" ); execTask.execute(); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java index 74209fe3f..3a389b301 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java @@ -14,7 +14,8 @@ import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.Hashtable; -import org.apache.tools.ant.Project; +import org.apache.avalon.framework.logger.LogEnabled; +import org.apache.avalon.framework.logger.Logger; import org.apache.tools.ant.Task; import org.xml.sax.AttributeList; import org.xml.sax.InputSource; @@ -30,7 +31,9 @@ import org.xml.sax.SAXException; * * @author RT */ -public class DescriptorHandler extends org.xml.sax.HandlerBase +public class DescriptorHandler + extends org.xml.sax.HandlerBase + implements LogEnabled { private final static int STATE_LOOKING_EJBJAR = 1; private final static int STATE_IN_EJBJAR = 2; @@ -105,6 +108,23 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase */ private File srcDir; + private Logger m_logger; + + /** + * Provide component with a logger. + * + * @param logger the logger + */ + public void enableLogging( Logger logger ) + { + m_logger = logger; + } + + protected final Logger getLogger() + { + return m_logger; + } + public DescriptorHandler( Task task, File srcDir ) { this.owningTask = task; @@ -221,7 +241,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase if( publicId != null ) { fileDTDs.put( publicId, fileDTD ); - owningTask.log( "Mapped publicId " + publicId + " to file " + fileDTD, Project.MSG_VERBOSE ); + getLogger().debug( "Mapped publicId " + publicId + " to file " + fileDTD ); } return; } @@ -231,7 +251,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase if( publicId != null ) { resourceDTDs.put( publicId, location ); - owningTask.log( "Mapped publicId " + publicId + " to resource " + location, Project.MSG_VERBOSE ); + getLogger().debug( "Mapped publicId " + publicId + " to resource " + location ); } } @@ -260,7 +280,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { try { - owningTask.log( "Resolved " + publicId + " to local file " + dtdFile, Project.MSG_VERBOSE ); + getLogger().debug( "Resolved " + publicId + " to local file " + dtdFile ); return new InputSource( new FileInputStream( dtdFile ) ); } catch( FileNotFoundException ex ) @@ -275,7 +295,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase InputStream is = this.getClass().getResourceAsStream( dtdResourceName ); if( is != null ) { - owningTask.log( "Resolved " + publicId + " to local resource " + dtdResourceName, Project.MSG_VERBOSE ); + getLogger().debug( "Resolved " + publicId + " to local resource " + dtdResourceName ); return new InputSource( is ); } } @@ -286,7 +306,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase try { InputStream is = dtdUrl.openStream(); - owningTask.log( "Resolved " + publicId + " to url " + dtdUrl, Project.MSG_VERBOSE ); + getLogger().debug( "Resolved " + publicId + " to url " + dtdUrl ); return new InputSource( is ); } catch( IOException ioe ) @@ -295,8 +315,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase } } - owningTask.log( "Could not resolve ( publicId: " + publicId + ", systemId: " + systemId + ") to a local entity", - Project.MSG_INFO ); + getLogger().info( "Could not resolve ( publicId: " + publicId + ", systemId: " + systemId + ") to a local entity" ); return null; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java index 6c518e1c3..d6e3c63c4 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java @@ -16,7 +16,6 @@ import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.FileSet; @@ -236,7 +235,7 @@ public class EjbJar extends MatchingTask */ public BorlandDeploymentTool createBorland() { - log( "Borland deployment tools", Project.MSG_VERBOSE ); + getLogger().debug( "Borland deployment tools" ); BorlandDeploymentTool tool = new BorlandDeploymentTool(); tool.setTask( this ); @@ -283,7 +282,7 @@ public class EjbJar extends MatchingTask */ public IPlanetDeploymentTool createIplanet() { - log( "iPlanet Application Server deployment tools", Project.MSG_VERBOSE ); + getLogger().debug( "iPlanet Application Server deployment tools" ); IPlanetDeploymentTool tool = new IPlanetDeploymentTool(); tool.setTask( this ); @@ -403,8 +402,7 @@ public class EjbJar extends MatchingTask ds.scan(); String[] files = ds.getIncludedFiles(); - log( files.length + " deployment descriptors located.", - Project.MSG_VERBOSE ); + getLogger().debug( files.length + " deployment descriptors located." ); // Loop through the files. Each file represents one deployment // descriptor, and hence one bean in our model. diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java index c0f20003e..f41199d45 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java @@ -23,6 +23,7 @@ import java.util.jar.JarOutputStream; import java.util.jar.Manifest; import java.util.zip.ZipEntry; import javax.xml.parsers.SAXParser; +import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.bcel.*; import org.apache.bcel.classfile.*; import org.apache.myrmidon.api.TaskException; @@ -46,7 +47,9 @@ import org.xml.sax.SAXException; * * @author RT */ -public class GenericDeploymentTool implements EJBDeploymentTool +public class GenericDeploymentTool + extends AbstractLogEnabled + implements EJBDeploymentTool { /** * Private constants that are used when constructing the standard jarfile @@ -250,12 +253,9 @@ public class GenericDeploymentTool implements EJBDeploymentTool if( needToRebuild( ejbFiles, jarFile ) ) { // Log that we are going to build... - log( "building " - + jarFile.getName() - + " with " - + String.valueOf( ejbFiles.size() ) - + " files", - Project.MSG_INFO ); + final String message = + "building " + jarFile.getName() + " with " + String.valueOf( ejbFiles.size() ) + " files"; + getLogger().info( message ); // Use helper method to write the jarfile String publicId = getPublicId(); @@ -265,8 +265,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool else { // Log that the file is up to date... - log( jarFile.toString() + " is up to date.", - Project.MSG_VERBOSE ); + getLogger().debug( jarFile.toString() + " is up to date." ); } } @@ -525,9 +524,10 @@ public class GenericDeploymentTool implements EJBDeploymentTool } catch( IOException ioe ) { - log( "WARNING: IOException while adding entry " + - logicalFilename + " to jarfile from " + inputFile.getPath() + " " + - ioe.getClass().getName() + "-" + ioe.getMessage(), Project.MSG_WARN ); + final String message = "WARNING: IOException while adding entry " + + logicalFilename + " to jarfile from " + inputFile.getPath() + " " + + ioe.getClass().getName() + "-" + ioe.getMessage(); + getLogger().warn( message ); } finally { @@ -619,7 +619,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool } catch( IOException e ) { - log( "exception: " + e.getMessage(), Project.MSG_INFO ); + getLogger().info( "exception: " + e.getMessage() ); } } newSet.clear(); @@ -644,7 +644,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool { String next = ( (String)i.next() ).replace( '/', File.separatorChar ); checkEntries.put( next + ".class", new File( base + next + ".class" ) ); - log( "dependent class: " + next + ".class" + " - " + base + next + ".class", Project.MSG_VERBOSE ); + getLogger().debug( "dependent class: " + next + ".class" + " - " + base + next + ".class" ); } } @@ -701,8 +701,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool if( config.manifest != null && config.manifest.exists() && config.manifest.lastModified() > lastBuild ) { - log( "Build needed because manifest " + config.manifest + " is out of date", - Project.MSG_VERBOSE ); + getLogger().debug( "Build needed because manifest " + config.manifest + " is out of date" ); return true; } @@ -715,8 +714,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool File currentFile = (File)fileIter.next(); if( lastBuild < currentFile.lastModified() ) { - log( "Build needed because " + currentFile.getPath() + " is out of date", - Project.MSG_VERBOSE ); + getLogger().debug( "Build needed because " + currentFile.getPath() + " is out of date" ); return true; } } @@ -887,8 +885,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool String entryName = (String)entryIterator.next(); File entryFile = (File)files.get( entryName ); - log( "adding file '" + entryName + "'", - Project.MSG_VERBOSE ); + getLogger().debug( "adding file '" + entryName + "'" ); addFileToJar( jarStream, entryFile, entryName ); @@ -912,8 +909,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool // link the file entryFile = new File( config.srcDir, entryName ); - log( "adding innerclass file '" + entryName + "'", - Project.MSG_VERBOSE ); + getLogger().debug( "adding innerclass file '" + entryName + "'" ); addFileToJar( jarStream, entryFile, entryName ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetDeploymentTool.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetDeploymentTool.java index a75fd7d9b..6bc7e37e1 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetDeploymentTool.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetDeploymentTool.java @@ -12,7 +12,6 @@ import java.io.IOException; import java.util.Hashtable; import javax.xml.parsers.SAXParser; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.xml.sax.SAXException; /** @@ -120,10 +119,10 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool */ public void setGenericJarSuffix( String inString ) { - log( "Since a generic JAR file is not created during processing, the " - + "iPlanet Deployment Tool does not support the " - + "\"genericjarsuffix\" attribute. It will be ignored.", - Project.MSG_WARN ); + final String message = "Since a generic JAR file is not created during processing, the " + + "iPlanet Deployment Tool does not support the " + + "\"genericjarsuffix\" attribute. It will be ignored."; + getLogger().warn( message ); } /** @@ -166,8 +165,7 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool { this.descriptorName = descriptorName; - log( "iPlanet Deployment Tool processing: " + descriptorName + " (and " - + getIasDescriptorName() + ")", Project.MSG_VERBOSE ); + getLogger().debug( "iPlanet Deployment Tool processing: " + descriptorName + " (and " + getIasDescriptorName() + ")" ); super.processDescriptor( descriptorName, saxParser ); } @@ -334,7 +332,7 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool File getVendorOutputJarFile( String baseName ) { File jarFile = new File( getDestDir(), baseName + jarSuffix ); - log( "JAR file name: " + jarFile.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "JAR file name: " + jarFile.toString() ); return jarFile; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java index 049c70f63..fd2e21c43 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java @@ -9,7 +9,6 @@ package org.apache.tools.ant.taskdefs.optional.ejb; import java.io.File; import java.util.Hashtable; -import org.apache.tools.ant.Project; /** * The deployment tool to add the jboss specific deployment descriptor to the @@ -45,7 +44,7 @@ public class JbossDeploymentTool extends GenericDeploymentTool } else { - log( "Unable to locate jboss deployment descriptor. It was expected to be in " + jbossDD.getPath(), Project.MSG_WARN ); + getLogger().warn( "Unable to locate jboss deployment descriptor. It was expected to be in " + jbossDD.getPath() ); return; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java index 6335a4fd0..44c01e4ae 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java @@ -22,7 +22,6 @@ import javax.xml.parsers.SAXParserFactory; import org.apache.avalon.excalibur.io.FileUtil; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.AntClassLoader; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.types.Path; import org.xml.sax.InputSource; @@ -407,8 +406,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool try { - log( "Checking if weblogic Jar needs to be rebuilt for jar " + weblogicJarFile.getName(), - Project.MSG_VERBOSE ); + getLogger().debug( "Checking if weblogic Jar needs to be rebuilt for jar " + weblogicJarFile.getName() ); // Only go forward if the generic and the weblogic file both exist if( genericJarFile.exists() && genericJarFile.isFile() && weblogicJarFile.exists() && weblogicJarFile.isFile() ) @@ -458,7 +456,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool if( genclass.isInterface() ) { //Interface changed rebuild jar. - log( "Interface " + genclass.getName() + " has changed", Project.MSG_VERBOSE ); + getLogger().debug( "Interface " + genclass.getName() + " has changed" ); rebuild = true; break; } @@ -474,7 +472,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool if( !genericEntry.getName().equals( "META-INF/MANIFEST.MF" ) ) { //File other then class changed rebuild - log( "Non class file " + genericEntry.getName() + " has changed", Project.MSG_VERBOSE ); + getLogger().debug( "Non class file " + genericEntry.getName() + " has changed" ); rebuild = true; break; } @@ -484,7 +482,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool else {// a file doesnt exist rebuild - log( "File " + filepath + " not present in weblogic jar", Project.MSG_VERBOSE ); + getLogger().debug( "File " + filepath + " not present in weblogic jar" ); rebuild = true; break; } @@ -492,7 +490,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool if( !rebuild ) { - log( "No rebuild needed - updating jar", Project.MSG_VERBOSE ); + getLogger().debug( "No rebuild needed - updating jar" ); newWLJarFile = new File( weblogicJarFile.getAbsolutePath() + ".temp" ); if( newWLJarFile.exists() ) { @@ -522,7 +520,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool // Update with changed Bean class if( replaceEntries.containsKey( je.getName() ) ) { - log( "Updating Bean class from generic Jar " + je.getName(), Project.MSG_VERBOSE ); + getLogger().debug( "Updating Bean class from generic Jar " + je.getName() ); // Use the entry from the generic jar je = (JarEntry)replaceEntries.get( je.getName() ); is = genericJar.getInputStream( je ); @@ -543,7 +541,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool } else { - log( "Weblogic Jar rebuild needed due to changed interface or XML", Project.MSG_VERBOSE ); + getLogger().debug( "Weblogic Jar rebuild needed due to changed interface or XML" ); } } else @@ -629,16 +627,16 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool } else { - log( "Unable to locate weblogic deployment descriptor. It was expected to be in " + - weblogicDD.getPath(), Project.MSG_WARN ); + final String message = "Unable to locate weblogic deployment descriptor. It was expected to be in " + + weblogicDD.getPath(); + getLogger().warn( message ); return; } if( !newCMP ) { - log( "The old method for locating CMP files has been DEPRECATED.", Project.MSG_VERBOSE ); - log( "Please adjust your weblogic descriptor and set newCMP=\"true\" " + - "to use the new CMP descriptor inclusion mechanism. ", Project.MSG_VERBOSE ); + getLogger().debug( "The old method for locating CMP files has been DEPRECATED." ); + getLogger().debug( "Please adjust your weblogic descriptor and set newCMP=\"true\" " + "to use the new CMP descriptor inclusion mechanism. " ); // The the weblogic cmp deployment descriptor File weblogicCMPDD = new File( getConfig().descriptorDir, ddPrefix + WL_CMP_DD ); @@ -716,8 +714,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool } if( !keepGeneric ) { - log( "deleting generic jar " + genericJarFile.toString(), - Project.MSG_VERBOSE ); + getLogger().debug( "deleting generic jar " + genericJarFile.toString() ); genericJarFile.delete(); } } @@ -791,7 +788,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool } else { - log( "Unrecognized publicId " + publicId + " - using EJB 1.1 compiler", Project.MSG_WARN ); + getLogger().warn( "Unrecognized publicId " + publicId + " - using EJB 1.1 compiler" ); ejbcClassName = COMPILER_EJB11; } } @@ -836,8 +833,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool javaTask.setClasspath( classpath ); } - log( "Calling " + ejbcClassName + " for " + sourceJar.toString(), - Project.MSG_VERBOSE ); + getLogger().debug( "Calling " + ejbcClassName + " for " + sourceJar.toString() ); if( javaTask.executeJava() != 0 ) { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicTOPLinkDeploymentTool.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicTOPLinkDeploymentTool.java index 8242396b1..29e255a5c 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicTOPLinkDeploymentTool.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicTOPLinkDeploymentTool.java @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs.optional.ejb; import java.io.File; import java.util.Hashtable; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool { @@ -98,8 +97,9 @@ public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool } else { - log( "Unable to locate toplink deployment descriptor. It was expected to be in " + - toplinkDD.getPath(), Project.MSG_WARN ); + final String message = "Unable to locate toplink deployment descriptor. It was expected to be in " + + toplinkDD.getPath(); + getLogger().warn( message ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java index 158e50f4c..9a8f6de05 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java @@ -18,7 +18,6 @@ import java.util.jar.JarFile; import java.util.jar.JarOutputStream; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.AntClassLoader; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.types.Argument; import org.apache.tools.ant.types.EnumeratedAttribute; @@ -30,8 +29,8 @@ import org.apache.tools.ant.types.Path; * * @author Maneesh Sahu */ - -public class WebsphereDeploymentTool extends GenericDeploymentTool +public class WebsphereDeploymentTool + extends GenericDeploymentTool { public final static String PUBLICID_EJB11 @@ -541,8 +540,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool JarOutputStream newJarStream = null; try { - log( "Checking if websphere Jar needs to be rebuilt for jar " + websphereJarFile.getName(), - Project.MSG_VERBOSE ); + getLogger().debug( "Checking if websphere Jar needs to be rebuilt for jar " + websphereJarFile.getName() ); // Only go forward if the generic and the websphere file both exist @@ -604,7 +602,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool //Interface changed rebuild jar. - log( "Interface " + genclass.getName() + " has changed", Project.MSG_VERBOSE ); + getLogger().debug( "Interface " + genclass.getName() + " has changed" ); rebuild = true; break; } @@ -623,7 +621,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool //File other then class changed rebuild - log( "Non class file " + genericEntry.getName() + " has changed", Project.MSG_VERBOSE ); + getLogger().debug( "Non class file " + genericEntry.getName() + " has changed" ); rebuild = true; } break; @@ -632,14 +630,14 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool } else {// a file doesnt exist rebuild - log( "File " + filepath + " not present in websphere jar", Project.MSG_VERBOSE ); + getLogger().debug( "File " + filepath + " not present in websphere jar" ); rebuild = true; break; } } if( !rebuild ) { - log( "No rebuild needed - updating jar", Project.MSG_VERBOSE ); + getLogger().debug( "No rebuild needed - updating jar" ); newwasJarFile = new File( websphereJarFile.getAbsolutePath() + ".temp" ); if( newwasJarFile.exists() ) { @@ -674,8 +672,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool if( replaceEntries.containsKey( je.getName() ) ) { - log( "Updating Bean class from generic Jar " + je.getName(), - Project.MSG_VERBOSE ); + getLogger().debug( "Updating Bean class from generic Jar " + je.getName() ); // Use the entry from the generic jar @@ -699,7 +696,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool } else { - log( "websphere Jar rebuild needed due to changed interface or XML", Project.MSG_VERBOSE ); + getLogger().debug( "websphere Jar rebuild needed due to changed interface or XML" ); } } else @@ -789,8 +786,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool } else { - log( "Unable to locate websphere extensions. It was expected to be in " + - websphereEXT.getPath(), Project.MSG_VERBOSE ); + getLogger().debug( "Unable to locate websphere extensions. It was expected to be in " + websphereEXT.getPath() ); } File websphereBND = new File( getConfig().descriptorDir, ddPrefix + WAS_BND ); if( websphereBND.exists() ) @@ -800,14 +796,12 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool } else { - log( "Unable to locate websphere bindings. It was expected to be in " + - websphereBND.getPath(), Project.MSG_VERBOSE ); + getLogger().debug( "Unable to locate websphere bindings. It was expected to be in " + websphereBND.getPath() ); } if( !newCMP ) { - log( "The old method for locating CMP files has been DEPRECATED.", Project.MSG_VERBOSE ); - log( "Please adjust your websphere descriptor and set newCMP=\"true\" " + - "to use the new CMP descriptor inclusion mechanism. ", Project.MSG_VERBOSE ); + getLogger().debug( "The old method for locating CMP files has been DEPRECATED." ); + getLogger().debug( "Please adjust your websphere descriptor and set newCMP=\"true\" " + "to use the new CMP descriptor inclusion mechanism. " ); } else { @@ -828,8 +822,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool } else { - log( "Unable to locate the websphere Map: " + - websphereMAP.getPath(), Project.MSG_VERBOSE ); + getLogger().debug( "Unable to locate the websphere Map: " + websphereMAP.getPath() ); } File websphereSchema = new File( getConfig().descriptorDir, ddPrefix + dbPrefix + WAS_CMP_SCHEMA ); @@ -840,8 +833,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool } else { - log( "Unable to locate the websphere Schema: " + - websphereSchema.getPath(), Project.MSG_VERBOSE ); + getLogger().debug( "Unable to locate the websphere Schema: " + websphereSchema.getPath() ); } // Theres nothing else to see here...keep moving sonny @@ -884,8 +876,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool } if( !keepGeneric ) { - log( "deleting generic jar " + genericJarFile.toString(), - Project.MSG_VERBOSE ); + getLogger().debug( "deleting generic jar " + genericJarFile.toString() ); genericJarFile.delete(); } } @@ -953,7 +944,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool // Why do my ""'s get stripped away??? - log( "EJB Deploy Options: " + args, Project.MSG_VERBOSE ); + getLogger().debug( "EJB Deploy Options: " + args ); Java javaTask = (Java)getTask().getProject().createTask( "java" ); // Set the JvmArgs @@ -997,8 +988,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool { javaTask.setFork( true ); } - log( "Calling websphere.ejbdeploy for " + sourceJar.toString(), - Project.MSG_VERBOSE ); + getLogger().debug( "Calling websphere.ejbdeploy for " + sourceJar.toString() ); javaTask.execute(); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java index f546cda76..0eee46df5 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java @@ -21,7 +21,6 @@ import java.util.Locale; import org.apache.avalon.excalibur.io.FileUtil; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.types.FileSet; @@ -484,12 +483,12 @@ public class Translate extends MatchingTask ins = new FileInputStream( bundleFile ); loaded = true; bundleLastModified[ i ] = new File( bundleFile ).lastModified(); - log( "Using " + bundleFile, Project.MSG_DEBUG ); + getLogger().debug( "Using " + bundleFile ); loadResourceMap( ins ); } catch( IOException ioe ) { - log( bundleFile + " not found.", Project.MSG_DEBUG ); + getLogger().debug( bundleFile + " not found." ); //if all resource files associated with this bundle //have been scanned for and still not able to //find a single resrouce file, throw exception @@ -536,9 +535,7 @@ public class Translate extends MatchingTask } catch( Exception e ) { - log( "Exception occured while trying to check/create " - + " parent directory. " + e.getMessage(), - Project.MSG_DEBUG ); + getLogger().debug( "Exception occured while trying to check/create " + " parent directory. " + e.getMessage() ); } destLastModified = dest.lastModified(); srcLastModified = new File( srcFiles[ i ] ).lastModified(); @@ -553,8 +550,7 @@ public class Translate extends MatchingTask || destLastModified < bundleLastModified[ 5 ] || destLastModified < bundleLastModified[ 6 ] ) { - log( "Processing " + srcFiles[ j ], - Project.MSG_DEBUG ); + getLogger().debug( "Processing " + srcFiles[ j ] ); FileOutputStream fos = new FileOutputStream( dest ); BufferedWriter out = new BufferedWriter( new OutputStreamWriter( fos, @@ -604,9 +600,7 @@ public class Translate extends MatchingTask //use the key itself as the value also. if( replace == null ) { - log( "Warning: The key: " + matches - + " hasn't been defined.", - Project.MSG_DEBUG ); + getLogger().debug( "Warning: The key: " + matches + " hasn't been defined." ); replace = matches; } line = line.substring( 0, startIndex ) @@ -632,9 +626,7 @@ public class Translate extends MatchingTask } else { - log( "Skipping " + srcFiles[ j ] + - " as destination file is up to date", - Project.MSG_VERBOSE ); + getLogger().debug( "Skipping " + srcFiles[ j ] + " as destination file is up to date" ); } } catch( IOException ioe ) diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLocalUtil.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLocalUtil.java index 867a4ebc9..0ff76723f 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLocalUtil.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLocalUtil.java @@ -162,7 +162,7 @@ abstract class VAJLocalUtil implements VAJUtil + dest, MSG_INFO ); for( int i = 0; i < packages.length; i++ ) { - log( " " + packages[ i ].getName(), MSG_VERBOSE ); + getLogger().debug( " " + packages[ i ].getName() ); } ExportCodeSpec exportSpec = new ExportCodeSpec(); @@ -246,7 +246,7 @@ abstract class VAJLocalUtil implements VAJUtil summaryLog.append( importProject ); summaryLog.append( "'." ); - log( summaryLog.toString(), MSG_INFO ); + getLogger().info( summaryLog.toString() ); try { @@ -257,7 +257,7 @@ abstract class VAJLocalUtil implements VAJUtil } else { - log( importedTypes.length + " types imported", MSG_DEBUG ); + getLogger().debug( importedTypes.length + " types imported" ); for( int i = 0; i < importedTypes.length; i++ ) { log( importedTypes[ i ].getPackage().getName() @@ -294,7 +294,7 @@ abstract class VAJLocalUtil implements VAJUtil VAJProjectDescription d = (VAJProjectDescription)e.next(); if( !d.projectFound() ) { - log( "No Projects match the name " + d.getName(), MSG_WARN ); + getLogger().warn( "No Projects match the name " + d.getName() ); } } @@ -483,10 +483,10 @@ abstract class VAJLocalUtil implements VAJUtil */ private void logFiles( ArrayList fileNames, String fileType ) { - log( fileType + " files found for import:", MSG_VERBOSE ); + getLogger().debug( fileType + " files found for import:" ); for( Iterator e = fileNames.iterator(); e.hasNext(); ) { - log( " " + e.next(), MSG_VERBOSE ); + getLogger().debug( " " + e.next() ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJRemoteUtil.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJRemoteUtil.java index 0b36ef344..709271293 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJRemoteUtil.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJRemoteUtil.java @@ -208,7 +208,7 @@ class VAJRemoteUtil implements VAJUtil boolean requestFailed = false; try { - log( "Request: " + request, MSG_DEBUG ); + getLogger().debug( "Request: " + request ); //must be HTTP connection URL requestUrl = new URL( request ); @@ -230,7 +230,7 @@ class VAJRemoteUtil implements VAJUtil } if( is == null ) { - log( "Can't get " + request, MSG_ERR ); + getLogger().error( "Can't get " + request ); throw new TaskException( "Couldn't execute " + request ); } @@ -251,7 +251,7 @@ class VAJRemoteUtil implements VAJUtil } catch( Exception e ) { - log( "Response line doesn't contain log level!", MSG_ERR ); + getLogger().error( "Response line doesn't contain log level!" ); } log( line.substring( 2 ), level ); line = br.readLine(); @@ -260,7 +260,7 @@ class VAJRemoteUtil implements VAJUtil } catch( IOException ex ) { - log( "Error sending tool request to VAJ" + ex, MSG_ERR ); + getLogger().error( "Error sending tool request to VAJ" + ex ); throw new TaskException( "Couldn't execute " + request ); } if( requestFailed ) diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJToolsServlet.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJToolsServlet.java index b42291996..90186ed0c 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJToolsServlet.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJToolsServlet.java @@ -65,7 +65,7 @@ public abstract class VAJToolsServlet extends HttpServlet } catch( TaskException e ) { - util.log( "Error occured: " + e.getMessage(), VAJUtil.MSG_ERR ); + util.getLogger().error( "Error occured: " + e.getMessage() ); } catch( Exception e ) { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java index 0472bcebc..bcc57a97b 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java @@ -188,7 +188,7 @@ public class JJTree extends Task exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); exe.setError( new LogOutputStream( this, Project.MSG_INFO ) ); - log( cmdl.toString(), Project.MSG_VERBOSE ); + getLogger().debug( cmdl.toString() ); exe.setCommandline( cmdl.getCommandline() ); try diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java index a1af36355..69a4821e6 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java @@ -11,7 +11,6 @@ import java.io.File; import java.util.Enumeration; import java.util.Hashtable; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.exec.Execute; import org.apache.tools.ant.types.Argument; @@ -216,7 +215,7 @@ public class JavaCC extends Task final File javaFile = getOutputJavaFile( outputDirectory, target ); if( javaFile.exists() && target.lastModified() < javaFile.lastModified() ) { - log( "Target is already built - skipping (" + target + ")", Project.MSG_VERBOSE ); + getLogger().debug( "Target is already built - skipping (" + target + ")" ); return; } cmdl.createArgument().setValue( target.getAbsolutePath() ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java index f7f0ca520..ec52643a7 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java @@ -275,7 +275,7 @@ public class JDependTask extends Task if( getHaltonerror() ) throw new TaskException( "JDepend failed" ); else - log( "JDepend FAILED", Project.MSG_ERR ); + getLogger().error( "JDepend FAILED" ); } } @@ -339,7 +339,7 @@ public class JDependTask extends Task if( getOutputFile() != null ) getLogger().info( "Output to be stored in " + getOutputFile().getPath() ); - log( "Executing: " + commandline.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "Executing: " + commandline.toString() ); try { return exe.execute(); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java index 8b224e80c..6f32d7660 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java @@ -9,7 +9,6 @@ package org.apache.tools.ant.taskdefs.optional.jlink; import java.io.File; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.types.Path; @@ -158,18 +157,18 @@ public class JlinkTask extends MatchingTask throw new TaskException( "addfiles or mergefiles required! Please set." ); } getLogger().info( "linking: " + outfile.getPath() ); - log( "compression: " + compress, Project.MSG_VERBOSE ); + getLogger().debug( "compression: " + compress ); jlink linker = new jlink(); linker.setOutfile( outfile.getPath() ); linker.setCompression( compress ); if( haveMergeFiles() ) { - log( "merge files: " + mergefiles.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "merge files: " + mergefiles.toString() ); linker.addMergeFiles( mergefiles.list() ); } if( haveAddFiles() ) { - log( "add files: " + addfiles.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "add files: " + addfiles.toString() ); linker.addAddFiles( addfiles.list() ); } try diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java index 1ad7c48d2..bd9f9d7d2 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java @@ -12,7 +12,6 @@ import java.util.ArrayList; import java.util.Date; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.taskdefs.optional.jsp.compilers.CompilerAdapter; import org.apache.tools.ant.taskdefs.optional.jsp.compilers.CompilerAdapterFactory; @@ -381,7 +380,7 @@ public class JspC extends MatchingTask { compiler = "jasper"; } - log( "compiling " + compileList.size() + " files", Project.MSG_VERBOSE ); + getLogger().debug( "compiling " + compileList.size() + " files" ); if( compileList.size() > 0 ) { @@ -405,7 +404,7 @@ public class JspC extends MatchingTask } else { - log( FAIL_MSG, Project.MSG_ERR ); + getLogger().error( FAIL_MSG ); } } } @@ -413,11 +412,11 @@ public class JspC extends MatchingTask { if( filecount == 0 ) { - log( "there were no files to compile", Project.MSG_INFO ); + getLogger().info( "there were no files to compile" ); } else { - log( "all files are up to date", Project.MSG_VERBOSE ); + getLogger().debug( "all files are up to date" ); } } } @@ -462,8 +461,9 @@ public class JspC extends MatchingTask if( srcFile.lastModified() > now ) { - log( "Warning: file modified in the future: " + - files[ i ], Project.MSG_WARN ); + final String message = + "Warning: file modified in the future: " + files[ i ]; + getLogger().warn( message ); } if( !javaFile.exists() || @@ -471,16 +471,11 @@ public class JspC extends MatchingTask { if( !javaFile.exists() ) { - log( "Compiling " + srcFile.getPath() + - " because java file " - + javaFile.getPath() + " does not exist", - Project.MSG_DEBUG ); + getLogger().debug( "Compiling " + srcFile.getPath() + " because java file " + javaFile.getPath() + " does not exist" ); } else { - log( "Compiling " + srcFile.getPath() + - " because it is out of date with respect to " - + javaFile.getPath(), Project.MSG_DEBUG ); + getLogger().debug( "Compiling " + srcFile.getPath() + " because it is out of date with respect to " + javaFile.getPath() ); } compileList.add( srcFile.getAbsolutePath() ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java index 2c3fcd39f..4aa3473cb 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java @@ -13,7 +13,6 @@ import java.util.Date; import java.util.StringTokenizer; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.types.Path; @@ -233,7 +232,7 @@ public class WLJspc extends MatchingTask helperTask.setClasspath( compileClasspath ); if( helperTask.executeJava() != 0 ) { - log( files[ i ] + " failed to compile", Project.MSG_WARN ); + getLogger().warn( files[ i ] + " failed to compile" ); } } } @@ -295,14 +294,14 @@ public class WLJspc extends MatchingTask if( srcFile.lastModified() > now ) { - log( "Warning: file modified in the future: " + - files[ i ], Project.MSG_WARN ); + final String message = "Warning: file modified in the future: " + files[ i ]; + getLogger().warn( message ); } if( srcFile.lastModified() > classFile.lastModified() ) { //log("Files are" + srcFile.getAbsolutePath()+" " +classFile.getAbsolutePath()); filesToDo.add( files[ i ] ); - log( "Recompiling File " + files[ i ], Project.MSG_VERBOSE ); + getLogger().debug( "Recompiling File " + files[ i ] ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultCompilerAdapter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultCompilerAdapter.java index 7a94f5d65..50dc0ec2c 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultCompilerAdapter.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultCompilerAdapter.java @@ -9,7 +9,7 @@ package org.apache.tools.ant.taskdefs.optional.jsp.compilers; import java.util.ArrayList; import java.util.Iterator; -import org.apache.tools.ant.Project; +import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.tools.ant.taskdefs.optional.jsp.JspC; import org.apache.tools.ant.types.Commandline; @@ -20,6 +20,7 @@ import org.apache.tools.ant.types.Commandline; * @author Matthew Watson mattw@i3sp.com */ public abstract class DefaultCompilerAdapter + extends AbstractLogEnabled implements CompilerAdapter { /* @@ -56,7 +57,7 @@ public abstract class DefaultCompilerAdapter ArrayList compileList, Commandline cmd ) { - jspc.log( "Compilation args: " + cmd.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "Compilation args: " + cmd.toString() ); StringBuffer niceSourceList = new StringBuffer( "File" ); if( compileList.size() != 1 ) @@ -75,10 +76,7 @@ public abstract class DefaultCompilerAdapter niceSourceList.append( " " + arg + lSep ); } - jspc.log( niceSourceList.toString(), Project.MSG_VERBOSE ); + getLogger().debug( niceSourceList.toString() ); } - /* - * ------------------------------------------------------------ - */ } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java index 14c7ecdfe..a15c6f92f 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java @@ -8,7 +8,6 @@ package org.apache.tools.ant.taskdefs.optional.jsp.compilers; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.taskdefs.optional.jsp.JspC; import org.apache.tools.ant.types.Commandline; @@ -28,7 +27,7 @@ public class JasperC public boolean execute() throws TaskException { - getJspc().log( "Using jasper compiler", Project.MSG_VERBOSE ); + getLogger().debug( "Using jasper compiler" ); Commandline cmd = setupJasperCommand(); try diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java index 65b455a11..cfff350e5 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java @@ -17,7 +17,6 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.apache.avalon.excalibur.io.FileUtil; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.EnumeratedAttribute; import org.w3c.dom.Document; @@ -83,7 +82,7 @@ public class AggregateTransformer */ public void setExtension( String ext ) { - task.log( "extension is not used anymore", Project.MSG_WARN ); + task.getLogger().warn( "extension is not used anymore" ); } public void setFormat( Format format ) diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java index 3610e1efb..41f11aad9 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java @@ -465,27 +465,24 @@ public class JUnitTask extends Task { int pling = u.indexOf( "!" ); String jarName = u.substring( 9, pling ); - log( "Implicitly adding " + jarName + " to classpath", - Project.MSG_DEBUG ); + getLogger().debug( "Implicitly adding " + jarName + " to classpath" ); createClasspath().setLocation( new File( ( new File( jarName ) ).getAbsolutePath() ) ); } else if( u.startsWith( "file:" ) ) { int tail = u.indexOf( resource ); String dirName = u.substring( 5, tail ); - log( "Implicitly adding " + dirName + " to classpath", - Project.MSG_DEBUG ); + getLogger().debug( "Implicitly adding " + dirName + " to classpath" ); createClasspath().setLocation( new File( ( new File( dirName ) ).getAbsolutePath() ) ); } else { - log( "Don\'t know how to handle resource URL " + u, - Project.MSG_DEBUG ); + getLogger().debug( "Don\'t know how to handle resource URL " + u ); } } else { - log( "Couldn\'t find " + resource, Project.MSG_DEBUG ); + getLogger().debug( "Couldn\'t find " + resource ); } } @@ -542,8 +539,9 @@ public class JUnitTask extends Task } else { - log( "TEST " + test.getName() + " FAILED" - + ( wasKilled ? " (timeout)" : "" ), Project.MSG_ERR ); + final String message = "TEST " + test.getName() + " FAILED" + + ( wasKilled ? " (timeout)" : "" ); + getLogger().error( message ); if( errorOccurredHere && test.getErrorProperty() != null ) { setProperty( test.getErrorProperty(), "true" ); @@ -609,7 +607,7 @@ public class JUnitTask extends Task cmd.createArgument().setValue( "haltOnFailure=" + test.getHaltonfailure() ); if( summary ) { - log( "Running " + test.getName(), Project.MSG_INFO ); + getLogger().info( "Running " + test.getName() ); cmd.createArgument().setValue( "formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter" ); } @@ -661,7 +659,7 @@ public class JUnitTask extends Task exe.setWorkingDirectory( dir ); } - log( "Executing: " + cmd.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "Executing: " + cmd.toString() ); int retVal; try { @@ -693,7 +691,7 @@ public class JUnitTask extends Task test.setProperties( getProject().getProperties() ); if( dir != null ) { - log( "dir attribute ignored if running in the same VM", Project.MSG_WARN ); + getLogger().warn( "dir attribute ignored if running in the same VM" ); } CommandlineJava.SysProperties sysProperties = commandline.getSystemProperties(); @@ -703,12 +701,12 @@ public class JUnitTask extends Task } try { - log( "Using System properties " + System.getProperties(), Project.MSG_VERBOSE ); + getLogger().debug( "Using System properties " + System.getProperties() ); AntClassLoader cl = null; Path classpath = commandline.getClasspath(); if( classpath != null ) { - log( "Using CLASSPATH " + classpath, Project.MSG_VERBOSE ); + getLogger().debug( "Using CLASSPATH " + classpath ); cl = new AntClassLoader( null, getProject(), classpath, false ); // make sure the test will be accepted as a TestCase @@ -719,7 +717,7 @@ public class JUnitTask extends Task runner = new JUnitTestRunner( test, test.getHaltonerror(), test.getFiltertrace(), test.getHaltonfailure(), cl ); if( summary ) { - log( "Running " + test.getName(), Project.MSG_INFO ); + getLogger().info( "Running " + test.getName() ); SummaryJUnitResultFormatter f = new SummaryJUnitResultFormatter(); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java index c7f5e2ff1..12d0f4191 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java @@ -21,7 +21,6 @@ import org.apache.avalon.excalibur.io.FileUtil; import org.apache.avalon.framework.ExceptionUtil; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.util.DOMElementWriter; @@ -275,7 +274,7 @@ public class XMLResultAggregator extends Task implements XMLConstants { try { - log( "Parsing file: '" + files[ i ] + "'", Project.MSG_VERBOSE ); + getLogger().debug( "Parsing file: '" + files[ i ] + "'" ); //XXX there seems to be a bug in xerces 1.3.0 that doesn't like file object // will investigate later. It does not use the given directory but // the vm dir instead ? Works fine with crimson. @@ -289,19 +288,19 @@ public class XMLResultAggregator extends Task implements XMLConstants else { // issue a warning. - log( "the file " + files[ i ] + " is not a valid testsuite XML document", Project.MSG_WARN ); + getLogger().warn( "the file " + files[ i ] + " is not a valid testsuite XML document" ); } } catch( SAXException e ) { // a testcase might have failed and write a zero-length document, // It has already failed, but hey.... mm. just put a warning - log( "The file " + files[ i ] + " is not a valid XML document. It is possibly corrupted.", Project.MSG_WARN ); - log( ExceptionUtil.printStackTrace( e ), Project.MSG_DEBUG ); + getLogger().warn( "The file " + files[ i ] + " is not a valid XML document. It is possibly corrupted." ); + getLogger().debug( ExceptionUtil.printStackTrace( e ) ); } catch( IOException e ) { - log( "Error while accessing file " + files[ i ] + ": " + e.getMessage(), Project.MSG_ERR ); + getLogger().error( "Error while accessing file " + files[ i ] + ": " + e.getMessage() ); } } return rootElement; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java index a2d367bcc..e9e073498 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java @@ -229,7 +229,7 @@ public abstract class AbstractMetamataTask extends Task // retrieve all the files we want to scan includedFiles = scanFileSets(); - log( includedFiles.size() + " files added for audit", Project.MSG_VERBOSE ); + getLogger().debug( includedFiles.size() + " files added for audit" ); // write all the options to a temp file and use it ro run the process ArrayList options = getOptions(); @@ -314,7 +314,7 @@ public abstract class AbstractMetamataTask extends Task { final Execute exe = new Execute(); setupStreamHandler( exe ); - log( cmdl.toString(), Project.MSG_VERBOSE ); + getLogger().debug( cmdl.toString() ); exe.setCommandline( cmdl.getCommandline() ); try { @@ -376,7 +376,7 @@ public abstract class AbstractMetamataTask extends Task DirectoryScanner ds = fs.getDirectoryScanner( getProject() ); ds.scan(); String[] f = ds.getIncludedFiles(); - log( i + ") Adding " + f.length + " files from directory " + ds.getBasedir(), Project.MSG_VERBOSE ); + getLogger().debug( i + ") Adding " + f.length + " files from directory " + ds.getBasedir() ); for( int j = 0; j < f.length; j++ ) { String pathname = f[ j ]; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java index dfef114ce..e0dbcbbf1 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java @@ -200,7 +200,7 @@ public class MAudit extends AbstractMetamataTask } if( !unused && searchPath != null ) { - log( "'searchpath' element ignored. 'unused' attribute is disabled.", Project.MSG_WARN ); + getLogger().warn( "'searchpath' element ignored. 'unused' attribute is disabled." ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAuditStreamHandler.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAuditStreamHandler.java index 9b4b409b1..18f1b0b2a 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAuditStreamHandler.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAuditStreamHandler.java @@ -19,7 +19,6 @@ import java.util.Hashtable; import java.util.Iterator; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler; import org.apache.tools.ant.util.DOMElementWriter; import org.apache.tools.ant.util.regexp.RegexpMatcher; @@ -157,7 +156,7 @@ class MAuditStreamHandler implements ExecuteStreamHandler String fullclassname = (String)filemapping.get( filepath ); if( fullclassname == null ) { - task.log( "Could not find class mapping for " + filepath, Project.MSG_WARN ); + task.getLogger().warn( "Could not find class mapping for " + filepath ); continue; } int pos = fullclassname.lastIndexOf( '.' ); @@ -193,7 +192,7 @@ class MAuditStreamHandler implements ExecuteStreamHandler } catch( IOException exc ) { - task.log( "Unable to write log file", Project.MSG_ERR ); + task.getLogger().error( "Unable to write log file" ); } finally { @@ -265,7 +264,7 @@ class MAuditStreamHandler implements ExecuteStreamHandler { // this doesn't match..report it as info, it could be // either the copyright, summary or a multiline message (damn !) - task.log( line, Project.MSG_INFO ); + task.getLogger().info( line ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java index d18c2bc95..ffaa776d5 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java @@ -26,7 +26,6 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamResult; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler; import org.xml.sax.Attributes; @@ -323,7 +322,7 @@ public class MMetricsStreamHandler implements ExecuteStreamHandler { e.printStackTrace(); // invalid lines are sent to the output as information, it might be anything, - task.log( line, Project.MSG_INFO ); + task.getLogger().info( line ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java index 359b5c7a9..b3d696aba 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java @@ -306,7 +306,7 @@ public class MParse extends Task } final Execute process = new Execute( handler ); - log( cmdl.toString(), Project.MSG_VERBOSE ); + getLogger().debug( cmdl.toString() ); process.setCommandline( cmdl.getCommandline() ); try { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java index 7e35aef0b..75ac8fbc6 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java @@ -25,7 +25,6 @@ import java.util.Locale; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.FileScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.FileSet; @@ -287,7 +286,7 @@ public class FTP try { - log( "Opening FTP connection to " + server, Project.MSG_VERBOSE ); + getLogger().debug( "Opening FTP connection to " + server ); ftp = new FTPClient(); @@ -297,15 +296,15 @@ public class FTP throw new TaskException( "FTP connection failed: " + ftp.getReplyString() ); } - log( "connected", Project.MSG_VERBOSE ); - log( "logging in to FTP server", Project.MSG_VERBOSE ); + getLogger().debug( "connected" ); + getLogger().debug( "logging in to FTP server" ); if( !ftp.login( userid, password ) ) { throw new TaskException( "Could not login to FTP server" ); } - log( "login succeeded", Project.MSG_VERBOSE ); + getLogger().debug( "login succeeded" ); if( binary ) { @@ -320,7 +319,7 @@ public class FTP if( passive ) { - log( "entering passive mode", Project.MSG_VERBOSE ); + getLogger().debug( "entering passive mode" ); ftp.enterLocalPassiveMode(); if( !FTPReply.isPositiveCompletion( ftp.getReplyCode() ) ) { @@ -343,7 +342,7 @@ public class FTP { if( remotedir != null ) { - log( "changing the remote directory", Project.MSG_VERBOSE ); + getLogger().debug( "changing the remote directory" ); ftp.changeWorkingDirectory( remotedir ); if( !FTPReply.isPositiveCompletion( ftp.getReplyCode() ) ) { @@ -367,7 +366,7 @@ public class FTP { try { - log( "disconnecting", Project.MSG_VERBOSE ); + getLogger().debug( "disconnecting" ); ftp.logout(); ftp.disconnect(); } @@ -421,7 +420,7 @@ public class FTP String s = "could not get file: " + ftp.getReplyString(); if( skipFailedTransfers == true ) { - log( s, Project.MSG_WARN ); + getLogger().warn( s ); skipped++; } else @@ -432,8 +431,7 @@ public class FTP } else { - log( "File " + file.getAbsolutePath() + " copied from " + server, - Project.MSG_VERBOSE ); + getLogger().debug( "File " + file.getAbsolutePath() + " copied from " + server ); transferred++; } } @@ -467,7 +465,7 @@ public class FTP protected boolean isUpToDate( FTPClient ftp, File localFile, String remoteFile ) throws IOException, TaskException { - log( "checking date for " + remoteFile, Project.MSG_VERBOSE ); + getLogger().debug( "checking date for " + remoteFile ); FTPFile[] files = ftp.listFiles( remoteFile ); @@ -480,8 +478,7 @@ public class FTP if( action == SEND_FILES ) { - log( "Could not date test remote file: " + remoteFile - + "assuming out of date.", Project.MSG_VERBOSE ); + getLogger().debug( "Could not date test remote file: " + remoteFile + "assuming out of date." ); return false; } else @@ -562,8 +559,7 @@ public class FTP dir = (File)parents.get( i ); if( !dirCache.contains( dir ) ) { - log( "creating remote directory " + resolveFile( dir.getPath() ), - Project.MSG_VERBOSE ); + getLogger().debug( "creating remote directory " + resolveFile( dir.getPath() ) ); ftp.makeDirectory( resolveFile( dir.getPath() ) ); // Both codes 550 and 553 can be produced by FTP Servers // to indicate that an attempt to create a directory has @@ -603,7 +599,7 @@ public class FTP String s = "could not delete file: " + ftp.getReplyString(); if( skipFailedTransfers == true ) { - log( s, Project.MSG_WARN ); + getLogger().warn( s ); skipped++; } else @@ -613,7 +609,7 @@ public class FTP } else { - log( "File " + filename + " deleted from " + server, Project.MSG_VERBOSE ); + getLogger().debug( "File " + filename + " deleted from " + server ); transferred++; } } @@ -747,7 +743,7 @@ public class FTP String s = "could not put file: " + ftp.getReplyString(); if( skipFailedTransfers == true ) { - log( s, Project.MSG_WARN ); + getLogger().warn( s ); skipped++; } else @@ -759,9 +755,7 @@ public class FTP else { - log( "File " + file.getAbsolutePath() + - " copied to " + server, - Project.MSG_VERBOSE ); + getLogger().debug( "File " + file.getAbsolutePath() + " copied to " + server ); transferred++; } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/MimeMail.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/MimeMail.java index b0870f901..333c8cf7c 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/MimeMail.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/MimeMail.java @@ -25,7 +25,6 @@ import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.FileSet; @@ -259,7 +258,7 @@ public class MimeMail extends Task MimeMessage msg = new MimeMessage( sesh ); //set the sender - log( "message sender: " + from, Project.MSG_VERBOSE ); + getLogger().debug( "message sender: " + from ); msg.setFrom( new InternetAddress( from ) ); // add recipient lists @@ -269,7 +268,7 @@ public class MimeMail extends Task if( subject != null ) { - log( "subject: " + subject, Project.MSG_VERBOSE ); + getLogger().debug( "subject: " + subject ); msg.setSubject( subject ); } @@ -322,8 +321,7 @@ public class MimeMail extends Task throw new TaskException( "File \"" + file.getAbsolutePath() + "\" does not exist or is not readable." ); } - log( "Attaching " + file.toString() + " - " + file.length() + " bytes", - Project.MSG_VERBOSE ); + getLogger().debug( "Attaching " + file.toString() + " - " + file.length() + " bytes" ); FileDataSource fileData = new FileDataSource( file ); DataHandler fileDataHandler = new DataHandler( fileData ); body.setDataHandler( fileDataHandler ); @@ -361,7 +359,7 @@ public class MimeMail extends Task else { String text = e.toString(); - log( text, Project.MSG_ERR ); + getLogger().error( text ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java index a02cad4ea..5f16a0346 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java @@ -15,7 +15,6 @@ import java.util.ArrayList; import java.util.Calendar; import java.util.Iterator; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; /** @@ -245,7 +244,7 @@ public class TelnetTask extends Task { os.write( ( s + "\n" ).getBytes() ); if( echoString ) - log( s, Project.MSG_INFO ); + getLogger().info( s ); os.flush(); } catch( Exception e ) @@ -304,7 +303,7 @@ public class TelnetTask extends Task sb.append( (char)is.read() ); } } - log( sb.toString(), Project.MSG_INFO ); + getLogger().info( sb.toString() ); } catch( TaskException be ) { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java index 82d57abdf..10e2dbbd2 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java @@ -11,7 +11,6 @@ import java.io.File; import java.util.ArrayList; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.FileSet; /** @@ -147,7 +146,7 @@ public class P4Add extends P4Base } else { - log( "No files specified to add!", Project.MSG_WARN ); + getLogger().warn( "No files specified to add!" ); } } @@ -155,7 +154,7 @@ public class P4Add extends P4Base private void execP4Add( StringBuffer list ) { - log( "Execing add " + P4CmdOpts + " " + addCmd + list, Project.MSG_INFO ); + getLogger().info( "Execing add " + P4CmdOpts + " " + addCmd + list ); execP4Command( "-s add " + P4CmdOpts + " " + addCmd + list, new SimpleP4OutputHandler( this ) ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java index c888a5a6a..7b289bbe6 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs.optional.perforce; import java.io.IOException; import org.apache.myrmidon.api.TaskException; import org.apache.oro.text.perl.Perl5Util; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.exec.Execute; import org.apache.tools.ant.types.Commandline; @@ -160,7 +159,7 @@ public abstract class P4Base extends org.apache.tools.ant.Task cmdl += cmdline[ i ] + " "; } - log( "Execing " + cmdl, Project.MSG_VERBOSE ); + getLogger().debug( "Execing " + cmdl ); if( handler == null ) handler = new SimpleP4OutputHandler( this ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java index 72743b5e0..7a14e4319 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java @@ -48,7 +48,7 @@ public class P4Change extends P4Base if( util.match( "/error/", line ) ) { - log( "Client Error", Project.MSG_VERBOSE ); + getLogger().debug( "Client Error" ); throw new TaskException( "Perforce Error, check client settings and/or server" ); } else if( util.match( "//", line ) ) @@ -95,7 +95,7 @@ public class P4Change extends P4Base line = util.substitute( "s/[^0-9]//g", line ); int changenumber = Integer.parseInt( line ); - log( "Change Number is " + changenumber, Project.MSG_INFO ); + getLogger().info( "Change Number is " + changenumber ); setProperty( "p4.change", "" + changenumber ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java index bdd86dc0a..2969da953 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java @@ -83,7 +83,7 @@ public class P4Counter extends P4Base { public void process( String line ) { - log( "P4Counter retrieved line \"" + line + "\"", Project.MSG_VERBOSE ); + getLogger().debug( "P4Counter retrieved line \"" + line + "\"" ); try { value = Integer.parseInt( line ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java index 39e00696e..0e04d6930 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs.optional.perforce; import java.text.SimpleDateFormat; import java.util.Date; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; /** * P4Label - create a Perforce Label. P4Label inserts a label into perforce @@ -46,23 +45,23 @@ public class P4Label extends P4Base public void execute() throws TaskException { - log( "P4Label exec:", Project.MSG_INFO ); + getLogger().info( "P4Label exec:" ); if( P4View == null || P4View.length() < 1 ) { - log( "View not set, assuming //depot/...", Project.MSG_WARN ); + getLogger().warn( "View not set, assuming //depot/..." ); P4View = "//depot/..."; } if( desc == null || desc.length() < 1 ) { - log( "Label Description not set, assuming 'AntLabel'", Project.MSG_WARN ); + getLogger().warn( "Label Description not set, assuming 'AntLabel'" ); desc = "AntLabel"; } if( lock != null && !lock.equalsIgnoreCase( "locked" ) ) { - log( "lock attribute invalid - ignoring", Project.MSG_WARN ); + getLogger().warn( "lock attribute invalid - ignoring" ); } if( name == null || name.length() < 1 ) @@ -70,7 +69,7 @@ public class P4Label extends P4Base SimpleDateFormat formatter = new SimpleDateFormat( "yyyy.MM.dd-hh:mm" ); Date now = new Date(); name = "AntLabel-" + formatter.format( now ); - log( "name not set, assuming '" + name + "'", Project.MSG_WARN ); + getLogger().warn( "name not set, assuming '" + name + "'" ); } //We have to create a unlocked label first @@ -85,7 +84,7 @@ public class P4Label extends P4Base { public void process( String line ) { - log( line, Project.MSG_VERBOSE ); + getLogger().debug( line ); } }; @@ -98,17 +97,17 @@ public class P4Label extends P4Base { public void process( String line ) { - log( line, Project.MSG_VERBOSE ); + getLogger().debug( line ); } } ); - log( "Created Label " + name + " (" + desc + ")", Project.MSG_INFO ); + getLogger().info( "Created Label " + name + " (" + desc + ")" ); //Now lock if required if( lock != null && lock.equalsIgnoreCase( "locked" ) ) { - log( "Modifying lock status to 'locked'", Project.MSG_INFO ); + getLogger().info( "Modifying lock status to 'locked'" ); final StringBuffer labelSpec = new StringBuffer(); @@ -121,7 +120,7 @@ public class P4Label extends P4Base { public void process( String line ) { - log( line, Project.MSG_VERBOSE ); + getLogger().debug( line ); if( util.match( "/^Options:/", line ) ) { @@ -133,15 +132,15 @@ public class P4Label extends P4Base }; execP4Command( "label -o " + name, handler ); - log( labelSpec.toString(), Project.MSG_DEBUG ); + getLogger().debug( labelSpec.toString() ); - log( "Now locking label...", Project.MSG_VERBOSE ); + getLogger().debug( "Now locking label..." ); handler = new P4HandlerAdapter() { public void process( String line ) { - log( line, Project.MSG_VERBOSE ); + getLogger().debug( line ); } }; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java index 17dae2f41..2f48bca21 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java @@ -8,7 +8,6 @@ package org.apache.tools.ant.taskdefs.optional.perforce; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; /** * P4Submit - submit a numbered changelist to Perforce. Note: P4Submit @@ -40,7 +39,7 @@ public class P4Submit extends P4Base { public void process( String line ) { - log( line, Project.MSG_VERBOSE ); + getLogger().debug( line ); } } ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java index 5e1508c43..b3ef5c2a4 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java @@ -8,7 +8,6 @@ package org.apache.tools.ant.taskdefs.optional.perforce; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; /** * P4Sync - synchronise client space to a perforce depot view. The API allows @@ -121,7 +120,7 @@ public class P4Sync extends P4Base syncCmd = syncCmd + "@" + label; } - log( "Execing sync " + P4CmdOpts + " " + syncCmd, Project.MSG_VERBOSE ); + getLogger().debug( "Execing sync " + P4CmdOpts + " " + syncCmd ); execP4Command( "-s sync " + P4CmdOpts + " " + syncCmd, new SimpleP4OutputHandler( this ) ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/SimpleP4OutputHandler.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/SimpleP4OutputHandler.java index 9dc36e656..6b878dca5 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/SimpleP4OutputHandler.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/SimpleP4OutputHandler.java @@ -8,7 +8,6 @@ package org.apache.tools.ant.taskdefs.optional.perforce; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; public class SimpleP4OutputHandler extends P4HandlerAdapter @@ -41,7 +40,7 @@ public class SimpleP4OutputHandler throw new TaskException( line ); } - parent.log( parent.util.substitute( "s/^.*: //", line ), Project.MSG_INFO ); + parent.getLogger().info( parent.util.substitute( "s/^.*: //", line ) ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java index cf65d21de..4d98cf33a 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java @@ -364,7 +364,7 @@ public class Pvcs extends org.apache.tools.ant.Task Random rand = new Random( System.currentTimeMillis() ); tmp = new File( "pvcs_ant_" + rand.nextLong() + ".log" ); tmp2 = new File( "pvcs_ant_" + rand.nextLong() + ".log" ); - log( "Executing " + commandLine.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "Executing " + commandLine.toString() ); result = runCmd( commandLine, new FileOutputStream( tmp ), new LogOutputStream( this, Project.MSG_WARN ) ); if( result != 0 && !ignorerc ) { @@ -376,7 +376,7 @@ public class Pvcs extends org.apache.tools.ant.Task throw new TaskException( "Communication between ant and pvcs failed. No output generated from executing PVCS commandline interface \"pcli\" and \"get\"" ); // Create folders in workspace - log( "Creating folders", Project.MSG_INFO ); + getLogger().info( "Creating folders" ); createFolders( tmp ); // Massage PCLI lvf output transforming '\' to '/' so get command works appropriately @@ -405,8 +405,8 @@ public class Pvcs extends org.apache.tools.ant.Task } commandLine.createArgument().setValue( "@" + tmp2.getAbsolutePath() ); - log( "Getting files", Project.MSG_INFO ); - log( "Executing " + commandLine.toString(), Project.MSG_VERBOSE ); + getLogger().info( "Getting files" ); + getLogger().debug( "Executing " + commandLine.toString() ); final LogOutputStream output = new LogOutputStream( this, Project.MSG_INFO ); final LogOutputStream error = new LogOutputStream( this, Project.MSG_WARN ); result = runCmd( commandLine, output, error ); @@ -491,7 +491,7 @@ public class Pvcs extends org.apache.tools.ant.Task String line = in.readLine(); while( line != null ) { - log( "Considering \"" + line + "\"", Project.MSG_VERBOSE ); + getLogger().debug( "Considering \"" + line + "\"" ); if( line.startsWith( "\"\\" ) || line.startsWith( "\"/" ) || line.startsWith( getLineStart() ) ) @@ -505,30 +505,30 @@ public class Pvcs extends org.apache.tools.ant.Task File dir = new File( f.substring( 0, index ) ); if( !dir.exists() ) { - log( "Creating " + dir.getAbsolutePath(), Project.MSG_VERBOSE ); + getLogger().debug( "Creating " + dir.getAbsolutePath() ); if( dir.mkdirs() ) { - log( "Created " + dir.getAbsolutePath(), Project.MSG_INFO ); + getLogger().info( "Created " + dir.getAbsolutePath() ); } else { - log( "Failed to create " + dir.getAbsolutePath(), Project.MSG_INFO ); + getLogger().info( "Failed to create " + dir.getAbsolutePath() ); } } else { - log( dir.getAbsolutePath() + " exists. Skipping", Project.MSG_VERBOSE ); + getLogger().debug( dir.getAbsolutePath() + " exists. Skipping" ); } } else { - log( "File separator problem with " + line, - Project.MSG_WARN ); + final String message = "File separator problem with " + line; + getLogger().warn( message ); } } else { - log( "Skipped \"" + line + "\"", Project.MSG_VERBOSE ); + getLogger().debug( "Skipped \"" + line + "\"" ); } line = in.readLine(); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java index 979294698..52cf452cc 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java @@ -118,7 +118,7 @@ public class CovMerge extends Task final Execute exe = new Execute(); exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); exe.setError( new LogOutputStream( this, Project.MSG_WARN ) ); - log( cmdl.toString(), Project.MSG_VERBOSE ); + getLogger().debug( cmdl.toString() ); exe.setCommandline( cmdl.getCommandline() ); // JProbe process always return 0 so we will not be diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java index a9e0ed59c..5cd20189d 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java @@ -245,15 +245,15 @@ public class CovReport extends Task final Execute exe = new Execute(); exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); exe.setError( new LogOutputStream( this, Project.MSG_WARN ) ); - log( cmdl.toString(), Project.MSG_VERBOSE ); + getLogger().debug( cmdl.toString() ); exe.setCommandline( cmdl.getCommandline() ); int exitValue = exe.execute(); if( exitValue != 0 ) { throw new TaskException( "JProbe Coverage Report failed (" + exitValue + ")" ); } - log( "coveragePath: " + coveragePath, Project.MSG_VERBOSE ); - log( "format: " + format, Project.MSG_VERBOSE ); + getLogger().debug( "coveragePath: " + coveragePath ); + getLogger().debug( "format: " + format ); if( reference != null && "xml".equals( format ) ) { reference.createEnhancedXMLReport(); @@ -397,13 +397,13 @@ public class CovReport extends Task if( filters == null || filters.size() == 0 ) { createFilters(); - log( "Adding default include filter to *.*()", Project.MSG_VERBOSE ); + getLogger().debug( "Adding default include filter to *.*()" ); ReportFilters.Include include = new ReportFilters.Include(); filters.addInclude( include ); } try { - log( "Creating enhanced XML report", Project.MSG_VERBOSE ); + getLogger().debug( "Creating enhanced XML report" ); XMLReport report = new XMLReport( CovReport.this, tofile ); report.setReportFilters( filters ); report.setJProbehome( new File( home.getParent() ) ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java index 04ca6834d..85eddede3 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java @@ -296,7 +296,7 @@ public class Coverage extends Task // use the custom handler for stdin issues LogStreamHandler handler = new CoverageStreamHandler( this ); Execute exec = new Execute( handler ); - log( cmdl.toString(), Project.MSG_VERBOSE ); + getLogger().debug( cmdl.toString() ); exec.setCommandline( cmdl.getCommandline() ); int exitValue = exec.execute(); if( exitValue != 0 ) @@ -459,7 +459,7 @@ public class Coverage extends Task { //@todo change this when switching to JDK 1.2 and use File.createTmpFile() File file = createTmpFile(); - log( "Creating parameter file: " + file, Project.MSG_VERBOSE ); + getLogger().debug( "Creating parameter file: " + file ); // options need to be one per line in the parameter file // so write them all in a single string @@ -471,7 +471,7 @@ public class Coverage extends Task pw.println( params[ i ] ); } pw.flush(); - log( "JProbe Coverage parameters:\n" + sw.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "JProbe Coverage parameters:\n" + sw.toString() ); // now write them to the file FileWriter fw = null; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java index a186f7f7c..6bf76faf2 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java @@ -15,7 +15,6 @@ import java.util.Iterator; import java.util.NoSuchElementException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.optional.sitraka.bytecode.ClassFile; import org.apache.tools.ant.taskdefs.optional.sitraka.bytecode.ClassPathLoader; @@ -195,7 +194,7 @@ public class XMLReport } else { - task.log( message, Project.MSG_DEBUG ); + task.getLogger().debug( message ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java index 8577a6130..511be9409 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java @@ -203,7 +203,7 @@ public class AntSoundPlayer } catch( UnsupportedAudioFileException uafe ) { - project.log( "Audio format is not yet supported: " + uafe.getMessage(), Project.MSG_INFO ); + project.getLogger().info( "Audio format is not yet supported: " + uafe.getMessage() ); } catch( IOException ioe ) { @@ -223,7 +223,7 @@ public class AntSoundPlayer } catch( LineUnavailableException e ) { - project.log( "The sound device is currently unavailable", Project.MSG_INFO ); + project.getLogger().info( "The sound device is currently unavailable" ); return; } catch( IOException e ) @@ -244,7 +244,7 @@ public class AntSoundPlayer } else { - project.log( "Can't get data from file " + file.getName(), Project.MSG_INFO ); + project.getLogger().info( "Can't get data from file " + file.getName() ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java index 8707867d5..bd580f7f4 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java @@ -11,7 +11,6 @@ import java.io.File; import java.util.ArrayList; import java.util.Random; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; /** @@ -57,7 +56,7 @@ public class SoundTask extends Task if( success == null ) { - log( "No nested success element found.", Project.MSG_WARN ); + getLogger().warn( "No nested success element found." ); } else { @@ -67,7 +66,7 @@ public class SoundTask extends Task if( fail == null ) { - log( "No nested failure element found.", Project.MSG_WARN ); + getLogger().warn( "No nested failure element found." ); } else { @@ -177,7 +176,7 @@ public class SoundTask extends Task } else { - log( source + ": invalid path.", Project.MSG_WARN ); + getLogger().warn( source + ": invalid path." ); this.source = nofile; } return this.source; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java index 28157f005..bffb7c1b2 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java @@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs.rmic; import java.io.File; import java.util.ArrayList; import java.util.Random; +import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Rmic; @@ -28,7 +29,9 @@ import org.apache.tools.ant.util.FileNameMapper; * @author Stefan Bodewig * @author Takashi Okamoto */ -public abstract class DefaultRmicAdapter implements RmicAdapter +public abstract class DefaultRmicAdapter + extends AbstractLogEnabled + implements RmicAdapter { private final static Random rand = new Random(); @@ -145,12 +148,11 @@ public abstract class DefaultRmicAdapter implements RmicAdapter if( attributes.getIiop() ) { - attributes.log( "IIOP has been turned on.", Project.MSG_INFO ); + getLogger().info( "IIOP has been turned on." ); cmd.createArgument().setValue( "-iiop" ); if( attributes.getIiopopts() != null ) { - attributes.log( "IIOP Options: " + attributes.getIiopopts(), - Project.MSG_INFO ); + getLogger().info( "IIOP Options: " + attributes.getIiopopts() ); cmd.createArgument().setValue( attributes.getIiopopts() ); } } @@ -158,12 +160,11 @@ public abstract class DefaultRmicAdapter implements RmicAdapter if( attributes.getIdl() ) { cmd.createArgument().setValue( "-idl" ); - attributes.log( "IDL has been turned on.", Project.MSG_INFO ); + getLogger().info( "IDL has been turned on." ); if( attributes.getIdlopts() != null ) { cmd.createArgument().setValue( attributes.getIdlopts() ); - attributes.log( "IDL Options: " + attributes.getIdlopts(), - Project.MSG_INFO ); + getLogger().info( "IDL Options: " + attributes.getIdlopts() ); } } @@ -243,8 +244,7 @@ public abstract class DefaultRmicAdapter implements RmicAdapter { ArrayList compileList = attributes.getCompileList(); - attributes.log( "Compilation args: " + cmd.toString(), - Project.MSG_VERBOSE ); + getLogger().debug( "Compilation args: " + cmd.toString() ); StringBuffer niceSourceList = new StringBuffer( "File" ); if( compileList.size() != 1 ) @@ -260,7 +260,7 @@ public abstract class DefaultRmicAdapter implements RmicAdapter niceSourceList.append( " " + arg ); } - attributes.log( niceSourceList.toString(), Project.MSG_VERBOSE ); + getLogger().debug( niceSourceList.toString() ); } /** @@ -407,20 +407,22 @@ public abstract class DefaultRmicAdapter implements RmicAdapter } catch( ClassNotFoundException e ) { - attributes.log( "Unable to verify class " + classname - + ". It could not be found.", - Project.MSG_WARN ); + final String message = "Unable to verify class " + classname + + ". It could not be found."; + getLogger().warn( message ); } catch( NoClassDefFoundError e ) { - attributes.log( "Unable to verify class " + classname - + ". It is not defined.", Project.MSG_WARN ); + final String message = "Unable to verify class " + classname + + ". It is not defined."; + getLogger().warn( message ); } catch( Throwable t ) { - attributes.log( "Unable to verify class " + classname - + ". Loading caused Exception: " - + t.getMessage(), Project.MSG_WARN ); + final String message = "Unable to verify class " + classname + + ". Loading caused Exception: " + + t.getMessage(); + getLogger().warn( message ); } } return target; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java index 2c6675af4..d0a17986a 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs.rmic; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; /** @@ -24,7 +23,7 @@ public class KaffeRmic extends DefaultRmicAdapter public boolean execute() throws TaskException { - getRmic().log( "Using Kaffe rmic", Project.MSG_VERBOSE ); + getLogger().debug( "Using Kaffe rmic" ); Commandline cmd = setupRmicCommand(); try diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java index d1ec95895..b44dfc8c9 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java @@ -27,7 +27,7 @@ public class SunRmic extends DefaultRmicAdapter public boolean execute() throws TaskException { - getRmic().log( "Using SUN rmic compiler", Project.MSG_VERBOSE ); + getLogger().debug( "Using SUN rmic compiler" ); Commandline cmd = setupRmicCommand(); // Create an instance of the rmic, redirecting output to diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/WLRmic.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/WLRmic.java index a68ec2c4c..cea03e3bb 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/WLRmic.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/WLRmic.java @@ -9,7 +9,6 @@ package org.apache.tools.ant.taskdefs.rmic; import java.lang.reflect.Method; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; /** @@ -43,7 +42,7 @@ public class WLRmic extends DefaultRmicAdapter public boolean execute() throws TaskException { - getRmic().log( "Using WebLogic rmic", Project.MSG_VERBOSE ); + getLogger().debug( "Using WebLogic rmic" ); Commandline cmd = setupRmicCommand( new String[]{"-noexit"} ); try diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/FileSet.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/FileSet.java index b37d8cb33..b0bb0cd4e 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/FileSet.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/FileSet.java @@ -27,9 +27,10 @@ import org.apache.tools.ant.Project; * @author Stefan Bodewig * @author Magesh Umasankar */ -public class FileSet extends DataType implements Cloneable +public class FileSet + extends DataType + implements Cloneable { - private PatternSet defaultPatterns = new PatternSet(); private ArrayList additionalPatterns = new ArrayList(); private boolean useDefaultExcludes = true; @@ -199,8 +200,7 @@ public class FileSet extends DataType implements Cloneable defaultPatterns.append( (PatternSet)o, p ); } - p.log( "FileSet: Setup file scanner in dir " + dir + - " with " + defaultPatterns, p.MSG_DEBUG ); + getLogger().debug( "FileSet: Setup file scanner in dir " + dir + " with " + defaultPatterns ); ds.setIncludes( defaultPatterns.getIncludePatterns( p ) ); ds.setExcludes( defaultPatterns.getExcludePatterns( p ) ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSet.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSet.java index 2f1682e28..5f56de5ea 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSet.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSet.java @@ -16,7 +16,6 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.Properties; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; /** * A set of filters to be applied to something. A filter set may have begintoken @@ -266,7 +265,7 @@ public class FilterSet extends DataType implements Cloneable if( filtersFile.isFile() ) { - log( "Reading filters from " + filtersFile, Project.MSG_VERBOSE ); + getLogger().debug( "Reading filters from " + filtersFile ); FileInputStream in = null; try { @@ -343,7 +342,7 @@ public class FilterSet extends DataType implements Cloneable if( tokens.containsKey( token ) ) { value = (String)tokens.get( token ); - log( "Replacing: " + beginToken + token + endToken + " -> " + value, Project.MSG_VERBOSE ); + getLogger().debug( "Replacing: " + beginToken + token + endToken + " -> " + value ); b.append( value ); i = index + beginToken.length() + token.length() + endToken.length(); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/Path.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/Path.java index 078b7e290..1a0d6a603 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/Path.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/Path.java @@ -118,7 +118,7 @@ public class Path * @param source Description of Parameter * @return Description of the Returned Value */ - public static String[] translatePath( Project project, String source ) + public String[] translatePath( Project project, String source ) { final ArrayList result = new ArrayList(); if( source == null ) @@ -136,8 +136,7 @@ public class Path } catch( TaskException e ) { - project.log( "Dropping path element " + pathElement + " as it is not valid relative to the project", - Project.MSG_VERBOSE ); + getLogger().debug( "Dropping path element " + pathElement + " as it is not valid relative to the project" ); } for( int i = 0; i < element.length(); i++ ) { @@ -498,8 +497,8 @@ public class Path // last: don't trust the developer if( !order.equals( "last" ) ) { - log( "invalid value for build.sysclasspath: " + order, - Project.MSG_WARN ); + final String message = "invalid value for build.sysclasspath: " + order; + getLogger().warn( message ); } result.addExisting( this ); @@ -728,7 +727,7 @@ public class Path public void setPath( String path ) { - parts = Path.translatePath( getProject(), path ); + parts = translatePath( getProject(), path ); } public String[] getParts() diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/util/SourceFileScanner.java b/proposal/myrmidon/src/main/org/apache/tools/ant/util/SourceFileScanner.java index 0d85dbf72..9021dd2aa 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/util/SourceFileScanner.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/util/SourceFileScanner.java @@ -10,9 +10,9 @@ package org.apache.tools.ant.util; import java.io.File; import java.util.ArrayList; import org.apache.avalon.excalibur.io.FileUtil; +import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.framework.Os; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; /** @@ -26,6 +26,7 @@ import org.apache.tools.ant.Task; * @author Stefan Bodewig */ public class SourceFileScanner + extends AbstractLogEnabled { private Task m_task; @@ -77,8 +78,7 @@ public class SourceFileScanner String[] targets = mapper.mapFileName( files[ i ] ); if( targets == null || targets.length == 0 ) { - m_task.log( files[ i ] + " skipped - don\'t know how to handle it", - Project.MSG_VERBOSE ); + getLogger().debug( files[ i ] + " skipped - don\'t know how to handle it" ); continue; } @@ -86,8 +86,8 @@ public class SourceFileScanner if( src.lastModified() > now ) { - m_task.log( "Warning: " + files[ i ] + " modified in the future.", - Project.MSG_WARN ); + final String message = "Warning: " + files[ i ] + " modified in the future."; + getLogger().warn( message ); } boolean added = false; @@ -98,15 +98,13 @@ public class SourceFileScanner if( !dest.exists() ) { - m_task.log( files[ i ] + " added as " + dest.getAbsolutePath() + " doesn\'t exist.", - Project.MSG_VERBOSE ); + getLogger().debug( files[ i ] + " added as " + dest.getAbsolutePath() + " doesn\'t exist." ); v.add( files[ i ] ); added = true; } else if( src.lastModified() > dest.lastModified() ) { - m_task.log( files[ i ] + " added as " + dest.getAbsolutePath() + " is outdated.", - Project.MSG_VERBOSE ); + getLogger().debug( files[ i ] + " added as " + dest.getAbsolutePath() + " is outdated." ); v.add( files[ i ] ); added = true; } @@ -122,9 +120,7 @@ public class SourceFileScanner if( !added ) { - m_task.log( files[ i ] + " omitted as " + targetList.toString() - + ( targets.length == 1 ? " is" : " are " ) - + " up to date.", Project.MSG_VERBOSE ); + getLogger().debug( files[ i ] + " omitted as " + targetList.toString() + ( targets.length == 1 ? " is" : " are " ) + " up to date." ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/AntClassLoader.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/AntClassLoader.java index b839d74e9..88d5d4983 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/AntClassLoader.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/AntClassLoader.java @@ -23,6 +23,8 @@ import java.util.Iterator; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import org.apache.avalon.excalibur.io.FileUtil; +import org.apache.avalon.framework.logger.LogEnabled; +import org.apache.avalon.framework.logger.Logger; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.types.Path; @@ -38,7 +40,7 @@ import org.apache.tools.ant.types.Path; */ public class AntClassLoader extends ClassLoader - implements BuildListener + implements BuildListener, LogEnabled { /** * The size of buffers to be used in this classloader. @@ -50,6 +52,23 @@ public class AntClassLoader private static Method getContextClassLoader; private static Method setContextClassLoader; + private Logger m_logger; + + /** + * Provide component with a logger. + * + * @param logger the logger + */ + public void enableLogging( Logger logger ) + { + m_logger = logger; + } + + protected final Logger getLogger() + { + return m_logger; + } + /** * The components of the classpath that the classloader searches for classes */ @@ -336,7 +355,7 @@ public class AntClassLoader if( url == null ) { - log( "Couldn't load Resource " + name, Project.MSG_DEBUG ); + getLogger().debug( "Couldn't load Resource " + name ); } return url; @@ -477,7 +496,7 @@ public class AntClassLoader public Class findClass( String name ) throws ClassNotFoundException { - log( "Finding class " + name, Project.MSG_DEBUG ); + getLogger().debug( "Finding class " + name ); return findClassInComponents( name ); } @@ -495,7 +514,7 @@ public class AntClassLoader public Class forceLoadClass( String classname ) throws ClassNotFoundException { - log( "force loading " + classname, Project.MSG_DEBUG ); + getLogger().debug( "force loading " + classname ); Class theClass = findLoadedClass( classname ); @@ -521,7 +540,7 @@ public class AntClassLoader public Class forceLoadSystemClass( String classname ) throws ClassNotFoundException { - log( "force system loading " + classname, Project.MSG_DEBUG ); + getLogger().debug( "force system loading " + classname ); Class theClass = findLoadedClass( classname ); @@ -622,12 +641,12 @@ public class AntClassLoader try { theClass = findBaseClass( classname ); - log( "Class " + classname + " loaded from parent loader", Project.MSG_DEBUG ); + getLogger().debug( "Class " + classname + " loaded from parent loader" ); } catch( ClassNotFoundException cnfe ) { theClass = findClass( classname ); - log( "Class " + classname + " loaded from ant loader", Project.MSG_DEBUG ); + getLogger().debug( "Class " + classname + " loaded from ant loader" ); } } else @@ -635,7 +654,7 @@ public class AntClassLoader try { theClass = findClass( classname ); - log( "Class " + classname + " loaded from ant loader", Project.MSG_DEBUG ); + getLogger().debug( "Class " + classname + " loaded from ant loader" ); } catch( ClassNotFoundException cnfe ) { @@ -644,7 +663,7 @@ public class AntClassLoader throw cnfe; } theClass = findBaseClass( classname ); - log( "Class " + classname + " loaded from parent loader", Project.MSG_DEBUG ); + getLogger().debug( "Class " + classname + " loaded from parent loader" ); } } @@ -793,8 +812,7 @@ public class AntClassLoader } catch( Exception e ) { - log( "Ignoring Exception " + e.getClass().getName() + ": " + e.getMessage() + - " reading resource " + resourceName + " from " + file, Project.MSG_VERBOSE ); + getLogger().debug( "Ignoring Exception " + e.getClass().getName() + ": " + e.getMessage() + " reading resource " + resourceName + " from " + file ); } return null; @@ -948,7 +966,7 @@ public class AntClassLoader catch( IOException ioe ) { // ioe.printStackTrace(); - log( "Exception reading component " + pathComponent, Project.MSG_VERBOSE ); + getLogger().debug( "Exception reading component " + pathComponent ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/Project.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/Project.java index 6381a0420..d278cbad6 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/Project.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/Project.java @@ -12,6 +12,8 @@ import java.util.ArrayList; import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; +import org.apache.avalon.framework.logger.AbstractLogEnabled; +import org.apache.avalon.framework.logger.Logger; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.types.FilterSet; import org.apache.tools.ant.types.FilterSetCollection; @@ -28,6 +30,7 @@ import org.apache.tools.ant.types.FilterSetCollection; * @author duncan@x180.com */ public class Project + extends AbstractLogEnabled { public final static int MSG_ERR = 0; public final static int MSG_WARN = 1; @@ -106,6 +109,11 @@ public class Project } } + public Logger hackGetLogger() + { + return super.getLogger(); + } + /** * static query of the java version * @@ -183,9 +191,9 @@ public class Project throw new TaskException( "Ant cannot work on Java 1.0" ); } - log( "Detected Java version: " + javaVersion + " in: " + System.getProperty( "java.home" ), MSG_VERBOSE ); + getLogger().debug( "Detected Java version: " + javaVersion + " in: " + System.getProperty( "java.home" ) ); - log( "Detected OS: " + System.getProperty( "os.name" ), MSG_VERBOSE ); + getLogger().debug( "Detected OS: " + System.getProperty( "os.name" ) ); } /** @@ -373,7 +381,7 @@ public class Project String propertyName = (String)j.next(); if( !keys.containsKey( propertyName ) ) { - project.log( "Property ${" + propertyName + "} has not been set", Project.MSG_VERBOSE ); + project.getLogger().debug( "Property ${" + propertyName + "} has not been set" ); } fragment = ( keys.containsKey( propertyName ) ) ? (String)keys.get( propertyName ) : "${" + propertyName + "}"; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/ProjectComponent.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/ProjectComponent.java index 96121b2ed..3fab29ed8 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/ProjectComponent.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/ProjectComponent.java @@ -7,6 +7,7 @@ */ package org.apache.tools.ant; +import org.apache.avalon.framework.logger.Logger; import org.apache.myrmidon.api.AbstractTask; import org.apache.myrmidon.api.TaskException; @@ -20,7 +21,12 @@ import org.apache.myrmidon.api.TaskException; public abstract class ProjectComponent extends AbstractTask { - private Project project; + private Project m_project; + + public Logger hackGetLogger() + { + return super.getLogger(); + } /** * Sets the project object of this component. This method is used by project @@ -31,7 +37,7 @@ public abstract class ProjectComponent */ public void setProject( Project project ) { - this.project = project; + this.m_project = project; } /** @@ -41,7 +47,7 @@ public abstract class ProjectComponent */ public Project getProject() { - return project; + return m_project; } public void execute() diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/Task.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/Task.java index 79118546b..babf6db9e 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/Task.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/Task.java @@ -13,12 +13,12 @@ public abstract class Task { protected void handleErrorOutput( String line ) { - log( line, Project.MSG_ERR ); + getLogger().error( line ); } protected void handleOutput( String line ) { - log( line, Project.MSG_INFO ); + getLogger().info( line ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/TaskAdapter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/TaskAdapter.java index 73e379c1a..91151d8ba 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/TaskAdapter.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/TaskAdapter.java @@ -61,8 +61,8 @@ public class TaskAdapter extends Task } catch( Exception ex ) { - log( "Error setting project in " + proxy.getClass(), - Project.MSG_ERR ); + final String message = "Error setting project in " + proxy.getClass(); + getLogger().error( message, ex ); throw new TaskException( "Error", ex ); } @@ -73,7 +73,7 @@ public class TaskAdapter extends Task executeM = c.getMethod( "execute", new Class[ 0 ] ); if( executeM == null ) { - log( "No public execute() in " + proxy.getClass(), Project.MSG_ERR ); + getLogger().error( "No public execute() in " + proxy.getClass() ); throw new TaskException( "No public execute() in " + proxy.getClass() ); } executeM.invoke( proxy, null ); @@ -81,7 +81,7 @@ public class TaskAdapter extends Task } catch( Exception ex ) { - log( "Error in " + proxy.getClass(), Project.MSG_ERR ); + getLogger().error( "Error in " + proxy.getClass() ); throw new TaskException( "Error", ex ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Available.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Available.java index 18f6b2530..0c759289d 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Available.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Available.java @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs; import java.io.File; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.AntClassLoader; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.condition.Condition; import org.apache.tools.ant.types.EnumeratedAttribute; @@ -136,7 +135,7 @@ public class Available if( ( classname != null ) && !checkClass( classname ) ) { - log( "Unable to load class " + classname + " to set property " + property, Project.MSG_VERBOSE ); + getLogger().debug( "Unable to load class " + classname + " to set property " + property ); return false; } @@ -144,18 +143,18 @@ public class Available { if( type != null ) { - log( "Unable to find " + type + " " + file + " to set property " + property, Project.MSG_VERBOSE ); + getLogger().debug( "Unable to find " + type + " " + file + " to set property " + property ); } else { - log( "Unable to find " + file + " to set property " + property, Project.MSG_VERBOSE ); + getLogger().debug( "Unable to find " + file + " to set property " + property ); } return false; } if( ( resource != null ) && !checkResource( resource ) ) { - log( "Unable to load resource " + resource + " to set property " + property, Project.MSG_VERBOSE ); + getLogger().debug( "Unable to load resource " + resource + " to set property " + property ); return false; } @@ -232,7 +231,7 @@ public class Available String[] paths = filepath.list(); for( int i = 0; i < paths.length; ++i ) { - log( "Searching " + paths[ i ], Project.MSG_DEBUG ); + getLogger().debug( "Searching " + paths[ i ] ); /* * filepath can be a list of directory and/or * file names (gen'd via ) @@ -254,19 +253,19 @@ public class Available { if( type == null ) { - log( "Found: " + path, Project.MSG_VERBOSE ); + getLogger().debug( "Found: " + path ); return true; } else if( type.isDir() && path.isDirectory() ) { - log( "Found directory: " + path, Project.MSG_VERBOSE ); + getLogger().debug( "Found directory: " + path ); return true; } else if( type.isFile() && path.isFile() ) { - log( "Found file: " + path, Project.MSG_VERBOSE ); + getLogger().debug( "Found file: " + path ); return true; } // not the requested type @@ -280,12 +279,12 @@ public class Available { if( type == null ) { - log( "Found: " + parent, Project.MSG_VERBOSE ); + getLogger().debug( "Found: " + parent ); return true; } else if( type.isDir() ) { - log( "Found directory: " + parent, Project.MSG_VERBOSE ); + getLogger().debug( "Found directory: " + parent ); return true; } // not the requested type @@ -338,7 +337,7 @@ public class Available { if( f.isDirectory() ) { - log( "Found directory: " + text, Project.MSG_VERBOSE ); + getLogger().debug( "Found directory: " + text ); } return f.isDirectory(); } @@ -346,14 +345,14 @@ public class Available { if( f.isFile() ) { - log( "Found file: " + text, Project.MSG_VERBOSE ); + getLogger().debug( "Found file: " + text ); } return f.isFile(); } } if( f.exists() ) { - log( "Found: " + text, Project.MSG_VERBOSE ); + getLogger().debug( "Found: " + text ); } return f.exists(); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Checksum.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Checksum.java index 821e2fedc..412ee5b72 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Checksum.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Checksum.java @@ -22,7 +22,6 @@ import java.util.Enumeration; import java.util.Hashtable; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.condition.Condition; import org.apache.tools.ant.types.FileSet; @@ -215,8 +214,7 @@ public class Checksum extends MatchingTask implements Condition } else { - log( file + " omitted as " + dest + " is up to date.", - Project.MSG_VERBOSE ); + getLogger().debug( file + " omitted as " + dest + " is up to date." ); } } else diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/DependSet.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/DependSet.java index cb85d81ed..d0c522617 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/DependSet.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/DependSet.java @@ -14,7 +14,6 @@ import java.util.Iterator; import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.framework.Os; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.FileList; import org.apache.tools.ant.types.FileSet; @@ -166,8 +165,7 @@ public class DependSet extends MatchingTask if( dest.lastModified() > now ) { - log( "Warning: " + targetFiles[ i ] + " modified in the future.", - Project.MSG_WARN ); + getLogger().warn( "Warning: " + targetFiles[ i ] + " modified in the future." ); } } } @@ -189,7 +187,7 @@ public class DependSet extends MatchingTask File dest = new File( targetFL.getDir( getProject() ), targetFiles[ i ] ); if( !dest.exists() ) { - log( targetFiles[ i ] + " does not exist.", Project.MSG_VERBOSE ); + getLogger().debug( targetFiles[ i ] + " does not exist." ); upToDate = false; continue; } @@ -199,8 +197,7 @@ public class DependSet extends MatchingTask } if( dest.lastModified() > now ) { - log( "Warning: " + targetFiles[ i ] + " modified in the future.", - Project.MSG_WARN ); + getLogger().warn( "Warning: " + targetFiles[ i ] + " modified in the future." ); } } } @@ -224,8 +221,7 @@ public class DependSet extends MatchingTask if( src.lastModified() > now ) { - log( "Warning: " + sourceFiles[ i ] + " modified in the future.", - Project.MSG_WARN ); + getLogger().warn( "Warning: " + sourceFiles[ i ] + " modified in the future." ); } Iterator enumTargets = allTargets.iterator(); @@ -235,8 +231,7 @@ public class DependSet extends MatchingTask File dest = (File)enumTargets.next(); if( src.lastModified() > dest.lastModified() ) { - log( dest.getPath() + " is out of date with respect to " + - sourceFiles[ i ], Project.MSG_VERBOSE ); + getLogger().debug( dest.getPath() + " is out of date with respect to " + sourceFiles[ i ] ); upToDate = false; } @@ -264,13 +259,12 @@ public class DependSet extends MatchingTask if( src.lastModified() > now ) { - log( "Warning: " + sourceFiles[ i ] + " modified in the future.", - Project.MSG_WARN ); + getLogger().warn( "Warning: " + sourceFiles[ i ] + " modified in the future." ); } if( !src.exists() ) { - log( sourceFiles[ i ] + " does not exist.", Project.MSG_VERBOSE ); + getLogger().debug( sourceFiles[ i ] + " does not exist." ); upToDate = false; break; } @@ -283,8 +277,7 @@ public class DependSet extends MatchingTask if( src.lastModified() > dest.lastModified() ) { - log( dest.getPath() + " is out of date with respect to " + - sourceFiles[ i ], Project.MSG_VERBOSE ); + getLogger().debug( dest.getPath() + " is out of date with respect to " + sourceFiles[ i ] ); upToDate = false; } @@ -295,11 +288,11 @@ public class DependSet extends MatchingTask if( !upToDate ) { - log( "Deleting all target files. ", Project.MSG_VERBOSE ); + getLogger().debug( "Deleting all target files. " ); for( Iterator e = allTargets.iterator(); e.hasNext(); ) { File fileToRemove = (File)e.next(); - log( "Deleting file " + fileToRemove.getAbsolutePath(), Project.MSG_VERBOSE ); + getLogger().debug( "Deleting file " + fileToRemove.getAbsolutePath() ); fileToRemove.delete(); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Ear.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Ear.java index e4c4569db..6ccc25405 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Ear.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Ear.java @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs; import java.io.File; import java.io.IOException; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.ZipFileSet; import org.apache.tools.zip.ZipOutputStream; @@ -52,7 +51,7 @@ public class Ear extends Jar { // We just set the prefix for this fileset, and pass it up. // Do we need to do this? LH - log( "addArchives called", Project.MSG_DEBUG ); + getLogger().debug( "addArchives called" ); fs.setPrefix( "/" ); super.addFileset( fs ); } @@ -90,8 +89,10 @@ public class Ear extends Jar { if( deploymentDescriptor == null || !deploymentDescriptor.equals( file ) || descriptorAdded ) { - log( "Warning: selected " + archiveType + " files include a META-INF/application.xml which will be ignored " + - "(please use appxml attribute to " + archiveType + " task)", Project.MSG_WARN ); + final String message = "Warning: selected " + archiveType + + " files include a META-INF/application.xml which will be ignored " + + "(please use appxml attribute to " + archiveType + " task)"; + getLogger().warn( message ); } else { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecuteOn.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecuteOn.java index 235bc4e8c..b6282598f 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecuteOn.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecuteOn.java @@ -13,7 +13,6 @@ import java.util.ArrayList; import java.util.Hashtable; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.exec.ExecTask; import org.apache.tools.ant.taskdefs.exec.Execute; import org.apache.tools.ant.types.Commandline; @@ -412,8 +411,7 @@ public class ExecuteOn extends ExecTask if( fileNames.size() == 0 && skipEmpty ) { - log( "Skipping fileset for directory " - + base + ". It is empty.", Project.MSG_INFO ); + getLogger().info( "Skipping fileset for directory " + base + ". It is empty." ); continue; } @@ -424,8 +422,7 @@ public class ExecuteOn extends ExecTask for( int j = 0; j < s.length; j++ ) { String[] command = getCommandline( s[ j ], base ); - log( "Executing " + Commandline.toString( command ), - Project.MSG_VERBOSE ); + getLogger().debug( "Executing " + Commandline.toString( command ) ); exe.setCommandline( command ); runExecute( exe ); } @@ -441,8 +438,7 @@ public class ExecuteOn extends ExecTask File[] b = new File[ baseDirs.size() ]; b = (File[])baseDirs.toArray( b ); String[] command = getCommandline( s, b ); - log( "Executing " + Commandline.toString( command ), - Project.MSG_VERBOSE ); + getLogger().debug( "Executing " + Commandline.toString( command ) ); exe.setCommandline( command ); runExecute( exe ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Expand.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Expand.java index 1d9c776b3..3d4146e0d 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Expand.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Expand.java @@ -20,7 +20,6 @@ import java.util.zip.ZipInputStream; import org.apache.avalon.excalibur.io.FileUtil; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.PatternSet; @@ -166,7 +165,7 @@ public class Expand extends MatchingTask ze.isDirectory() ); } - log( "expand complete", Project.MSG_VERBOSE ); + getLogger().debug( "expand complete" ); } catch( IOException ioe ) { @@ -241,13 +240,11 @@ public class Expand extends MatchingTask if( !overwrite && f.exists() && f.lastModified() >= entryDate.getTime() ) { - log( "Skipping " + f + " as it is up-to-date", - Project.MSG_DEBUG ); + getLogger().debug( "Skipping " + f + " as it is up-to-date" ); return; } - log( "expanding " + entryName + " to " + f, - Project.MSG_VERBOSE ); + getLogger().debug( "expanding " + entryName + " to " + f ); // create intermediary directories - sometimes zip don't add them File dirF = f.getParentFile(); dirF.mkdirs(); @@ -293,7 +290,7 @@ public class Expand extends MatchingTask } catch( FileNotFoundException ex ) { - log( "Unable to expand to file " + f.getPath(), Project.MSG_WARN ); + getLogger().warn( "Unable to expand to file " + f.getPath() ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Filter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Filter.java index a192f7ff6..68edf3845 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Filter.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Filter.java @@ -9,7 +9,6 @@ package org.apache.tools.ant.taskdefs; import java.io.File; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; /** @@ -69,7 +68,7 @@ public class Filter extends Task protected void readFilters() throws TaskException { - log( "Reading filters from " + filtersFile, Project.MSG_VERBOSE ); + getLogger().debug( "Reading filters from " + filtersFile ); getProject().getGlobalFilterSet().readFiltersFromFile( filtersFile ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/FixCRLF.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/FixCRLF.java index 55815bcd4..af7582581 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/FixCRLF.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/FixCRLF.java @@ -23,7 +23,6 @@ import java.util.Iterator; import java.util.NoSuchElementException; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.util.FileUtils; @@ -321,14 +320,13 @@ public class FixCRLF extends MatchingTask } // log options used - log( "options:" + - " eol=" + - ( eol == ASIS ? "asis" : eol == CR ? "cr" : eol == LF ? "lf" : "crlf" ) + - " tab=" + ( tabs == TABS ? "add" : tabs == ASIS ? "asis" : "remove" ) + - " eof=" + ( ctrlz == ADD ? "add" : ctrlz == ASIS ? "asis" : "remove" ) + - " tablength=" + tablength + - " encoding=" + ( encoding == null ? "default" : encoding ), - Project.MSG_VERBOSE ); + getLogger().debug( "options:" + + " eol=" + + ( eol == ASIS ? "asis" : eol == CR ? "cr" : eol == LF ? "lf" : "crlf" ) + + " tab=" + ( tabs == TABS ? "add" : tabs == ASIS ? "asis" : "remove" ) + + " eof=" + ( ctrlz == ADD ? "add" : ctrlz == ASIS ? "asis" : "remove" ) + + " tablength=" + tablength + + " encoding=" + ( encoding == null ? "default" : encoding ) ); DirectoryScanner ds = super.getDirectoryScanner( srcDir ); String[] files = ds.getIncludedFiles(); @@ -758,10 +756,10 @@ public class FixCRLF extends MatchingTask if( destFile.exists() ) { // Compare the destination with the temp file - log( "destFile exists", Project.MSG_DEBUG ); + getLogger().debug( "destFile exists" ); if( !FileUtils.contentEquals( destFile, tmpFile ) ) { - log( destFile + " is being written", Project.MSG_DEBUG ); + getLogger().debug( destFile + " is being written" ); if( !destFile.delete() ) { throw new TaskException( "Unable to delete " @@ -779,9 +777,7 @@ public class FixCRLF extends MatchingTask } else {// destination is equal to temp file - log( destFile + - " is not written, as the contents are identical", - Project.MSG_DEBUG ); + getLogger().debug( destFile + " is not written, as the contents are identical" ); if( !tmpFile.delete() ) { throw new TaskException( "Unable to delete " @@ -791,7 +787,8 @@ public class FixCRLF extends MatchingTask } else {// destFile does not exist - write the temp file - log( "destFile does not exist", Project.MSG_DEBUG ); + ///XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + getLogger().debug( "destFile does not exist" ); if( !tmpFile.renameTo( destFile ) ) { throw new TaskException( @@ -820,7 +817,7 @@ public class FixCRLF extends MatchingTask } catch( IOException io ) { - log( "Error closing " + srcFile, Project.MSG_ERR ); + getLogger().error( "Error closing " + srcFile ); }// end of catch if( tmpFile != null ) diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Input.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Input.java index 927b37f93..1685549df 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Input.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Input.java @@ -13,7 +13,6 @@ import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; /** @@ -110,7 +109,7 @@ public class Input extends Task accept.add( stok.nextToken() ); } } - log( message, Project.MSG_WARN ); + getLogger().warn( message ); if( input == null ) { try @@ -121,7 +120,7 @@ public class Input extends Task { while( !accept.contains( input ) ) { - log( message, Project.MSG_WARN ); + getLogger().warn( message ); input = in.readLine(); } } @@ -149,7 +148,7 @@ public class Input extends Task } else { - log( "Override ignored for " + addproperty, Project.MSG_VERBOSE ); + getLogger().debug( "Override ignored for " + addproperty ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Jar.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Jar.java index c4c5b096c..96463c325 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Jar.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Jar.java @@ -21,7 +21,6 @@ import java.util.Enumeration; import java.util.Iterator; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.FileScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.ZipFileSet; import org.apache.tools.zip.ZipOutputStream; @@ -96,7 +95,7 @@ public class Jar extends Zip } catch( ManifestException e ) { - log( "Manifest is invalid: " + e.getMessage(), Project.MSG_ERR ); + getLogger().error( "Manifest is invalid: " + e.getMessage() ); throw new TaskException( "Invalid Manifest: " + manifestFile, e ); } catch( IOException e ) @@ -121,8 +120,8 @@ public class Jar extends Zip public void setWhenempty( WhenEmpty we ) { - log( "JARs are never empty, they contain at least a manifest file", - Project.MSG_WARN ); + final String message = "JARs are never empty, they contain at least a manifest file"; + getLogger().warn( message ); } public void addConfiguredManifest( Manifest newManifest ) @@ -165,7 +164,7 @@ public class Jar extends Zip java.util.zip.ZipEntry entry = theZipFile.getEntry( "META-INF/MANIFEST.MF" ); if( entry == null ) { - log( "Updating jar since the current jar has no manifest", Project.MSG_VERBOSE ); + getLogger().debug( "Updating jar since the current jar has no manifest" ); return false; } Manifest currentManifest = new Manifest( new InputStreamReader( theZipFile.getInputStream( entry ) ) ); @@ -175,15 +174,14 @@ public class Jar extends Zip } if( !currentManifest.equals( manifest ) ) { - log( "Updating jar since jar manifest has changed", Project.MSG_VERBOSE ); + getLogger().debug( "Updating jar since jar manifest has changed" ); return false; } } catch( Exception e ) { // any problems and we will rebuild - log( "Updating jar since cannot read current jar manifest: " + e.getClass().getName() + e.getMessage(), - Project.MSG_VERBOSE ); + getLogger().debug( "Updating jar since cannot read current jar manifest: " + e.getClass().getName() + e.getMessage() ); return false; } finally @@ -245,7 +243,7 @@ public class Jar extends Zip } for( Iterator e = execManifest.getWarnings(); e.hasNext(); ) { - log( "Manifest warning: " + (String)e.next(), Project.MSG_WARN ); + getLogger().warn( "Manifest warning: " + (String)e.next() ); } zipDir( null, zOut, "META-INF/" ); @@ -261,7 +259,7 @@ public class Jar extends Zip } catch( ManifestException e ) { - log( "Manifest is invalid: " + e.getMessage(), Project.MSG_ERR ); + getLogger().error( "Manifest is invalid: " + e.getMessage() ); throw new TaskException( "Invalid Manifest", e ); } } @@ -275,8 +273,10 @@ public class Jar extends Zip // a element. if( vPath.equalsIgnoreCase( "META-INF/MANIFEST.MF" ) ) { - log( "Warning: selected " + archiveType + " files include a META-INF/MANIFEST.MF which will be ignored " + - "(please use manifest attribute to " + archiveType + " task)", Project.MSG_WARN ); + final String message = "Warning: selected " + archiveType + + " files include a META-INF/MANIFEST.MF which will be ignored " + + "(please use manifest attribute to " + archiveType + " task)"; + getLogger().warn( message ); } else { @@ -388,7 +388,7 @@ public class Jar extends Zip } catch( ManifestException e ) { - log( "Manifest is invalid: " + e.getMessage(), Project.MSG_ERR ); + getLogger().error( "Manifest is invalid: " + e.getMessage() ); throw new TaskException( "Invalid Manifest", e ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java index ba7258f53..7b47a45b8 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java @@ -226,7 +226,7 @@ public class Java extends Task } else { - log( "Java Result: " + err, Project.MSG_ERR ); + getLogger().error( "Java Result: " + err ); } } } @@ -253,7 +253,7 @@ public class Java extends Task if( fork ) { - log( "Forking " + cmdl.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "Forking " + cmdl.toString() ); return run( cmdl.getCommandline() ); } @@ -261,15 +261,14 @@ public class Java extends Task { if( cmdl.getVmCommand().size() > 1 ) { - log( "JVM args ignored when same JVM is used.", Project.MSG_WARN ); + getLogger().warn( "JVM args ignored when same JVM is used." ); } if( dir != null ) { - log( "Working directory ignored when same JVM is used.", Project.MSG_WARN ); + getLogger().warn( "Working directory ignored when same JVM is used." ); } - log( "Running in same VM " + cmdl.getJavaCommand().toString(), - Project.MSG_VERBOSE ); + getLogger().debug( "Running in same VM " + cmdl.getJavaCommand().toString() ); run( cmdl ); return 0; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Javac.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Javac.java index 78a3c117c..025a2eadb 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Javac.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Javac.java @@ -772,11 +772,11 @@ public class Javac extends MatchingTask { CompilerAdapter adapter = CompilerAdapterFactory.getCompiler( - compiler, this ); - getLogger().info( "Compiling " + compileList.length + - " source file" - + ( compileList.length == 1 ? "" : "s" ) - + ( destDir != null ? " to " + destDir : "" ) ); + compiler, getLogger() ); + final String message = "Compiling " + compileList.length + " source file" + + ( compileList.length == 1 ? "" : "s" ) + + ( destDir != null ? " to " + destDir : "" ); + getLogger().info( message ); // now we need to populate the compiler adapter adapter.setJavac( this ); @@ -790,7 +790,7 @@ public class Javac extends MatchingTask } else { - log( FAIL_MSG, Project.MSG_ERR ); + getLogger().error( FAIL_MSG ); } } } @@ -877,13 +877,13 @@ public class Javac extends MatchingTask { if( isJdkCompiler( compiler ) ) { - log( "Since fork is true, ignoring build.compiler setting.", - Project.MSG_WARN ); + final String message = "Since fork is true, ignoring build.compiler setting."; + getLogger().warn( message ); compiler = "extJavac"; } else { - log( "Since build.compiler setting isn't classic or modern, ignoring fork setting.", Project.MSG_WARN ); + getLogger().warn( "Since build.compiler setting isn't classic or modern, ignoring fork setting." ); } } else diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/PathConvert.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/PathConvert.java index 8abfa9fce..9c3cf9758 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/PathConvert.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/PathConvert.java @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs; import java.io.File; import java.util.ArrayList; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Path; @@ -224,7 +223,7 @@ public class PathConvert extends Task // Place the result into the specified property String value = rslt.toString(); - log( "Set property " + property + " = " + value, Project.MSG_VERBOSE ); + getLogger().debug( "Set property " + property + " = " + value ); setProperty( property, value ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Property.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Property.java index 4f9417204..58f74c258 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Property.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Property.java @@ -18,7 +18,6 @@ import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.framework.exec.Environment; import org.apache.myrmidon.framework.exec.ExecException; import org.apache.tools.ant.AntClassLoader; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Reference; @@ -214,7 +213,7 @@ public class Property extends Task if( !prefix.endsWith( "." ) ) prefix += "."; - log( "Loading EnvironmentData " + prefix, Project.MSG_VERBOSE ); + getLogger().debug( "Loading EnvironmentData " + prefix ); try { final Properties environment = Environment.getNativeEnvironment(); @@ -225,7 +224,7 @@ public class Property extends Task if( value.equals( "" ) ) { - log( "Ignoring: " + key, Project.MSG_WARN ); + getLogger().warn( "Ignoring: " + key ); } else { @@ -249,7 +248,7 @@ public class Property extends Task throws TaskException { Properties props = new Properties(); - log( "Loading " + file.getAbsolutePath(), Project.MSG_VERBOSE ); + getLogger().debug( "Loading " + file.getAbsolutePath() ); try { if( file.exists() ) @@ -270,8 +269,7 @@ public class Property extends Task } else { - log( "Unable to find property file: " + file.getAbsolutePath(), - Project.MSG_VERBOSE ); + getLogger().debug( "Unable to find property file: " + file.getAbsolutePath() ); } } catch( IOException ex ) @@ -284,7 +282,7 @@ public class Property extends Task throws TaskException { Properties props = new Properties(); - log( "Resource Loading " + name, Project.MSG_VERBOSE ); + getLogger().debug( "Resource Loading " + name ); try { ClassLoader cL = null; @@ -315,7 +313,7 @@ public class Property extends Task } else { - log( "Unable to find resource " + name, Project.MSG_WARN ); + getLogger().warn( "Unable to find resource " + name ); } } catch( IOException ex ) diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/RecorderEntry.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/RecorderEntry.java index 3e14f9d02..1fd7cf65e 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/RecorderEntry.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/RecorderEntry.java @@ -8,6 +8,7 @@ package org.apache.tools.ant.taskdefs; import java.io.PrintStream; +import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.tools.ant.BuildEvent; import org.apache.tools.ant.BuildLogger; import org.apache.tools.ant.Project; @@ -19,7 +20,9 @@ import org.apache.tools.ant.Project; * @author J D Glanville * @version 0.5 */ -public class RecorderEntry implements BuildLogger +public class RecorderEntry + extends AbstractLogEnabled + implements BuildLogger { /** * the line separator for this OS @@ -126,7 +129,7 @@ public class RecorderEntry implements BuildLogger public void buildFinished( BuildEvent event ) { - log( "< BUILD FINISHED", Project.MSG_DEBUG ); + getLogger().debug( "< BUILD FINISHED" ); Throwable error = event.getException(); if( error == null ) @@ -144,12 +147,12 @@ public class RecorderEntry implements BuildLogger public void buildStarted( BuildEvent event ) { - log( "> BUILD STARTED", Project.MSG_DEBUG ); + getLogger().debug( "> BUILD STARTED" ); } public void messageLogged( BuildEvent event ) { - log( "--- MESSAGE LOGGED", Project.MSG_DEBUG ); + getLogger().debug( "--- MESSAGE LOGGED" ); StringBuffer buf = new StringBuffer(); if( event.getTask() != null ) @@ -171,28 +174,28 @@ public class RecorderEntry implements BuildLogger public void targetFinished( BuildEvent event ) { - log( "<< TARGET FINISHED -- " + event.getTarget(), Project.MSG_DEBUG ); + getLogger().debug( "<< TARGET FINISHED -- " + event.getTarget() ); String time = formatTime( System.currentTimeMillis() - targetStartTime ); - log( event.getTarget() + ": duration " + time, Project.MSG_VERBOSE ); + getLogger().debug( event.getTarget() + ": duration " + time ); out.flush(); } public void targetStarted( BuildEvent event ) { - log( ">> TARGET STARTED -- " + event.getTarget(), Project.MSG_DEBUG ); - log( LINE_SEP + event.getTarget().getName() + ":", Project.MSG_INFO ); + getLogger().debug( ">> TARGET STARTED -- " + event.getTarget() ); + getLogger().info( LINE_SEP + event.getTarget().getName() + ":" ); targetStartTime = System.currentTimeMillis(); } public void taskFinished( BuildEvent event ) { - log( "<<< TASK FINISHED -- " + event.getTask(), Project.MSG_DEBUG ); + getLogger().debug( "<<< TASK FINISHED -- " + event.getTask() ); out.flush(); } public void taskStarted( BuildEvent event ) { - log( ">>> TASK STARTED -- " + event.getTask(), Project.MSG_DEBUG ); + getLogger().debug( ">>> TASK STARTED -- " + event.getTask() ); } /** diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Replace.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Replace.java index ccdd0e06e..bad4fa8f5 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Replace.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Replace.java @@ -24,7 +24,6 @@ import java.util.ArrayList; import java.util.Properties; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; /** * Replaces all occurrences of one or more string tokens with given values in @@ -225,7 +224,7 @@ public class Replace extends MatchingTask if( summary ) { - log( "Replaced " + replaceCount + " occurrences in " + fileCount + " files.", Project.MSG_INFO ); + getLogger().info( "Replaced " + replaceCount + " occurrences in " + fileCount + " files." ); } } @@ -350,7 +349,7 @@ public class Replace extends MatchingTask String tok = stringReplace( token.getText(), "\n", linesep ); // for each found token, replace with value - log( "Replacing in " + src.getPath() + ": " + token.getText() + " --> " + value.getText(), Project.MSG_VERBOSE ); + getLogger().debug( "Replacing in " + src.getPath() + ": " + token.getText() + " --> " + value.getText() ); newString = stringReplace( newString, tok, val ); } @@ -426,7 +425,7 @@ public class Replace extends MatchingTask Replacefilter filter = (Replacefilter)replacefilters.get( i ); //for each found token, replace with value - log( "Replacing in " + filename + ": " + filter.getToken() + " --> " + filter.getReplaceValue(), Project.MSG_VERBOSE ); + getLogger().debug( "Replacing in " + filename + ": " + filter.getToken() + " --> " + filter.getReplaceValue() ); newString = stringReplace( newString, filter.getToken(), filter.getReplaceValue() ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Rmic.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Rmic.java index 8fb94c6b8..5ec4fd0b7 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Rmic.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Rmic.java @@ -15,7 +15,6 @@ import org.apache.avalon.excalibur.io.FileUtil; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.AntClassLoader; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.rmic.RmicAdapter; import org.apache.tools.ant.taskdefs.rmic.RmicAdapterFactory; import org.apache.tools.ant.types.FilterSetCollection; @@ -474,19 +473,22 @@ public class Rmic extends MatchingTask } catch( ClassNotFoundException e ) { - log( "Unable to verify class " + classname + - ". It could not be found.", Project.MSG_WARN ); + final String message = "Unable to verify class " + classname + + ". It could not be found."; + getLogger().warn( message ); } catch( NoClassDefFoundError e ) { - log( "Unable to verify class " + classname + - ". It is not defined.", Project.MSG_WARN ); + final String message = "Unable to verify class " + classname + + ". It is not defined."; + getLogger().warn( message ); } catch( Throwable t ) { - log( "Unable to verify class " + classname + - ". Loading caused Exception: " + - t.getMessage(), Project.MSG_WARN ); + final String message = "Unable to verify class " + classname + + ". Loading caused Exception: " + + t.getMessage(); + getLogger().warn( message ); } // we only get here if an exception has been thrown return false; @@ -536,7 +538,7 @@ public class Rmic extends MatchingTask if( verify ) { - log( "Verify has been turned on.", Project.MSG_INFO ); + getLogger().info( "Verify has been turned on." ); } String compiler = getProject().getProperty( "build.rmic" ); @@ -567,9 +569,7 @@ public class Rmic extends MatchingTask int fileCount = compileList.size(); if( fileCount > 0 ) { - log( "RMI Compiling " + fileCount + - " class" + ( fileCount > 1 ? "es" : "" ) + " to " + baseDir, - Project.MSG_INFO ); + getLogger().info( "RMI Compiling " + fileCount + " class" + ( fileCount > 1 ? "es" : "" ) + " to " + baseDir ); // finally, lets execute the compiler!! if( !adapter.execute() ) @@ -587,9 +587,8 @@ public class Rmic extends MatchingTask { if( idl ) { - log( "Cannot determine sourcefiles in idl mode, ", - Project.MSG_WARN ); - log( "sourcebase attribute will be ignored.", Project.MSG_WARN ); + getLogger().warn( "Cannot determine sourcefiles in idl mode, " ); + getLogger().warn( "sourcebase attribute will be ignored." ); } else { @@ -620,14 +619,12 @@ public class Rmic extends MatchingTask String[] newFiles = files; if( idl ) { - log( "will leave uptodate test to rmic implementation in idl mode.", - Project.MSG_VERBOSE ); + getLogger().debug( "will leave uptodate test to rmic implementation in idl mode." ); } else if( iiop && iiopopts != null && iiopopts.indexOf( "-always" ) > -1 ) { - log( "no uptodate test as -always option has been specified", - Project.MSG_VERBOSE ); + getLogger().debug( "no uptodate test as -always option has been specified" ); } else { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SQLExec.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SQLExec.java index 6644e3dfa..a667f18de 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SQLExec.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SQLExec.java @@ -33,7 +33,6 @@ import java.util.StringTokenizer; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.AntClassLoader; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.FileSet; @@ -456,15 +455,14 @@ public class SQLExec extends Task Class dc; if( classpath != null ) { - log( "Loading " + driver + " using AntClassLoader with classpath " + classpath, - Project.MSG_VERBOSE ); + getLogger().debug( "Loading " + driver + " using AntClassLoader with classpath " + classpath ); loader = new AntClassLoader( getProject(), classpath ); dc = loader.loadClass( driver ); } else { - log( "Loading " + driver + " using system loader.", Project.MSG_VERBOSE ); + getLogger().debug( "Loading " + driver + " using system loader." ); dc = Class.forName( driver ); } driverInstance = (Driver)dc.newInstance(); @@ -484,7 +482,7 @@ public class SQLExec extends Task try { - log( "connecting to " + url, Project.MSG_VERBOSE ); + getLogger().debug( "connecting to " + url ); Properties info = new Properties(); info.put( "user", userId ); info.put( "password", password ); @@ -508,7 +506,7 @@ public class SQLExec extends Task { if( output != null ) { - log( "Opening PrintStream to output file " + output, Project.MSG_VERBOSE ); + getLogger().debug( "Opening PrintStream to output file " + output ); out = new PrintStream( new BufferedOutputStream( new FileOutputStream( output ) ) ); } @@ -520,7 +518,7 @@ public class SQLExec extends Task ( (Transaction)e.next() ).runTransaction( out ); if( !autocommit ) { - log( "Commiting transaction", Project.MSG_VERBOSE ); + getLogger().debug( "Commiting transaction" ); conn.commit(); } } @@ -602,10 +600,10 @@ public class SQLExec extends Task { String theVendor = dmd.getDatabaseProductName().toLowerCase(); - log( "RDBMS = " + theVendor, Project.MSG_VERBOSE ); + getLogger().debug( "RDBMS = " + theVendor ); if( theVendor == null || theVendor.indexOf( rdbms ) < 0 ) { - log( "Not the required RDBMS: " + rdbms, Project.MSG_VERBOSE ); + getLogger().debug( "Not the required RDBMS: " + rdbms ); return false; } } @@ -614,12 +612,12 @@ public class SQLExec extends Task { String theVersion = dmd.getDatabaseProductVersion().toLowerCase(); - log( "Version = " + theVersion, Project.MSG_VERBOSE ); + getLogger().debug( "Version = " + theVersion ); if( theVersion == null || !( theVersion.startsWith( version ) || theVersion.indexOf( " " + version ) >= 0 ) ) { - log( "Not the required version: \"" + version + "\"", Project.MSG_VERBOSE ); + getLogger().debug( "Not the required version: \"" + version + "\"" ); return false; } } @@ -627,7 +625,7 @@ public class SQLExec extends Task catch( SQLException e ) { // Could not get the required information - log( "Failed to obtain required RDBMS information", Project.MSG_ERR ); + getLogger().error( "Failed to obtain required RDBMS information" ); return false; } @@ -653,8 +651,7 @@ public class SQLExec extends Task totalSql++; if( !statement.execute( sql ) ) { - log( statement.getUpdateCount() + " rows affected", - Project.MSG_VERBOSE ); + getLogger().debug( statement.getUpdateCount() + " rows affected" ); } else { @@ -667,7 +664,7 @@ public class SQLExec extends Task SQLWarning warning = conn.getWarnings(); while( warning != null ) { - log( warning + " sql warning", Project.MSG_VERBOSE ); + getLogger().debug( warning + " sql warning" ); warning = warning.getNextWarning(); } conn.clearWarnings(); @@ -675,10 +672,10 @@ public class SQLExec extends Task } catch( SQLException e ) { - log( "Failed to execute: " + sql, Project.MSG_ERR ); + getLogger().error( "Failed to execute: " + sql ); if( !onError.equals( "continue" ) ) throw e; - log( e.toString(), Project.MSG_ERR ); + getLogger().error( e.toString() ); } } @@ -697,7 +694,7 @@ public class SQLExec extends Task rs = statement.getResultSet(); if( rs != null ) { - log( "Processing new result set.", Project.MSG_VERBOSE ); + getLogger().debug( "Processing new result set." ); ResultSetMetaData md = rs.getMetaData(); int columnCount = md.getColumnCount(); StringBuffer line = new StringBuffer(); @@ -781,7 +778,7 @@ public class SQLExec extends Task if( delimiterType.equals( DelimiterType.NORMAL ) && sql.endsWith( delimiter ) || delimiterType.equals( DelimiterType.ROW ) && line.equals( delimiter ) ) { - log( "SQL: " + sql, Project.MSG_VERBOSE ); + getLogger().debug( "SQL: " + sql ); execSQL( sql.substring( 0, sql.length() - delimiter.length() ), out ); sql = ""; } @@ -852,14 +849,13 @@ public class SQLExec extends Task { if( tSqlCommand.length() != 0 ) { - log( "Executing commands", Project.MSG_INFO ); + getLogger().info( "Executing commands" ); runStatements( new StringReader( tSqlCommand ), out ); } if( tSrcFile != null ) { - log( "Executing file: " + tSrcFile.getAbsolutePath(), - Project.MSG_INFO ); + getLogger().info( "Executing file: " + tSrcFile.getAbsolutePath() ); Reader reader = ( encoding == null ) ? new FileReader( tSrcFile ) : new InputStreamReader( new FileInputStream( tSrcFile ), encoding ); runStatements( reader, out ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SendEmail.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SendEmail.java index 0952e343e..c73f5bd89 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SendEmail.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SendEmail.java @@ -16,7 +16,6 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.StringTokenizer; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.mail.MailMessage; @@ -402,7 +401,7 @@ public class SendEmail extends Task } else { - log( err, Project.MSG_ERR ); + getLogger().error( err ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Sleep.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Sleep.java index 6f0e8fd62..a5c5972f9 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Sleep.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Sleep.java @@ -8,7 +8,6 @@ package org.apache.tools.ant.taskdefs; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; /** @@ -128,8 +127,7 @@ public class Sleep extends Task { validate(); long sleepTime = getSleepTime(); - log( "sleeping for " + sleepTime + " milliseconds", - Project.MSG_VERBOSE ); + getLogger().debug( "sleeping for " + sleepTime + " milliseconds" ); doSleep( sleepTime ); } catch( Exception e ) @@ -141,7 +139,7 @@ public class Sleep extends Task else { String text = e.toString(); - log( text, Project.MSG_ERR ); + getLogger().error( text ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Tar.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Tar.java index f115425f0..40fd19756 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Tar.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Tar.java @@ -163,12 +163,11 @@ public class Tar if( upToDate ) { - log( "Nothing to do: " + tarFile.getAbsolutePath() + " is up to date.", - Project.MSG_INFO ); + getLogger().info( "Nothing to do: " + tarFile.getAbsolutePath() + " is up to date." ); return; } - log( "Building tar: " + tarFile.getAbsolutePath(), Project.MSG_INFO ); + getLogger().info( "Building tar: " + tarFile.getAbsolutePath() ); TarOutputStream tOut = null; try @@ -256,17 +255,19 @@ public class Tar { if( longFileMode.isOmitMode() ) { - log( "Omitting: " + vPath, Project.MSG_INFO ); + getLogger().info( "Omitting: " + vPath ); return; } else if( longFileMode.isWarnMode() ) { - log( "Entry: " + vPath + " longer than " + - TarConstants.NAMELEN + " characters.", Project.MSG_WARN ); + final String message = "Entry: " + vPath + " longer than " + + TarConstants.NAMELEN + " characters."; + getLogger().warn( message ); if( !longWarningGiven ) { - log( "Resulting tar file can only be processed successfully" - + " by GNU compatible tar commands", Project.MSG_WARN ); + final String message2 = "Resulting tar file can only be processed successfully" + + " by GNU compatible tar commands"; + getLogger().warn( message2 ); longWarningGiven = true; } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Touch.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Touch.java index 2b3e7a72c..6850825a8 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Touch.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Touch.java @@ -134,7 +134,7 @@ public class Touch extends Task { if( !file.exists() ) { - log( "Creating " + file, Project.MSG_INFO ); + getLogger().info( "Creating " + file ); try { FileOutputStream fos = new FileOutputStream( file ); @@ -150,8 +150,7 @@ public class Touch extends Task if( millis >= 0 && getProject().getJavaVersion() == Project.JAVA_1_1 ) { - log( "modification time of files cannot be set in JDK 1.1", - Project.MSG_WARN ); + getLogger().warn( "modification time of files cannot be set in JDK 1.1" ); return; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Untar.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Untar.java index a93b0f0d0..ddaf2346e 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Untar.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Untar.java @@ -11,7 +11,6 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.tar.TarEntry; import org.apache.tools.tar.TarInputStream; @@ -30,7 +29,7 @@ public class Untar extends Expand TarInputStream tis = null; try { - log( "Expanding: " + srcF + " into " + dir, Project.MSG_INFO ); + getLogger().info( "Expanding: " + srcF + " into " + dir ); tis = new TarInputStream( new FileInputStream( srcF ) ); TarEntry te = null; @@ -41,7 +40,7 @@ public class Untar extends Expand te.getName(), te.getModTime(), te.isDirectory() ); } - log( "expand complete", Project.MSG_VERBOSE ); + getLogger().debug( "expand complete" ); } catch( IOException ioe ) diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/UpToDate.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/UpToDate.java index 489e36f2e..e21414632 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/UpToDate.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/UpToDate.java @@ -12,7 +12,6 @@ import java.util.ArrayList; import java.util.Iterator; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.condition.Condition; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Mapper; @@ -150,13 +149,11 @@ public class UpToDate extends MatchingTask implements Condition setProperty( _property, this.getValue() ); if( mapperElement == null ) { - log( "File \"" + _targetFile.getAbsolutePath() + "\" is up to date.", - Project.MSG_VERBOSE ); + getLogger().debug( "File \"" + _targetFile.getAbsolutePath() + "\" is up to date." ); } else { - log( "All target files have been up to date.", - Project.MSG_VERBOSE ); + getLogger().debug( "All target files have been up to date." ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/War.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/War.java index 8ac50c00c..19841d440 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/War.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/War.java @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs; import java.io.File; import java.io.IOException; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.ZipFileSet; import org.apache.tools.zip.ZipOutputStream; @@ -101,8 +100,10 @@ public class War extends Jar { if( deploymentDescriptor == null || !deploymentDescriptor.equals( file ) || descriptorAdded ) { - log( "Warning: selected " + archiveType + " files include a WEB-INF/web.xml which will be ignored " + - "(please use webxml attribute to " + archiveType + " task)", Project.MSG_WARN ); + final String message = "Warning: selected " + archiveType + + " files include a WEB-INF/web.xml which will be ignored " + + "(please use webxml attribute to " + archiveType + " task)"; + getLogger().warn( message ); } else { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Zip.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Zip.java index 8e7c1d6ba..ed712a3dd 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Zip.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Zip.java @@ -23,7 +23,6 @@ import java.util.zip.ZipInputStream; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.FileScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.ZipFileSet; @@ -384,8 +383,9 @@ public class Zip extends MatchingTask { if( !renamedFile.delete() ) { - log( "Warning: unable to delete temporary file " + - renamedFile.getName(), Project.MSG_WARN ); + final String message = "Warning: unable to delete temporary file " + + renamedFile.getName(); + getLogger().warn( message ); } } } @@ -420,8 +420,9 @@ public class Zip extends MatchingTask { if( emptyBehavior.equals( "skip" ) ) { - log( "Warning: skipping " + archiveType + " archive " + zipFile + - " because no files were included.", Project.MSG_WARN ); + final String message = "Warning: skipping " + archiveType + " archive " + zipFile + + " because no files were included."; + getLogger().warn( message ); return true; } else if( emptyBehavior.equals( "fail" ) ) @@ -708,7 +709,7 @@ public class Zip extends MatchingTask // In this case using java.util.zip will not work // because it does not permit a zero-entry archive. // Must create it manually. - log( "Note: creating empty " + archiveType + " archive " + zipFile, Project.MSG_INFO ); + getLogger().info( "Note: creating empty " + archiveType + " archive " + zipFile ); try { OutputStream os = new FileOutputStream( zipFile ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java index 448d3f96b..c17ca22a3 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java @@ -7,9 +7,8 @@ */ package org.apache.tools.ant.taskdefs.compilers; +import org.apache.avalon.framework.logger.Logger; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.Task; /** * Creates the necessary compiler adapter, given basic criteria. @@ -51,7 +50,7 @@ public class CompilerAdapterFactory * @throws TaskException if the compiler type could not be resolved into a * compiler adapter. */ - public static CompilerAdapter getCompiler( String compilerType, Task task ) + public static CompilerAdapter getCompiler( String compilerType, Logger logger ) throws TaskException { /* @@ -83,8 +82,9 @@ public class CompilerAdapterFactory } catch( ClassNotFoundException cnfe ) { - task.log( "Modern compiler is not available - using " - + "classic compiler", Project.MSG_WARN ); + final String message = "Modern compiler is not available - using " + + "classic compiler"; + logger.warn( message ); return new Javac12(); } return new Javac13(); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java index 18e337c2d..321a33d1c 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java @@ -11,6 +11,7 @@ import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; +import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Javac; @@ -29,28 +30,30 @@ import org.apache.tools.ant.types.Path; * @author Stefan Bodewig * @author J D Glanville */ -public abstract class DefaultCompilerAdapter implements CompilerAdapter +public abstract class DefaultCompilerAdapter + extends AbstractLogEnabled + implements CompilerAdapter { - protected static String lSep = System.getProperty( "line.separator" ); - protected boolean debug = false; - protected boolean optimize = false; - protected boolean deprecation = false; - protected boolean depend = false; - protected boolean verbose = false; - - protected Javac attributes; - protected Path bootclasspath; - protected Path compileClasspath; - - protected File[] compileList; - protected File destDir; - protected String encoding; - protected Path extdirs; - protected boolean includeAntRuntime; - protected boolean includeJavaRuntime; - protected String memoryInitialSize; - protected String memoryMaximumSize; - protected Project project; + protected static String LINE_SEP = System.getProperty( "line.separator" ); + protected boolean m_debug; + protected boolean m_optimize; + protected boolean m_deprecation; + protected boolean m_depend; + protected boolean m_verbose; + + protected Javac m_attributes; + protected Path m_bootclasspath; + protected Path m_compileClasspath; + + protected File[] m_compileList; + protected File m_destDir; + protected String m_encoding; + protected Path m_extdirs; + protected boolean m_includeAntRuntime; + protected boolean m_includeJavaRuntime; + protected String m_memoryInitialSize; + protected String m_memoryMaximumSize; + protected Project m_project; /* * jdg - TODO - all these attributes are currently protected, but they @@ -61,30 +64,30 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter public void setJavac( Javac attributes ) { - this.attributes = attributes; + this.m_attributes = attributes; src = attributes.getSrcdir(); - destDir = attributes.getDestdir(); - encoding = attributes.getEncoding(); - debug = attributes.getDebug(); - optimize = attributes.getOptimize(); - deprecation = attributes.getDeprecation(); - depend = attributes.getDepend(); - verbose = attributes.getVerbose(); + m_destDir = attributes.getDestdir(); + m_encoding = attributes.getEncoding(); + m_debug = attributes.getDebug(); + m_optimize = attributes.getOptimize(); + m_deprecation = attributes.getDeprecation(); + m_depend = attributes.getDepend(); + m_verbose = attributes.getVerbose(); target = attributes.getTarget(); - bootclasspath = attributes.getBootclasspath(); - extdirs = attributes.getExtdirs(); - compileList = attributes.getFileList(); - compileClasspath = attributes.getClasspath(); - project = attributes.getProject(); - includeAntRuntime = attributes.getIncludeantruntime(); - includeJavaRuntime = attributes.getIncludejavaruntime(); - memoryInitialSize = attributes.getMemoryInitialSize(); - memoryMaximumSize = attributes.getMemoryMaximumSize(); + m_bootclasspath = attributes.getBootclasspath(); + m_extdirs = attributes.getExtdirs(); + m_compileList = attributes.getFileList(); + m_compileClasspath = attributes.getClasspath(); + m_project = attributes.getProject(); + m_includeAntRuntime = attributes.getIncludeantruntime(); + m_includeJavaRuntime = attributes.getIncludejavaruntime(); + m_memoryInitialSize = attributes.getMemoryInitialSize(); + m_memoryMaximumSize = attributes.getMemoryMaximumSize(); } public Javac getJavac() { - return attributes; + return m_attributes; } protected Commandline setupJavacCommand() @@ -128,46 +131,46 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter // has its own parameter format boolean usingJava1_1 = Project.getJavaVersion().equals( Project.JAVA_1_1 ); String memoryParameterPrefix = usingJava1_1 ? "-J-" : "-J-X"; - if( memoryInitialSize != null ) + if( m_memoryInitialSize != null ) { - if( !attributes.isForkedJavac() ) + if( !m_attributes.isForkedJavac() ) { - attributes.log( "Since fork is false, ignoring memoryInitialSize setting.", - Project.MSG_WARN ); + final String message = "Since fork is false, ignoring memoryInitialSize setting."; + getLogger().warn( message ); } else { - cmd.createArgument().setValue( memoryParameterPrefix + "ms" + memoryInitialSize ); + cmd.createArgument().setValue( memoryParameterPrefix + "ms" + m_memoryInitialSize ); } } - if( memoryMaximumSize != null ) + if( m_memoryMaximumSize != null ) { - if( !attributes.isForkedJavac() ) + if( !m_attributes.isForkedJavac() ) { - attributes.log( "Since fork is false, ignoring memoryMaximumSize setting.", - Project.MSG_WARN ); + final String message = "Since fork is false, ignoring memoryMaximumSize setting."; + getLogger().warn( message ); } else { - cmd.createArgument().setValue( memoryParameterPrefix + "mx" + memoryMaximumSize ); + cmd.createArgument().setValue( memoryParameterPrefix + "mx" + m_memoryMaximumSize ); } } - if( attributes.getNowarn() ) + if( m_attributes.getNowarn() ) { cmd.createArgument().setValue( "-nowarn" ); } - if( deprecation == true ) + if( m_deprecation == true ) { cmd.createArgument().setValue( "-deprecation" ); } - if( destDir != null ) + if( m_destDir != null ) { cmd.createArgument().setValue( "-d" ); - cmd.createArgument().setFile( destDir ); + cmd.createArgument().setFile( m_destDir ); } cmd.createArgument().setValue( "-classpath" ); @@ -176,17 +179,17 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter // as well as "bootclasspath" and "extdirs" if( Project.getJavaVersion().startsWith( "1.1" ) ) { - Path cp = new Path( project ); + Path cp = new Path( m_project ); /* * XXX - This doesn't mix very well with build.systemclasspath, */ - if( bootclasspath != null ) + if( m_bootclasspath != null ) { - cp.append( bootclasspath ); + cp.append( m_bootclasspath ); } - if( extdirs != null ) + if( m_extdirs != null ) { - cp.addExtdirs( extdirs ); + cp.addExtdirs( m_extdirs ); } cp.append( classpath ); cp.append( src ); @@ -202,31 +205,31 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter cmd.createArgument().setValue( "-target" ); cmd.createArgument().setValue( target ); } - if( bootclasspath != null ) + if( m_bootclasspath != null ) { cmd.createArgument().setValue( "-bootclasspath" ); - cmd.createArgument().setPath( bootclasspath ); + cmd.createArgument().setPath( m_bootclasspath ); } - if( extdirs != null ) + if( m_extdirs != null ) { cmd.createArgument().setValue( "-extdirs" ); - cmd.createArgument().setPath( extdirs ); + cmd.createArgument().setPath( m_extdirs ); } } - if( encoding != null ) + if( m_encoding != null ) { cmd.createArgument().setValue( "-encoding" ); - cmd.createArgument().setValue( encoding ); + cmd.createArgument().setValue( m_encoding ); } - if( debug ) + if( m_debug ) { if( useDebugLevel && Project.getJavaVersion() != Project.JAVA_1_0 && Project.getJavaVersion() != Project.JAVA_1_1 ) { - String debugLevel = attributes.getDebugLevel(); + String debugLevel = m_attributes.getDebugLevel(); if( debugLevel != null ) { cmd.createArgument().setValue( "-g:" + debugLevel ); @@ -246,12 +249,12 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { cmd.createArgument().setValue( "-g:none" ); } - if( optimize ) + if( m_optimize ) { cmd.createArgument().setValue( "-O" ); } - if( depend ) + if( m_depend ) { if( Project.getJavaVersion().startsWith( "1.1" ) ) { @@ -263,12 +266,12 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter } else { - attributes.log( "depend attribute is not supported by the modern compiler", - Project.MSG_WARN ); + final String message = "depend attribute is not supported by the modern compiler"; + getLogger().warn( message ); } } - if( verbose ) + if( m_verbose ) { cmd.createArgument().setValue( "-verbose" ); } @@ -305,10 +308,10 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter throws TaskException { setupJavacCommandlineSwitches( cmd, true ); - if( attributes.getSource() != null ) + if( m_attributes.getSource() != null ) { cmd.createArgument().setValue( "-source" ); - cmd.createArgument().setValue( attributes.getSource() ); + cmd.createArgument().setValue( m_attributes.getSource() ); } return cmd; } @@ -321,39 +324,39 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter protected Path getCompileClasspath() throws TaskException { - Path classpath = new Path( project ); + Path classpath = new Path( m_project ); // add dest dir to classpath so that previously compiled and // untouched classes are on classpath - if( destDir != null ) + if( m_destDir != null ) { - classpath.setLocation( destDir ); + classpath.setLocation( m_destDir ); } // Combine the build classpath with the system classpath, in an // order determined by the value of build.classpath - if( compileClasspath == null ) + if( m_compileClasspath == null ) { - if( includeAntRuntime ) + if( m_includeAntRuntime ) { classpath.addExisting( Path.systemClasspath ); } } else { - if( includeAntRuntime ) + if( m_includeAntRuntime ) { - classpath.addExisting( compileClasspath.concatSystemClasspath( "last" ) ); + classpath.addExisting( m_compileClasspath.concatSystemClasspath( "last" ) ); } else { - classpath.addExisting( compileClasspath.concatSystemClasspath( "ignore" ) ); + classpath.addExisting( m_compileClasspath.concatSystemClasspath( "ignore" ) ); } } - if( includeJavaRuntime ) + if( m_includeJavaRuntime ) { classpath.addJavaRuntime(); } @@ -435,9 +438,9 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter try { final Execute exe = new Execute(); - exe.setOutput( new LogOutputStream( attributes, Project.MSG_INFO ) ); - exe.setError( new LogOutputStream( attributes, Project.MSG_WARN ) ); - exe.setWorkingDirectory( project.getBaseDir() ); + exe.setOutput( new LogOutputStream( m_attributes, Project.MSG_INFO ) ); + exe.setError( new LogOutputStream( m_attributes, Project.MSG_WARN ) ); + exe.setWorkingDirectory( m_project.getBaseDir() ); exe.setCommandline( commandArray ); return exe.execute(); } @@ -464,27 +467,25 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter */ protected void logAndAddFilesToCompile( Commandline cmd ) { - attributes.log( "Compilation args: " + cmd.toString(), - Project.MSG_VERBOSE ); + getLogger().debug( "Compilation args: " + cmd.toString() ); StringBuffer niceSourceList = new StringBuffer( "File" ); - if( compileList.length != 1 ) + if( m_compileList.length != 1 ) { niceSourceList.append( "s" ); } niceSourceList.append( " to be compiled:" ); - niceSourceList.append( lSep ); + niceSourceList.append( LINE_SEP ); - for( int i = 0; i < compileList.length; i++ ) + for( int i = 0; i < m_compileList.length; i++ ) { - String arg = compileList[ i ].getAbsolutePath(); + String arg = m_compileList[ i ].getAbsolutePath(); cmd.createArgument().setValue( arg ); - niceSourceList.append( " " + arg + lSep ); + niceSourceList.append( " " + arg + LINE_SEP ); } - attributes.log( niceSourceList.toString(), Project.MSG_VERBOSE ); + getLogger().debug( niceSourceList.toString() ); } - } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Gcj.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Gcj.java index a758fb210..3fffbdb03 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Gcj.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Gcj.java @@ -8,7 +8,6 @@ package org.apache.tools.ant.taskdefs.compilers; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; @@ -32,7 +31,7 @@ public class Gcj extends DefaultCompilerAdapter throws TaskException { Commandline cmd; - attributes.log( "Using gcj compiler", Project.MSG_VERBOSE ); + getLogger().debug( "Using gcj compiler" ); cmd = setupGCJCommand(); int firstFileName = cmd.size(); @@ -45,23 +44,23 @@ public class Gcj extends DefaultCompilerAdapter throws TaskException { Commandline cmd = new Commandline(); - Path classpath = new Path( project ); + Path classpath = new Path( m_project ); // gcj doesn't support bootclasspath dir (-bootclasspath) // so we'll emulate it for compatibility and convenience. - if( bootclasspath != null ) + if( m_bootclasspath != null ) { - classpath.append( bootclasspath ); + classpath.append( m_bootclasspath ); } // gcj doesn't support an extension dir (-extdir) // so we'll emulate it for compatibility and convenience. - classpath.addExtdirs( extdirs ); + classpath.addExtdirs( m_extdirs ); - if( ( bootclasspath == null ) || ( bootclasspath.size() == 0 ) ) + if( ( m_bootclasspath == null ) || ( m_bootclasspath.size() == 0 ) ) { // no bootclasspath, therefore, get one from the java runtime - includeJavaRuntime = true; + m_includeJavaRuntime = true; } classpath.append( getCompileClasspath() ); @@ -71,12 +70,12 @@ public class Gcj extends DefaultCompilerAdapter cmd.setExecutable( "gcj" ); - if( destDir != null ) + if( m_destDir != null ) { cmd.createArgument().setValue( "-d" ); - cmd.createArgument().setFile( destDir ); + cmd.createArgument().setFile( m_destDir ); - if( destDir.mkdirs() ) + if( m_destDir.mkdirs() ) { throw new TaskException( "Can't make output directories. Maybe permission is wrong. " ); } @@ -86,15 +85,15 @@ public class Gcj extends DefaultCompilerAdapter cmd.createArgument().setValue( "-classpath" ); cmd.createArgument().setPath( classpath ); - if( encoding != null ) + if( m_encoding != null ) { - cmd.createArgument().setValue( "--encoding=" + encoding ); + cmd.createArgument().setValue( "--encoding=" + m_encoding ); } - if( debug ) + if( m_debug ) { cmd.createArgument().setValue( "-g1" ); } - if( optimize ) + if( m_optimize ) { cmd.createArgument().setValue( "-O" ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Javac12.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Javac12.java index c1a2a1035..923b90760 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Javac12.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Javac12.java @@ -32,10 +32,10 @@ public class Javac12 extends DefaultCompilerAdapter public boolean execute() throws TaskException { - attributes.log( "Using classic compiler", Project.MSG_VERBOSE ); + getLogger().debug( "Using classic compiler" ); Commandline cmd = setupJavacCommand( true ); - OutputStream logstr = new LogOutputStream( attributes, Project.MSG_WARN ); + OutputStream logstr = new LogOutputStream( m_attributes, Project.MSG_WARN ); try { // Create an instance of the compiler, redirecting output to diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Javac13.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Javac13.java index 5152be24b..339dbe883 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Javac13.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Javac13.java @@ -9,7 +9,6 @@ package org.apache.tools.ant.taskdefs.compilers; import java.lang.reflect.Method; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; /** @@ -33,7 +32,7 @@ public class Javac13 extends DefaultCompilerAdapter public boolean execute() throws TaskException { - attributes.log( "Using modern compiler", Project.MSG_VERBOSE ); + getLogger().debug( "Using modern compiler" ); Commandline cmd = setupModernJavacCommand(); // Use reflection to be able to build on all JDKs >= 1.1: diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java index 606b4e1d1..4011f34af 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java @@ -8,7 +8,6 @@ package org.apache.tools.ant.taskdefs.compilers; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; /** @@ -28,7 +27,7 @@ public class JavacExternal extends DefaultCompilerAdapter public boolean execute() throws TaskException { - attributes.log( "Using external javac compiler", Project.MSG_VERBOSE ); + getLogger().debug( "Using external javac compiler" ); Commandline cmd = new Commandline(); cmd.setExecutable( getJavac().getJavacExecutable() ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Jikes.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Jikes.java index 6e980c1ba..d6c3983d6 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Jikes.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Jikes.java @@ -22,7 +22,8 @@ import org.apache.tools.ant.types.Path; * @author Stefan Bodewig * @author J D Glanville */ -public class Jikes extends DefaultCompilerAdapter +public class Jikes + extends DefaultCompilerAdapter { /** @@ -39,25 +40,25 @@ public class Jikes extends DefaultCompilerAdapter public boolean execute() throws TaskException { - attributes.log( "Using jikes compiler", Project.MSG_VERBOSE ); + getLogger().debug( "Using jikes compiler" ); - Path classpath = new Path( project ); + Path classpath = new Path( m_project ); // Jikes doesn't support bootclasspath dir (-bootclasspath) // so we'll emulate it for compatibility and convenience. - if( bootclasspath != null ) + if( m_bootclasspath != null ) { - classpath.append( bootclasspath ); + classpath.append( m_bootclasspath ); } // Jikes doesn't support an extension dir (-extdir) // so we'll emulate it for compatibility and convenience. - classpath.addExtdirs( extdirs ); + classpath.addExtdirs( m_extdirs ); - if( ( bootclasspath == null ) || ( bootclasspath.size() == 0 ) ) + if( ( m_bootclasspath == null ) || ( m_bootclasspath.size() == 0 ) ) { // no bootclasspath, therefore, get one from the java runtime - includeJavaRuntime = true; + m_includeJavaRuntime = true; } else { @@ -76,42 +77,42 @@ public class Jikes extends DefaultCompilerAdapter String jikesPath = System.getProperty( "jikes.class.path" ); if( jikesPath != null ) { - classpath.append( new Path( project, jikesPath ) ); + classpath.append( new Path( m_project, jikesPath ) ); } Commandline cmd = new Commandline(); cmd.setExecutable( "jikes" ); - if( deprecation == true ) + if( m_deprecation == true ) cmd.createArgument().setValue( "-deprecation" ); - if( destDir != null ) + if( m_destDir != null ) { cmd.createArgument().setValue( "-d" ); - cmd.createArgument().setFile( destDir ); + cmd.createArgument().setFile( m_destDir ); } cmd.createArgument().setValue( "-classpath" ); cmd.createArgument().setPath( classpath ); - if( encoding != null ) + if( m_encoding != null ) { cmd.createArgument().setValue( "-encoding" ); - cmd.createArgument().setValue( encoding ); + cmd.createArgument().setValue( m_encoding ); } - if( debug ) + if( m_debug ) { cmd.createArgument().setValue( "-g" ); } - if( optimize ) + if( m_optimize ) { cmd.createArgument().setValue( "-O" ); } - if( verbose ) + if( m_verbose ) { cmd.createArgument().setValue( "-verbose" ); } - if( depend ) + if( m_depend ) { cmd.createArgument().setValue( "-depend" ); } @@ -126,13 +127,13 @@ public class Jikes extends DefaultCompilerAdapter * by emacs, so that emacs can directly set the cursor to the place, * where the error occured. */ - String emacsProperty = project.getProperty( "build.compiler.emacs" ); + String emacsProperty = m_project.getProperty( "build.compiler.emacs" ); if( emacsProperty != null && Project.toBoolean( emacsProperty ) ) { cmd.createArgument().setValue( "+E" ); } - if( attributes.getNowarn() ) + if( m_attributes.getNowarn() ) { /* * FIXME later @@ -146,7 +147,7 @@ public class Jikes extends DefaultCompilerAdapter /** * Jikes can issue pedantic warnings. */ - String pedanticProperty = project.getProperty( "build.compiler.pedantic" ); + String pedanticProperty = m_project.getProperty( "build.compiler.pedantic" ); if( pedanticProperty != null && Project.toBoolean( pedanticProperty ) ) { cmd.createArgument().setValue( "+P" ); @@ -156,7 +157,7 @@ public class Jikes extends DefaultCompilerAdapter * Jikes supports something it calls "full dependency checking", see the * jikes documentation for differences between -depend and +F. */ - String fullDependProperty = project.getProperty( "build.compiler.fulldepend" ); + String fullDependProperty = m_project.getProperty( "build.compiler.fulldepend" ); if( fullDependProperty != null && Project.toBoolean( fullDependProperty ) ) { cmd.createArgument().setValue( "+F" ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Jvc.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Jvc.java index 722d4112f..1d84210cb 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Jvc.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Jvc.java @@ -8,7 +8,6 @@ package org.apache.tools.ant.taskdefs.compilers; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; @@ -28,25 +27,25 @@ public class Jvc extends DefaultCompilerAdapter public boolean execute() throws TaskException { - attributes.log( "Using jvc compiler", Project.MSG_VERBOSE ); + getLogger().debug( "Using jvc compiler" ); - Path classpath = new Path( project ); + Path classpath = new Path( m_project ); // jvc doesn't support bootclasspath dir (-bootclasspath) // so we'll emulate it for compatibility and convenience. - if( bootclasspath != null ) + if( m_bootclasspath != null ) { - classpath.append( bootclasspath ); + classpath.append( m_bootclasspath ); } // jvc doesn't support an extension dir (-extdir) // so we'll emulate it for compatibility and convenience. - classpath.addExtdirs( extdirs ); + classpath.addExtdirs( m_extdirs ); - if( ( bootclasspath == null ) || ( bootclasspath.size() == 0 ) ) + if( ( m_bootclasspath == null ) || ( m_bootclasspath.size() == 0 ) ) { // no bootclasspath, therefore, get one from the java runtime - includeJavaRuntime = true; + m_includeJavaRuntime = true; } else { @@ -64,10 +63,10 @@ public class Jvc extends DefaultCompilerAdapter Commandline cmd = new Commandline(); cmd.setExecutable( "jvc" ); - if( destDir != null ) + if( m_destDir != null ) { cmd.createArgument().setValue( "/d" ); - cmd.createArgument().setFile( destDir ); + cmd.createArgument().setFile( m_destDir ); } // Add the Classpath before the "internal" one. @@ -81,15 +80,15 @@ public class Jvc extends DefaultCompilerAdapter // Do not display Logo cmd.createArgument().setValue( "/nologo" ); - if( debug ) + if( m_debug ) { cmd.createArgument().setValue( "/g" ); } - if( optimize ) + if( m_optimize ) { cmd.createArgument().setValue( "/O" ); } - if( verbose ) + if( m_verbose ) { cmd.createArgument().setValue( "/verbose" ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Kjc.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Kjc.java index e29c87a96..34761ad92 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Kjc.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Kjc.java @@ -9,7 +9,6 @@ package org.apache.tools.ant.taskdefs.compilers; import java.lang.reflect.Method; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; @@ -25,7 +24,7 @@ public class Kjc extends DefaultCompilerAdapter public boolean execute() throws TaskException { - attributes.log( "Using kjc compiler", Project.MSG_VERBOSE ); + getLogger().debug( "Using kjc compiler" ); Commandline cmd = setupKjcCommand(); try @@ -71,31 +70,31 @@ public class Kjc extends DefaultCompilerAdapter // generate classpath, because kjc does't support sourcepath. Path classpath = getCompileClasspath(); - if( deprecation == true ) + if( m_deprecation == true ) { cmd.createArgument().setValue( "-deprecation" ); } - if( destDir != null ) + if( m_destDir != null ) { cmd.createArgument().setValue( "-d" ); - cmd.createArgument().setFile( destDir ); + cmd.createArgument().setFile( m_destDir ); } // generate the clsspath cmd.createArgument().setValue( "-classpath" ); - Path cp = new Path( project ); + Path cp = new Path( m_project ); // kjc don't have bootclasspath option. - if( bootclasspath != null ) + if( m_bootclasspath != null ) { - cp.append( bootclasspath ); + cp.append( m_bootclasspath ); } - if( extdirs != null ) + if( m_extdirs != null ) { - cp.addExtdirs( extdirs ); + cp.addExtdirs( m_extdirs ); } cp.append( classpath ); @@ -105,23 +104,23 @@ public class Kjc extends DefaultCompilerAdapter // kjc-1.5A doesn't support -encoding option now. // but it will be supported near the feature. - if( encoding != null ) + if( m_encoding != null ) { cmd.createArgument().setValue( "-encoding" ); - cmd.createArgument().setValue( encoding ); + cmd.createArgument().setValue( m_encoding ); } - if( debug ) + if( m_debug ) { cmd.createArgument().setValue( "-g" ); } - if( optimize ) + if( m_optimize ) { cmd.createArgument().setValue( "-O2" ); } - if( verbose ) + if( m_verbose ) { cmd.createArgument().setValue( "-verbose" ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Sj.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Sj.java index 8db25bee6..1ac12beda 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Sj.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Sj.java @@ -8,7 +8,6 @@ package org.apache.tools.ant.taskdefs.compilers; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; /** @@ -30,12 +29,12 @@ public class Sj extends DefaultCompilerAdapter public boolean execute() throws TaskException { - attributes.log( "Using symantec java compiler", Project.MSG_VERBOSE ); + getLogger().debug( "Using symantec java compiler" ); Commandline cmd = setupJavacCommand(); cmd.setExecutable( "sj" ); - int firstFileName = cmd.size() - compileList.length; + int firstFileName = cmd.size() - m_compileList.length; return executeExternalCompile( cmd.getCommandline(), firstFileName ) == 0; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Http.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Http.java index a1b217522..25ed4d0ef 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Http.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Http.java @@ -12,7 +12,6 @@ import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.ProjectComponent; /** @@ -39,7 +38,7 @@ public class Http { throw new TaskException( "No url specified in HTTP task" ); } - log( "Checking for " + spec, Project.MSG_VERBOSE ); + getLogger().debug( "Checking for " + spec ); try { URL url = new URL( spec ); @@ -50,7 +49,7 @@ public class Http { HttpURLConnection http = (HttpURLConnection)conn; int code = http.getResponseCode(); - log( "Result code for " + spec + " was " + code, Project.MSG_VERBOSE ); + getLogger().debug( "Result code for " + spec + " was " + code ); if( code > 0 && code < 500 ) { return true; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Socket.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Socket.java index eed6fbdcb..b66cd8254 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Socket.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Socket.java @@ -9,7 +9,6 @@ package org.apache.tools.ant.taskdefs.condition; import java.io.IOException; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.ProjectComponent; /** @@ -46,7 +45,7 @@ public class Socket { throw new TaskException( "No port specified in Socket task" ); } - log( "Checking for listener at " + server + ":" + port, Project.MSG_VERBOSE ); + getLogger().debug( "Checking for listener at " + server + ":" + port ); try { java.net.Socket socket = new java.net.Socket( server, port ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/Execute.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/Execute.java index 485736b0b..91364e481 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/Execute.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/Execute.java @@ -65,7 +65,7 @@ public class Execute { try { - task.log( Commandline.toString( cmdline ), Project.MSG_VERBOSE ); + task.hackGetLogger().debug( Commandline.toString( cmdline ) ); final Execute exe = new Execute(); exe.setOutput( new LogOutputStream( task, Project.MSG_INFO ) ); exe.setError( new LogOutputStream( task, Project.MSG_WARN ) ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/file/Copy.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/file/Copy.java index 19f1459e6..ca570f749 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/file/Copy.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/file/Copy.java @@ -232,8 +232,7 @@ public class Copy } else { - log( m_file + " omitted as " + m_destFile + " is up to date.", - Project.MSG_VERBOSE ); + getLogger().debug( m_file + " omitted as " + m_destFile + " is up to date." ); } } else @@ -395,7 +394,7 @@ public class Copy { if( !d.mkdirs() ) { - log( "Unable to create directory " + d.getAbsolutePath(), Project.MSG_ERR ); + getLogger().error( "Unable to create directory " + d.getAbsolutePath() ); } else { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/file/Delete.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/file/Delete.java index 0c4d0cd73..d37809d55 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/file/Delete.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/file/Delete.java @@ -280,8 +280,7 @@ public class Delete } else { - log( "Could not find file " + file.getAbsolutePath() + " to delete.", - Project.MSG_VERBOSE ); + getLogger().debug( "Could not find file " + file.getAbsolutePath() + " to delete." ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/file/Move.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/file/Move.java index 0786914b3..6c2498627 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/file/Move.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/file/Move.java @@ -13,7 +13,6 @@ import java.util.Enumeration; import java.util.Iterator; import org.apache.avalon.excalibur.io.FileUtil; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.FilterSet; import org.apache.tools.ant.types.FilterSetCollection; @@ -195,7 +194,7 @@ public class Move extends Copy { if( !d.mkdirs() ) { - log( "Unable to create directory " + d.getAbsolutePath(), Project.MSG_ERR ); + getLogger().error( "Unable to create directory " + d.getAbsolutePath() ); } else { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java index d85679c53..e0ab9265e 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java @@ -920,7 +920,7 @@ public class Javadoc if( !Os.isFamily( "netware" ) ) { getLogger().debug( "Unable to locate " + jdocExecutable.getAbsolutePath() + - ". Using \"javadoc\" instead." ); + ". Using \"javadoc\" instead." ); } return "javadoc"; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ANTLR.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ANTLR.java index 86d79de34..10c682390 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ANTLR.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ANTLR.java @@ -76,13 +76,13 @@ public class ANTLR extends Task public void setOutputdirectory( File outputDirectory ) { - log( "Setting output directory to: " + outputDirectory.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "Setting output directory to: " + outputDirectory.toString() ); this.outputDirectory = outputDirectory; } public void setTarget( File target ) { - log( "Setting target to: " + target.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "Setting target to: " + target.toString() ); this.target = target; } @@ -127,7 +127,7 @@ public class ANTLR extends Task if( fork ) { - log( "Forking " + commandline.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "Forking " + commandline.toString() ); int err = run( commandline.getCommandline() ); if( err == 1 ) { @@ -163,27 +163,24 @@ public class ANTLR extends Task { int pling = u.indexOf( "!" ); String jarName = u.substring( 9, pling ); - log( "Implicitly adding " + jarName + " to classpath", - Project.MSG_DEBUG ); + getLogger().debug( "Implicitly adding " + jarName + " to classpath" ); createClasspath().setLocation( new File( ( new File( jarName ) ).getAbsolutePath() ) ); } else if( u.startsWith( "file:" ) ) { int tail = u.indexOf( resource ); String dirName = u.substring( 5, tail ); - log( "Implicitly adding " + dirName + " to classpath", - Project.MSG_DEBUG ); + getLogger().debug( "Implicitly adding " + dirName + " to classpath" ); createClasspath().setLocation( new File( ( new File( dirName ) ).getAbsolutePath() ) ); } else { - log( "Don\'t know how to handle resource URL " + u, - Project.MSG_DEBUG ); + getLogger().debug( "Don\'t know how to handle resource URL " + u ); } } else { - log( "Couldn\'t find " + resource, Project.MSG_DEBUG ); + getLogger().debug( "Couldn\'t find " + resource ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Cab.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Cab.java index 5b67eb2ce..55c7fdf94 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Cab.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Cab.java @@ -17,7 +17,6 @@ import java.util.Iterator; import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.framework.Os; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.taskdefs.exec.ExecTask; import org.apache.tools.ant.types.FileSet; @@ -118,7 +117,7 @@ public class Cab extends MatchingTask if( !Os.isFamily( "windows" ) ) { - log( "Using listcab/libcabinet", Project.MSG_VERBOSE ); + getLogger().debug( "Using listcab/libcabinet" ); StringBuffer sb = new StringBuffer(); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/IContract.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/IContract.java index b2094fb6a..c7aa61bff 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/IContract.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/IContract.java @@ -18,7 +18,6 @@ import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.BuildEvent; import org.apache.tools.ant.BuildListener; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.taskdefs.Javac; import org.apache.tools.ant.taskdefs.MatchingTask; @@ -976,8 +975,8 @@ public class IContract extends MatchingTask if( srcFile.lastModified() > now ) { - log( "Warning: file modified in the future: " + - files[ i ], Project.MSG_WARN ); + final String message = "Warning: file modified in the future: " + files[ i ]; + getLogger().warn( message ); } if( !classFile.exists() || srcFile.lastModified() > classFile.lastModified() ) @@ -1069,7 +1068,7 @@ public class IContract extends MatchingTask if( "jikes".equals( compiler ) ) { icCompiler = compiler; - includeJavaRuntime = true; + m_includeJavaRuntime = true; path.append( getCompileClasspath() ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Javah.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Javah.java index 24616c776..f4c293d59 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Javah.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Javah.java @@ -290,8 +290,7 @@ public class Javah extends Task protected void logAndAddFilesToCompile( Commandline cmd ) { int n = 0; - log( "Compilation args: " + cmd.toString(), - Project.MSG_VERBOSE ); + getLogger().debug( "Compilation args: " + cmd.toString() ); StringBuffer niceClassList = new StringBuffer(); if( cls != null ) @@ -324,7 +323,7 @@ public class Javah extends Task prefix.append( " to be compiled:" ); prefix.append( lSep ); - log( prefix.toString() + niceClassList.toString(), Project.MSG_VERBOSE ); + getLogger().debug( prefix.toString() + niceClassList.toString() ); } /** diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java index 470e263fa..899cee73a 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs.optional; import java.io.File; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Mapper; @@ -225,7 +224,7 @@ public class Native2Ascii extends MatchingTask } } - log( "converting " + srcName, Project.MSG_VERBOSE ); + getLogger().debug( "converting " + srcName ); sun.tools.native2ascii.Main n2a = new sun.tools.native2ascii.Main(); if( !n2a.convert( cmd.getArguments() ) ) diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/NetRexxC.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/NetRexxC.java index a890cd379..5457dbaf5 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/NetRexxC.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/NetRexxC.java @@ -20,7 +20,6 @@ import netrexx.lang.Rexx; import org.apache.avalon.excalibur.io.FileUtil; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.MatchingTask; /** @@ -596,8 +595,7 @@ public class NetRexxC extends MatchingTask } else { - log( "Dropping from classpath: " + - f.getAbsolutePath(), Project.MSG_VERBOSE ); + getLogger().debug( "Dropping from classpath: " + f.getAbsolutePath() ); } } @@ -640,7 +638,7 @@ public class NetRexxC extends MatchingTask private void doNetRexxCompile() throws TaskException { - log( "Using NetRexx compiler", Project.MSG_VERBOSE ); + getLogger().debug( "Using NetRexx compiler" ); String classpath = getCompileClasspath(); StringBuffer compileOptions = new StringBuffer(); StringBuffer fileList = new StringBuffer(); @@ -674,7 +672,7 @@ public class NetRexxC extends MatchingTask compileOptions.append( compileOptionsArray[ i ] ); compileOptions.append( " " ); } - log( compileOptions.toString(), Project.MSG_VERBOSE ); + getLogger().debug( compileOptions.toString() ); String eol = System.getProperty( "line.separator" ); StringBuffer niceSourceList = new StringBuffer( "Files to be compiled:" + eol ); @@ -686,7 +684,7 @@ public class NetRexxC extends MatchingTask niceSourceList.append( eol ); } - log( niceSourceList.toString(), Project.MSG_VERBOSE ); + getLogger().debug( niceSourceList.toString() ); // need to set java.class.path property and restore it later // since the NetRexx compiler has no option for the classpath @@ -702,17 +700,17 @@ public class NetRexxC extends MatchingTask if( rc > 1 ) {// 1 is warnings from real NetRexxC - log( out.toString(), Project.MSG_ERR ); + getLogger().error( out.toString() ); String msg = "Compile failed, messages should have been provided."; throw new TaskException( msg ); } else if( rc == 1 ) { - log( out.toString(), Project.MSG_WARN ); + getLogger().warn( out.toString() ); } else { - log( out.toString(), Project.MSG_INFO ); + getLogger().info( out.toString() ); } } finally diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java index ea3967ea5..339ecdfd9 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java @@ -18,7 +18,6 @@ import java.io.PrintWriter; import java.util.ArrayList; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.RegularExpression; @@ -191,14 +190,15 @@ public class ReplaceRegExp extends Task } catch( IOException e ) { - log( "An error occurred processing file: '" + file.getAbsolutePath() + "': " + e.toString(), - Project.MSG_ERR ); + final String message = "An error occurred processing file: '" + + file.getAbsolutePath() + "': " + e.toString(); + getLogger().error( message, e ); } } else if( file != null ) { - log( "The following file is missing: '" + file.getAbsolutePath() + "'", - Project.MSG_ERR ); + final String message = "The following file is missing: '" + file.getAbsolutePath() + "'"; + getLogger().error( message ); } int sz = filesets.size(); @@ -219,14 +219,15 @@ public class ReplaceRegExp extends Task } catch( Exception e ) { - log( "An error occurred processing file: '" + f.getAbsolutePath() + "': " + e.toString(), - Project.MSG_ERR ); + final String message = "An error occurred processing file: '" + f.getAbsolutePath() + + "': " + e.toString(); + getLogger().error( message ); } } else { - log( "The following file is missing: '" + file.getAbsolutePath() + "'", - Project.MSG_ERR ); + final String message = "The following file is missing: '" + file.getAbsolutePath() + "'"; + getLogger().error( message ); } } } @@ -276,12 +277,13 @@ public class ReplaceRegExp extends Task boolean changes = false; - log( "Replacing pattern '" + regex.getPattern( getProject() ) + "' with '" + subs.getExpression( getProject() ) + - "' in '" + f.getPath() + "'" + - ( byline ? " by line" : "" ) + - ( flags.length() > 0 ? " with flags: '" + flags + "'" : "" ) + - ".", - Project.MSG_WARN ); + final String message = "Replacing pattern '" + regex.getPattern( getProject() ) + + "' with '" + subs.getExpression( getProject() ) + + "' in '" + f.getPath() + "'" + + ( byline ? " by line" : "" ) + + ( flags.length() > 0 ? " with flags: '" + flags + "'" : "" ) + + "."; + getLogger().warn( message ); if( byline ) { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/Depend.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/Depend.java index 4efd69dd2..a0b95ff1a 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/Depend.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/Depend.java @@ -22,7 +22,6 @@ import java.util.Iterator; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.AntClassLoader; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Reference; @@ -226,33 +225,32 @@ public class Depend extends MatchingTask if( dump ) { - log( "Reverse Dependency Dump for " + affectedClassMap.size() + - " classes:", Project.MSG_DEBUG ); + getLogger().debug( "Reverse Dependency Dump for " + affectedClassMap.size() + " classes:" ); for( Enumeration e = affectedClassMap.keys(); e.hasMoreElements(); ) { String className = (String)e.nextElement(); - log( " Class " + className + " affects:", Project.MSG_DEBUG ); + getLogger().debug( " Class " + className + " affects:" ); Hashtable affectedClasses = (Hashtable)affectedClassMap.get( className ); for( Enumeration e2 = affectedClasses.keys(); e2.hasMoreElements(); ) { String affectedClass = (String)e2.nextElement(); ClassFileInfo info = (ClassFileInfo)affectedClasses.get( affectedClass ); - log( " " + affectedClass + " in " + info.absoluteFile.getPath(), Project.MSG_DEBUG ); + getLogger().debug( " " + affectedClass + " in " + info.absoluteFile.getPath() ); } } if( classpathDependencies != null ) { - log( "Classpath file dependencies (Forward):", Project.MSG_DEBUG ); + getLogger().debug( "Classpath file dependencies (Forward):" ); for( Enumeration e = classpathDependencies.keys(); e.hasMoreElements(); ) { String className = (String)e.nextElement(); - log( " Class " + className + " depends on:", Project.MSG_DEBUG ); + getLogger().debug( " Class " + className + " depends on:" ); Hashtable dependencies = (Hashtable)classpathDependencies.get( className ); for( Enumeration e2 = dependencies.elements(); e2.hasMoreElements(); ) { File classpathFile = (File)e2.nextElement(); - log( " " + classpathFile.getPath(), Project.MSG_DEBUG ); + getLogger().debug( " " + classpathFile.getPath() ); } } } @@ -293,8 +291,7 @@ public class Depend extends MatchingTask File classpathFile = (File)e2.nextElement(); if( classpathFile.lastModified() > info.absoluteFile.lastModified() ) { - log( "Class " + className + - " is out of date with respect to " + classpathFile, Project.MSG_DEBUG ); + getLogger().debug( "Class " + className + " is out of date with respect to " + classpathFile ); outOfDateClasses.put( className, className ); break; } @@ -431,8 +428,7 @@ public class Depend extends MatchingTask ClassFileInfo affectedClassInfo = (ClassFileInfo)affectedClasses.get( affectedClassName ); if( affectedClassInfo.absoluteFile.exists() ) { - log( "Deleting file " + affectedClassInfo.absoluteFile.getPath() + " since " + - className + " out of date", Project.MSG_VERBOSE ); + getLogger().debug( "Deleting file " + affectedClassInfo.absoluteFile.getPath() + " since " + className + " out of date" ); affectedClassInfo.absoluteFile.delete(); count++; if( closure ) @@ -449,14 +445,13 @@ public class Depend extends MatchingTask // need to delete the main class String topLevelClassName = affectedClassName.substring( 0, affectedClassName.indexOf( "$" ) ); - log( "Top level class = " + topLevelClassName, Project.MSG_VERBOSE ); + getLogger().debug( "Top level class = " + topLevelClassName ); ClassFileInfo topLevelClassInfo = (ClassFileInfo)classFileInfoMap.get( topLevelClassName ); if( topLevelClassInfo != null && topLevelClassInfo.absoluteFile.exists() ) { - log( "Deleting file " + topLevelClassInfo.absoluteFile.getPath() + " since " + - "one of its inner classes was removed", Project.MSG_VERBOSE ); + getLogger().debug( "Deleting file " + topLevelClassInfo.absoluteFile.getPath() + " since " + "one of its inner classes was removed" ); topLevelClassInfo.absoluteFile.delete(); count++; if( closure ) @@ -519,7 +514,7 @@ public class Depend extends MatchingTask for( Iterator e = getClassFiles( destPath ).iterator(); e.hasNext(); ) { ClassFileInfo info = (ClassFileInfo)e.next(); - log( "Adding class info for " + info.className, Project.MSG_DEBUG ); + getLogger().debug( "Adding class info for " + info.className ); classFileInfoMap.put( info.className, info ); ArrayList dependencyList = null; @@ -622,9 +617,7 @@ public class Depend extends MatchingTask String classFilePath = classURL.getFile(); classpathFileObject = new File( classFilePath ); } - log( "Class " + className + - " depends on " + classpathFileObject + - " due to " + dependency, Project.MSG_DEBUG ); + getLogger().debug( "Class " + className + " depends on " + classpathFileObject + " due to " + dependency ); } } classpathFileCache.put( dependency, classpathFileObject ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java index afccb54e6..36bb1f30c 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs.optional.dotnet; import java.io.File; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; /** * Task to assemble .net 'Intermediate Language' files. The task will only work @@ -188,7 +187,7 @@ public class Ilasm public void setOwner( String s ) { - log( "This option is not supported by ILASM as of Beta-2, and will be ignored", Project.MSG_WARN ); + getLogger().warn( "This option is not supported by ILASM as of Beta-2, and will be ignored" ); } /** diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java index 785b985ff..82f3fa816 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java @@ -9,6 +9,7 @@ package org.apache.tools.ant.taskdefs.optional.dotnet;// imports import java.io.File; import java.io.IOException; +import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; @@ -29,8 +30,8 @@ import org.apache.tools.ant.types.Commandline; */ public class NetCommand + extends AbstractLogEnabled { - /** * trace flag */ @@ -162,7 +163,7 @@ public class NetCommand } else { - _owner.log( _title + " Result: " + err, Project.MSG_ERR ); + getLogger().error( _title + " Result: " + err ); } } } @@ -179,7 +180,7 @@ public class NetCommand */ protected void logError( String msg ) { - _owner.log( msg, Project.MSG_ERR ); + getLogger().error( msg ); } /** @@ -189,7 +190,7 @@ public class NetCommand */ protected void logVerbose( String msg ) { - _owner.log( msg, Project.MSG_VERBOSE ); + getLogger().debug( msg ); } /** diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java index 7b7107409..f2d1bf3ed 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java @@ -153,7 +153,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec String s = reader.readLine(); if( s != null ) { - log( "[java2iiop] " + s, Project.MSG_DEBUG ); + getLogger().debug( "[java2iiop] " + s ); }// end of if () } @@ -175,13 +175,13 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec String javafile; while( ( javafile = reader.readLine() ) != null ) { - log( "buffer:" + javafile, Project.MSG_DEBUG ); + getLogger().debug( "buffer:" + javafile ); if( javafile.endsWith( ".java" ) ) { String classfile = toClassFile( javafile ); String key = classfile.substring( getConfig().srcDir.getAbsolutePath().length() + 1 ); - log( " generated : " + classfile, Project.MSG_DEBUG ); - log( " key : " + key, Project.MSG_DEBUG ); + getLogger().debug( " generated : " + classfile ); + getLogger().debug( " key : " + key ); _genfiles.put( key, new File( classfile ) ); }// end of if () }// end of while () @@ -278,7 +278,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec File borlandDD = new File( getConfig().descriptorDir, ddPrefix + BAS_DD ); if( borlandDD.exists() ) { - log( "Borland specific file found " + borlandDD, Project.MSG_VERBOSE ); + getLogger().debug( "Borland specific file found " + borlandDD ); ejbFiles.put( META_DIR + BAS_DD, borlandDD ); } else @@ -314,7 +314,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec //remove .class extension String home = toClass( clazz ); homes.add( home ); - log( " Home " + home, Project.MSG_VERBOSE ); + getLogger().debug( " Home " + home ); }// end of if () }// end of while () @@ -391,8 +391,8 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec try { - log( "Calling java2iiop", Project.MSG_VERBOSE ); - log( commandline.toString(), Project.MSG_DEBUG ); + getLogger().debug( "Calling java2iiop" ); + getLogger().debug( commandline.toString() ); execTask.setCommandline( commandline.getCommandline() ); int result = execTask.execute(); if( result != 0 ) @@ -403,7 +403,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec } catch( java.io.IOException e ) { - log( "java2iiop exception :" + e.getMessage(), Project.MSG_ERR ); + getLogger().error( "java2iiop exception :" + e.getMessage() ); throw new TaskException( "Error", e ); } } @@ -421,7 +421,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec //org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient.class ); org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient gentask = null; - log( "generate client for " + sourceJar, Project.MSG_INFO ); + getLogger().info( "generate client for " + sourceJar ); try { String args = verifyArgs; @@ -483,7 +483,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec throws TaskException { org.apache.tools.ant.taskdefs.Java javaTask = null; - log( "verify " + sourceJar, Project.MSG_INFO ); + getLogger().info( "verify " + sourceJar ); try { @@ -501,7 +501,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec javaTask.setFork( true ); } - log( "Calling " + VERIFY + " for " + sourceJar.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "Calling " + VERIFY + " for " + sourceJar.toString() ); javaTask.execute(); } catch( Exception e ) diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java index ad0d585bb..714d685c5 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java @@ -9,7 +9,6 @@ package org.apache.tools.ant.taskdefs.optional.ejb; import java.io.File; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.taskdefs.exec.ExecTask; @@ -121,7 +120,7 @@ public class BorlandGenerateClient extends Task if( clientjarfile == null || clientjarfile.isDirectory() ) { - log( "invalid or missing client jar file.", Project.MSG_VERBOSE ); + getLogger().debug( "invalid or missing client jar file." ); String ejbjarname = ejbjarfile.getAbsolutePath(); //clientname = ejbjarfile+client.jar String clientname = ejbjarname.substring( 0, ejbjarname.lastIndexOf( "." ) ); @@ -181,7 +180,7 @@ public class BorlandGenerateClient extends Task execTask.createArg().setValue( "-clientjarfile" ); execTask.createArg().setValue( clientjarfile.getAbsolutePath() ); - log( "Calling java2iiop", Project.MSG_VERBOSE ); + getLogger().debug( "Calling java2iiop" ); execTask.execute(); } catch( Exception e ) @@ -232,7 +231,7 @@ public class BorlandGenerateClient extends Task execTask.createArg().setValue( "-clientjarfile" ); execTask.createArg().setValue( clientjarfile.getAbsolutePath() ); - log( "Calling EJBUtilities", Project.MSG_VERBOSE ); + getLogger().debug( "Calling EJBUtilities" ); execTask.execute(); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java index 74209fe3f..3a389b301 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java @@ -14,7 +14,8 @@ import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.Hashtable; -import org.apache.tools.ant.Project; +import org.apache.avalon.framework.logger.LogEnabled; +import org.apache.avalon.framework.logger.Logger; import org.apache.tools.ant.Task; import org.xml.sax.AttributeList; import org.xml.sax.InputSource; @@ -30,7 +31,9 @@ import org.xml.sax.SAXException; * * @author RT */ -public class DescriptorHandler extends org.xml.sax.HandlerBase +public class DescriptorHandler + extends org.xml.sax.HandlerBase + implements LogEnabled { private final static int STATE_LOOKING_EJBJAR = 1; private final static int STATE_IN_EJBJAR = 2; @@ -105,6 +108,23 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase */ private File srcDir; + private Logger m_logger; + + /** + * Provide component with a logger. + * + * @param logger the logger + */ + public void enableLogging( Logger logger ) + { + m_logger = logger; + } + + protected final Logger getLogger() + { + return m_logger; + } + public DescriptorHandler( Task task, File srcDir ) { this.owningTask = task; @@ -221,7 +241,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase if( publicId != null ) { fileDTDs.put( publicId, fileDTD ); - owningTask.log( "Mapped publicId " + publicId + " to file " + fileDTD, Project.MSG_VERBOSE ); + getLogger().debug( "Mapped publicId " + publicId + " to file " + fileDTD ); } return; } @@ -231,7 +251,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase if( publicId != null ) { resourceDTDs.put( publicId, location ); - owningTask.log( "Mapped publicId " + publicId + " to resource " + location, Project.MSG_VERBOSE ); + getLogger().debug( "Mapped publicId " + publicId + " to resource " + location ); } } @@ -260,7 +280,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { try { - owningTask.log( "Resolved " + publicId + " to local file " + dtdFile, Project.MSG_VERBOSE ); + getLogger().debug( "Resolved " + publicId + " to local file " + dtdFile ); return new InputSource( new FileInputStream( dtdFile ) ); } catch( FileNotFoundException ex ) @@ -275,7 +295,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase InputStream is = this.getClass().getResourceAsStream( dtdResourceName ); if( is != null ) { - owningTask.log( "Resolved " + publicId + " to local resource " + dtdResourceName, Project.MSG_VERBOSE ); + getLogger().debug( "Resolved " + publicId + " to local resource " + dtdResourceName ); return new InputSource( is ); } } @@ -286,7 +306,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase try { InputStream is = dtdUrl.openStream(); - owningTask.log( "Resolved " + publicId + " to url " + dtdUrl, Project.MSG_VERBOSE ); + getLogger().debug( "Resolved " + publicId + " to url " + dtdUrl ); return new InputSource( is ); } catch( IOException ioe ) @@ -295,8 +315,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase } } - owningTask.log( "Could not resolve ( publicId: " + publicId + ", systemId: " + systemId + ") to a local entity", - Project.MSG_INFO ); + getLogger().info( "Could not resolve ( publicId: " + publicId + ", systemId: " + systemId + ") to a local entity" ); return null; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java index 6c518e1c3..d6e3c63c4 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java @@ -16,7 +16,6 @@ import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.FileSet; @@ -236,7 +235,7 @@ public class EjbJar extends MatchingTask */ public BorlandDeploymentTool createBorland() { - log( "Borland deployment tools", Project.MSG_VERBOSE ); + getLogger().debug( "Borland deployment tools" ); BorlandDeploymentTool tool = new BorlandDeploymentTool(); tool.setTask( this ); @@ -283,7 +282,7 @@ public class EjbJar extends MatchingTask */ public IPlanetDeploymentTool createIplanet() { - log( "iPlanet Application Server deployment tools", Project.MSG_VERBOSE ); + getLogger().debug( "iPlanet Application Server deployment tools" ); IPlanetDeploymentTool tool = new IPlanetDeploymentTool(); tool.setTask( this ); @@ -403,8 +402,7 @@ public class EjbJar extends MatchingTask ds.scan(); String[] files = ds.getIncludedFiles(); - log( files.length + " deployment descriptors located.", - Project.MSG_VERBOSE ); + getLogger().debug( files.length + " deployment descriptors located." ); // Loop through the files. Each file represents one deployment // descriptor, and hence one bean in our model. diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java index c0f20003e..f41199d45 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java @@ -23,6 +23,7 @@ import java.util.jar.JarOutputStream; import java.util.jar.Manifest; import java.util.zip.ZipEntry; import javax.xml.parsers.SAXParser; +import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.bcel.*; import org.apache.bcel.classfile.*; import org.apache.myrmidon.api.TaskException; @@ -46,7 +47,9 @@ import org.xml.sax.SAXException; * * @author RT */ -public class GenericDeploymentTool implements EJBDeploymentTool +public class GenericDeploymentTool + extends AbstractLogEnabled + implements EJBDeploymentTool { /** * Private constants that are used when constructing the standard jarfile @@ -250,12 +253,9 @@ public class GenericDeploymentTool implements EJBDeploymentTool if( needToRebuild( ejbFiles, jarFile ) ) { // Log that we are going to build... - log( "building " - + jarFile.getName() - + " with " - + String.valueOf( ejbFiles.size() ) - + " files", - Project.MSG_INFO ); + final String message = + "building " + jarFile.getName() + " with " + String.valueOf( ejbFiles.size() ) + " files"; + getLogger().info( message ); // Use helper method to write the jarfile String publicId = getPublicId(); @@ -265,8 +265,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool else { // Log that the file is up to date... - log( jarFile.toString() + " is up to date.", - Project.MSG_VERBOSE ); + getLogger().debug( jarFile.toString() + " is up to date." ); } } @@ -525,9 +524,10 @@ public class GenericDeploymentTool implements EJBDeploymentTool } catch( IOException ioe ) { - log( "WARNING: IOException while adding entry " + - logicalFilename + " to jarfile from " + inputFile.getPath() + " " + - ioe.getClass().getName() + "-" + ioe.getMessage(), Project.MSG_WARN ); + final String message = "WARNING: IOException while adding entry " + + logicalFilename + " to jarfile from " + inputFile.getPath() + " " + + ioe.getClass().getName() + "-" + ioe.getMessage(); + getLogger().warn( message ); } finally { @@ -619,7 +619,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool } catch( IOException e ) { - log( "exception: " + e.getMessage(), Project.MSG_INFO ); + getLogger().info( "exception: " + e.getMessage() ); } } newSet.clear(); @@ -644,7 +644,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool { String next = ( (String)i.next() ).replace( '/', File.separatorChar ); checkEntries.put( next + ".class", new File( base + next + ".class" ) ); - log( "dependent class: " + next + ".class" + " - " + base + next + ".class", Project.MSG_VERBOSE ); + getLogger().debug( "dependent class: " + next + ".class" + " - " + base + next + ".class" ); } } @@ -701,8 +701,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool if( config.manifest != null && config.manifest.exists() && config.manifest.lastModified() > lastBuild ) { - log( "Build needed because manifest " + config.manifest + " is out of date", - Project.MSG_VERBOSE ); + getLogger().debug( "Build needed because manifest " + config.manifest + " is out of date" ); return true; } @@ -715,8 +714,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool File currentFile = (File)fileIter.next(); if( lastBuild < currentFile.lastModified() ) { - log( "Build needed because " + currentFile.getPath() + " is out of date", - Project.MSG_VERBOSE ); + getLogger().debug( "Build needed because " + currentFile.getPath() + " is out of date" ); return true; } } @@ -887,8 +885,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool String entryName = (String)entryIterator.next(); File entryFile = (File)files.get( entryName ); - log( "adding file '" + entryName + "'", - Project.MSG_VERBOSE ); + getLogger().debug( "adding file '" + entryName + "'" ); addFileToJar( jarStream, entryFile, entryName ); @@ -912,8 +909,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool // link the file entryFile = new File( config.srcDir, entryName ); - log( "adding innerclass file '" + entryName + "'", - Project.MSG_VERBOSE ); + getLogger().debug( "adding innerclass file '" + entryName + "'" ); addFileToJar( jarStream, entryFile, entryName ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetDeploymentTool.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetDeploymentTool.java index a75fd7d9b..6bc7e37e1 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetDeploymentTool.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetDeploymentTool.java @@ -12,7 +12,6 @@ import java.io.IOException; import java.util.Hashtable; import javax.xml.parsers.SAXParser; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.xml.sax.SAXException; /** @@ -120,10 +119,10 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool */ public void setGenericJarSuffix( String inString ) { - log( "Since a generic JAR file is not created during processing, the " - + "iPlanet Deployment Tool does not support the " - + "\"genericjarsuffix\" attribute. It will be ignored.", - Project.MSG_WARN ); + final String message = "Since a generic JAR file is not created during processing, the " + + "iPlanet Deployment Tool does not support the " + + "\"genericjarsuffix\" attribute. It will be ignored."; + getLogger().warn( message ); } /** @@ -166,8 +165,7 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool { this.descriptorName = descriptorName; - log( "iPlanet Deployment Tool processing: " + descriptorName + " (and " - + getIasDescriptorName() + ")", Project.MSG_VERBOSE ); + getLogger().debug( "iPlanet Deployment Tool processing: " + descriptorName + " (and " + getIasDescriptorName() + ")" ); super.processDescriptor( descriptorName, saxParser ); } @@ -334,7 +332,7 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool File getVendorOutputJarFile( String baseName ) { File jarFile = new File( getDestDir(), baseName + jarSuffix ); - log( "JAR file name: " + jarFile.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "JAR file name: " + jarFile.toString() ); return jarFile; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java index 049c70f63..fd2e21c43 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java @@ -9,7 +9,6 @@ package org.apache.tools.ant.taskdefs.optional.ejb; import java.io.File; import java.util.Hashtable; -import org.apache.tools.ant.Project; /** * The deployment tool to add the jboss specific deployment descriptor to the @@ -45,7 +44,7 @@ public class JbossDeploymentTool extends GenericDeploymentTool } else { - log( "Unable to locate jboss deployment descriptor. It was expected to be in " + jbossDD.getPath(), Project.MSG_WARN ); + getLogger().warn( "Unable to locate jboss deployment descriptor. It was expected to be in " + jbossDD.getPath() ); return; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java index 6335a4fd0..44c01e4ae 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java @@ -22,7 +22,6 @@ import javax.xml.parsers.SAXParserFactory; import org.apache.avalon.excalibur.io.FileUtil; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.AntClassLoader; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.types.Path; import org.xml.sax.InputSource; @@ -407,8 +406,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool try { - log( "Checking if weblogic Jar needs to be rebuilt for jar " + weblogicJarFile.getName(), - Project.MSG_VERBOSE ); + getLogger().debug( "Checking if weblogic Jar needs to be rebuilt for jar " + weblogicJarFile.getName() ); // Only go forward if the generic and the weblogic file both exist if( genericJarFile.exists() && genericJarFile.isFile() && weblogicJarFile.exists() && weblogicJarFile.isFile() ) @@ -458,7 +456,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool if( genclass.isInterface() ) { //Interface changed rebuild jar. - log( "Interface " + genclass.getName() + " has changed", Project.MSG_VERBOSE ); + getLogger().debug( "Interface " + genclass.getName() + " has changed" ); rebuild = true; break; } @@ -474,7 +472,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool if( !genericEntry.getName().equals( "META-INF/MANIFEST.MF" ) ) { //File other then class changed rebuild - log( "Non class file " + genericEntry.getName() + " has changed", Project.MSG_VERBOSE ); + getLogger().debug( "Non class file " + genericEntry.getName() + " has changed" ); rebuild = true; break; } @@ -484,7 +482,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool else {// a file doesnt exist rebuild - log( "File " + filepath + " not present in weblogic jar", Project.MSG_VERBOSE ); + getLogger().debug( "File " + filepath + " not present in weblogic jar" ); rebuild = true; break; } @@ -492,7 +490,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool if( !rebuild ) { - log( "No rebuild needed - updating jar", Project.MSG_VERBOSE ); + getLogger().debug( "No rebuild needed - updating jar" ); newWLJarFile = new File( weblogicJarFile.getAbsolutePath() + ".temp" ); if( newWLJarFile.exists() ) { @@ -522,7 +520,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool // Update with changed Bean class if( replaceEntries.containsKey( je.getName() ) ) { - log( "Updating Bean class from generic Jar " + je.getName(), Project.MSG_VERBOSE ); + getLogger().debug( "Updating Bean class from generic Jar " + je.getName() ); // Use the entry from the generic jar je = (JarEntry)replaceEntries.get( je.getName() ); is = genericJar.getInputStream( je ); @@ -543,7 +541,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool } else { - log( "Weblogic Jar rebuild needed due to changed interface or XML", Project.MSG_VERBOSE ); + getLogger().debug( "Weblogic Jar rebuild needed due to changed interface or XML" ); } } else @@ -629,16 +627,16 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool } else { - log( "Unable to locate weblogic deployment descriptor. It was expected to be in " + - weblogicDD.getPath(), Project.MSG_WARN ); + final String message = "Unable to locate weblogic deployment descriptor. It was expected to be in " + + weblogicDD.getPath(); + getLogger().warn( message ); return; } if( !newCMP ) { - log( "The old method for locating CMP files has been DEPRECATED.", Project.MSG_VERBOSE ); - log( "Please adjust your weblogic descriptor and set newCMP=\"true\" " + - "to use the new CMP descriptor inclusion mechanism. ", Project.MSG_VERBOSE ); + getLogger().debug( "The old method for locating CMP files has been DEPRECATED." ); + getLogger().debug( "Please adjust your weblogic descriptor and set newCMP=\"true\" " + "to use the new CMP descriptor inclusion mechanism. " ); // The the weblogic cmp deployment descriptor File weblogicCMPDD = new File( getConfig().descriptorDir, ddPrefix + WL_CMP_DD ); @@ -716,8 +714,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool } if( !keepGeneric ) { - log( "deleting generic jar " + genericJarFile.toString(), - Project.MSG_VERBOSE ); + getLogger().debug( "deleting generic jar " + genericJarFile.toString() ); genericJarFile.delete(); } } @@ -791,7 +788,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool } else { - log( "Unrecognized publicId " + publicId + " - using EJB 1.1 compiler", Project.MSG_WARN ); + getLogger().warn( "Unrecognized publicId " + publicId + " - using EJB 1.1 compiler" ); ejbcClassName = COMPILER_EJB11; } } @@ -836,8 +833,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool javaTask.setClasspath( classpath ); } - log( "Calling " + ejbcClassName + " for " + sourceJar.toString(), - Project.MSG_VERBOSE ); + getLogger().debug( "Calling " + ejbcClassName + " for " + sourceJar.toString() ); if( javaTask.executeJava() != 0 ) { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicTOPLinkDeploymentTool.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicTOPLinkDeploymentTool.java index 8242396b1..29e255a5c 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicTOPLinkDeploymentTool.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicTOPLinkDeploymentTool.java @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs.optional.ejb; import java.io.File; import java.util.Hashtable; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool { @@ -98,8 +97,9 @@ public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool } else { - log( "Unable to locate toplink deployment descriptor. It was expected to be in " + - toplinkDD.getPath(), Project.MSG_WARN ); + final String message = "Unable to locate toplink deployment descriptor. It was expected to be in " + + toplinkDD.getPath(); + getLogger().warn( message ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java index 158e50f4c..9a8f6de05 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java @@ -18,7 +18,6 @@ import java.util.jar.JarFile; import java.util.jar.JarOutputStream; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.AntClassLoader; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.types.Argument; import org.apache.tools.ant.types.EnumeratedAttribute; @@ -30,8 +29,8 @@ import org.apache.tools.ant.types.Path; * * @author Maneesh Sahu */ - -public class WebsphereDeploymentTool extends GenericDeploymentTool +public class WebsphereDeploymentTool + extends GenericDeploymentTool { public final static String PUBLICID_EJB11 @@ -541,8 +540,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool JarOutputStream newJarStream = null; try { - log( "Checking if websphere Jar needs to be rebuilt for jar " + websphereJarFile.getName(), - Project.MSG_VERBOSE ); + getLogger().debug( "Checking if websphere Jar needs to be rebuilt for jar " + websphereJarFile.getName() ); // Only go forward if the generic and the websphere file both exist @@ -604,7 +602,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool //Interface changed rebuild jar. - log( "Interface " + genclass.getName() + " has changed", Project.MSG_VERBOSE ); + getLogger().debug( "Interface " + genclass.getName() + " has changed" ); rebuild = true; break; } @@ -623,7 +621,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool //File other then class changed rebuild - log( "Non class file " + genericEntry.getName() + " has changed", Project.MSG_VERBOSE ); + getLogger().debug( "Non class file " + genericEntry.getName() + " has changed" ); rebuild = true; } break; @@ -632,14 +630,14 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool } else {// a file doesnt exist rebuild - log( "File " + filepath + " not present in websphere jar", Project.MSG_VERBOSE ); + getLogger().debug( "File " + filepath + " not present in websphere jar" ); rebuild = true; break; } } if( !rebuild ) { - log( "No rebuild needed - updating jar", Project.MSG_VERBOSE ); + getLogger().debug( "No rebuild needed - updating jar" ); newwasJarFile = new File( websphereJarFile.getAbsolutePath() + ".temp" ); if( newwasJarFile.exists() ) { @@ -674,8 +672,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool if( replaceEntries.containsKey( je.getName() ) ) { - log( "Updating Bean class from generic Jar " + je.getName(), - Project.MSG_VERBOSE ); + getLogger().debug( "Updating Bean class from generic Jar " + je.getName() ); // Use the entry from the generic jar @@ -699,7 +696,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool } else { - log( "websphere Jar rebuild needed due to changed interface or XML", Project.MSG_VERBOSE ); + getLogger().debug( "websphere Jar rebuild needed due to changed interface or XML" ); } } else @@ -789,8 +786,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool } else { - log( "Unable to locate websphere extensions. It was expected to be in " + - websphereEXT.getPath(), Project.MSG_VERBOSE ); + getLogger().debug( "Unable to locate websphere extensions. It was expected to be in " + websphereEXT.getPath() ); } File websphereBND = new File( getConfig().descriptorDir, ddPrefix + WAS_BND ); if( websphereBND.exists() ) @@ -800,14 +796,12 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool } else { - log( "Unable to locate websphere bindings. It was expected to be in " + - websphereBND.getPath(), Project.MSG_VERBOSE ); + getLogger().debug( "Unable to locate websphere bindings. It was expected to be in " + websphereBND.getPath() ); } if( !newCMP ) { - log( "The old method for locating CMP files has been DEPRECATED.", Project.MSG_VERBOSE ); - log( "Please adjust your websphere descriptor and set newCMP=\"true\" " + - "to use the new CMP descriptor inclusion mechanism. ", Project.MSG_VERBOSE ); + getLogger().debug( "The old method for locating CMP files has been DEPRECATED." ); + getLogger().debug( "Please adjust your websphere descriptor and set newCMP=\"true\" " + "to use the new CMP descriptor inclusion mechanism. " ); } else { @@ -828,8 +822,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool } else { - log( "Unable to locate the websphere Map: " + - websphereMAP.getPath(), Project.MSG_VERBOSE ); + getLogger().debug( "Unable to locate the websphere Map: " + websphereMAP.getPath() ); } File websphereSchema = new File( getConfig().descriptorDir, ddPrefix + dbPrefix + WAS_CMP_SCHEMA ); @@ -840,8 +833,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool } else { - log( "Unable to locate the websphere Schema: " + - websphereSchema.getPath(), Project.MSG_VERBOSE ); + getLogger().debug( "Unable to locate the websphere Schema: " + websphereSchema.getPath() ); } // Theres nothing else to see here...keep moving sonny @@ -884,8 +876,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool } if( !keepGeneric ) { - log( "deleting generic jar " + genericJarFile.toString(), - Project.MSG_VERBOSE ); + getLogger().debug( "deleting generic jar " + genericJarFile.toString() ); genericJarFile.delete(); } } @@ -953,7 +944,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool // Why do my ""'s get stripped away??? - log( "EJB Deploy Options: " + args, Project.MSG_VERBOSE ); + getLogger().debug( "EJB Deploy Options: " + args ); Java javaTask = (Java)getTask().getProject().createTask( "java" ); // Set the JvmArgs @@ -997,8 +988,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool { javaTask.setFork( true ); } - log( "Calling websphere.ejbdeploy for " + sourceJar.toString(), - Project.MSG_VERBOSE ); + getLogger().debug( "Calling websphere.ejbdeploy for " + sourceJar.toString() ); javaTask.execute(); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java index f546cda76..0eee46df5 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java @@ -21,7 +21,6 @@ import java.util.Locale; import org.apache.avalon.excalibur.io.FileUtil; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.types.FileSet; @@ -484,12 +483,12 @@ public class Translate extends MatchingTask ins = new FileInputStream( bundleFile ); loaded = true; bundleLastModified[ i ] = new File( bundleFile ).lastModified(); - log( "Using " + bundleFile, Project.MSG_DEBUG ); + getLogger().debug( "Using " + bundleFile ); loadResourceMap( ins ); } catch( IOException ioe ) { - log( bundleFile + " not found.", Project.MSG_DEBUG ); + getLogger().debug( bundleFile + " not found." ); //if all resource files associated with this bundle //have been scanned for and still not able to //find a single resrouce file, throw exception @@ -536,9 +535,7 @@ public class Translate extends MatchingTask } catch( Exception e ) { - log( "Exception occured while trying to check/create " - + " parent directory. " + e.getMessage(), - Project.MSG_DEBUG ); + getLogger().debug( "Exception occured while trying to check/create " + " parent directory. " + e.getMessage() ); } destLastModified = dest.lastModified(); srcLastModified = new File( srcFiles[ i ] ).lastModified(); @@ -553,8 +550,7 @@ public class Translate extends MatchingTask || destLastModified < bundleLastModified[ 5 ] || destLastModified < bundleLastModified[ 6 ] ) { - log( "Processing " + srcFiles[ j ], - Project.MSG_DEBUG ); + getLogger().debug( "Processing " + srcFiles[ j ] ); FileOutputStream fos = new FileOutputStream( dest ); BufferedWriter out = new BufferedWriter( new OutputStreamWriter( fos, @@ -604,9 +600,7 @@ public class Translate extends MatchingTask //use the key itself as the value also. if( replace == null ) { - log( "Warning: The key: " + matches - + " hasn't been defined.", - Project.MSG_DEBUG ); + getLogger().debug( "Warning: The key: " + matches + " hasn't been defined." ); replace = matches; } line = line.substring( 0, startIndex ) @@ -632,9 +626,7 @@ public class Translate extends MatchingTask } else { - log( "Skipping " + srcFiles[ j ] + - " as destination file is up to date", - Project.MSG_VERBOSE ); + getLogger().debug( "Skipping " + srcFiles[ j ] + " as destination file is up to date" ); } } catch( IOException ioe ) diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJLocalUtil.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJLocalUtil.java index 867a4ebc9..0ff76723f 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJLocalUtil.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJLocalUtil.java @@ -162,7 +162,7 @@ abstract class VAJLocalUtil implements VAJUtil + dest, MSG_INFO ); for( int i = 0; i < packages.length; i++ ) { - log( " " + packages[ i ].getName(), MSG_VERBOSE ); + getLogger().debug( " " + packages[ i ].getName() ); } ExportCodeSpec exportSpec = new ExportCodeSpec(); @@ -246,7 +246,7 @@ abstract class VAJLocalUtil implements VAJUtil summaryLog.append( importProject ); summaryLog.append( "'." ); - log( summaryLog.toString(), MSG_INFO ); + getLogger().info( summaryLog.toString() ); try { @@ -257,7 +257,7 @@ abstract class VAJLocalUtil implements VAJUtil } else { - log( importedTypes.length + " types imported", MSG_DEBUG ); + getLogger().debug( importedTypes.length + " types imported" ); for( int i = 0; i < importedTypes.length; i++ ) { log( importedTypes[ i ].getPackage().getName() @@ -294,7 +294,7 @@ abstract class VAJLocalUtil implements VAJUtil VAJProjectDescription d = (VAJProjectDescription)e.next(); if( !d.projectFound() ) { - log( "No Projects match the name " + d.getName(), MSG_WARN ); + getLogger().warn( "No Projects match the name " + d.getName() ); } } @@ -483,10 +483,10 @@ abstract class VAJLocalUtil implements VAJUtil */ private void logFiles( ArrayList fileNames, String fileType ) { - log( fileType + " files found for import:", MSG_VERBOSE ); + getLogger().debug( fileType + " files found for import:" ); for( Iterator e = fileNames.iterator(); e.hasNext(); ) { - log( " " + e.next(), MSG_VERBOSE ); + getLogger().debug( " " + e.next() ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJRemoteUtil.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJRemoteUtil.java index 0b36ef344..709271293 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJRemoteUtil.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJRemoteUtil.java @@ -208,7 +208,7 @@ class VAJRemoteUtil implements VAJUtil boolean requestFailed = false; try { - log( "Request: " + request, MSG_DEBUG ); + getLogger().debug( "Request: " + request ); //must be HTTP connection URL requestUrl = new URL( request ); @@ -230,7 +230,7 @@ class VAJRemoteUtil implements VAJUtil } if( is == null ) { - log( "Can't get " + request, MSG_ERR ); + getLogger().error( "Can't get " + request ); throw new TaskException( "Couldn't execute " + request ); } @@ -251,7 +251,7 @@ class VAJRemoteUtil implements VAJUtil } catch( Exception e ) { - log( "Response line doesn't contain log level!", MSG_ERR ); + getLogger().error( "Response line doesn't contain log level!" ); } log( line.substring( 2 ), level ); line = br.readLine(); @@ -260,7 +260,7 @@ class VAJRemoteUtil implements VAJUtil } catch( IOException ex ) { - log( "Error sending tool request to VAJ" + ex, MSG_ERR ); + getLogger().error( "Error sending tool request to VAJ" + ex ); throw new TaskException( "Couldn't execute " + request ); } if( requestFailed ) diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJToolsServlet.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJToolsServlet.java index b42291996..90186ed0c 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJToolsServlet.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJToolsServlet.java @@ -65,7 +65,7 @@ public abstract class VAJToolsServlet extends HttpServlet } catch( TaskException e ) { - util.log( "Error occured: " + e.getMessage(), VAJUtil.MSG_ERR ); + util.getLogger().error( "Error occured: " + e.getMessage() ); } catch( Exception e ) { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java index 0472bcebc..bcc57a97b 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java @@ -188,7 +188,7 @@ public class JJTree extends Task exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); exe.setError( new LogOutputStream( this, Project.MSG_INFO ) ); - log( cmdl.toString(), Project.MSG_VERBOSE ); + getLogger().debug( cmdl.toString() ); exe.setCommandline( cmdl.getCommandline() ); try diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java index a1af36355..69a4821e6 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java @@ -11,7 +11,6 @@ import java.io.File; import java.util.Enumeration; import java.util.Hashtable; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.exec.Execute; import org.apache.tools.ant.types.Argument; @@ -216,7 +215,7 @@ public class JavaCC extends Task final File javaFile = getOutputJavaFile( outputDirectory, target ); if( javaFile.exists() && target.lastModified() < javaFile.lastModified() ) { - log( "Target is already built - skipping (" + target + ")", Project.MSG_VERBOSE ); + getLogger().debug( "Target is already built - skipping (" + target + ")" ); return; } cmdl.createArgument().setValue( target.getAbsolutePath() ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java index f7f0ca520..ec52643a7 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java @@ -275,7 +275,7 @@ public class JDependTask extends Task if( getHaltonerror() ) throw new TaskException( "JDepend failed" ); else - log( "JDepend FAILED", Project.MSG_ERR ); + getLogger().error( "JDepend FAILED" ); } } @@ -339,7 +339,7 @@ public class JDependTask extends Task if( getOutputFile() != null ) getLogger().info( "Output to be stored in " + getOutputFile().getPath() ); - log( "Executing: " + commandline.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "Executing: " + commandline.toString() ); try { return exe.execute(); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java index 8b224e80c..6f32d7660 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java @@ -9,7 +9,6 @@ package org.apache.tools.ant.taskdefs.optional.jlink; import java.io.File; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.types.Path; @@ -158,18 +157,18 @@ public class JlinkTask extends MatchingTask throw new TaskException( "addfiles or mergefiles required! Please set." ); } getLogger().info( "linking: " + outfile.getPath() ); - log( "compression: " + compress, Project.MSG_VERBOSE ); + getLogger().debug( "compression: " + compress ); jlink linker = new jlink(); linker.setOutfile( outfile.getPath() ); linker.setCompression( compress ); if( haveMergeFiles() ) { - log( "merge files: " + mergefiles.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "merge files: " + mergefiles.toString() ); linker.addMergeFiles( mergefiles.list() ); } if( haveAddFiles() ) { - log( "add files: " + addfiles.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "add files: " + addfiles.toString() ); linker.addAddFiles( addfiles.list() ); } try diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java index 1ad7c48d2..bd9f9d7d2 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java @@ -12,7 +12,6 @@ import java.util.ArrayList; import java.util.Date; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.taskdefs.optional.jsp.compilers.CompilerAdapter; import org.apache.tools.ant.taskdefs.optional.jsp.compilers.CompilerAdapterFactory; @@ -381,7 +380,7 @@ public class JspC extends MatchingTask { compiler = "jasper"; } - log( "compiling " + compileList.size() + " files", Project.MSG_VERBOSE ); + getLogger().debug( "compiling " + compileList.size() + " files" ); if( compileList.size() > 0 ) { @@ -405,7 +404,7 @@ public class JspC extends MatchingTask } else { - log( FAIL_MSG, Project.MSG_ERR ); + getLogger().error( FAIL_MSG ); } } } @@ -413,11 +412,11 @@ public class JspC extends MatchingTask { if( filecount == 0 ) { - log( "there were no files to compile", Project.MSG_INFO ); + getLogger().info( "there were no files to compile" ); } else { - log( "all files are up to date", Project.MSG_VERBOSE ); + getLogger().debug( "all files are up to date" ); } } } @@ -462,8 +461,9 @@ public class JspC extends MatchingTask if( srcFile.lastModified() > now ) { - log( "Warning: file modified in the future: " + - files[ i ], Project.MSG_WARN ); + final String message = + "Warning: file modified in the future: " + files[ i ]; + getLogger().warn( message ); } if( !javaFile.exists() || @@ -471,16 +471,11 @@ public class JspC extends MatchingTask { if( !javaFile.exists() ) { - log( "Compiling " + srcFile.getPath() + - " because java file " - + javaFile.getPath() + " does not exist", - Project.MSG_DEBUG ); + getLogger().debug( "Compiling " + srcFile.getPath() + " because java file " + javaFile.getPath() + " does not exist" ); } else { - log( "Compiling " + srcFile.getPath() + - " because it is out of date with respect to " - + javaFile.getPath(), Project.MSG_DEBUG ); + getLogger().debug( "Compiling " + srcFile.getPath() + " because it is out of date with respect to " + javaFile.getPath() ); } compileList.add( srcFile.getAbsolutePath() ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java index 2c3fcd39f..4aa3473cb 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java @@ -13,7 +13,6 @@ import java.util.Date; import java.util.StringTokenizer; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.types.Path; @@ -233,7 +232,7 @@ public class WLJspc extends MatchingTask helperTask.setClasspath( compileClasspath ); if( helperTask.executeJava() != 0 ) { - log( files[ i ] + " failed to compile", Project.MSG_WARN ); + getLogger().warn( files[ i ] + " failed to compile" ); } } } @@ -295,14 +294,14 @@ public class WLJspc extends MatchingTask if( srcFile.lastModified() > now ) { - log( "Warning: file modified in the future: " + - files[ i ], Project.MSG_WARN ); + final String message = "Warning: file modified in the future: " + files[ i ]; + getLogger().warn( message ); } if( srcFile.lastModified() > classFile.lastModified() ) { //log("Files are" + srcFile.getAbsolutePath()+" " +classFile.getAbsolutePath()); filesToDo.add( files[ i ] ); - log( "Recompiling File " + files[ i ], Project.MSG_VERBOSE ); + getLogger().debug( "Recompiling File " + files[ i ] ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultCompilerAdapter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultCompilerAdapter.java index 7a94f5d65..50dc0ec2c 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultCompilerAdapter.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultCompilerAdapter.java @@ -9,7 +9,7 @@ package org.apache.tools.ant.taskdefs.optional.jsp.compilers; import java.util.ArrayList; import java.util.Iterator; -import org.apache.tools.ant.Project; +import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.tools.ant.taskdefs.optional.jsp.JspC; import org.apache.tools.ant.types.Commandline; @@ -20,6 +20,7 @@ import org.apache.tools.ant.types.Commandline; * @author Matthew Watson mattw@i3sp.com */ public abstract class DefaultCompilerAdapter + extends AbstractLogEnabled implements CompilerAdapter { /* @@ -56,7 +57,7 @@ public abstract class DefaultCompilerAdapter ArrayList compileList, Commandline cmd ) { - jspc.log( "Compilation args: " + cmd.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "Compilation args: " + cmd.toString() ); StringBuffer niceSourceList = new StringBuffer( "File" ); if( compileList.size() != 1 ) @@ -75,10 +76,7 @@ public abstract class DefaultCompilerAdapter niceSourceList.append( " " + arg + lSep ); } - jspc.log( niceSourceList.toString(), Project.MSG_VERBOSE ); + getLogger().debug( niceSourceList.toString() ); } - /* - * ------------------------------------------------------------ - */ } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java index 14c7ecdfe..a15c6f92f 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java @@ -8,7 +8,6 @@ package org.apache.tools.ant.taskdefs.optional.jsp.compilers; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.taskdefs.optional.jsp.JspC; import org.apache.tools.ant.types.Commandline; @@ -28,7 +27,7 @@ public class JasperC public boolean execute() throws TaskException { - getJspc().log( "Using jasper compiler", Project.MSG_VERBOSE ); + getLogger().debug( "Using jasper compiler" ); Commandline cmd = setupJasperCommand(); try diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java index 65b455a11..cfff350e5 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java @@ -17,7 +17,6 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.apache.avalon.excalibur.io.FileUtil; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.EnumeratedAttribute; import org.w3c.dom.Document; @@ -83,7 +82,7 @@ public class AggregateTransformer */ public void setExtension( String ext ) { - task.log( "extension is not used anymore", Project.MSG_WARN ); + task.getLogger().warn( "extension is not used anymore" ); } public void setFormat( Format format ) diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java index 3610e1efb..41f11aad9 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java @@ -465,27 +465,24 @@ public class JUnitTask extends Task { int pling = u.indexOf( "!" ); String jarName = u.substring( 9, pling ); - log( "Implicitly adding " + jarName + " to classpath", - Project.MSG_DEBUG ); + getLogger().debug( "Implicitly adding " + jarName + " to classpath" ); createClasspath().setLocation( new File( ( new File( jarName ) ).getAbsolutePath() ) ); } else if( u.startsWith( "file:" ) ) { int tail = u.indexOf( resource ); String dirName = u.substring( 5, tail ); - log( "Implicitly adding " + dirName + " to classpath", - Project.MSG_DEBUG ); + getLogger().debug( "Implicitly adding " + dirName + " to classpath" ); createClasspath().setLocation( new File( ( new File( dirName ) ).getAbsolutePath() ) ); } else { - log( "Don\'t know how to handle resource URL " + u, - Project.MSG_DEBUG ); + getLogger().debug( "Don\'t know how to handle resource URL " + u ); } } else { - log( "Couldn\'t find " + resource, Project.MSG_DEBUG ); + getLogger().debug( "Couldn\'t find " + resource ); } } @@ -542,8 +539,9 @@ public class JUnitTask extends Task } else { - log( "TEST " + test.getName() + " FAILED" - + ( wasKilled ? " (timeout)" : "" ), Project.MSG_ERR ); + final String message = "TEST " + test.getName() + " FAILED" + + ( wasKilled ? " (timeout)" : "" ); + getLogger().error( message ); if( errorOccurredHere && test.getErrorProperty() != null ) { setProperty( test.getErrorProperty(), "true" ); @@ -609,7 +607,7 @@ public class JUnitTask extends Task cmd.createArgument().setValue( "haltOnFailure=" + test.getHaltonfailure() ); if( summary ) { - log( "Running " + test.getName(), Project.MSG_INFO ); + getLogger().info( "Running " + test.getName() ); cmd.createArgument().setValue( "formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter" ); } @@ -661,7 +659,7 @@ public class JUnitTask extends Task exe.setWorkingDirectory( dir ); } - log( "Executing: " + cmd.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "Executing: " + cmd.toString() ); int retVal; try { @@ -693,7 +691,7 @@ public class JUnitTask extends Task test.setProperties( getProject().getProperties() ); if( dir != null ) { - log( "dir attribute ignored if running in the same VM", Project.MSG_WARN ); + getLogger().warn( "dir attribute ignored if running in the same VM" ); } CommandlineJava.SysProperties sysProperties = commandline.getSystemProperties(); @@ -703,12 +701,12 @@ public class JUnitTask extends Task } try { - log( "Using System properties " + System.getProperties(), Project.MSG_VERBOSE ); + getLogger().debug( "Using System properties " + System.getProperties() ); AntClassLoader cl = null; Path classpath = commandline.getClasspath(); if( classpath != null ) { - log( "Using CLASSPATH " + classpath, Project.MSG_VERBOSE ); + getLogger().debug( "Using CLASSPATH " + classpath ); cl = new AntClassLoader( null, getProject(), classpath, false ); // make sure the test will be accepted as a TestCase @@ -719,7 +717,7 @@ public class JUnitTask extends Task runner = new JUnitTestRunner( test, test.getHaltonerror(), test.getFiltertrace(), test.getHaltonfailure(), cl ); if( summary ) { - log( "Running " + test.getName(), Project.MSG_INFO ); + getLogger().info( "Running " + test.getName() ); SummaryJUnitResultFormatter f = new SummaryJUnitResultFormatter(); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java index c7f5e2ff1..12d0f4191 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java @@ -21,7 +21,6 @@ import org.apache.avalon.excalibur.io.FileUtil; import org.apache.avalon.framework.ExceptionUtil; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.util.DOMElementWriter; @@ -275,7 +274,7 @@ public class XMLResultAggregator extends Task implements XMLConstants { try { - log( "Parsing file: '" + files[ i ] + "'", Project.MSG_VERBOSE ); + getLogger().debug( "Parsing file: '" + files[ i ] + "'" ); //XXX there seems to be a bug in xerces 1.3.0 that doesn't like file object // will investigate later. It does not use the given directory but // the vm dir instead ? Works fine with crimson. @@ -289,19 +288,19 @@ public class XMLResultAggregator extends Task implements XMLConstants else { // issue a warning. - log( "the file " + files[ i ] + " is not a valid testsuite XML document", Project.MSG_WARN ); + getLogger().warn( "the file " + files[ i ] + " is not a valid testsuite XML document" ); } } catch( SAXException e ) { // a testcase might have failed and write a zero-length document, // It has already failed, but hey.... mm. just put a warning - log( "The file " + files[ i ] + " is not a valid XML document. It is possibly corrupted.", Project.MSG_WARN ); - log( ExceptionUtil.printStackTrace( e ), Project.MSG_DEBUG ); + getLogger().warn( "The file " + files[ i ] + " is not a valid XML document. It is possibly corrupted." ); + getLogger().debug( ExceptionUtil.printStackTrace( e ) ); } catch( IOException e ) { - log( "Error while accessing file " + files[ i ] + ": " + e.getMessage(), Project.MSG_ERR ); + getLogger().error( "Error while accessing file " + files[ i ] + ": " + e.getMessage() ); } } return rootElement; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java index a2d367bcc..e9e073498 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java @@ -229,7 +229,7 @@ public abstract class AbstractMetamataTask extends Task // retrieve all the files we want to scan includedFiles = scanFileSets(); - log( includedFiles.size() + " files added for audit", Project.MSG_VERBOSE ); + getLogger().debug( includedFiles.size() + " files added for audit" ); // write all the options to a temp file and use it ro run the process ArrayList options = getOptions(); @@ -314,7 +314,7 @@ public abstract class AbstractMetamataTask extends Task { final Execute exe = new Execute(); setupStreamHandler( exe ); - log( cmdl.toString(), Project.MSG_VERBOSE ); + getLogger().debug( cmdl.toString() ); exe.setCommandline( cmdl.getCommandline() ); try { @@ -376,7 +376,7 @@ public abstract class AbstractMetamataTask extends Task DirectoryScanner ds = fs.getDirectoryScanner( getProject() ); ds.scan(); String[] f = ds.getIncludedFiles(); - log( i + ") Adding " + f.length + " files from directory " + ds.getBasedir(), Project.MSG_VERBOSE ); + getLogger().debug( i + ") Adding " + f.length + " files from directory " + ds.getBasedir() ); for( int j = 0; j < f.length; j++ ) { String pathname = f[ j ]; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java index dfef114ce..e0dbcbbf1 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java @@ -200,7 +200,7 @@ public class MAudit extends AbstractMetamataTask } if( !unused && searchPath != null ) { - log( "'searchpath' element ignored. 'unused' attribute is disabled.", Project.MSG_WARN ); + getLogger().warn( "'searchpath' element ignored. 'unused' attribute is disabled." ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MAuditStreamHandler.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MAuditStreamHandler.java index 9b4b409b1..18f1b0b2a 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MAuditStreamHandler.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MAuditStreamHandler.java @@ -19,7 +19,6 @@ import java.util.Hashtable; import java.util.Iterator; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler; import org.apache.tools.ant.util.DOMElementWriter; import org.apache.tools.ant.util.regexp.RegexpMatcher; @@ -157,7 +156,7 @@ class MAuditStreamHandler implements ExecuteStreamHandler String fullclassname = (String)filemapping.get( filepath ); if( fullclassname == null ) { - task.log( "Could not find class mapping for " + filepath, Project.MSG_WARN ); + task.getLogger().warn( "Could not find class mapping for " + filepath ); continue; } int pos = fullclassname.lastIndexOf( '.' ); @@ -193,7 +192,7 @@ class MAuditStreamHandler implements ExecuteStreamHandler } catch( IOException exc ) { - task.log( "Unable to write log file", Project.MSG_ERR ); + task.getLogger().error( "Unable to write log file" ); } finally { @@ -265,7 +264,7 @@ class MAuditStreamHandler implements ExecuteStreamHandler { // this doesn't match..report it as info, it could be // either the copyright, summary or a multiline message (damn !) - task.log( line, Project.MSG_INFO ); + task.getLogger().info( line ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java index d18c2bc95..ffaa776d5 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java @@ -26,7 +26,6 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamResult; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler; import org.xml.sax.Attributes; @@ -323,7 +322,7 @@ public class MMetricsStreamHandler implements ExecuteStreamHandler { e.printStackTrace(); // invalid lines are sent to the output as information, it might be anything, - task.log( line, Project.MSG_INFO ); + task.getLogger().info( line ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java index 359b5c7a9..b3d696aba 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java @@ -306,7 +306,7 @@ public class MParse extends Task } final Execute process = new Execute( handler ); - log( cmdl.toString(), Project.MSG_VERBOSE ); + getLogger().debug( cmdl.toString() ); process.setCommandline( cmdl.getCommandline() ); try { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/FTP.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/FTP.java index 7e35aef0b..75ac8fbc6 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/FTP.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/FTP.java @@ -25,7 +25,6 @@ import java.util.Locale; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.FileScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.FileSet; @@ -287,7 +286,7 @@ public class FTP try { - log( "Opening FTP connection to " + server, Project.MSG_VERBOSE ); + getLogger().debug( "Opening FTP connection to " + server ); ftp = new FTPClient(); @@ -297,15 +296,15 @@ public class FTP throw new TaskException( "FTP connection failed: " + ftp.getReplyString() ); } - log( "connected", Project.MSG_VERBOSE ); - log( "logging in to FTP server", Project.MSG_VERBOSE ); + getLogger().debug( "connected" ); + getLogger().debug( "logging in to FTP server" ); if( !ftp.login( userid, password ) ) { throw new TaskException( "Could not login to FTP server" ); } - log( "login succeeded", Project.MSG_VERBOSE ); + getLogger().debug( "login succeeded" ); if( binary ) { @@ -320,7 +319,7 @@ public class FTP if( passive ) { - log( "entering passive mode", Project.MSG_VERBOSE ); + getLogger().debug( "entering passive mode" ); ftp.enterLocalPassiveMode(); if( !FTPReply.isPositiveCompletion( ftp.getReplyCode() ) ) { @@ -343,7 +342,7 @@ public class FTP { if( remotedir != null ) { - log( "changing the remote directory", Project.MSG_VERBOSE ); + getLogger().debug( "changing the remote directory" ); ftp.changeWorkingDirectory( remotedir ); if( !FTPReply.isPositiveCompletion( ftp.getReplyCode() ) ) { @@ -367,7 +366,7 @@ public class FTP { try { - log( "disconnecting", Project.MSG_VERBOSE ); + getLogger().debug( "disconnecting" ); ftp.logout(); ftp.disconnect(); } @@ -421,7 +420,7 @@ public class FTP String s = "could not get file: " + ftp.getReplyString(); if( skipFailedTransfers == true ) { - log( s, Project.MSG_WARN ); + getLogger().warn( s ); skipped++; } else @@ -432,8 +431,7 @@ public class FTP } else { - log( "File " + file.getAbsolutePath() + " copied from " + server, - Project.MSG_VERBOSE ); + getLogger().debug( "File " + file.getAbsolutePath() + " copied from " + server ); transferred++; } } @@ -467,7 +465,7 @@ public class FTP protected boolean isUpToDate( FTPClient ftp, File localFile, String remoteFile ) throws IOException, TaskException { - log( "checking date for " + remoteFile, Project.MSG_VERBOSE ); + getLogger().debug( "checking date for " + remoteFile ); FTPFile[] files = ftp.listFiles( remoteFile ); @@ -480,8 +478,7 @@ public class FTP if( action == SEND_FILES ) { - log( "Could not date test remote file: " + remoteFile - + "assuming out of date.", Project.MSG_VERBOSE ); + getLogger().debug( "Could not date test remote file: " + remoteFile + "assuming out of date." ); return false; } else @@ -562,8 +559,7 @@ public class FTP dir = (File)parents.get( i ); if( !dirCache.contains( dir ) ) { - log( "creating remote directory " + resolveFile( dir.getPath() ), - Project.MSG_VERBOSE ); + getLogger().debug( "creating remote directory " + resolveFile( dir.getPath() ) ); ftp.makeDirectory( resolveFile( dir.getPath() ) ); // Both codes 550 and 553 can be produced by FTP Servers // to indicate that an attempt to create a directory has @@ -603,7 +599,7 @@ public class FTP String s = "could not delete file: " + ftp.getReplyString(); if( skipFailedTransfers == true ) { - log( s, Project.MSG_WARN ); + getLogger().warn( s ); skipped++; } else @@ -613,7 +609,7 @@ public class FTP } else { - log( "File " + filename + " deleted from " + server, Project.MSG_VERBOSE ); + getLogger().debug( "File " + filename + " deleted from " + server ); transferred++; } } @@ -747,7 +743,7 @@ public class FTP String s = "could not put file: " + ftp.getReplyString(); if( skipFailedTransfers == true ) { - log( s, Project.MSG_WARN ); + getLogger().warn( s ); skipped++; } else @@ -759,9 +755,7 @@ public class FTP else { - log( "File " + file.getAbsolutePath() + - " copied to " + server, - Project.MSG_VERBOSE ); + getLogger().debug( "File " + file.getAbsolutePath() + " copied to " + server ); transferred++; } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/MimeMail.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/MimeMail.java index b0870f901..333c8cf7c 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/MimeMail.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/MimeMail.java @@ -25,7 +25,6 @@ import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.FileSet; @@ -259,7 +258,7 @@ public class MimeMail extends Task MimeMessage msg = new MimeMessage( sesh ); //set the sender - log( "message sender: " + from, Project.MSG_VERBOSE ); + getLogger().debug( "message sender: " + from ); msg.setFrom( new InternetAddress( from ) ); // add recipient lists @@ -269,7 +268,7 @@ public class MimeMail extends Task if( subject != null ) { - log( "subject: " + subject, Project.MSG_VERBOSE ); + getLogger().debug( "subject: " + subject ); msg.setSubject( subject ); } @@ -322,8 +321,7 @@ public class MimeMail extends Task throw new TaskException( "File \"" + file.getAbsolutePath() + "\" does not exist or is not readable." ); } - log( "Attaching " + file.toString() + " - " + file.length() + " bytes", - Project.MSG_VERBOSE ); + getLogger().debug( "Attaching " + file.toString() + " - " + file.length() + " bytes" ); FileDataSource fileData = new FileDataSource( file ); DataHandler fileDataHandler = new DataHandler( fileData ); body.setDataHandler( fileDataHandler ); @@ -361,7 +359,7 @@ public class MimeMail extends Task else { String text = e.toString(); - log( text, Project.MSG_ERR ); + getLogger().error( text ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java index a02cad4ea..5f16a0346 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java @@ -15,7 +15,6 @@ import java.util.ArrayList; import java.util.Calendar; import java.util.Iterator; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; /** @@ -245,7 +244,7 @@ public class TelnetTask extends Task { os.write( ( s + "\n" ).getBytes() ); if( echoString ) - log( s, Project.MSG_INFO ); + getLogger().info( s ); os.flush(); } catch( Exception e ) @@ -304,7 +303,7 @@ public class TelnetTask extends Task sb.append( (char)is.read() ); } } - log( sb.toString(), Project.MSG_INFO ); + getLogger().info( sb.toString() ); } catch( TaskException be ) { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java index 82d57abdf..10e2dbbd2 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java @@ -11,7 +11,6 @@ import java.io.File; import java.util.ArrayList; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.FileSet; /** @@ -147,7 +146,7 @@ public class P4Add extends P4Base } else { - log( "No files specified to add!", Project.MSG_WARN ); + getLogger().warn( "No files specified to add!" ); } } @@ -155,7 +154,7 @@ public class P4Add extends P4Base private void execP4Add( StringBuffer list ) { - log( "Execing add " + P4CmdOpts + " " + addCmd + list, Project.MSG_INFO ); + getLogger().info( "Execing add " + P4CmdOpts + " " + addCmd + list ); execP4Command( "-s add " + P4CmdOpts + " " + addCmd + list, new SimpleP4OutputHandler( this ) ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java index c888a5a6a..7b289bbe6 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs.optional.perforce; import java.io.IOException; import org.apache.myrmidon.api.TaskException; import org.apache.oro.text.perl.Perl5Util; -import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.exec.Execute; import org.apache.tools.ant.types.Commandline; @@ -160,7 +159,7 @@ public abstract class P4Base extends org.apache.tools.ant.Task cmdl += cmdline[ i ] + " "; } - log( "Execing " + cmdl, Project.MSG_VERBOSE ); + getLogger().debug( "Execing " + cmdl ); if( handler == null ) handler = new SimpleP4OutputHandler( this ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java index 72743b5e0..7a14e4319 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java @@ -48,7 +48,7 @@ public class P4Change extends P4Base if( util.match( "/error/", line ) ) { - log( "Client Error", Project.MSG_VERBOSE ); + getLogger().debug( "Client Error" ); throw new TaskException( "Perforce Error, check client settings and/or server" ); } else if( util.match( "//", line ) ) @@ -95,7 +95,7 @@ public class P4Change extends P4Base line = util.substitute( "s/[^0-9]//g", line ); int changenumber = Integer.parseInt( line ); - log( "Change Number is " + changenumber, Project.MSG_INFO ); + getLogger().info( "Change Number is " + changenumber ); setProperty( "p4.change", "" + changenumber ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java index bdd86dc0a..2969da953 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java @@ -83,7 +83,7 @@ public class P4Counter extends P4Base { public void process( String line ) { - log( "P4Counter retrieved line \"" + line + "\"", Project.MSG_VERBOSE ); + getLogger().debug( "P4Counter retrieved line \"" + line + "\"" ); try { value = Integer.parseInt( line ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java index 39e00696e..0e04d6930 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs.optional.perforce; import java.text.SimpleDateFormat; import java.util.Date; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; /** * P4Label - create a Perforce Label. P4Label inserts a label into perforce @@ -46,23 +45,23 @@ public class P4Label extends P4Base public void execute() throws TaskException { - log( "P4Label exec:", Project.MSG_INFO ); + getLogger().info( "P4Label exec:" ); if( P4View == null || P4View.length() < 1 ) { - log( "View not set, assuming //depot/...", Project.MSG_WARN ); + getLogger().warn( "View not set, assuming //depot/..." ); P4View = "//depot/..."; } if( desc == null || desc.length() < 1 ) { - log( "Label Description not set, assuming 'AntLabel'", Project.MSG_WARN ); + getLogger().warn( "Label Description not set, assuming 'AntLabel'" ); desc = "AntLabel"; } if( lock != null && !lock.equalsIgnoreCase( "locked" ) ) { - log( "lock attribute invalid - ignoring", Project.MSG_WARN ); + getLogger().warn( "lock attribute invalid - ignoring" ); } if( name == null || name.length() < 1 ) @@ -70,7 +69,7 @@ public class P4Label extends P4Base SimpleDateFormat formatter = new SimpleDateFormat( "yyyy.MM.dd-hh:mm" ); Date now = new Date(); name = "AntLabel-" + formatter.format( now ); - log( "name not set, assuming '" + name + "'", Project.MSG_WARN ); + getLogger().warn( "name not set, assuming '" + name + "'" ); } //We have to create a unlocked label first @@ -85,7 +84,7 @@ public class P4Label extends P4Base { public void process( String line ) { - log( line, Project.MSG_VERBOSE ); + getLogger().debug( line ); } }; @@ -98,17 +97,17 @@ public class P4Label extends P4Base { public void process( String line ) { - log( line, Project.MSG_VERBOSE ); + getLogger().debug( line ); } } ); - log( "Created Label " + name + " (" + desc + ")", Project.MSG_INFO ); + getLogger().info( "Created Label " + name + " (" + desc + ")" ); //Now lock if required if( lock != null && lock.equalsIgnoreCase( "locked" ) ) { - log( "Modifying lock status to 'locked'", Project.MSG_INFO ); + getLogger().info( "Modifying lock status to 'locked'" ); final StringBuffer labelSpec = new StringBuffer(); @@ -121,7 +120,7 @@ public class P4Label extends P4Base { public void process( String line ) { - log( line, Project.MSG_VERBOSE ); + getLogger().debug( line ); if( util.match( "/^Options:/", line ) ) { @@ -133,15 +132,15 @@ public class P4Label extends P4Base }; execP4Command( "label -o " + name, handler ); - log( labelSpec.toString(), Project.MSG_DEBUG ); + getLogger().debug( labelSpec.toString() ); - log( "Now locking label...", Project.MSG_VERBOSE ); + getLogger().debug( "Now locking label..." ); handler = new P4HandlerAdapter() { public void process( String line ) { - log( line, Project.MSG_VERBOSE ); + getLogger().debug( line ); } }; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java index 17dae2f41..2f48bca21 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java @@ -8,7 +8,6 @@ package org.apache.tools.ant.taskdefs.optional.perforce; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; /** * P4Submit - submit a numbered changelist to Perforce. Note: P4Submit @@ -40,7 +39,7 @@ public class P4Submit extends P4Base { public void process( String line ) { - log( line, Project.MSG_VERBOSE ); + getLogger().debug( line ); } } ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java index 5e1508c43..b3ef5c2a4 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java @@ -8,7 +8,6 @@ package org.apache.tools.ant.taskdefs.optional.perforce; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; /** * P4Sync - synchronise client space to a perforce depot view. The API allows @@ -121,7 +120,7 @@ public class P4Sync extends P4Base syncCmd = syncCmd + "@" + label; } - log( "Execing sync " + P4CmdOpts + " " + syncCmd, Project.MSG_VERBOSE ); + getLogger().debug( "Execing sync " + P4CmdOpts + " " + syncCmd ); execP4Command( "-s sync " + P4CmdOpts + " " + syncCmd, new SimpleP4OutputHandler( this ) ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/SimpleP4OutputHandler.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/SimpleP4OutputHandler.java index 9dc36e656..6b878dca5 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/SimpleP4OutputHandler.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/SimpleP4OutputHandler.java @@ -8,7 +8,6 @@ package org.apache.tools.ant.taskdefs.optional.perforce; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; public class SimpleP4OutputHandler extends P4HandlerAdapter @@ -41,7 +40,7 @@ public class SimpleP4OutputHandler throw new TaskException( line ); } - parent.log( parent.util.substitute( "s/^.*: //", line ), Project.MSG_INFO ); + parent.getLogger().info( parent.util.substitute( "s/^.*: //", line ) ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java index cf65d21de..4d98cf33a 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java @@ -364,7 +364,7 @@ public class Pvcs extends org.apache.tools.ant.Task Random rand = new Random( System.currentTimeMillis() ); tmp = new File( "pvcs_ant_" + rand.nextLong() + ".log" ); tmp2 = new File( "pvcs_ant_" + rand.nextLong() + ".log" ); - log( "Executing " + commandLine.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "Executing " + commandLine.toString() ); result = runCmd( commandLine, new FileOutputStream( tmp ), new LogOutputStream( this, Project.MSG_WARN ) ); if( result != 0 && !ignorerc ) { @@ -376,7 +376,7 @@ public class Pvcs extends org.apache.tools.ant.Task throw new TaskException( "Communication between ant and pvcs failed. No output generated from executing PVCS commandline interface \"pcli\" and \"get\"" ); // Create folders in workspace - log( "Creating folders", Project.MSG_INFO ); + getLogger().info( "Creating folders" ); createFolders( tmp ); // Massage PCLI lvf output transforming '\' to '/' so get command works appropriately @@ -405,8 +405,8 @@ public class Pvcs extends org.apache.tools.ant.Task } commandLine.createArgument().setValue( "@" + tmp2.getAbsolutePath() ); - log( "Getting files", Project.MSG_INFO ); - log( "Executing " + commandLine.toString(), Project.MSG_VERBOSE ); + getLogger().info( "Getting files" ); + getLogger().debug( "Executing " + commandLine.toString() ); final LogOutputStream output = new LogOutputStream( this, Project.MSG_INFO ); final LogOutputStream error = new LogOutputStream( this, Project.MSG_WARN ); result = runCmd( commandLine, output, error ); @@ -491,7 +491,7 @@ public class Pvcs extends org.apache.tools.ant.Task String line = in.readLine(); while( line != null ) { - log( "Considering \"" + line + "\"", Project.MSG_VERBOSE ); + getLogger().debug( "Considering \"" + line + "\"" ); if( line.startsWith( "\"\\" ) || line.startsWith( "\"/" ) || line.startsWith( getLineStart() ) ) @@ -505,30 +505,30 @@ public class Pvcs extends org.apache.tools.ant.Task File dir = new File( f.substring( 0, index ) ); if( !dir.exists() ) { - log( "Creating " + dir.getAbsolutePath(), Project.MSG_VERBOSE ); + getLogger().debug( "Creating " + dir.getAbsolutePath() ); if( dir.mkdirs() ) { - log( "Created " + dir.getAbsolutePath(), Project.MSG_INFO ); + getLogger().info( "Created " + dir.getAbsolutePath() ); } else { - log( "Failed to create " + dir.getAbsolutePath(), Project.MSG_INFO ); + getLogger().info( "Failed to create " + dir.getAbsolutePath() ); } } else { - log( dir.getAbsolutePath() + " exists. Skipping", Project.MSG_VERBOSE ); + getLogger().debug( dir.getAbsolutePath() + " exists. Skipping" ); } } else { - log( "File separator problem with " + line, - Project.MSG_WARN ); + final String message = "File separator problem with " + line; + getLogger().warn( message ); } } else { - log( "Skipped \"" + line + "\"", Project.MSG_VERBOSE ); + getLogger().debug( "Skipped \"" + line + "\"" ); } line = in.readLine(); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java index 979294698..52cf452cc 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java @@ -118,7 +118,7 @@ public class CovMerge extends Task final Execute exe = new Execute(); exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); exe.setError( new LogOutputStream( this, Project.MSG_WARN ) ); - log( cmdl.toString(), Project.MSG_VERBOSE ); + getLogger().debug( cmdl.toString() ); exe.setCommandline( cmdl.getCommandline() ); // JProbe process always return 0 so we will not be diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java index a9e0ed59c..5cd20189d 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java @@ -245,15 +245,15 @@ public class CovReport extends Task final Execute exe = new Execute(); exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); exe.setError( new LogOutputStream( this, Project.MSG_WARN ) ); - log( cmdl.toString(), Project.MSG_VERBOSE ); + getLogger().debug( cmdl.toString() ); exe.setCommandline( cmdl.getCommandline() ); int exitValue = exe.execute(); if( exitValue != 0 ) { throw new TaskException( "JProbe Coverage Report failed (" + exitValue + ")" ); } - log( "coveragePath: " + coveragePath, Project.MSG_VERBOSE ); - log( "format: " + format, Project.MSG_VERBOSE ); + getLogger().debug( "coveragePath: " + coveragePath ); + getLogger().debug( "format: " + format ); if( reference != null && "xml".equals( format ) ) { reference.createEnhancedXMLReport(); @@ -397,13 +397,13 @@ public class CovReport extends Task if( filters == null || filters.size() == 0 ) { createFilters(); - log( "Adding default include filter to *.*()", Project.MSG_VERBOSE ); + getLogger().debug( "Adding default include filter to *.*()" ); ReportFilters.Include include = new ReportFilters.Include(); filters.addInclude( include ); } try { - log( "Creating enhanced XML report", Project.MSG_VERBOSE ); + getLogger().debug( "Creating enhanced XML report" ); XMLReport report = new XMLReport( CovReport.this, tofile ); report.setReportFilters( filters ); report.setJProbehome( new File( home.getParent() ) ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java index 04ca6834d..85eddede3 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java @@ -296,7 +296,7 @@ public class Coverage extends Task // use the custom handler for stdin issues LogStreamHandler handler = new CoverageStreamHandler( this ); Execute exec = new Execute( handler ); - log( cmdl.toString(), Project.MSG_VERBOSE ); + getLogger().debug( cmdl.toString() ); exec.setCommandline( cmdl.getCommandline() ); int exitValue = exec.execute(); if( exitValue != 0 ) @@ -459,7 +459,7 @@ public class Coverage extends Task { //@todo change this when switching to JDK 1.2 and use File.createTmpFile() File file = createTmpFile(); - log( "Creating parameter file: " + file, Project.MSG_VERBOSE ); + getLogger().debug( "Creating parameter file: " + file ); // options need to be one per line in the parameter file // so write them all in a single string @@ -471,7 +471,7 @@ public class Coverage extends Task pw.println( params[ i ] ); } pw.flush(); - log( "JProbe Coverage parameters:\n" + sw.toString(), Project.MSG_VERBOSE ); + getLogger().debug( "JProbe Coverage parameters:\n" + sw.toString() ); // now write them to the file FileWriter fw = null; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java index a186f7f7c..6bf76faf2 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java @@ -15,7 +15,6 @@ import java.util.Iterator; import java.util.NoSuchElementException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.optional.sitraka.bytecode.ClassFile; import org.apache.tools.ant.taskdefs.optional.sitraka.bytecode.ClassPathLoader; @@ -195,7 +194,7 @@ public class XMLReport } else { - task.log( message, Project.MSG_DEBUG ); + task.getLogger().debug( message ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java index 8577a6130..511be9409 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java @@ -203,7 +203,7 @@ public class AntSoundPlayer } catch( UnsupportedAudioFileException uafe ) { - project.log( "Audio format is not yet supported: " + uafe.getMessage(), Project.MSG_INFO ); + project.getLogger().info( "Audio format is not yet supported: " + uafe.getMessage() ); } catch( IOException ioe ) { @@ -223,7 +223,7 @@ public class AntSoundPlayer } catch( LineUnavailableException e ) { - project.log( "The sound device is currently unavailable", Project.MSG_INFO ); + project.getLogger().info( "The sound device is currently unavailable" ); return; } catch( IOException e ) @@ -244,7 +244,7 @@ public class AntSoundPlayer } else { - project.log( "Can't get data from file " + file.getName(), Project.MSG_INFO ); + project.getLogger().info( "Can't get data from file " + file.getName() ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java index 8707867d5..bd580f7f4 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java @@ -11,7 +11,6 @@ import java.io.File; import java.util.ArrayList; import java.util.Random; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; /** @@ -57,7 +56,7 @@ public class SoundTask extends Task if( success == null ) { - log( "No nested success element found.", Project.MSG_WARN ); + getLogger().warn( "No nested success element found." ); } else { @@ -67,7 +66,7 @@ public class SoundTask extends Task if( fail == null ) { - log( "No nested failure element found.", Project.MSG_WARN ); + getLogger().warn( "No nested failure element found." ); } else { @@ -177,7 +176,7 @@ public class SoundTask extends Task } else { - log( source + ": invalid path.", Project.MSG_WARN ); + getLogger().warn( source + ": invalid path." ); this.source = nofile; } return this.source; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java index 28157f005..bffb7c1b2 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java @@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs.rmic; import java.io.File; import java.util.ArrayList; import java.util.Random; +import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Rmic; @@ -28,7 +29,9 @@ import org.apache.tools.ant.util.FileNameMapper; * @author Stefan Bodewig * @author Takashi Okamoto */ -public abstract class DefaultRmicAdapter implements RmicAdapter +public abstract class DefaultRmicAdapter + extends AbstractLogEnabled + implements RmicAdapter { private final static Random rand = new Random(); @@ -145,12 +148,11 @@ public abstract class DefaultRmicAdapter implements RmicAdapter if( attributes.getIiop() ) { - attributes.log( "IIOP has been turned on.", Project.MSG_INFO ); + getLogger().info( "IIOP has been turned on." ); cmd.createArgument().setValue( "-iiop" ); if( attributes.getIiopopts() != null ) { - attributes.log( "IIOP Options: " + attributes.getIiopopts(), - Project.MSG_INFO ); + getLogger().info( "IIOP Options: " + attributes.getIiopopts() ); cmd.createArgument().setValue( attributes.getIiopopts() ); } } @@ -158,12 +160,11 @@ public abstract class DefaultRmicAdapter implements RmicAdapter if( attributes.getIdl() ) { cmd.createArgument().setValue( "-idl" ); - attributes.log( "IDL has been turned on.", Project.MSG_INFO ); + getLogger().info( "IDL has been turned on." ); if( attributes.getIdlopts() != null ) { cmd.createArgument().setValue( attributes.getIdlopts() ); - attributes.log( "IDL Options: " + attributes.getIdlopts(), - Project.MSG_INFO ); + getLogger().info( "IDL Options: " + attributes.getIdlopts() ); } } @@ -243,8 +244,7 @@ public abstract class DefaultRmicAdapter implements RmicAdapter { ArrayList compileList = attributes.getCompileList(); - attributes.log( "Compilation args: " + cmd.toString(), - Project.MSG_VERBOSE ); + getLogger().debug( "Compilation args: " + cmd.toString() ); StringBuffer niceSourceList = new StringBuffer( "File" ); if( compileList.size() != 1 ) @@ -260,7 +260,7 @@ public abstract class DefaultRmicAdapter implements RmicAdapter niceSourceList.append( " " + arg ); } - attributes.log( niceSourceList.toString(), Project.MSG_VERBOSE ); + getLogger().debug( niceSourceList.toString() ); } /** @@ -407,20 +407,22 @@ public abstract class DefaultRmicAdapter implements RmicAdapter } catch( ClassNotFoundException e ) { - attributes.log( "Unable to verify class " + classname - + ". It could not be found.", - Project.MSG_WARN ); + final String message = "Unable to verify class " + classname + + ". It could not be found."; + getLogger().warn( message ); } catch( NoClassDefFoundError e ) { - attributes.log( "Unable to verify class " + classname - + ". It is not defined.", Project.MSG_WARN ); + final String message = "Unable to verify class " + classname + + ". It is not defined."; + getLogger().warn( message ); } catch( Throwable t ) { - attributes.log( "Unable to verify class " + classname - + ". Loading caused Exception: " - + t.getMessage(), Project.MSG_WARN ); + final String message = "Unable to verify class " + classname + + ". Loading caused Exception: " + + t.getMessage(); + getLogger().warn( message ); } } return target; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java index 2c6675af4..d0a17986a 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs.rmic; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; /** @@ -24,7 +23,7 @@ public class KaffeRmic extends DefaultRmicAdapter public boolean execute() throws TaskException { - getRmic().log( "Using Kaffe rmic", Project.MSG_VERBOSE ); + getLogger().debug( "Using Kaffe rmic" ); Commandline cmd = setupRmicCommand(); try diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/SunRmic.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/SunRmic.java index d1ec95895..b44dfc8c9 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/SunRmic.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/SunRmic.java @@ -27,7 +27,7 @@ public class SunRmic extends DefaultRmicAdapter public boolean execute() throws TaskException { - getRmic().log( "Using SUN rmic compiler", Project.MSG_VERBOSE ); + getLogger().debug( "Using SUN rmic compiler" ); Commandline cmd = setupRmicCommand(); // Create an instance of the rmic, redirecting output to diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/WLRmic.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/WLRmic.java index a68ec2c4c..cea03e3bb 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/WLRmic.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/WLRmic.java @@ -9,7 +9,6 @@ package org.apache.tools.ant.taskdefs.rmic; import java.lang.reflect.Method; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; /** @@ -43,7 +42,7 @@ public class WLRmic extends DefaultRmicAdapter public boolean execute() throws TaskException { - getRmic().log( "Using WebLogic rmic", Project.MSG_VERBOSE ); + getLogger().debug( "Using WebLogic rmic" ); Commandline cmd = setupRmicCommand( new String[]{"-noexit"} ); try diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FileSet.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FileSet.java index b37d8cb33..b0bb0cd4e 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FileSet.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FileSet.java @@ -27,9 +27,10 @@ import org.apache.tools.ant.Project; * @author Stefan Bodewig * @author Magesh Umasankar */ -public class FileSet extends DataType implements Cloneable +public class FileSet + extends DataType + implements Cloneable { - private PatternSet defaultPatterns = new PatternSet(); private ArrayList additionalPatterns = new ArrayList(); private boolean useDefaultExcludes = true; @@ -199,8 +200,7 @@ public class FileSet extends DataType implements Cloneable defaultPatterns.append( (PatternSet)o, p ); } - p.log( "FileSet: Setup file scanner in dir " + dir + - " with " + defaultPatterns, p.MSG_DEBUG ); + getLogger().debug( "FileSet: Setup file scanner in dir " + dir + " with " + defaultPatterns ); ds.setIncludes( defaultPatterns.getIncludePatterns( p ) ); ds.setExcludes( defaultPatterns.getExcludePatterns( p ) ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FilterSet.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FilterSet.java index 2f1682e28..5f56de5ea 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FilterSet.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FilterSet.java @@ -16,7 +16,6 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.Properties; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; /** * A set of filters to be applied to something. A filter set may have begintoken @@ -266,7 +265,7 @@ public class FilterSet extends DataType implements Cloneable if( filtersFile.isFile() ) { - log( "Reading filters from " + filtersFile, Project.MSG_VERBOSE ); + getLogger().debug( "Reading filters from " + filtersFile ); FileInputStream in = null; try { @@ -343,7 +342,7 @@ public class FilterSet extends DataType implements Cloneable if( tokens.containsKey( token ) ) { value = (String)tokens.get( token ); - log( "Replacing: " + beginToken + token + endToken + " -> " + value, Project.MSG_VERBOSE ); + getLogger().debug( "Replacing: " + beginToken + token + endToken + " -> " + value ); b.append( value ); i = index + beginToken.length() + token.length() + endToken.length(); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Path.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Path.java index 078b7e290..1a0d6a603 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Path.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Path.java @@ -118,7 +118,7 @@ public class Path * @param source Description of Parameter * @return Description of the Returned Value */ - public static String[] translatePath( Project project, String source ) + public String[] translatePath( Project project, String source ) { final ArrayList result = new ArrayList(); if( source == null ) @@ -136,8 +136,7 @@ public class Path } catch( TaskException e ) { - project.log( "Dropping path element " + pathElement + " as it is not valid relative to the project", - Project.MSG_VERBOSE ); + getLogger().debug( "Dropping path element " + pathElement + " as it is not valid relative to the project" ); } for( int i = 0; i < element.length(); i++ ) { @@ -498,8 +497,8 @@ public class Path // last: don't trust the developer if( !order.equals( "last" ) ) { - log( "invalid value for build.sysclasspath: " + order, - Project.MSG_WARN ); + final String message = "invalid value for build.sysclasspath: " + order; + getLogger().warn( message ); } result.addExisting( this ); @@ -728,7 +727,7 @@ public class Path public void setPath( String path ) { - parts = Path.translatePath( getProject(), path ); + parts = translatePath( getProject(), path ); } public String[] getParts() diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/SourceFileScanner.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/SourceFileScanner.java index 0d85dbf72..9021dd2aa 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/SourceFileScanner.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/SourceFileScanner.java @@ -10,9 +10,9 @@ package org.apache.tools.ant.util; import java.io.File; import java.util.ArrayList; import org.apache.avalon.excalibur.io.FileUtil; +import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.framework.Os; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; /** @@ -26,6 +26,7 @@ import org.apache.tools.ant.Task; * @author Stefan Bodewig */ public class SourceFileScanner + extends AbstractLogEnabled { private Task m_task; @@ -77,8 +78,7 @@ public class SourceFileScanner String[] targets = mapper.mapFileName( files[ i ] ); if( targets == null || targets.length == 0 ) { - m_task.log( files[ i ] + " skipped - don\'t know how to handle it", - Project.MSG_VERBOSE ); + getLogger().debug( files[ i ] + " skipped - don\'t know how to handle it" ); continue; } @@ -86,8 +86,8 @@ public class SourceFileScanner if( src.lastModified() > now ) { - m_task.log( "Warning: " + files[ i ] + " modified in the future.", - Project.MSG_WARN ); + final String message = "Warning: " + files[ i ] + " modified in the future."; + getLogger().warn( message ); } boolean added = false; @@ -98,15 +98,13 @@ public class SourceFileScanner if( !dest.exists() ) { - m_task.log( files[ i ] + " added as " + dest.getAbsolutePath() + " doesn\'t exist.", - Project.MSG_VERBOSE ); + getLogger().debug( files[ i ] + " added as " + dest.getAbsolutePath() + " doesn\'t exist." ); v.add( files[ i ] ); added = true; } else if( src.lastModified() > dest.lastModified() ) { - m_task.log( files[ i ] + " added as " + dest.getAbsolutePath() + " is outdated.", - Project.MSG_VERBOSE ); + getLogger().debug( files[ i ] + " added as " + dest.getAbsolutePath() + " is outdated." ); v.add( files[ i ] ); added = true; } @@ -122,9 +120,7 @@ public class SourceFileScanner if( !added ) { - m_task.log( files[ i ] + " omitted as " + targetList.toString() - + ( targets.length == 1 ? " is" : " are " ) - + " up to date.", Project.MSG_VERBOSE ); + getLogger().debug( files[ i ] + " omitted as " + targetList.toString() + ( targets.length == 1 ? " is" : " are " ) + " up to date." ); } }