Switching last two methods to use 'str' rather than 'string'
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@504336 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2ddc45fc77
commit
4b27f9cc30
|
@ -887,7 +887,7 @@ class Entities {
|
||||||
*
|
*
|
||||||
* @param writer
|
* @param writer
|
||||||
* The <code>Writer</code> to write the results to; assumed to be non-null.
|
* The <code>Writer</code> to write the results to; assumed to be non-null.
|
||||||
* @param string
|
* @param str
|
||||||
* The <code>String</code> to write the results to; assumed to be non-null.
|
* The <code>String</code> to write the results to; assumed to be non-null.
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* when <code>Writer</code> passed throws the exception from calls to the {@link Writer#write(int)}
|
* when <code>Writer</code> passed throws the exception from calls to the {@link Writer#write(int)}
|
||||||
|
@ -896,35 +896,35 @@ class Entities {
|
||||||
* @see #escape(String)
|
* @see #escape(String)
|
||||||
* @see Writer
|
* @see Writer
|
||||||
*/
|
*/
|
||||||
public void unescape(Writer writer, String string) throws IOException {
|
public void unescape(Writer writer, String str) throws IOException {
|
||||||
int firstAmp = string.indexOf('&');
|
int firstAmp = str.indexOf('&');
|
||||||
if (firstAmp < 0) {
|
if (firstAmp < 0) {
|
||||||
writer.write(string);
|
writer.write(str);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
doUnescape(writer, string, firstAmp);
|
doUnescape(writer, str, firstAmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doUnescape(Writer writer, String string, int firstAmp) throws IOException {
|
private void doUnescape(Writer writer, String str, int firstAmp) throws IOException {
|
||||||
writer.write(string, 0, firstAmp);
|
writer.write(str, 0, firstAmp);
|
||||||
int len = string.length();
|
int len = str.length();
|
||||||
for (int i = firstAmp; i < len; i++) {
|
for (int i = firstAmp; i < len; i++) {
|
||||||
char c = string.charAt(i);
|
char c = str.charAt(i);
|
||||||
if (c == '&') {
|
if (c == '&') {
|
||||||
int nextIdx = i + 1;
|
int nextIdx = i + 1;
|
||||||
int semiColonIdx = string.indexOf(';', nextIdx);
|
int semiColonIdx = str.indexOf(';', nextIdx);
|
||||||
if (semiColonIdx == -1) {
|
if (semiColonIdx == -1) {
|
||||||
writer.write(c);
|
writer.write(c);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int amphersandIdx = string.indexOf('&', i + 1);
|
int amphersandIdx = str.indexOf('&', i + 1);
|
||||||
if (amphersandIdx != -1 && amphersandIdx < semiColonIdx) {
|
if (amphersandIdx != -1 && amphersandIdx < semiColonIdx) {
|
||||||
// Then the text looks like &...&...;
|
// Then the text looks like &...&...;
|
||||||
writer.write(c);
|
writer.write(c);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String entityContent = string.substring(nextIdx, semiColonIdx);
|
String entityContent = str.substring(nextIdx, semiColonIdx);
|
||||||
int entityValue = -1;
|
int entityValue = -1;
|
||||||
int entityContentLen = entityContent.length();
|
int entityContentLen = entityContent.length();
|
||||||
if (entityContentLen > 0) {
|
if (entityContentLen > 0) {
|
||||||
|
|
Loading…
Reference in New Issue