Skip to content

Conversation

@timtebeek
Copy link
Contributor

@timtebeek timtebeek commented Apr 16, 2023

Replace any StringUtils#isEmpty(String) and #isNotEmpty(String)

A continuation of https://issues.apache.org/jira/browse/MNG-6825 and https://issues.apache.org/jira/browse/MNG-6829, where previously a request was made to instead of switching implementation to a different StringUtils, we should instead switch to using JDK internals where we can. This is a first such pull request to gauge interest before I can potentially make 47 more PRs to replace a total of 210 uses of isEmpty / isNotEmpty.

timtebeek and others added 2 commits April 16, 2023 18:50
…otEmpty(String)

### [Replace any StringUtils#isEmpty(String) and #isNotEmpty(String)](https://public.moderne.io/recipes/org.openrewrite.java.migrate.apache.commons.lang.IsNotEmptyToJdk)

A continuation of https://issues.apache.org/jira/browse/MNG-6825 and https://issues.apache.org/jira/browse/MNG-6829, where previously a request was made to instead of switching implementation to a different StringUtils, we should instead switch to using JDK internals where we can. This is a first such pull request to gauge interest before I can potentially make 47 more PRs to replace a total of 210 uses of isEmpty / isNotEmpty.


Co-authored-by: Moderne <team@moderne.io>
@timtebeek
Copy link
Contributor Author

@slachiewicz This is a continuation of #168 ; now aimed at reducing the reliance on StringUtils as earlier requested by @gnodet. Any feedback welcome; I hope to be useful while keeping the noise down; which is a struggle when previously asked to produce small pull requests.

There's a few unfortunate patterns in the repository where previously !StringUtils.isEmpty was used, which isn't as clear when replaced one to one with !(userDatePattern == null || userDatePattern.isEmpty()). Let me know if this should be cleared up before we run this at scale.

@timtebeek
Copy link
Contributor Author

@elharo Here's a previous one that we could merge now that the CCLA has been signed, unless you want me to tackle the ! inversion first.

Copy link
Contributor

@elharo elharo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Github is acting up and won't let me merge. I'll try later.

@elharo elharo merged commit 5a7875e into apache:master May 9, 2023
@timtebeek timtebeek deleted the refactor/replace-any-string-utils-is-empty-string-and-is-not-empty-string branch August 19, 2023 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants