From 6b652facf6f5886b1166b2227fafe1caf9c914d3 Mon Sep 17 00:00:00 2001 From: Matthew Jason Benson Date: Tue, 8 May 2007 22:28:38 +0000 Subject: [PATCH] add a new constructor for programmatic construction of a StringResource with property substitution (will support fixing broken Concat tests) git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@536355 13f79535-47bb-0310-9956-ffa450edef68 --- .../tools/ant/types/resources/StringResource.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/org/apache/tools/ant/types/resources/StringResource.java b/src/main/org/apache/tools/ant/types/resources/StringResource.java index fb069cc0a..30ec7d9a7 100644 --- a/src/main/org/apache/tools/ant/types/resources/StringResource.java +++ b/src/main/org/apache/tools/ant/types/resources/StringResource.java @@ -26,6 +26,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Resource; import org.apache.tools.ant.types.Reference; @@ -52,7 +53,18 @@ public class StringResource extends Resource { * @param value the value of this StringResource. */ public StringResource(String value) { - setValue(value); + this(null, value); + } + + /** + * Construct a StringResource with the supplied project and value, + * doing property replacement against the project if non-null. + * @param project the owning Project. + * @param value the value of this StringResource. + */ + public StringResource(Project project, String value) { + setProject(project); + setValue(project == null ? value : project.replaceProperties(value)); } /**