Browse Source

Bug 43936: <fixcrlf> errors are unhelpful

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@597397 13f79535-47bb-0310-9956-ffa450edef68
master
Steve Loughran 17 years ago
parent
commit
f47e4095c8
1 changed files with 8 additions and 6 deletions
  1. +8
    -6
      src/main/org/apache/tools/ant/taskdefs/FixCRLF.java

+ 8
- 6
src/main/org/apache/tools/ant/taskdefs/FixCRLF.java View File

@@ -83,9 +83,10 @@ import org.apache.tools.ant.util.FileUtils;

public class FixCRLF extends MatchingTask implements ChainableReader {

private static final String FIXCRLF_ERROR = "<fixcrlf> error: ";
/** error string for using srcdir and file */
public static final String ERROR_FILE_AND_SRCDIR
= "srcdir and file are mutually exclusive";
=FIXCRLF_ERROR+"srcdir and file are mutually exclusive";

private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();

@@ -106,6 +107,7 @@ public class FixCRLF extends MatchingTask implements ChainableReader {
*/
private String outputEncoding = null;


/**
* Chain this task as a reader.
* @param rdr Reader to chain.
@@ -312,20 +314,20 @@ public class FixCRLF extends MatchingTask implements ChainableReader {
srcDir = file.getParentFile();
}
if (srcDir == null) {
throw new BuildException("srcdir attribute must be set!");
throw new BuildException(FIXCRLF_ERROR +"srcdir attribute must be set!");
}
if (!srcDir.exists()) {
throw new BuildException("srcdir does not exist!");
throw new BuildException(FIXCRLF_ERROR +"srcdir does not exist: '"+srcDir+"'");
}
if (!srcDir.isDirectory()) {
throw new BuildException("srcdir is not a directory!");
throw new BuildException(FIXCRLF_ERROR +"srcdir is not a directory: '"+srcDir+"'");
}
if (destDir != null) {
if (!destDir.exists()) {
throw new BuildException("destdir does not exist!");
throw new BuildException(FIXCRLF_ERROR +"destdir does not exist: '" + destDir + "'");
}
if (!destDir.isDirectory()) {
throw new BuildException("destdir is not a directory!");
throw new BuildException(FIXCRLF_ERROR +"destdir is not a directory: '" + destDir + "'");
}
}
}


Loading…
Cancel
Save