Browse Source

1. Use a variable name that better represents the type of data stored.

2.  Minor code cleanup.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271392 13f79535-47bb-0310-9956-ffa450edef68
master
Magesh Umasankar 23 years ago
parent
commit
3ca907710e
1 changed files with 11 additions and 11 deletions
  1. +11
    -11
      proposal/sandbox/filterreaders/src/main/org/apache/tools/ant/filters/ReplaceTokens.java

+ 11
- 11
proposal/sandbox/filterreaders/src/main/org/apache/tools/ant/filters/ReplaceTokens.java View File

@@ -17,7 +17,7 @@ import org.apache.tools.ant.types.Parameterizable;
* <param type="tokenchar" name="begintoken" value="#"/>
* <param type="tokenchar" name="endtoken" value="#"/>
* <param type="token" name="DATE" value="${DATE}"/>
* <filterreader>
* </filterreader>
*
* @author <a href="mailto:umagesh@apache.org">Magesh Umasankar</a>
*/
@@ -29,7 +29,7 @@ public final class ReplaceTokens

private static final char DEFAULT_END_TOKEN = '@';

private String storedData = null;
private String queuedData = null;

private Parameter[] parameters;

@@ -59,19 +59,19 @@ public final class ReplaceTokens
initialized = true;
}

if (storedData != null && storedData.length() > 0) {
int ch = storedData.charAt(0);
if (storedData.length() > 1) {
storedData = storedData.substring(1);
if (queuedData != null && queuedData.length() > 0) {
final int ch = queuedData.charAt(0);
if (queuedData.length() > 1) {
queuedData = queuedData.substring(1);
} else {
storedData = null;
queuedData = null;
}
return ch;
}

int ch = in.read();
if (ch == beginToken) {
StringBuffer key = new StringBuffer("");
final StringBuffer key = new StringBuffer("");
do {
ch = in.read();
if (ch != -1) {
@@ -82,16 +82,16 @@ public final class ReplaceTokens
} while (ch != endToken);

if (ch == -1) {
storedData = beginToken + key.toString();
queuedData = beginToken + key.toString();
return read();
} else {
key.setLength(key.length() - 1);
final String replaceWith = (String) hash.get(key.toString());
if (replaceWith != null) {
storedData = replaceWith;
queuedData = replaceWith;
return read();
} else {
storedData = beginToken + key.toString() + endToken;
queuedData = beginToken + key.toString() + endToken;
return read();
}
}


Loading…
Cancel
Save