Author: mbenson
Date: Fri Apr 9 15:14:50 2010
New Revision: 932456
URL: http://svn.apache.org/viewvc?rev=932456&view=rev
Log:
problems 49079, 48961
Address indexOf inefficiency in PropertyHelper embedded skip-double-dollar
propertyexpander
implementation.
Modified:
ant/core/trunk/src/main/org/apache/tools/ant/PropertyHelper.java
Modified: ant/core/trunk/src/main/org/apache/tools/ant/PropertyHelper.java
URL:
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/PropertyHelper.java?rev=932456&r1=932455&r2=932456&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/PropertyHelper.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/PropertyHelper.java Fri Apr 9
15:14:50 2010
@@ -213,8 +213,16 @@ public class PropertyHelper implements G
public String parsePropertyName(
String s, ParsePosition pos, ParseNextProperty notUsed) {
int index = pos.getIndex();
- if (s.indexOf("$$", index) == index) {
- pos.setIndex(++index);
+ if (s.length() - index >= 2) {
+ /* check for $$; if found, advance by one--
+ * this expander is at the bottom of the stack
+ * and will thus be the last consulted,
+ * so the next thing that ParseProperties will do
+ * is advance the parse position beyond the second $
+ */
+ if ('$' == s.charAt(index) && '$' == s.charAt(++index)) {
+ pos.setIndex(index);
+ }
}
return null;
}