Browse Source

problems 49079, 48961

Address indexOf inefficiency in PropertyHelper embedded skip-double-dollar propertyexpander
implementation.



git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@932456 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 15 years ago
parent
commit
16d4f876a8
1 changed files with 10 additions and 2 deletions
  1. +10
    -2
      src/main/org/apache/tools/ant/PropertyHelper.java

+ 10
- 2
src/main/org/apache/tools/ant/PropertyHelper.java View File

@@ -213,8 +213,16 @@ public class PropertyHelper implements GetProperty {
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;
}


Loading…
Cancel
Save