This is an automated email from the ASF dual-hosted git repository. garydgregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-text.git
commit a5de772be59d49fb2c9df8e52e0eaa96c6001fdc Author: Gary Gregory <[email protected]> AuthorDate: Tue Jun 2 07:37:32 2026 -0400 Use less vertical space --- .../org/apache/commons/text/translate/NumericEntityUnescaper.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/main/java/org/apache/commons/text/translate/NumericEntityUnescaper.java b/src/main/java/org/apache/commons/text/translate/NumericEntityUnescaper.java index 962995f4..bb384071 100644 --- a/src/main/java/org/apache/commons/text/translate/NumericEntityUnescaper.java +++ b/src/main/java/org/apache/commons/text/translate/NumericEntityUnescaper.java @@ -110,26 +110,21 @@ public class NumericEntityUnescaper extends CharSequenceTranslator { if (input.charAt(index) == '&' && index < seqEnd - 2 && input.charAt(index + 1) == '#') { int start = index + 2; boolean isHex = false; - final char firstChar = input.charAt(start); if (firstChar == 'x' || firstChar == 'X') { start++; isHex = true; - // Check there's more than just an x after the &# if (start == seqEnd) { return 0; } } - int end = start; // Note that this supports character codes without a ; on the end while (end < seqEnd && CharUtils.isHex(input.charAt(end))) { end++; } - final boolean semiNext = end != seqEnd && input.charAt(end) == ';'; - if (!semiNext) { if (isSet(OPTION.semiColonRequired)) { return 0; @@ -138,7 +133,6 @@ public class NumericEntityUnescaper extends CharSequenceTranslator { throw new IllegalArgumentException("Semi-colon required at end of numeric entity"); } } - final int entityValue; try { if (isHex) { @@ -149,7 +143,6 @@ public class NumericEntityUnescaper extends CharSequenceTranslator { } catch (final NumberFormatException nfe) { return 0; } - if (!Character.isValidCodePoint(entityValue)) { return 0; } @@ -160,7 +153,6 @@ public class NumericEntityUnescaper extends CharSequenceTranslator { } else { writer.write(entityValue); } - return 2 + end - start + (isHex ? 1 : 0) + (semiNext ? 1 : 0); } return 0;
