Browse Source

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
master
Kevin Jackson 19 years ago
parent
commit
30a41589b4
1 changed files with 23 additions and 19 deletions
  1. +23
    -19
      src/main/org/apache/tools/ant/taskdefs/FixCRLF.java

+ 23
- 19
src/main/org/apache/tools/ant/taskdefs/FixCRLF.java View File

@@ -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();


Loading…
Cancel
Save