diff --git a/app/aem/core/src/main/java/com/cognifide/apm/core/actions/ActionResultImpl.java b/app/aem/core/src/main/java/com/cognifide/apm/core/actions/ActionResultImpl.java index c7b99cae7..5f60540f9 100644 --- a/app/aem/core/src/main/java/com/cognifide/apm/core/actions/ActionResultImpl.java +++ b/app/aem/core/src/main/java/com/cognifide/apm/core/actions/ActionResultImpl.java @@ -19,8 +19,6 @@ */ package com.cognifide.apm.core.actions; -import static java.lang.String.format; - import com.cognifide.apm.api.actions.ActionResult; import com.cognifide.apm.api.actions.Message; import com.cognifide.apm.api.status.Status; @@ -123,7 +121,7 @@ private static String checkCommonAuthorizable(List actionResults) for (ActionResult actionResult : actionResults) { String current = actionResult.getAuthorizable(); if (current != null && !StringUtils.equals(current, pattern)) { - String error = format("Cannot create CompositeActionResult, mismatch of authorizables. Found: %s Expected: %s", + String error = String.format("Cannot create CompositeActionResult, mismatch of authorizables. Found: %s Expected: %s", actionResult.getAuthorizable(), pattern); throw new IllegalArgumentException(error); } diff --git a/app/aem/core/src/main/java/com/cognifide/apm/core/actions/ParameterDescriptor.java b/app/aem/core/src/main/java/com/cognifide/apm/core/actions/ParameterDescriptor.java index 133226269..21511a10b 100644 --- a/app/aem/core/src/main/java/com/cognifide/apm/core/actions/ParameterDescriptor.java +++ b/app/aem/core/src/main/java/com/cognifide/apm/core/actions/ParameterDescriptor.java @@ -20,8 +20,6 @@ package com.cognifide.apm.core.actions; -import static java.util.Collections.singletonList; - import com.cognifide.apm.api.actions.annotations.Flag; import com.cognifide.apm.api.actions.annotations.Named; import com.cognifide.apm.api.actions.annotations.Required; @@ -29,6 +27,7 @@ import com.cognifide.apm.core.grammar.ApmType; import com.cognifide.apm.core.grammar.argument.Arguments; import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @@ -62,7 +61,7 @@ public static class RequiredParameterDescriptor extends ParameterDescriptor { public RequiredParameterDescriptor(Class type, int index, Required required) { super(type); this.index = index; - this.argumentDescriptions = singletonList(new ArgumentDescription( + this.argumentDescriptions = Collections.singletonList(new ArgumentDescription( required != null ? required.value() : "(" + index + ")", "required", required != null ? required.description() : "" @@ -101,7 +100,7 @@ public static class NamedParameterDescriptor extends ParameterDescriptor { public NamedParameterDescriptor(Class type, Named named) { super(type); this.name = named.value(); - this.argumentDescriptions = singletonList(new ArgumentDescription( + this.argumentDescriptions = Collections.singletonList(new ArgumentDescription( name, "named", named.description() )); } @@ -168,7 +167,7 @@ public static class FlagParameterDescriptor extends ParameterDescriptor { public FlagParameterDescriptor(Class type, Flag flag) { super(type); - this.argumentDescriptions = singletonList(new ArgumentDescription(flag.value(), "flag", flag.description())); + this.argumentDescriptions = Collections.singletonList(new ArgumentDescription(flag.value(), "flag", flag.description())); this.flag = flag.value(); } diff --git a/app/aem/core/src/main/java/com/cognifide/apm/core/logger/ProgressEntry.java b/app/aem/core/src/main/java/com/cognifide/apm/core/logger/ProgressEntry.java index e57645d65..3acd8cff6 100644 --- a/app/aem/core/src/main/java/com/cognifide/apm/core/logger/ProgressEntry.java +++ b/app/aem/core/src/main/java/com/cognifide/apm/core/logger/ProgressEntry.java @@ -19,13 +19,12 @@ */ package com.cognifide.apm.core.logger; -import static org.apache.commons.lang3.StringUtils.defaultString; - import com.cognifide.apm.api.services.ExecutionResult.Entry; import com.cognifide.apm.api.status.Status; import com.google.common.collect.ImmutableList; import java.util.Collections; import java.util.List; +import org.apache.commons.lang3.StringUtils; public class ProgressEntry implements Entry { @@ -44,11 +43,11 @@ public class ProgressEntry implements Entry { public ProgressEntry(Status status, List messages, String command, String authorizable, List parameters, Position position) { this.status = status != null ? status : Status.SUCCESS; - this.command = defaultString(command); + this.command = StringUtils.defaultString(command); this.position = position; this.messages = messages != null ? ImmutableList.copyOf(messages) : Collections.emptyList(); this.parameters = parameters != null ? ImmutableList.copyOf(parameters) : Collections.emptyList(); - this.authorizable = defaultString(authorizable); + this.authorizable = StringUtils.defaultString(authorizable); } @Override diff --git a/app/aem/core/src/main/java/com/cognifide/apm/core/progress/ProgressImpl.java b/app/aem/core/src/main/java/com/cognifide/apm/core/progress/ProgressImpl.java index 4a32759dd..5fed899ab 100644 --- a/app/aem/core/src/main/java/com/cognifide/apm/core/progress/ProgressImpl.java +++ b/app/aem/core/src/main/java/com/cognifide/apm/core/progress/ProgressImpl.java @@ -19,9 +19,6 @@ */ package com.cognifide.apm.core.progress; -import static java.lang.String.format; -import static java.util.Collections.singletonList; - import com.cognifide.apm.api.actions.ActionResult; import com.cognifide.apm.api.actions.Message; import com.cognifide.apm.api.status.Status; @@ -87,14 +84,14 @@ private List toParameters(Arguments arguments) { } final List parameters = new ArrayList<>(); arguments.getRequired().forEach(it -> parameters.add(it.toString())); - arguments.getNamed().forEach((key, value) -> parameters.add(format("%s=%s", key, value))); - arguments.getFlags().forEach(it -> parameters.add(format("--%s", it))); + arguments.getNamed().forEach((key, value) -> parameters.add(String.format("%s=%s", key, value))); + arguments.getFlags().forEach(it -> parameters.add(String.format("--%s", it))); return parameters; } @Override public void addEntry(Status status, String message) { - this.entries.add(shortEntry("", singletonList(message), status)); + this.entries.add(shortEntry("", Collections.singletonList(message), status)); } @Override @@ -104,7 +101,7 @@ public void addEntry(Status status, List messages) { @Override public void addEntry(Status status, String message, String command) { - this.entries.add(shortEntry(command, singletonList(message), status)); + this.entries.add(shortEntry(command, Collections.singletonList(message), status)); } @Override diff --git a/app/aem/core/src/main/java/com/cognifide/apm/core/scripts/ScriptStorageImpl.java b/app/aem/core/src/main/java/com/cognifide/apm/core/scripts/ScriptStorageImpl.java index 7dc0104bb..ebb10e841 100644 --- a/app/aem/core/src/main/java/com/cognifide/apm/core/scripts/ScriptStorageImpl.java +++ b/app/aem/core/src/main/java/com/cognifide/apm/core/scripts/ScriptStorageImpl.java @@ -19,8 +19,6 @@ */ package com.cognifide.apm.core.scripts; -import static java.lang.String.format; - import com.cognifide.apm.api.scripts.Script; import com.cognifide.apm.api.services.ScriptFinder; import com.cognifide.apm.core.Apm; @@ -178,7 +176,7 @@ private List validate(FileDescriptor file) { private static void ensurePropertyMatchesPattern(List errors, String property, String value, Pattern pattern) { if (!pattern.matcher(value).matches()) { - errors.add(format("Invalid %s: \"%s\"", property, value)); + errors.add(String.format("Invalid %s: \"%s\"", property, value)); } } diff --git a/app/aem/core/src/main/java/com/cognifide/apm/core/ui/models/ScriptsRowModel.java b/app/aem/core/src/main/java/com/cognifide/apm/core/ui/models/ScriptsRowModel.java index 8497e8782..cd935d33c 100644 --- a/app/aem/core/src/main/java/com/cognifide/apm/core/ui/models/ScriptsRowModel.java +++ b/app/aem/core/src/main/java/com/cognifide/apm/core/ui/models/ScriptsRowModel.java @@ -19,8 +19,6 @@ */ package com.cognifide.apm.core.ui.models; -import static org.apache.commons.lang3.StringUtils.defaultIfEmpty; - import com.cognifide.apm.api.scripts.Script; import com.cognifide.apm.core.history.History; import com.cognifide.apm.core.history.HistoryEntry; @@ -81,7 +79,7 @@ public final class ScriptsRowModel { @PostConstruct private void afterCreated() { this.isFolder = isFolder(resource); - this.scriptName = defaultIfEmpty(getProperty(resource, JcrConstants.JCR_TITLE), resource.getName()); + this.scriptName = StringUtils.defaultIfEmpty(getProperty(resource, JcrConstants.JCR_TITLE), resource.getName()); if (!isFolder) { Optional.ofNullable(resource.adaptTo(ScriptModel.class)).ifPresent(script -> { ScriptHistory scriptHistory = history.findScriptHistory(resource.getResourceResolver(), script);