You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2018/02/02 09:51:44 UTC

[1/2] ant git commit: fix javadoc

Repository: ant
Updated Branches:
  refs/heads/1.9.x b38faab1c -> a390fd653


fix javadoc


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

Branch: refs/heads/1.9.x
Commit: 82573c463b5640cd98128b2eeb23110e694ac148
Parents: b38faab
Author: Stefan Bodewig <bo...@apache.org>
Authored: Fri Feb 2 10:25:30 2018 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Fri Feb 2 10:25:30 2018 +0100

----------------------------------------------------------------------
 src/main/org/apache/tools/ant/types/AbstractFileSet.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/82573c46/src/main/org/apache/tools/ant/types/AbstractFileSet.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/AbstractFileSet.java b/src/main/org/apache/tools/ant/types/AbstractFileSet.java
index 1639150..7d1ac4a 100644
--- a/src/main/org/apache/tools/ant/types/AbstractFileSet.java
+++ b/src/main/org/apache/tools/ant/types/AbstractFileSet.java
@@ -292,7 +292,7 @@ public abstract class AbstractFileSet extends DataType
     }
 
     /**
-     * Appends <code>excludes</code> to the current list of include
+     * Appends <code>excludes</code> to the current list of exclude
      * patterns.
      *
      * @param excludes array containing the exclude patterns.


[2/2] ant git commit: BZ 62071 - fix error message when fileset.setFile is called twice

Posted by bo...@apache.org.
BZ 62071 - fix error message when fileset.setFile is called twice


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

Branch: refs/heads/1.9.x
Commit: a390fd653ca45cb32cee7b25050ae70a4f1b55c9
Parents: 82573c4
Author: Stefan Bodewig <bo...@apache.org>
Authored: Fri Feb 2 10:25:53 2018 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Fri Feb 2 10:25:53 2018 +0100

----------------------------------------------------------------------
 WHATSNEW                                        |  5 +++++
 .../apache/tools/ant/types/AbstractFileSet.java | 11 ++++++++++-
 .../tools/ant/types/AbstractFileSetTest.java    | 20 ++++++++++++++++++++
 3 files changed, 35 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/a390fd65/WHATSNEW
----------------------------------------------------------------------
diff --git a/WHATSNEW b/WHATSNEW
index 1430c8d..923f75a 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -30,6 +30,11 @@ Fixed bugs:
    streams of a process, could end up being truncated.
    Bugzilla Report 58833, 58451
 
+ * <fileset>/<zipfileset>/<tarfileset> will now throw an exception
+   with a more useful error message when setFile is called twice on
+   the same instance.
+   Bugzilla Report 62071
+
 Other changes:
 --------------
 

http://git-wip-us.apache.org/repos/asf/ant/blob/a390fd65/src/main/org/apache/tools/ant/types/AbstractFileSet.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/AbstractFileSet.java b/src/main/org/apache/tools/ant/types/AbstractFileSet.java
index 7d1ac4a..0c1d57d 100644
--- a/src/main/org/apache/tools/ant/types/AbstractFileSet.java
+++ b/src/main/org/apache/tools/ant/types/AbstractFileSet.java
@@ -232,7 +232,16 @@ public abstract class AbstractFileSet extends DataType
         if (isReference()) {
             throw tooManyAttributes();
         }
-        if (getDir() != null) {
+        if (fileAttributeUsed) {
+            if (getDir().equals(file.getParentFile())) {
+                String[] includes = defaultPatterns.getIncludePatterns(getProject());
+                if (includes.length == 1 && includes[0].equals(file.getName())) {
+                    // NOOP, setFile has been invoked twice with the same parameter
+                    return;
+                }
+            }
+            throw new BuildException("setFile cannot be called twice with different arguments");
+        } else if (getDir() != null) {
             throw dirAndFileAreMutuallyExclusive();
         }
         setDir(file.getParentFile());

http://git-wip-us.apache.org/repos/asf/ant/blob/a390fd65/src/tests/junit/org/apache/tools/ant/types/AbstractFileSetTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/AbstractFileSetTest.java b/src/tests/junit/org/apache/tools/ant/types/AbstractFileSetTest.java
index 56ee498..a025b2b 100644
--- a/src/tests/junit/org/apache/tools/ant/types/AbstractFileSetTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/AbstractFileSetTest.java
@@ -244,4 +244,24 @@ public abstract class AbstractFileSetTest {
         File dir = f1.getDir(project);
         assertEquals("Dir is basedir", dir, project.getBaseDir());
     }
+
+    @Test
+    public void canCallSetFileTwiceWithSameArgument() {
+        AbstractFileSet f = getInstance();
+        f.setFile(new File("/a"));
+        f.setFile(new File("/a"));
+        // really only asserts no exception is thrown
+    }
+
+    @Test
+    public void cantCallSetFileTwiceWithDifferentArguments() {
+        AbstractFileSet f = getInstance();
+        f.setFile(new File("/a"));
+        try {
+            f.setFile(new File("/b"));
+            fail("expected an exception");
+        } catch (BuildException ex) {
+            assertEquals("setFile cannot be called twice with different arguments", ex.getMessage());
+        }
+    }
 }