You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by gi...@apache.org on 2018/04/06 20:36:30 UTC

[1/2] ant git commit: Adjust test case for Java 8

Repository: ant
Updated Branches:
  refs/heads/master 73bda1fb1 -> a4099af87


Adjust test case for Java 8

Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/d3ea4247
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/d3ea4247
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/d3ea4247

Branch: refs/heads/master
Commit: d3ea4247a33f703f411e887347ff34d01bf17434
Parents: 73bda1f
Author: Gintas Grigelionis <gi...@apache.org>
Authored: Fri Apr 6 22:14:36 2018 +0200
Committer: Gintas Grigelionis <gi...@apache.org>
Committed: Fri Apr 6 22:14:36 2018 +0200

----------------------------------------------------------------------
 src/etc/testcases/core/containersrc/test/SpecialSeq.java    | 8 ++------
 src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java | 4 ++--
 2 files changed, 4 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/d3ea4247/src/etc/testcases/core/containersrc/test/SpecialSeq.java
----------------------------------------------------------------------
diff --git a/src/etc/testcases/core/containersrc/test/SpecialSeq.java b/src/etc/testcases/core/containersrc/test/SpecialSeq.java
index f3f0176..d823732 100644
--- a/src/etc/testcases/core/containersrc/test/SpecialSeq.java
+++ b/src/etc/testcases/core/containersrc/test/SpecialSeq.java
@@ -23,12 +23,11 @@ import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.types.FileSet;
 import org.apache.tools.ant.taskdefs.Echo;
 
