diff --git a/src/main/org/apache/tools/ant/types/resources/PropertyResource.java b/src/main/org/apache/tools/ant/types/resources/PropertyResource.java index b99b7eb64..2874d1707 100644 --- a/src/main/org/apache/tools/ant/types/resources/PropertyResource.java +++ b/src/main/org/apache/tools/ant/types/resources/PropertyResource.java @@ -97,6 +97,20 @@ public class PropertyResource extends Resource { return super.hashCode() * PROPERTY_MAGIC; } + /** + * Get the string. + * + * @return the string contents of the resource. + * @since Ant 1.7 + */ + public String toString() { + if (isReference()) { + return getCheckedRef().toString(); + } + return getName()!=null?("${"+getName()+"}") + :"null"; + } + /** * Get an InputStream for the Resource. * @return an InputStream containing this Resource's content. 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 05947a7e9..01c67fa06 100644 --- a/src/main/org/apache/tools/ant/types/resources/StringResource.java +++ b/src/main/org/apache/tools/ant/types/resources/StringResource.java @@ -127,6 +127,19 @@ public class StringResource extends Resource { return super.hashCode() * STRING_MAGIC; } + /** + * Get the string. + * + * @return the string contents of the resource. + * @since Ant 1.7 + */ + public String toString() { + if (isReference()) { + return getCheckedRef().toString(); + } + return String.valueOf(getContent()); + } + /** * Get an InputStream for the Resource. * @return an InputStream containing this Resource's content.