Browse Source

Bug 42319: log-statement if resource.size is 0 and therefore the property is not set.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@540066 13f79535-47bb-0310-9956-ffa450edef68
master
Jan Materne 18 years ago
parent
commit
bc19df1e99
2 changed files with 26 additions and 0 deletions
  1. +2
    -0
      src/main/org/apache/tools/ant/taskdefs/LoadResource.java
  2. +24
    -0
      src/tests/antunit/taskdefs/loadresource-test.xml

+ 2
- 0
src/main/org/apache/tools/ant/taskdefs/LoadResource.java View File

@@ -178,6 +178,8 @@ public class LoadResource extends Task {
instream = crh.getAssembledReader();

text = crh.readFully(instream);
} else {
log("Do not set property " + property + " as its length is 0.");
}

if (text != null) {


+ 24
- 0
src/tests/antunit/taskdefs/loadresource-test.xml View File

@@ -0,0 +1,24 @@
<project default="antunit" xmlns:au="antlib:org.apache.ant.antunit">
<import file="../antunit-base.xml" />
<target name="test-resourceString">
<loadresource property="p">
<string value="one"/>
</loadresource >
<au:assertPropertyEquals name="p" value="one"/>
</target>
<target name="test-resourceSizeZero" description="Bug 42319">
<loadresource property="p">
<string value=""/>
</loadresource >
<au:assertTrue>
<not>
<isset property="p"/>
</not>
</au:assertTrue>
<au:assertLogContains text="Do not set property p as its length is 0."/>
</target>
</project>

Loading…
Cancel
Save