Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<spotbugs.threshold>Low</spotbugs.threshold>
<spotless.check.skip>false</spotless.check.skip>
<ban-junit4-imports.skip>false</ban-junit4-imports.skip>
<ban-commons-lang-2.skip>false</ban-commons-lang-2.skip>
</properties>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import java.util.logging.Logger;
import jenkins.model.GlobalConfiguration;
import jenkins.model.GlobalConfigurationCategory;
import org.apache.commons.lang.StringUtils;

public abstract class AbstractAwsGlobalConfiguration extends GlobalConfiguration {

Expand All @@ -53,6 +52,6 @@

String msg = t.getMessage();
String className = t.getClass().getSimpleName();
return className + ": " + StringUtils.defaultIfBlank(msg, "Unknown error");
return className + ": " + ((msg == null || msg.isBlank()) ? "Unknown error" : msg);

Check warning on line 55 in src/main/java/io/jenkins/plugins/aws/global_configuration/AbstractAwsGlobalConfiguration.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 55 is not covered by tests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import java.util.Objects;
import java.util.Optional;
import jenkins.model.Jenkins;
import org.apache.commons.lang.StringUtils;
import org.jenkinsci.Symbol;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
Expand Down Expand Up @@ -117,7 +116,7 @@

@DataBoundSetter
public void setCredentialsId(@CheckForNull String credentialsId) {
this.credentialsId = StringUtils.defaultIfBlank(credentialsId, null);
this.credentialsId = (credentialsId == null || credentialsId.isBlank()) ? null : credentialsId;

Check warning on line 119 in src/main/java/io/jenkins/plugins/aws/global_configuration/CredentialsAwsGlobalConfiguration.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 119 is only partially covered, one branch is missing
save();
}

Expand Down Expand Up @@ -211,7 +210,7 @@
*/
public AwsSessionCredentials sessionCredentials(String region, String credentialsId) throws IOException {
AmazonWebServicesCredentials baseCredentials =
StringUtils.isNotBlank(credentialsId) ? getCredentials(credentialsId) : null;
(credentialsId != null && !credentialsId.isBlank()) ? getCredentials(credentialsId) : null;

Check warning on line 213 in src/main/java/io/jenkins/plugins/aws/global_configuration/CredentialsAwsGlobalConfiguration.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 213 is not covered by tests
if (baseCredentials != null) {
return sessionCredentialsFromKeyAndSecret(region, baseCredentials);
} else {
Expand Down Expand Up @@ -284,7 +283,7 @@
}

public FormValidation doCheckRegion(@QueryParameter String region) {
if (StringUtils.isNotBlank(region)) {
if (region != null && !region.isBlank()) {

Check warning on line 286 in src/main/java/io/jenkins/plugins/aws/global_configuration/CredentialsAwsGlobalConfiguration.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 286 is only partially covered, one branch is missing
if (Region.regions().stream().noneMatch(r -> r.id().equals(region))) {
return FormValidation.error("Region is not valid");
}
Expand Down