You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by jh...@apache.org on 2019/10/21 09:17:17 UTC

[ant] branch master updated: Made some variable names more consistent with the other parts of the code.

This is an automated email from the ASF dual-hosted git repository.

jhm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ant.git


The following commit(s) were added to refs/heads/master by this push:
     new 1b42c23  Made some variable names more consistent with the other parts of the code.
1b42c23 is described below

commit 1b42c235a17c4e35af5c250e7e0cbe07d806f945
Author: Yusuke Shinyama <yu...@shinyama.jp>
AuthorDate: Mon Oct 21 14:05:15 2019 +0900

    Made some variable names more consistent with the other parts of the code.
---
 src/main/org/apache/tools/ant/BuildException.java  |  8 +--
 .../org/apache/tools/ant/taskdefs/Checksum.java    |  6 +-
 .../tools/ant/taskdefs/condition/Equals.java       | 12 ++--
 .../apache/tools/ant/taskdefs/cvslib/RCSFile.java  |  4 +-
 .../taskdefs/optional/junit/JUnitTestRunner.java   | 16 ++---
 .../tools/ant/taskdefs/optional/unix/Symlink.java  | 76 +++++++++++-----------
 .../org/apache/tools/ant/types/Commandline.java    |  8 +--
 7 files changed, 65 insertions(+), 65 deletions(-)

diff --git a/src/main/org/apache/tools/ant/BuildException.java b/src/main/org/apache/tools/ant/BuildException.java
index 3025240..6dc2c12 100644
--- a/src/main/org/apache/tools/ant/BuildException.java
+++ b/src/main/org/apache/tools/ant/BuildException.java
@@ -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;
     }
 
diff --git a/src/main/org/apache/tools/ant/taskdefs/Checksum.java b/src/main/org/apache/tools/ant/taskdefs/Checksum.java
index 7bf9fd1..2faf92e 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Checksum.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Checksum.java
@@ -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);
     }
 
     /**
diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/Equals.java b/src/main/org/apache/tools/ant/taskdefs/condition/Equals.java
index db0313a..44e3561 100644
--- a/src/main/org/apache/tools/ant/taskdefs/condition/Equals.java
+++ b/src/main/org/apache/tools/ant/taskdefs/condition/Equals.java
@@ -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) {
diff --git a/src/main/org/apache/tools/ant/taskdefs/cvslib/RCSFile.java b/src/main/org/apache/tools/ant/taskdefs/cvslib/RCSFile.java
index 16bc74d..2aa42cd 100644
--- a/src/main/org/apache/tools/ant/taskdefs/cvslib/RCSFile.java
+++ b/src/main/org/apache/tools/ant/taskdefs/cvslib/RCSFile.java
@@ -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,
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
index f914b17..4370bdc 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
@@ -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);
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java b/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java
index a61ad16..54d6811 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java
@@ -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));
                 }
             }
         }
diff --git a/src/main/org/apache/tools/ant/types/Commandline.java b/src/main/org/apache/tools/ant/types/Commandline.java
index 71fc125..86aa4d6 100644
--- a/src/main/org/apache/tools/ant/types/Commandline.java
+++ b/src/main/org/apache/tools/ant/types/Commandline.java
@@ -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();
     }