Skip to content

Commit

Permalink
[MNG-6829] Replace StringUtils#isEmpty(String) and #isNotEmpty(String)
Browse files Browse the repository at this point in the history
  • Loading branch information
2 people authored and slachiewicz committed Aug 15, 2023
1 parent 4c3098b commit 7ab5b40
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.apache.maven.project.MavenProject;
import org.apache.maven.settings.Server;
import org.apache.maven.settings.Settings;
import org.codehaus.plexus.util.StringUtils;
import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher;
import org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException;

Expand Down Expand Up @@ -201,7 +200,7 @@ AbstractGpgSigner newSigner(MavenProject project) throws MojoExecutionException,
* @throws MojoFailureException
*/
private void loadGpgPassphrase() throws MojoFailureException {
if (StringUtils.isEmpty(this.passphrase)) {
if (this.passphrase == null || this.passphrase.isEmpty()) {
Server server = this.settings.getServer(passphraseServerId);

if (server != null) {
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/org/apache/maven/plugins/gpg/GpgSigner.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

import org.apache.maven.plugin.MojoExecutionException;
import org.codehaus.plexus.util.Os;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.cli.CommandLineException;
import org.codehaus.plexus.util.cli.CommandLineUtils;
import org.codehaus.plexus.util.cli.Commandline;
Expand All @@ -51,7 +50,7 @@ protected void generateSignatureForFile(File file, File signature) throws MojoEx

Commandline cmd = new Commandline();

if (StringUtils.isNotEmpty(executable)) {
if (executable != null && !executable.isEmpty()) {
cmd.setExecutable(executable);
} else {
cmd.setExecutable("gpg" + (Os.isFamily(Os.FAMILY_WINDOWS) ? ".exe" : ""));
Expand Down Expand Up @@ -137,7 +136,7 @@ protected void generateSignatureForFile(File file, File signature) throws MojoEx
cmd.createArg().setValue("--no-default-keyring");
}

if (StringUtils.isNotEmpty(secretKeyring)) {
if (secretKeyring != null && !secretKeyring.isEmpty()) {
if (gpgVersion.isBefore(GpgVersion.parse("2.1"))) {
cmd.createArg().setValue("--secret-keyring");
cmd.createArg().setValue(secretKeyring);
Expand All @@ -147,7 +146,7 @@ protected void generateSignatureForFile(File file, File signature) throws MojoEx
}
}

if (StringUtils.isNotEmpty(publicKeyring)) {
if (publicKeyring != null && !publicKeyring.isEmpty()) {
cmd.createArg().setValue("--keyring");
cmd.createArg().setValue(publicKeyring);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

import org.apache.maven.plugin.MojoExecutionException;
import org.codehaus.plexus.util.Os;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.cli.CommandLineException;
import org.codehaus.plexus.util.cli.CommandLineUtils;
import org.codehaus.plexus.util.cli.Commandline;
Expand Down Expand Up @@ -57,7 +56,7 @@ private GpgVersionParser(GpgVersionConsumer consumer) {
public static GpgVersionParser parse(String executable) throws MojoExecutionException {
Commandline cmd = new Commandline();

if (StringUtils.isNotEmpty(executable)) {
if (executable != null && !executable.isEmpty()) {
cmd.setExecutable(executable);
} else {
cmd.setExecutable("gpg" + (Os.isFamily(Os.FAMILY_WINDOWS) ? ".exe" : ""));
Expand Down

0 comments on commit 7ab5b40

Please sign in to comment.