From 30a41589b40d875b84d124885d566d3614e17079 Mon Sep 17 00:00:00 2001 From: Kevin Jackson Date: Wed, 5 Jul 2006 03:15:22 +0000 Subject: [PATCH] move validation of properties into private method git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@419143 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tools/ant/taskdefs/FixCRLF.java | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java b/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java index d73426e5a..078c890f7 100644 --- a/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java +++ b/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java @@ -275,7 +275,29 @@ public class FixCRLF extends MatchingTask implements ChainableReader { */ public void execute() throws BuildException { // first off, make sure that we've got a srcdir and destdir + validate(); + + // log options used + String enc = encoding == null ? "default" : encoding; + log("options:" + + " eol=" + filter.getEol().getValue() + + " tab=" + filter.getTab().getValue() + + " eof=" + filter.getEof().getValue() + + " tablength=" + filter.getTablength() + + " encoding=" + enc + + " outputencoding=" + + (outputEncoding == null ? enc : outputEncoding), + Project.MSG_VERBOSE); + + DirectoryScanner ds = super.getDirectoryScanner(srcDir); + String[] files = ds.getIncludedFiles(); + + for (int i = 0; i < files.length; i++) { + processFile(files[i]); + } + } + private void validate() throws BuildException { if (file != null) { if (srcDir != null) { throw new BuildException(ERROR_FILE_AND_SRCDIR); @@ -302,26 +324,8 @@ public class FixCRLF extends MatchingTask implements ChainableReader { throw new BuildException("destdir is not a directory!"); } } - // log options used - String enc = encoding == null ? "default" : encoding; - log("options:" - + " eol=" + filter.getEol().getValue() - + " tab=" + filter.getTab().getValue() - + " eof=" + filter.getEof().getValue() - + " tablength=" + filter.getTablength() - + " encoding=" + enc - + " outputencoding=" - + (outputEncoding == null ? enc : outputEncoding), - Project.MSG_VERBOSE); - - DirectoryScanner ds = super.getDirectoryScanner(srcDir); - String[] files = ds.getIncludedFiles(); - - for (int i = 0; i < files.length; i++) { - processFile(files[i]); - } } - + private void processFile(String file) throws BuildException { File srcFile = new File(srcDir, file); long lastModified = srcFile.lastModified();