diff --git a/WHATSNEW b/WHATSNEW
index e1cf6dc1f..315e6968b 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -44,6 +44,9 @@ Other changes:
documented.
Bugzilla Report 50576.
+ * The concat task now permits the name of its exposed resource
+ by means of its 'resourcename' attribute.
+
Changes from Ant 1.8.1 TO Ant 1.8.2
===================================
diff --git a/manual/Tasks/concat.html b/manual/Tasks/concat.html
index 922bfdb54..ced7eb1e2 100644
--- a/manual/Tasks/concat.html
+++ b/manual/Tasks/concat.html
@@ -190,6 +190,15 @@ Resource Collections are used to
No |
+
+ resourcename |
+
+ Since Ant 1.8.3
+ Specifies the name reported if this task is exposed
+ as a resource.
+ |
+ No |
+
diff --git a/src/main/org/apache/tools/ant/taskdefs/Concat.java b/src/main/org/apache/tools/ant/taskdefs/Concat.java
index 5c0a626b8..1424e20d6 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Concat.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Concat.java
@@ -424,7 +424,8 @@ public class Concat extends Task implements ResourceCollection {
: new ReaderInputStream(rdr, outputEncoding);
}
public String getName() {
- return "concat (" + String.valueOf(c) + ")";
+ return resourceName == null
+ ? "concat (" + String.valueOf(c) + ")" : resourceName;
}
}
@@ -486,6 +487,8 @@ public class Concat extends Task implements ResourceCollection {
/** whether to not create dest if no source files are
* available */
private boolean ignoreEmpty = true;
+ /** exposed resource name */
+ private String resourceName;
private ReaderFactory resourceReaderFactory = new ReaderFactory() {
public Reader getReader(Object o) throws IOException {
@@ -627,6 +630,15 @@ public class Concat extends Task implements ResourceCollection {
this.ignoreEmpty = ignoreEmpty;
}
+ /**
+ * Set the name that will be reported by the exposed {@link Resource}.
+ * @param resourceName to set
+ * @since Ant 1.8.3
+ */
+ public void setResourceName(String resourceName) {
+ this.resourceName = resourceName;
+ }
+
// Nested element creators.
/**
diff --git a/src/tests/antunit/types/resources/concat-resource-test.xml b/src/tests/antunit/types/resources/concat-resource-test.xml
index ead945004..554c13d20 100644
--- a/src/tests/antunit/types/resources/concat-resource-test.xml
+++ b/src/tests/antunit/types/resources/concat-resource-test.xml
@@ -139,4 +139,22 @@ baz
+
+
+
+
+
+
+
+ whatever
+
+
+ whatever
+
+
+
+
+
+
+