[
https://issues.apache.org/jira/browse/LANG-1752?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17885040#comment-17885040
]
Saif Asif commented on LANG-1752:
---------------------------------
[~ggregory] I tested out and there is a NPE thrown when we use the equals
method of Strings.CS or Strings.CI. The original implementation of
StringUtils.equals is null safe.
I created a PR [https://github.com/apache/commons-lang/pull/1279] where I
Separated out test cases from StringUtils and added more cases for null check.
It seems that we are running into a NPE when we use the new
{{Strings.CS.equals(null,null)}} method. See
[line|https://github.com/apache/commons-lang/pull/1279/files#diff-190bb6d0ff6389981367f96b7e05541b5c7598c718e611d04f07d9cf66e7f65bR124]
where I created a test cases to highlight this exact failure case.
When using {{StringUtils.equals(null, null)}} it doesn't throw a NPE. IMO We
should use the same functionality when using either of the {{Strings.CS}} or
{{Strings.CI}} equals method
> Seperating ignoresCase APIs from StringUtils
> --------------------------------------------
>
> Key: LANG-1752
> URL: https://issues.apache.org/jira/browse/LANG-1752
> Project: Commons Lang
> Issue Type: Improvement
> Reporter: Saif Asif
> Assignee: Gary D. Gregory
> Priority: Major
>
> Overtime, more and more APIs are being added to the StringUtils class that
> are a variation of existing APIs based on casing e.g `endsWithIgnoreCase` is
> just `endsWith` with an additional boolean ignoreCase set to true.
> {code:java}
> public static boolean endsWithIgnoreCase(final CharSequence str, final
> CharSequence suffix) {
> return endsWith(str, suffix, true);
> }
> private static boolean endsWith(final CharSequence str, final CharSequence
> suffix, final boolean ignoreCase) {}{code}
>
> This leads to StringUtils class increasing in size.
> I would like to propose that we refactor StringUtils class and move all
> ignoreCase APIs to their own class e.g something like
> {code:java}
> StringUtilsIgnoreCase{code}
> or so.
> Since the refactoring will be huge, we can target for the next major version
> (4.0?) and introduce `@deprecated` on the methods to give users enough time
> to track and update their existing code bases.
> What does the community think ?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)