Browse Source

Ensure tablength is a positive power of 2 in FixCRLF.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267754 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 25 years ago
parent
commit
ee67180827
3 changed files with 17 additions and 16 deletions
  1. +2
    -2
      docs/index.html
  2. +5
    -4
      src/main/org/apache/tools/ant/taskdefs/Cvs.java
  3. +10
    -10
      src/main/org/apache/tools/ant/taskdefs/FixCRLF.java

+ 2
- 2
docs/index.html View File

@@ -1244,8 +1244,8 @@ relative to the <i>src</i> directory.</p>
</tr> </tr>
<tr> <tr>
<td valign="top">tablength</td> <td valign="top">tablength</td>
<td valign="top">The number of characters a TAB stop corresponds to.
Default for this parameter is 8.</td>
<td valign="top">The number of characters a TAB stop corresponds to.
Must be a positive power of 2, default for this parameter is 8.</td>
<td valign="top" align="center">No</td> <td valign="top" align="center">No</td>
</tr> </tr>
<tr> <tr>


+ 5
- 4
src/main/org/apache/tools/ant/taskdefs/Cvs.java View File

@@ -62,6 +62,7 @@ import java.io.*;
* *
* @author costin@dnt.ro * @author costin@dnt.ro
* @author stefano@apache.org * @author stefano@apache.org
* @author Wolfgang Werner <a href="mailto:wwerner@picturesafe.de">wwerner@picturesafe.de</a>
*/ */


public class Cvs extends Exec { public class Cvs extends Exec {
@@ -141,12 +142,12 @@ public class Cvs extends Exec {
this.command = c; this.command = c;
} }
public void setQuiet(String q) {
quiet = Project.toBoolean(q);
public void setQuiet(boolean q) {
quiet = q;
} }
public void setNoexec(String ne) {
noexec = Project.toBoolean(ne);
public void setNoexec(boolean ne) {
noexec = ne;
} }
} }




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

@@ -116,21 +116,17 @@ public class FixCRLF extends MatchingTask {


/** /**
* Set the source dir to find the source text files. * Set the source dir to find the source text files.
*
* @param srcDirName name of the source directory.
*/ */
public void setSrcdir(String srcDirName) {
srcDir = project.resolveFile(srcDirName);
public void setSrcdir(File srcDir) {
this.srcDir = srcDir;
} }


/** /**
* Set the destination where the fixed files should be placed. * Set the destination where the fixed files should be placed.
* Default is to replace the original file. * Default is to replace the original file.
*
* @param destDirName name of the destination directory.
*/ */
public void setDestdir(String destDirName) {
destDir = project.resolveFile(destDirName);
public void setDestdir(File destDir) {
this.destDir = destDir;
} }


/** /**
@@ -182,8 +178,12 @@ public class FixCRLF extends MatchingTask {
* *
* @param tlength specify the length of tab in spaces, has to be a power of 2 * @param tlength specify the length of tab in spaces, has to be a power of 2
*/ */
public void setTablength(String tlength) {
tablength = Integer.parseInt(tlength);
public void setTablength(int tlength) throws BuildException {
if (tlength < 2 || (tlength % 2) != 0) {
throw new BuildException("tablength must be a positive power of 2",
location);
}
tablength = tlength;
} }


/** /**


Loading…
Cancel
Save