Browse Source

Made some variable names more consistent with the other parts of the code.

master
Yusuke Shinyama 5 years ago
parent
commit
1b42c235a1
7 changed files with 65 additions and 65 deletions
  1. +4
    -4
      src/main/org/apache/tools/ant/BuildException.java
  2. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/Checksum.java
  3. +6
    -6
      src/main/org/apache/tools/ant/taskdefs/condition/Equals.java
  4. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/cvslib/RCSFile.java
  5. +8
    -8
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
  6. +38
    -38
      src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java
  7. +4
    -4
      src/main/org/apache/tools/ant/types/Commandline.java

+ 4
- 4
src/main/org/apache/tools/ant/BuildException.java View File

@@ -74,15 +74,15 @@ public class BuildException extends RuntimeException {
* Constructs an exception with the given message and exception as
* a root cause and a location in a file.
*
* @param msg A description of or information about the exception.
* Should not be <code>null</code> unless a cause is specified.
* @param message A description of or information about the exception.
* Should not be <code>null</code> unless a cause is specified.
* @param cause The exception that might have caused this one.
* May be <code>null</code>.
* @param location The location in the project file where the error
* occurred. Must not be <code>null</code>.
*/
public BuildException(String msg, Throwable cause, Location location) {
this(msg, cause);
public BuildException(String message, Throwable cause, Location location) {
this(message, cause);
this.location = location;
}



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

@@ -262,12 +262,12 @@ public class Checksum extends MatchingTask implements Condition {
* Specify the pattern to use as a MessageFormat pattern.
*
* <p>{0} gets replaced by the checksum, {1} by the filename.</p>
* @param p a <code>String</code> value
* @param pattern a <code>String</code> value
*
* @since 1.7.0
*/
public void setPattern(String p) {
format = new MessageFormat(p);
public void setPattern(String pattern) {
format = new MessageFormat(pattern);
}

/**


+ 6
- 6
src/main/org/apache/tools/ant/taskdefs/condition/Equals.java View File

@@ -50,10 +50,10 @@ public class Equals implements Condition {
/**
* Set the first string
*
* @param a1 the first string
* @param arg1 the first string
*/
public void setArg1(String a1) {
setArg1Internal(a1);
public void setArg1(String arg1) {
setArg1Internal(arg1);
}

private void setArg1Internal(Object arg1) {
@@ -77,10 +77,10 @@ public class Equals implements Condition {
/**
* Set the second string
*
* @param a2 the second string
* @param arg2 the second string
*/
public void setArg2(String a2) {
setArg2Internal(a2);
public void setArg2(String arg2) {
setArg2Internal(arg2);
}

private void setArg2Internal(Object arg2) {


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

@@ -26,8 +26,8 @@ class RCSFile {
private String revision;
private String previousRevision;

RCSFile(final String name, final String rev) {
this(name, rev, null);
RCSFile(final String name, final String revision) {
this(name, revision, null);
}

RCSFile(final String name,


+ 8
- 8
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java View File

@@ -713,15 +713,15 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR
logTestListenerEvent("endTest(" + testName + ")");
}

private void logTestListenerEvent(String msg) {
private void logTestListenerEvent(String message) {
if (logTestListenerEvents) {
@SuppressWarnings("resource")
final PrintStream out = savedOut != null ? savedOut : System.out;
out.flush();
final StringTokenizer msgLines =
new StringTokenizer(String.valueOf(msg), "\r\n", false);
while (msgLines.hasMoreTokens()) {
out.println(JUnitTask.TESTLISTENER_PREFIX + msgLines.nextToken());
final StringTokenizer messageLines =
new StringTokenizer(String.valueOf(message), "\r\n", false);
while (messageLines.hasMoreTokens()) {
out.println(JUnitTask.TESTLISTENER_PREFIX + messageLines.nextToken());
}
out.flush();
}
@@ -1241,9 +1241,9 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR
// JUnit 4-specific test GUIs will show just "failures".
// But Ant's output shows "failures" vs. "errors".
// We would prefer to show "failure" for things that logically are.
final String msg = t.getMessage();
final AssertionFailedError failure = msg != null
? new AssertionFailedError(msg) : new AssertionFailedError();
final String message = t.getMessage();
final AssertionFailedError failure = message != null
? new AssertionFailedError(message) : new AssertionFailedError();
failure.initCause(t.getCause());
failure.setStackTrace(t.getStackTrace());
testListener.addFailure(test, failure);


+ 38
- 38
src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java View File

@@ -203,20 +203,20 @@ public class Symlink extends DispatchTask {
return;
}
final Properties links = loadLinks(fileSets);
for (final String lnk : links.stringPropertyNames()) {
final String res = links.getProperty(lnk);
for (final String link : links.stringPropertyNames()) {
final String resource = links.getProperty(link);
try {
if (Files.isSymbolicLink(Paths.get(lnk)) &&
new File(lnk).getCanonicalPath().equals(new File(res).getCanonicalPath())) {
if (Files.isSymbolicLink(Paths.get(link)) &&
new File(link).getCanonicalPath().equals(new File(resource).getCanonicalPath())) {
// it's already a symlink and the symlink target is the same
// as the target noted in the properties file. So there's no
// need to recreate it
log("not recreating " + lnk + " as it points to the correct target already",
log("not recreating " + link + " as it points to the correct target already",
Project.MSG_DEBUG);
continue;
}
} catch (IOException e) {
final String errMessage = "Failed to check if path " + lnk + " is a symbolic link, linking to " + res;
final String errMessage = "Failed to check if path " + link + " is a symbolic link, linking to " + resource;
if (failonerror) {
throw new BuildException(errMessage, e);
}
@@ -225,7 +225,7 @@ public class Symlink extends DispatchTask {
continue;
}
// create the link
this.doLink(res, lnk);
this.doLink(resource, link);
}
} finally {
setDefaults();
@@ -251,18 +251,18 @@ public class Symlink extends DispatchTask {
Map<File, List<File>> byDir = new HashMap<>();

// get an Iterator of file objects representing links (canonical):
findLinks(fileSets).forEach(lnk -> byDir
.computeIfAbsent(lnk.getParentFile(), k -> new ArrayList<>())
.add(lnk));
findLinks(fileSets).forEach(link -> byDir
.computeIfAbsent(link.getParentFile(), k -> new ArrayList<>())
.add(link));

// write a Properties file in each directory:
byDir.forEach((dir, linksInDir) -> {
Properties linksToStore = new Properties();

// fill up a Properties object with link and resource names:
for (File lnk : linksInDir) {
for (File link : linksInDir) {
try {
linksToStore.put(lnk.getName(), lnk.getCanonicalPath());
linksToStore.put(link.getName(), link.getCanonicalPath());
} catch (IOException ioe) {
handleError("Couldn't get canonical name of parent link");
}
@@ -323,10 +323,10 @@ public class Symlink extends DispatchTask {
/**
* Set the name of the link. Used when action = &quot;single&quot;.
*
* @param lnk The name for the link.
* @param link The name for the link.
*/
public void setLink(String lnk) {
this.link = lnk;
public void setLink(String link) {
this.link = link;
}

/**
@@ -435,50 +435,50 @@ public class Symlink extends DispatchTask {
/**
* Conduct the actual construction of a link.
*
* @param res The path of the resource we are linking to.
* @param lnk The name of the link we wish to make.
* @param resource The path of the resource we are linking to.
* @param link The name of the link we wish to make.
* @throws BuildException when things go wrong
*/
private void doLink(String res, String lnk) throws BuildException {
final Path link = Paths.get(lnk);
final Path target = Paths.get(res);
final boolean alreadyExists = Files.exists(link, LinkOption.NOFOLLOW_LINKS);
private void doLink(String resource, String link) throws BuildException {
final Path linkPath = Paths.get(link);
final Path target = Paths.get(resource);
final boolean alreadyExists = Files.exists(linkPath, LinkOption.NOFOLLOW_LINKS);
if (!alreadyExists) {
// if the path (at which the link is expected to be created) isn't already present
// then we just go ahead and attempt to symlink
try {
log("creating symlink " + link + " -> " + target, Project.MSG_DEBUG);
Files.createSymbolicLink(link, target);
log("creating symlink " + linkPath + " -> " + target, Project.MSG_DEBUG);
Files.createSymbolicLink(linkPath, target);
} catch (IOException e) {
if (failonerror) {
throw new BuildException("Failed to create symlink " + lnk + " to target " + res, e);
throw new BuildException("Failed to create symlink " + link + " to target " + resource, e);
}
log("Unable to create symlink " + lnk + " to target " + res, e, Project.MSG_INFO);
log("Unable to create symlink " + link + " to target " + resource, e, Project.MSG_INFO);
}
return;
}
// file already exists, see if we are allowed to overwrite
if (!overwrite) {
log("Skipping symlink creation, since file at " + lnk + " already exists and overwrite is set to false", Project.MSG_INFO);
log("Skipping symlink creation, since file at " + link + " already exists and overwrite is set to false", Project.MSG_INFO);
return;
}
// we have been asked to overwrite, so we now do the necessary steps

// initiate a deletion of the existing file
final boolean existingFileDeleted = link.toFile().delete();
final boolean existingFileDeleted = linkPath.toFile().delete();
if (!existingFileDeleted) {
handleError("Deletion of file at " + lnk + " failed, while trying to overwrite it with a symlink");
handleError("Deletion of file at " + link + " failed, while trying to overwrite it with a symlink");
return;
}
try {
log("creating symlink " + link + " -> " + target + " after removing original",
log("creating symlink " + linkPath + " -> " + target + " after removing original",
Project.MSG_DEBUG);
Files.createSymbolicLink(link, target);
Files.createSymbolicLink(linkPath, target);
} catch (IOException e) {
if (failonerror) {
throw new BuildException("Failed to create symlink " + lnk + " to target " + res, e);
throw new BuildException("Failed to create symlink " + link + " to target " + resource, e);
}
log("Unable to create symlink " + lnk + " to target " + res, e, Project.MSG_INFO);
log("Unable to create symlink " + link + " to target " + resource, e, Project.MSG_INFO);
}
}

@@ -545,10 +545,10 @@ public class Symlink extends DispatchTask {
for (String name : ds.getIncludedFiles()) {
File inc = new File(dir, name);
File pf = inc.getParentFile();
Properties lnks = new Properties();
Properties links = new Properties();
try (InputStream is = new BufferedInputStream(
Files.newInputStream(inc.toPath()))) {
lnks.load(is);
links.load(is);
pf = pf.getCanonicalFile();
} catch (FileNotFoundException fnfe) {
handleError("Unable to find " + name + "; skipping it.");
@@ -559,21 +559,21 @@ public class Symlink extends DispatchTask {
continue;
}
try {
lnks.store(new PrintStream(
links.store(new PrintStream(
new LogOutputStream(this, Project.MSG_INFO)),
"listing properties");
} catch (IOException ex) {
log("failed to log unshortened properties");
lnks.list(new PrintStream(
links.list(new PrintStream(
new LogOutputStream(this, Project.MSG_INFO)));
}
// Write the contents to our master list of links
// This method assumes that all links are defined in
// terms of absolute paths, or paths relative to the
// working directory:
for (String key : lnks.stringPropertyNames()) {
for (String key : links.stringPropertyNames()) {
finalList.put(new File(pf, key).getAbsolutePath(),
lnks.getProperty(key));
links.getProperty(key));
}
}
}


+ 4
- 4
src/main/org/apache/tools/ant/types/Commandline.java View File

@@ -360,8 +360,8 @@ public class Commandline implements Cloneable {
* @param line an array of arguments to append.
*/
public void addArguments(String[] line) {
for (String l : line) {
createArgument().setValue(l);
for (String argument : line) {
createArgument().setValue(argument);
}
}

@@ -464,11 +464,11 @@ public class Commandline implements Cloneable {
}
// path containing one or more elements
final StringBuilder result = new StringBuilder();
for (String l : line) {
for (String argument : line) {
if (result.length() > 0) {
result.append(' ');
}
result.append(quoteArgument(l));
result.append(quoteArgument(argument));
}
return result.toString();
}


Loading…
Cancel
Save