Skip to content

Commit

Permalink
[MNG-6829] Replace any StringUtils#isEmpty(String) and #isNotEmpty(St…
Browse files Browse the repository at this point in the history
…ring) (#38)

* [MNG-6829] Replace any StringUtils#isEmpty(String) and #isNotEmpty(String)

Use this link to re-run the recipe: https://public.moderne.io/recipes/org.openrewrite.java.migrate.apache.commons.lang.IsNotEmptyToJdk?organizationId=QXBhY2hlIE1hdmVu

Co-authored-by: Moderne <team@moderne.io>

* Appease Spotless

* Apply spotless

---------

Co-authored-by: Moderne <team@moderne.io>
  • Loading branch information
timtebeek and TeamModerne committed May 15, 2023
1 parent 240621a commit 7a3d620
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Expand Up @@ -384,13 +384,15 @@ public void execute() throws MojoExecutionException {
return;
}

if (StringUtils.isEmpty(encoding)) {
if (encoding == null || encoding.isEmpty()) {
getLog().warn("File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING
+ ", i.e. build is platform dependent!");
}

if (resolveScopes == null) {
resolveScopes = new String[] {StringUtils.isEmpty(this.includeScope) ? JavaScopes.TEST : this.includeScope};
resolveScopes = new String[] {
(this.includeScope == null || this.includeScope.isEmpty()) ? JavaScopes.TEST : this.includeScope
};
}

if (supplementalModels == null) {
Expand Down Expand Up @@ -804,7 +806,7 @@ public Object internalGet(String key) {
String inceptionYear = project.getInceptionYear();
String year = new SimpleDateFormat("yyyy").format((outputDate == null) ? new Date() : outputDate);

if (StringUtils.isEmpty(inceptionYear)) {
if (inceptionYear == null || inceptionYear.isEmpty()) {
if (getLog().isDebugEnabled()) {
getLog().debug("inceptionYear not specified, defaulting to " + year);
}
Expand Down Expand Up @@ -849,10 +851,10 @@ private List<File> downloadBundles(List<String> bundles) throws MojoExecutionExc
String g = s[0];
String a = s[1];
String v = s[2];
String type = (s.length >= 4 ? s[3] : "jar");
String type = s.length >= 4 ? s[3] : "jar";
ArtifactType artifactType =
RepositoryUtils.newArtifactType(type, artifactHandlerManager.getArtifactHandler(type));
String classifier = (s.length == 5 ? s[4] : artifactType.getClassifier());
String classifier = s.length == 5 ? s[4] : artifactType.getClassifier();

DefaultArtifact artifact =
new DefaultArtifact(g, a, classifier, artifactType.getExtension(), v, artifactType);
Expand Down
Expand Up @@ -93,7 +93,7 @@ public void execute() throws MojoExecutionException {
return;
}

if (StringUtils.isEmpty(sourceEncoding)) {
if (sourceEncoding == null || sourceEncoding.isEmpty()) {
getLog().warn("sourceEncoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING
+ ", i.e. build is platform dependent!");
sourceEncoding = ReaderFactory.FILE_ENCODING;
Expand Down

0 comments on commit 7a3d620

Please sign in to comment.