}
if ((tmpIndex > startIndex) &&
(tmpIndex < maxLength) &&
(contents.charAt(tmpIndex) == ';')) {
int entityNumber = Integer.parseInt(contents.substring(startIndex, tmpIndex), radix);
HtmlCharacters htmlCharacter = HtmlCharacters.getCharacterByEntityNumber(entityNumber);
boolean shouldReplace = true;
if (htmlCharacter != null) {
shouldReplace = htmlCharacter.shouldReplaceNumeric();
if (HtmlCharacters.SYMBOL_VERTICAL_BAR.equals(htmlCharacter) &&
(analysis.isInTemplate(ampersandIndex) != null)) {
shouldReplace = false;
}
}
if (shouldReplace) {
if (errors == null) {
return true;
}
result = true;
CheckErrorResult errorResult = createCheckErrorResult(
analysis, ampersandIndex, tmpIndex + 1,
htmlCharacter != null ? ErrorLevel.ERROR : ErrorLevel.WARNING);
if (htmlCharacter != null) {
errorResult.addReplacement("" + htmlCharacter.getValue(), true);
} else {
errorResult.addReplacement("" + (char) entityNumber, false);
}
errors.add(errorResult);
}