[
https://issues.apache.org/jira/browse/LANG-1793?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Zhongxin Yan updated LANG-1793:
-------------------------------
Attachment: image-2025-11-25-23-58-04-347.png
> Incorrect Javadoc description in CharUtils.isAsciiAlphanumeric()
> ----------------------------------------------------------------
>
> Key: LANG-1793
> URL: https://issues.apache.org/jira/browse/LANG-1793
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.*
> Affects Versions: 3.20.0
> Reporter: Zhongxin Yan
> Priority: Major
> Attachments: image-2025-11-25-23-58-04-347.png
>
>
> The Javadoc of the {{isAsciiAlphanumeric}} method in {{CharUtils}} contains
> an incorrect description.
> The first sentence currently states:
> {quote}“Tests whether the character is ASCII 7 bit numeric.”
> {quote}
> However, the actual implementation checks whether the character is
> {*}alphanumeric{*}, meaning it returns {{true}} for both:
> * alphabetic characters ({{{}A–Z{}}}, {{{}a–z{}}}), and
> * numeric characters ({{{}0–9{}}}).
> This mismatch between the Javadoc and the method behavior is misleading and
> may cause confusion for API users. The documentation should be updated to
> reflect that the method checks for ASCII alphanumeric characters, not numeric
> characters only.
> /**
> * Tests whether the character is ASCII 7 bit numeric.
> *
> * <pre>
> * CharUtils.isAsciiAlphanumeric('a') = true
> * CharUtils.isAsciiAlphanumeric('A') = true
> * CharUtils.isAsciiAlphanumeric('3') = true
> * CharUtils.isAsciiAlphanumeric('-') = false
> * CharUtils.isAsciiAlphanumeric('\n') = false
> * CharUtils.isAsciiAlphanumeric('©') = false
> * </pre>
> *
> * @param ch the character to check
> * @return true if between 48 and 57 or 65 and 90 or 97 and 122 inclusive
> */
> public static boolean isAsciiAlphanumeric(final char ch) {
> return isAsciiAlpha(ch) || isAsciiNumeric(ch);
> }
--
This message was sent by Atlassian Jira
(v8.20.10#820010)