Browse Source

Minor style updates.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277274 13f79535-47bb-0310-9956-ffa450edef68
master
Jacobus Martinus Kruithof 20 years ago
parent
commit
554adbd008
4 changed files with 20 additions and 21 deletions
  1. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/Concat.java
  2. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/PathConvert.java
  3. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Replace.java
  4. +13
    -14
      src/main/org/apache/tools/ant/taskdefs/Touch.java

+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/Concat.java View File

@@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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); + " files to " + destinationFile);
FileOutputStream out = null; FileOutputStream out = null;
FileInputStream in = null; FileInputStream in = null;
byte[] buffer = new byte[8 * 1024];
byte[] buffer = new byte[BUFFER_SIZE];
try { try {
try { try {
out = new FileOutputStream(destinationFile); out = new FileOutputStream(destinationFile);
@@ -713,7 +713,7 @@ public class Concat extends Task {
* @throws BuildException if the file does not exist, or cannot be * @throws BuildException if the file does not exist, or cannot be
* read * read
*/ */
public void setFile(File file) {
public void setFile(File file) throws BuildException {
// non-existing files are not allowed // non-existing files are not allowed
if (!file.exists()) { if (!file.exists()) {
throw new BuildException("File " + file + " does not exist."); throw new BuildException("File " + file + " does not exist.");


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/PathConvert.java View File

@@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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. // case-insensitive.
String fromDirSep = onWindows ? "\\" : "/"; String fromDirSep = onWindows ? "\\" : "/";


StringBuffer rslt = new StringBuffer(100);
StringBuffer rslt = new StringBuffer();


// Get the list of path components in canonical form // Get the list of path components in canonical form
String[] elems = path.list(); String[] elems = path.list();


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/Replace.java View File

@@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 <code>String</code> token. * @param token <code>String</code> token.
*/ */
public void setToken(String token) { public void setToken(String token) {


+ 13
- 14
src/main/org/apache/tools/ant/taskdefs/Touch.java View File

@@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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.DateFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale; import java.util.Locale;
import java.util.Vector; import java.util.Vector;
import org.apache.tools.ant.BuildException; 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.types.FileList;
import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.ant.util.FileNameMapper; 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); * Touch a file and/or fileset(s) and/or filelist(s);
@@ -174,12 +172,13 @@ public class Touch extends Task {


/** /**
* Add a <code>FileNameMapper</code>. * Add a <code>FileNameMapper</code>.
* @param mapper the <code>FileNameMapper</code> to add.
* @param fileNameMapper the <code>FileNameMapper</code> to add.
* @since Ant 1.6.3 * @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) { 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."); + getTaskName() + " task.");
} }
this.fileNameMapper = fileNameMapper; this.fileNameMapper = fileNameMapper;
@@ -203,10 +202,10 @@ public class Touch extends Task {


/** /**
* Check that this task has been configured properly. * Check that this task has been configured properly.
* @throws <code>BuildException</code> if configuration errors are detected.
* @throws BuildException if configuration errors are detected.
* @since Ant 1.6.3 * @since Ant 1.6.3
*/ */
protected synchronized void checkConfiguration() {
protected synchronized void checkConfiguration() throws BuildException {
if (file == null && filesets.size() + filelists.size() == 0) { if (file == null && filesets.size() + filelists.size() == 0) {
throw new BuildException("Specify at least one source" throw new BuildException("Specify at least one source"
+ "--a file, filelist or a fileset."); + "--a file, filelist or a fileset.");
@@ -253,22 +252,22 @@ public class Touch extends Task {


/** /**
* Execute the touch operation. * Execute the touch operation.
* @throws <code>BuildException</code> if an error occurs.
* @throws BuildException if an error occurs.
*/ */
public void execute() {
public void execute() throws BuildException {
checkConfiguration(); checkConfiguration();
touch(); touch();
} }


/** /**
* Does the actual work; assumes everything has been checked by now. * Does the actual work; assumes everything has been checked by now.
* @throws <code>BuildException</code> if an error occurs.
* @throws BuildException if an error occurs.
*/ */
protected void touch() {
protected void touch() throws BuildException {
long defaultTimestamp = getTimestamp(); long defaultTimestamp = getTimestamp();


if (file != null) { if (file != null) {
touch(fileUtils.getParentFile(file), file.getName(), defaultTimestamp);
touch(file.getParentFile(), file.getName(), defaultTimestamp);
} }
// deal with the filesets // deal with the filesets
for (int i = 0; i < filesets.size(); i++) { for (int i = 0; i < filesets.size(); i++) {
@@ -323,7 +322,7 @@ public class Touch extends Task {
String[] mapped = fileNameMapper.mapFileName(filename); String[] mapped = fileNameMapper.mapFileName(filename);
if (mapped != null && mapped.length > 0) { if (mapped != null && mapped.length > 0) {
long modTime = (f.exists()) ? f.lastModified() : defaultTimestamp; 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); touch(getProject().resolveFile(mapped[i]), modTime);
} }
} }


Loading…
Cancel
Save