-import java.util.Enumeration;
 import java.util.Vector;
 
 public class SpecialSeq extends Task implements TaskContainer {
     /** Optional Vector holding the nested tasks */
-    private Vector nestedTasks = new Vector();
+    private Vector<Task> nestedTasks = new Vector<>();
 
     private FileSet fileset;
 
@@ -50,10 +49,7 @@ public class SpecialSeq extends Task implements TaskContainer {
         if (fileset == null || fileset.getDir(getProject()) == null) {
             throw new BuildException("Fileset was not configured");
         }
-        for (Enumeration e = nestedTasks.elements(); e.hasMoreElements();) {
-            Task nestedTask = (Task) e.nextElement();
-            nestedTask.perform();
-        }
+        nestedTasks.forEach(Task::perform);
         nestedEcho.reconfigure();
         nestedEcho.perform();
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/d3ea4247/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java b/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java
index 8f0d13d..175a39a 100644
--- a/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java
+++ b/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java
@@ -403,8 +403,8 @@ public class ProjectHelperImpl extends ProjectHelper {
                         baseDir = value;
                         break;
                     default:
-                        throw new SAXParseException("Unexpected attribute \"" + attrs.getName(i)
-                                        + "\"", helperImpl.locator);
+                        throw new SAXParseException("Unexpected attribute \"" + key + "\"",
+                                helperImpl.locator);
                 }
             }
 


[2/2] ant git commit: Checkstyle

Posted by gi...@apache.org.
Checkstyle

Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/a4099af8
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/a4099af8
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/a4099af8

Branch: refs/heads/master
Commit: a4099af879d918764300af4c72a540382c7163a8
Parents: d3ea424
Author: Gintas Grigelionis <gi...@apache.org>
Authored: Fri Apr 6 22:36:08 2018 +0200
Committer: Gintas Grigelionis <gi...@apache.org>
Committed: Fri Apr 6 22:36:08 2018 +0200

----------------------------------------------------------------------
 src/main/org/apache/tools/ant/taskdefs/JDBCTask.java         | 2 +-
 src/tests/antunit/core/uuencode/src/task/BaseTask.java       | 2 +-
 .../junit/org/apache/tools/ant/taskdefs/ManifestTest.java    | 8 ++++----
 src/tests/junit/org/apache/tools/ant/taskdefs/TouchTest.java | 2 +-
 .../junit/org/apache/tools/ant/taskdefs/XmlPropertyTest.java | 4 ++--
 src/tests/junit/org/apache/tools/ant/types/MapperTest.java   | 2 +-
 .../org/apache/tools/ant/util/LazyFileOutputStreamTest.java  | 2 +-
 7 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/a4099af8/src/main/org/apache/tools/ant/taskdefs/JDBCTask.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/JDBCTask.java b/src/main/org/apache/tools/ant/taskdefs/JDBCTask.java
index 6377d28..fdfdc39 100644
--- a/src/main/org/apache/tools/ant/taskdefs/JDBCTask.java
+++ b/src/main/org/apache/tools/ant/taskdefs/JDBCTask.java
@@ -60,7 +60,7 @@ public class SQLExampleTask extends JDBCTask {
         Statement stmt=null;
         try {
             if (tableName == null) {
-                throw new BuildException("TableName must be specified",location);
+                throw new BuildException("TableName must be specified", location);
             }
             String sql = "SELECT * FROM "+tableName;
             stmt= conn.createStatement();

http://git-wip-us.apache.org/repos/asf/ant/blob/a4099af8/src/tests/antunit/core/uuencode/src/task/BaseTask.java
----------------------------------------------------------------------
diff --git a/src/tests/antunit/core/uuencode/src/task/BaseTask.java b/src/tests/antunit/core/uuencode/src/task/BaseTask.java
index 70eb7a3..cfb30b1 100644
--- a/src/tests/antunit/core/uuencode/src/task/BaseTask.java
+++ b/src/tests/antunit/core/uuencode/src/task/BaseTask.java
@@ -31,7 +31,7 @@ import java.io.OutputStream;
  * Base class for the uuencode/decode test tasks.
  */
 abstract public class BaseTask extends Task {
-    private final static FileUtils FILE_UTILS = FileUtils.getFileUtils();
+    private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
     private File inFile;
     private File outFile;
 

http://git-wip-us.apache.org/repos/asf/ant/blob/a4099af8/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java
index 3dbcdf1..f8bd329 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java
@@ -55,10 +55,10 @@ public class ManifestTest {
     private File outDir;
 
     public static final String LONG_LINE
-        = "AReallyLongLineToTestLineBreakingInManifests-ACapabilityWhich" +
-          "IsSureToLeadToHundredsOfQuestionsAboutWhyAntMungesManifests" +
-          "OfCourseTheAnswerIsThatIsWhatTheSpecRequiresAndIfAnythingHas" +
-          "AProblemWithThatItIsNotABugInAnt";
+            = "AReallyLongLineToTestLineBreakingInManifests-ACapabilityWhich"
+            + "IsSureToLeadToHundredsOfQuestionsAboutWhyAntMungesManifests"
+            + "OfCourseTheAnswerIsThatIsWhatTheSpecRequiresAndIfAnythingHas"
+            + "AProblemWithThatItIsNotABugInAnt";
 
     public static final String LONG_70_NAME
         = "ThisNameIsJustSeventyCharactersWhichIsAllowedAccordingToTheSpecsFiller";

http://git-wip-us.apache.org/repos/asf/ant/blob/a4099af8/src/tests/junit/org/apache/tools/ant/taskdefs/TouchTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/TouchTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/TouchTest.java
index 0f90146..80a0884 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/TouchTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/TouchTest.java
@@ -193,7 +193,7 @@ public class TouchTest {
      * @param timestamp long
      * @param time long
      */
-    public void assertTimesNearlyMatch(long timestamp,long time) {
+    public void assertTimesNearlyMatch(long timestamp, long time) {
         long granularity= FILE_UTILS.getFileTimestampGranularity();
         assertTimesNearlyMatch(timestamp, time, granularity);
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/a4099af8/src/tests/junit/org/apache/tools/ant/taskdefs/XmlPropertyTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/XmlPropertyTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/XmlPropertyTest.java
index fb3cde2..379f6be 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/XmlPropertyTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/XmlPropertyTest.java
@@ -332,7 +332,7 @@ public class XmlPropertyTest {
      * Retrieve a list of xml files in the specified folder
      * and below.
      */
-    private static Enumeration<File> getFiles (final File startingDir) {
+    private static Enumeration<File> getFiles(final File startingDir) {
         Vector<File> result = new Vector<>();
         getFiles(startingDir, result);
         return result.elements();
@@ -342,7 +342,7 @@ public class XmlPropertyTest {
      * Collect a list of xml files in the specified folder
      * and below.
      */
-    private static void getFiles (final File startingDir, Vector<File> collect) {
+    private static void getFiles(final File startingDir, Vector<File> collect) {
         FileFilter filter = file -> {
             if (file.isDirectory()) {
                 return true;

http://git-wip-us.apache.org/repos/asf/ant/blob/a4099af8/src/tests/junit/org/apache/tools/ant/types/MapperTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/MapperTest.java b/src/tests/junit/org/apache/tools/ant/types/MapperTest.java
index 37433ea..3949a15 100644
--- a/src/tests/junit/org/apache/tools/ant/types/MapperTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/MapperTest.java
@@ -222,7 +222,7 @@ public class MapperTest {
         String[] targets = fileNameMapper.mapFileName("a");
         assertNotNull("no filenames mapped", targets);
         assertEquals("wrong number of filenames mapped", 2, targets.length);
-        List list = Arrays.asList(targets);
+        List<String> list = Arrays.asList(targets);
         assertTrue("cannot find expected target \"def\"", list.contains("def"));
         assertTrue("cannot find expected target \"ghi\"", list.contains("ghi"));
 

http://git-wip-us.apache.org/repos/asf/ant/blob/a4099af8/src/tests/junit/org/apache/tools/ant/util/LazyFileOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/LazyFileOutputStreamTest.java b/src/tests/junit/org/apache/tools/ant/util/LazyFileOutputStreamTest.java
index 2a4cbf7..513472c 100644
--- a/src/tests/junit/org/apache/tools/ant/util/LazyFileOutputStreamTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/LazyFileOutputStreamTest.java
@@ -31,7 +31,7 @@ import static org.junit.Assert.assertTrue;
  */
 public class LazyFileOutputStreamTest {
     private LazyFileOutputStream los;
-    private final static File f = new File("test.txt");
+    private static final File f = new File("test.txt");
 
     @Before
     public void setUp() {