Browse Source

Add innocuous warning message to catch erroneous ref="${refid}" stuff.

Suggested by Tim Ellison.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@473415 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 18 years ago
parent
commit
7e01ed9d2d
3 changed files with 24 additions and 1 deletions
  1. +3
    -0
      WHATSNEW
  2. +12
    -1
      src/main/org/apache/tools/ant/Project.java
  3. +9
    -0
      src/tests/antunit/core/ref-psyntax-hint.xml

+ 3
- 0
WHATSNEW View File

@@ -16,6 +16,9 @@ Fixed bugs:
Other changes:
--------------

* Warn user when a reference in the form "${refid}" cannot be resolved as this
is a sign they probably meant "refid" (misuse of property expansion syntax).

Changes from Ant 1.7.0Beta3 to Ant 1.7.0RC1
===========================================



+ 12
- 1
src/main/org/apache/tools/ant/Project.java View File

@@ -1911,7 +1911,18 @@ public class Project implements ResourceFactory {
return ret;
}
// Check for old id behaviour
return resolveIdReference(key, this);
ret = resolveIdReference(key, this);
if (ret == null && !key.equals(MagicNames.REFID_PROPERTY_HELPER)) {
Vector p = new Vector();
PropertyHelper.getPropertyHelper(this).parsePropertyString(
key, new Vector(), p);
if (p.size() == 1) {
log("Unresolvable reference " + key
+ " might be a misuse of property expansion syntax.",
MSG_WARN);
}
}
return ret;
}

/**


+ 9
- 0
src/tests/antunit/core/ref-psyntax-hint.xml View File

@@ -0,0 +1,9 @@
<project xmlns:au="antlib:org.apache.ant.antunit">
<target name="testIt">
<au:expectfailure>
<pathconvert refid="${foo}" />
</au:expectfailure>
<au:assertLogContains level="warning"
text="Unresolvable reference $${foo} might be a misuse of property expansion syntax." />
</target>
</project>

Loading…
Cancel
Save