ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r473415 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/Project.java src/tests/antunit/core/ref-psyntax-hint.xml
Date Fri, 10 Nov 2006 18:29:45 GMT
Author: mbenson
Date: Fri Nov 10 10:29:44 2006
New Revision: 473415

URL: http://svn.apache.org/viewvc?view=rev&rev=473415
Log:
Add innocuous warning message to catch erroneous ref="${refid}" stuff.
Suggested by Tim Ellison.

Added:
    ant/core/trunk/src/tests/antunit/core/ref-psyntax-hint.xml   (with props)
Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/Project.java

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?view=diff&rev=473415&r1=473414&r2=473415
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Fri Nov 10 10:29:44 2006
@@ -16,6 +16,9 @@
 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
 ===========================================
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/Project.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/Project.java?view=diff&rev=473415&r1=473414&r2=473415
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/Project.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/Project.java Fri Nov 10 10:29:44 2006
@@ -1911,7 +1911,18 @@
             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;
     }
 
     /**

Added: ant/core/trunk/src/tests/antunit/core/ref-psyntax-hint.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/core/ref-psyntax-hint.xml?view=auto&rev=473415
==============================================================================
--- ant/core/trunk/src/tests/antunit/core/ref-psyntax-hint.xml (added)
+++ ant/core/trunk/src/tests/antunit/core/ref-psyntax-hint.xml Fri Nov 10 10:29:44 2006
@@ -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>

Propchange: ant/core/trunk/src/tests/antunit/core/ref-psyntax-hint.xml
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message