diff --git a/src/main/org/apache/tools/ant/filters/StripLineComments.java b/src/main/org/apache/tools/ant/filters/StripLineComments.java
index 84ac8904f..54888496d 100644
--- a/src/main/org/apache/tools/ant/filters/StripLineComments.java
+++ b/src/main/org/apache/tools/ant/filters/StripLineComments.java
@@ -208,6 +208,9 @@ public final class StripLineComments
* Must not be null
.
*/
public final void setValue(String comment) {
+ if (value != null) {
+ throw new IllegalStateException("Comment value already set.");
+ }
value = comment;
}
diff --git a/src/tests/antunit/filters/striplinecomments-test.xml b/src/tests/antunit/filters/striplinecomments-test.xml
index a1cafee6f..3bc518f00 100644
--- a/src/tests/antunit/filters/striplinecomments-test.xml
+++ b/src/tests/antunit/filters/striplinecomments-test.xml
@@ -55,4 +55,14 @@ REMark
+
+
+
+
+ #"
+
+
+
+
+