diff --git a/src/main/org/apache/tools/ant/taskdefs/Concat.java b/src/main/org/apache/tools/ant/taskdefs/Concat.java
index d2bfffc4b..7a0d1ce9b 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Concat.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Concat.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2004 The Apache Software Foundation
+ * Copyright 2002-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -480,7 +480,7 @@ public class Concat extends Task {
+ " files to " + destinationFile);
FileOutputStream out = null;
FileInputStream in = null;
- byte[] buffer = new byte[8 * 1024];
+ byte[] buffer = new byte[BUFFER_SIZE];
try {
try {
out = new FileOutputStream(destinationFile);
@@ -713,7 +713,7 @@ public class Concat extends Task {
* @throws BuildException if the file does not exist, or cannot be
* read
*/
- public void setFile(File file) {
+ public void setFile(File file) throws BuildException {
// non-existing files are not allowed
if (!file.exists()) {
throw new BuildException("File " + file + " does not exist.");
diff --git a/src/main/org/apache/tools/ant/taskdefs/PathConvert.java b/src/main/org/apache/tools/ant/taskdefs/PathConvert.java
index f20bf86aa..5cae7e04e 100644
--- a/src/main/org/apache/tools/ant/taskdefs/PathConvert.java
+++ b/src/main/org/apache/tools/ant/taskdefs/PathConvert.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2004 The Apache Software Foundation
+ * Copyright 2001-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -361,7 +361,7 @@ public class PathConvert extends Task {
// case-insensitive.
String fromDirSep = onWindows ? "\\" : "/";
- StringBuffer rslt = new StringBuffer(100);
+ StringBuffer rslt = new StringBuffer();
// Get the list of path components in canonical form
String[] elems = path.list();
diff --git a/src/main/org/apache/tools/ant/taskdefs/Replace.java b/src/main/org/apache/tools/ant/taskdefs/Replace.java
index e2deee4e6..514dc9b4d 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Replace.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Replace.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2004 The Apache Software Foundation
+ * Copyright 2000-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -173,7 +173,7 @@ public class Replace extends MatchingTask {
}
/**
- * Set the token to replace,
+ * Set the token to replace.
* @param token String
token.
*/
public void setToken(String token) {
diff --git a/src/main/org/apache/tools/ant/taskdefs/Touch.java b/src/main/org/apache/tools/ant/taskdefs/Touch.java
index 047d65198..dc964d065 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Touch.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Touch.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2004 The Apache Software Foundation
+ * Copyright 2000-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,6 @@ import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
-import java.util.Date;
import java.util.Locale;
import java.util.Vector;
import org.apache.tools.ant.BuildException;
@@ -34,7 +33,6 @@ import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.FileList;
import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.ant.util.FileNameMapper;
-import org.apache.tools.ant.util.JavaEnvUtils;
/**
* Touch a file and/or fileset(s) and/or filelist(s);
@@ -174,12 +172,13 @@ public class Touch extends Task {
/**
* Add a FileNameMapper
.
- * @param mapper the FileNameMapper
to add.
+ * @param fileNameMapper the FileNameMapper
to add.
* @since Ant 1.6.3
+ * @throws BuildException if multiple mappers are added.
*/
- public void add(FileNameMapper fileNameMapper) {
+ public void add(FileNameMapper fileNameMapper) throws BuildException {
if (this.fileNameMapper != null) {
- throw new BuildException( "Only one mapper may be added to the "
+ throw new BuildException("Only one mapper may be added to the "
+ getTaskName() + " task.");
}
this.fileNameMapper = fileNameMapper;
@@ -203,10 +202,10 @@ public class Touch extends Task {
/**
* Check that this task has been configured properly.
- * @throws BuildException
if configuration errors are detected.
+ * @throws BuildException if configuration errors are detected.
* @since Ant 1.6.3
*/
- protected synchronized void checkConfiguration() {
+ protected synchronized void checkConfiguration() throws BuildException {
if (file == null && filesets.size() + filelists.size() == 0) {
throw new BuildException("Specify at least one source"
+ "--a file, filelist or a fileset.");
@@ -253,22 +252,22 @@ public class Touch extends Task {
/**
* Execute the touch operation.
- * @throws BuildException
if an error occurs.
+ * @throws BuildException if an error occurs.
*/
- public void execute() {
+ public void execute() throws BuildException {
checkConfiguration();
touch();
}
/**
* Does the actual work; assumes everything has been checked by now.
- * @throws BuildException
if an error occurs.
+ * @throws BuildException if an error occurs.
*/
- protected void touch() {
+ protected void touch() throws BuildException {
long defaultTimestamp = getTimestamp();
if (file != null) {
- touch(fileUtils.getParentFile(file), file.getName(), defaultTimestamp);
+ touch(file.getParentFile(), file.getName(), defaultTimestamp);
}
// deal with the filesets
for (int i = 0; i < filesets.size(); i++) {
@@ -323,7 +322,7 @@ public class Touch extends Task {
String[] mapped = fileNameMapper.mapFileName(filename);
if (mapped != null && mapped.length > 0) {
long modTime = (f.exists()) ? f.lastModified() : defaultTimestamp;
- for (int i = 0; i < mapped.length ; i++) {
+ for (int i = 0; i < mapped.length; i++) {
touch(getProject().resolveFile(mapped[i]), modTime);
}
}