Skip to content
Open
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 @@ -83,6 +83,7 @@ THE SOFTWARE.
<hpi.compatibleSinceVersion>1885</hpi.compatibleSinceVersion>
<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
3 changes: 1 addition & 2 deletions src/main/java/hudson/plugins/ec2/CloudHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import org.apache.commons.lang.StringUtils;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.core.exception.SdkException;
import software.amazon.awssdk.services.ec2.Ec2Client;
Expand Down Expand Up @@ -46,7 +45,7 @@

@CheckForNull
static Instance getInstance(String instanceId, EC2Cloud cloud) throws SdkException {
if (StringUtils.isEmpty(instanceId) || cloud == null) {
if (instanceId == null || instanceId.isEmpty() || cloud == null) {

Check warning on line 48 in src/main/java/hudson/plugins/ec2/CloudHelper.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 48 is only partially covered, 2 branches are missing
return null;
}

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/hudson/plugins/ec2/EC2AbstractSlave.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import java.util.logging.Logger;
import jenkins.model.Jenkins;
import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.verb.POST;
Expand Down Expand Up @@ -1124,7 +1123,7 @@
public static ListBoxModel fillZoneItems(AwsCredentialsProvider credentialsProvider, String region) {
ListBoxModel model = new ListBoxModel();

if (!StringUtils.isEmpty(region)) {
if (region != null && !region.isEmpty()) {

Check warning on line 1126 in src/main/java/hudson/plugins/ec2/EC2AbstractSlave.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 1126 is not covered by tests
Ec2Client client =
AmazonEC2Factory.getInstance().connect(credentialsProvider, EC2Cloud.parseRegion(region), null);
DescribeAvailabilityZonesResponse zones = client.describeAvailabilityZones();
Expand Down
36 changes: 18 additions & 18 deletions src/main/java/hudson/plugins/ec2/EC2Cloud.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
import jenkins.model.Jenkins;
import jenkins.model.JenkinsLocationConfiguration;
import jenkins.util.Timer;
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 @@ -924,8 +923,8 @@
if (template != null) {
List<Tag> instanceTags = sir.tags();
for (Tag tag : instanceTags) {
if (StringUtils.equals(tag.key(), EC2Tag.TAG_NAME_JENKINS_SLAVE_TYPE)
&& StringUtils.equals(
if (Objects.equals(tag.key(), EC2Tag.TAG_NAME_JENKINS_SLAVE_TYPE)
&& Objects.equals(

Check warning on line 927 in src/main/java/hudson/plugins/ec2/EC2Cloud.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 926-927 are not covered by tests
tag.value(), getSlaveTypeTagValue(EC2_SLAVE_TYPE_SPOT, template.description))
&& sir.launchSpecification().imageId().equals(template.getAmi())) {

Expand Down Expand Up @@ -988,16 +987,16 @@

private boolean isEc2ProvisionedAmiSlave(List<Tag> tags, String description) {
for (Tag tag : tags) {
if (StringUtils.equals(tag.key(), EC2Tag.TAG_NAME_JENKINS_SLAVE_TYPE)) {
if (Objects.equals(tag.key(), EC2Tag.TAG_NAME_JENKINS_SLAVE_TYPE)) {
if (description == null) {
return true;
} else if (StringUtils.equals(tag.value(), EC2Cloud.EC2_SLAVE_TYPE_DEMAND)
|| StringUtils.equals(tag.value(), EC2Cloud.EC2_SLAVE_TYPE_SPOT)) {
} else if (Objects.equals(tag.value(), EC2Cloud.EC2_SLAVE_TYPE_DEMAND)

Check warning on line 993 in src/main/java/hudson/plugins/ec2/EC2Cloud.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 993 is only partially covered, one branch is missing
|| Objects.equals(tag.value(), EC2Cloud.EC2_SLAVE_TYPE_SPOT)) {

Check warning on line 994 in src/main/java/hudson/plugins/ec2/EC2Cloud.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 994 is only partially covered, one branch is missing
// To handle cases where description is null and also upgrade cases for existing agent nodes.
return true;
} else if (StringUtils.equals(
} else if (Objects.equals(
tag.value(), getSlaveTypeTagValue(EC2Cloud.EC2_SLAVE_TYPE_DEMAND, description))
|| StringUtils.equals(
|| Objects.equals(

Check warning on line 999 in src/main/java/hudson/plugins/ec2/EC2Cloud.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 999 is only partially covered, one branch is missing
tag.value(), getSlaveTypeTagValue(EC2Cloud.EC2_SLAVE_TYPE_SPOT, description))) {
return true;
} else {
Expand Down Expand Up @@ -1229,7 +1228,7 @@
t);
return null;
}
if (StringUtils.isEmpty(instanceId)) {
if (instanceId == null || instanceId.isEmpty()) {

Check warning on line 1231 in src/main/java/hudson/plugins/ec2/EC2Cloud.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 1231 is not covered by tests
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
Expand Down Expand Up @@ -1394,7 +1393,7 @@
final boolean useInstanceProfileForCredentials, final String credentialsId) {
if (useInstanceProfileForCredentials) {
return InstanceProfileCredentialsProvider.create();
} else if (StringUtils.isBlank(credentialsId)) {
} else if (credentialsId == null || credentialsId.isBlank()) {
return DefaultCredentialsProvider.builder().build();
} else {
AmazonWebServicesCredentials credentials = getCredentials(credentialsId);
Expand All @@ -1414,10 +1413,11 @@

AwsCredentialsProvider provider = createCredentialsProvider(useInstanceProfileForCredentials, credentialsId);

if (StringUtils.isNotEmpty(roleArn)) {
if (roleArn != null && !roleArn.isEmpty()) {

Check warning on line 1416 in src/main/java/hudson/plugins/ec2/EC2Cloud.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 1416 is only partially covered, one branch is missing
AssumeRoleRequest assumeRoleRequest = AssumeRoleRequest.builder()
.roleArn(roleArn)
.roleSessionName(StringUtils.defaultIfBlank(roleSessionName, "Jenkins"))
.roleSessionName(
roleSessionName != null && !roleSessionName.isBlank() ? roleSessionName : "Jenkins")

Check warning on line 1420 in src/main/java/hudson/plugins/ec2/EC2Cloud.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 1420 is only partially covered, one branch is missing
.build();

StsClientBuilder stsClientBuilder = StsClient.builder()
Expand All @@ -1441,7 +1441,7 @@

@CheckForNull
private static AmazonWebServicesCredentials getCredentials(@CheckForNull String credentialsId) {
if (StringUtils.isBlank(credentialsId)) {
if (credentialsId == null || credentialsId.isBlank()) {

Check warning on line 1444 in src/main/java/hudson/plugins/ec2/EC2Cloud.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 1444 is only partially covered, 2 branches are missing
return null;
}
return CredentialsMatchers.firstOrNull(
Expand Down Expand Up @@ -1592,7 +1592,7 @@
@QueryParameter String roleArn, @QueryParameter String roleSessionName) {
// Don't do anything if the user is only reading the configuration
if (Jenkins.get().hasPermission(Jenkins.ADMINISTER)) {
if (StringUtils.isNotEmpty(roleArn) && StringUtils.isBlank(roleSessionName)) {
if (roleArn != null && !roleArn.isEmpty() && (roleSessionName == null || roleSessionName.isBlank())) {

Check warning on line 1595 in src/main/java/hudson/plugins/ec2/EC2Cloud.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 1595 is only partially covered, 2 branches are missing
return FormValidation.warning(
"Session Name is recommended when specifying an Arn Role. If empty, 'Jenkins' will be used.");
}
Expand Down Expand Up @@ -1628,132 +1628,132 @@
if (k == null) {
validations.add(FormValidation.error(
"Failed to find private key file " + System.getProperty(SSH_PRIVATE_KEY_FILEPATH)));
if (!StringUtils.isEmpty(value)) {
if (value != null && !value.isEmpty()) {
validations.add(FormValidation.warning(
"Private key file path defined, selected credential will be ignored"));
}
return FormValidation.aggregate(validations);
}
privateKey = k.getPrivateKey();
}

boolean hasStart = false, hasEnd = false;
BufferedReader br = new BufferedReader(new StringReader(privateKey));
String line;
while ((line = br.readLine()) != null) {
if (line.equals("-----BEGIN RSA PRIVATE KEY-----")
|| line.equals("-----BEGIN OPENSSH PRIVATE KEY-----")) {
hasStart = true;
}
if (line.equals("-----END RSA PRIVATE KEY-----") || line.equals("-----END OPENSSH PRIVATE KEY-----")) {
hasEnd = true;
}
}
if (!hasStart) {
validations.add(FormValidation.error("This doesn't look like a private key at all"));
}
if (!hasEnd) {
validations.add(FormValidation.error(
"The private key is missing the trailing 'END RSA PRIVATE KEY' marker. Copy&paste error?"));
}

if (!System.getProperty(SSH_PRIVATE_KEY_FILEPATH, "").isEmpty()) {
if (!StringUtils.isEmpty(value)) {
if (value != null && !value.isEmpty()) {
validations.add(FormValidation.warning("Using private key file instead of selected credential"));
} else {
validations.add(FormValidation.ok("Using private key file"));
}
}

try {
FIPS140Utils.ensurePrivateKeyInFipsMode(privateKey);
} catch (IllegalArgumentException ex) {
validations.add(FormValidation.error(ex, ex.getLocalizedMessage()));
}

validations.add(FormValidation.ok("SSH key validation successful"));
return FormValidation.aggregate(validations);
}

/**
* Tests the connection settings.
* <p>
* Overriding needs to {@code @RequirePOST}
* @param region
* @param useInstanceProfileForCredentials
* @param credentialsId
* @param sshKeysCredentialsId
* @param roleArn
* @param roleSessionName
* @return the validation result
* @throws IOException
* @throws ServletException
*/
@RequirePOST
public FormValidation doTestConnection(
@AncestorInPath ItemGroup context,
@QueryParameter String region,
@QueryParameter String altEC2Endpoint,
@QueryParameter boolean useInstanceProfileForCredentials,
@QueryParameter String credentialsId,
@QueryParameter String sshKeysCredentialsId,
@QueryParameter String roleArn,
@QueryParameter String roleSessionName)
throws IOException, ServletException {
if (!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) {
return FormValidation.ok();
}
try {
List<FormValidation> validations = new ArrayList<>();

LOGGER.fine(() -> "begin doTestConnection()");
String privateKey = "";
if (System.getProperty(SSH_PRIVATE_KEY_FILEPATH, "").isEmpty()) {
LOGGER.fine(() -> "static credential is in use");
SSHUserPrivateKey sshCredential = getSshCredential(sshKeysCredentialsId, context);
if (sshCredential != null) {
privateKey = sshCredential.getPrivateKey();
} else {
return FormValidation.error(
"Failed to find credential \"" + sshKeysCredentialsId + "\" in store.");
}
} else {
EC2PrivateKey k = EC2PrivateKey.fetchFromDisk();
if (k == null) {
validations.add(FormValidation.error(
"Failed to find private key file " + System.getProperty(SSH_PRIVATE_KEY_FILEPATH)));
if (!StringUtils.isEmpty(sshKeysCredentialsId)) {
if (sshKeysCredentialsId != null && !sshKeysCredentialsId.isEmpty()) {
validations.add(FormValidation.warning(
"Private key file path defined, selected credential will be ignored"));
}
return FormValidation.aggregate(validations);
}
privateKey = k.getPrivateKey();
}
LOGGER.fine(() -> "private key found ok");

if (Util.fixEmpty(region) == null) {
region = DEFAULT_EC2_HOST;
}

AwsCredentialsProvider credentialsProvider = createCredentialsProvider(
useInstanceProfileForCredentials, credentialsId, roleArn, roleSessionName, region);
Ec2Client ec2 = AmazonEC2Factory.getInstance()
.connect(credentialsProvider, parseRegion(region), parseEndpoint(altEC2Endpoint));
ec2.describeInstances();

if (!privateKey.trim().isEmpty()) {
// check if this key exists
EC2PrivateKey pk = new EC2PrivateKey(privateKey);
if (pk.find(ec2) == null) {
validations.add(FormValidation.error(
"The EC2 key pair private key isn't registered to this EC2 region (fingerprint is "
+ pk.getFingerprint() + ")"));
}
}

if (!System.getProperty(SSH_PRIVATE_KEY_FILEPATH, "").isEmpty()) {
if (!StringUtils.isEmpty(sshKeysCredentialsId)) {
if (sshKeysCredentialsId != null && !sshKeysCredentialsId.isEmpty()) {

Check warning on line 1756 in src/main/java/hudson/plugins/ec2/EC2Cloud.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 1631-1756 are not covered by tests
validations.add(
FormValidation.warning("Using private key file instead of selected credential"));
} else {
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/hudson/plugins/ec2/EC2HostAddressProvider.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package hudson.plugins.ec2;

import java.util.Optional;
import org.apache.commons.lang.StringUtils;
import software.amazon.awssdk.services.ec2.model.Instance;

public class EC2HostAddressProvider {
Expand Down Expand Up @@ -62,6 +61,6 @@ private static String getPrivateIpAddress(Instance instance) {
}

private static Optional<String> filterNonEmpty(String value) {
return Optional.ofNullable(value).filter(StringUtils::isNotEmpty);
return Optional.ofNullable(value).filter(s -> !s.isEmpty());
}
}
5 changes: 2 additions & 3 deletions src/main/java/hudson/plugins/ec2/EC2PrivateKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import java.util.logging.Logger;
import javax.crypto.Cipher;
import jenkins.bouncycastle.api.PEMEncodable;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import software.amazon.awssdk.core.exception.SdkException;
Expand Down Expand Up @@ -145,7 +144,7 @@
cipher.init(
Cipher.DECRYPT_MODE,
PEMEncodable.decode(privateKey.getPlainText()).toPrivateKey());
byte[] cipherText = Base64.getDecoder().decode(StringUtils.deleteWhitespace(encodedPassword));
byte[] cipherText = Base64.getDecoder().decode(encodedPassword.replaceAll("\\s+", ""));
Comment on lines -148 to +147

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

noticed the impl of deleteWhitespace is quite different than a regex replacement. I'm tempted to suggest inlining ~15LoC to avoid surprises

byte[] plainText = cipher.doFinal(cipherText);
return new String(plainText, StandardCharsets.US_ASCII);
} catch (Exception e) {
Expand All @@ -161,7 +160,7 @@

@CheckForNull
public static EC2PrivateKey fetchFromDisk(String filepath) {
if (StringUtils.isNotEmpty(filepath)) {
if (filepath != null && !filepath.isEmpty()) {

Check warning on line 163 in src/main/java/hudson/plugins/ec2/EC2PrivateKey.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 163 is only partially covered, 2 branches are missing
try {
return new EC2PrivateKey(Files.readString(Paths.get(filepath), StandardCharsets.UTF_8));
} catch (IOException e) {
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/hudson/plugins/ec2/EC2SlaveMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import jenkins.model.Jenkins;
import org.apache.commons.lang.StringUtils;
import software.amazon.awssdk.core.exception.SdkException;
import software.amazon.awssdk.services.ec2.model.Ec2Exception;
import software.amazon.awssdk.services.ec2.model.Instance;
Expand Down Expand Up @@ -51,7 +50,7 @@
for (Node node : Jenkins.get().getNodes()) {
if (node instanceof EC2AbstractSlave ec2Slave) {
String instanceId = ec2Slave.getInstanceId();
if (StringUtils.isEmpty(instanceId)) {
if (instanceId == null || instanceId.isEmpty()) {

Check warning on line 53 in src/main/java/hudson/plugins/ec2/EC2SlaveMonitor.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 53 is not covered by tests
continue;
}
EC2Cloud cloud = ec2Slave.getCloud();
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/hudson/plugins/ec2/EC2SpotSlave.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import jenkins.model.Jenkins;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.stapler.DataBoundConstructor;
import software.amazon.awssdk.core.exception.SdkException;
import software.amazon.awssdk.services.ec2.Ec2Client;
Expand Down Expand Up @@ -308,7 +307,7 @@

@Override
public String getInstanceId() {
if (StringUtils.isEmpty(instanceId)) {
if (instanceId == null || instanceId.isEmpty()) {

Check warning on line 310 in src/main/java/hudson/plugins/ec2/EC2SpotSlave.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 310 is not covered by tests
SpotInstanceRequest sr = getSpotRequest();
if (sr != null) {
instanceId = sr.instanceId();
Expand Down
17 changes: 8 additions & 9 deletions src/main/java/hudson/plugins/ec2/MacData.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import hudson.Extension;
import hudson.model.Descriptor;
import jenkins.model.Jenkins;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.stapler.DataBoundConstructor;

public class MacData extends SSHData {
Expand Down Expand Up @@ -59,29 +58,29 @@
return false;
}
final MacData other = (MacData) obj;
if (StringUtils.isEmpty(rootCommandPrefix)) {
if (!StringUtils.isEmpty(other.rootCommandPrefix)) {
if (rootCommandPrefix == null || rootCommandPrefix.isEmpty()) {

Check warning on line 61 in src/main/java/hudson/plugins/ec2/MacData.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 61 is only partially covered, 2 branches are missing
if (other.rootCommandPrefix != null && !other.rootCommandPrefix.isEmpty()) {

Check warning on line 62 in src/main/java/hudson/plugins/ec2/MacData.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 62 is not covered by tests
return false;
}
} else if (!rootCommandPrefix.equals(other.rootCommandPrefix)) {
return false;
}
if (StringUtils.isEmpty(slaveCommandPrefix)) {
if (!StringUtils.isEmpty(other.slaveCommandPrefix)) {
if (slaveCommandPrefix == null || slaveCommandPrefix.isEmpty()) {

Check warning on line 68 in src/main/java/hudson/plugins/ec2/MacData.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 68 is only partially covered, 2 branches are missing
if (other.slaveCommandPrefix != null && !other.slaveCommandPrefix.isEmpty()) {

Check warning on line 69 in src/main/java/hudson/plugins/ec2/MacData.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 69 is only partially covered, 3 branches are missing
return false;
}
} else if (!slaveCommandPrefix.equals(other.slaveCommandPrefix)) {
return false;
}
if (StringUtils.isEmpty(slaveCommandSuffix)) {
if (!StringUtils.isEmpty(other.slaveCommandSuffix)) {
if (slaveCommandSuffix == null || slaveCommandSuffix.isEmpty()) {

Check warning on line 75 in src/main/java/hudson/plugins/ec2/MacData.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 75 is only partially covered, 2 branches are missing
if (other.slaveCommandSuffix != null && !other.slaveCommandSuffix.isEmpty()) {

Check warning on line 76 in src/main/java/hudson/plugins/ec2/MacData.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 76 is only partially covered, 3 branches are missing
return false;
}
} else if (!slaveCommandSuffix.equals(other.slaveCommandSuffix)) {
return false;
}
if (StringUtils.isEmpty(sshPort)) {
if (!StringUtils.isEmpty(other.sshPort)) {
if (sshPort == null || sshPort.isEmpty()) {

Check warning on line 82 in src/main/java/hudson/plugins/ec2/MacData.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 82 is only partially covered, 2 branches are missing
if (other.sshPort != null && !other.sshPort.isEmpty()) {

Check warning on line 83 in src/main/java/hudson/plugins/ec2/MacData.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 83 is not covered by tests
return false;
}
} else if (!sshPort.equals(other.sshPort)) {
Expand Down
17 changes: 8 additions & 9 deletions src/main/java/hudson/plugins/ec2/SSHData.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package hudson.plugins.ec2;

import jenkins.model.Jenkins;
import org.apache.commons.lang.StringUtils;

public abstract class SSHData extends AMITypeData {
protected final String rootCommandPrefix;
Expand Down Expand Up @@ -103,29 +102,29 @@
return false;
}
final SSHData other = (SSHData) obj;
if (StringUtils.isEmpty(rootCommandPrefix)) {
if (!StringUtils.isEmpty(other.rootCommandPrefix)) {
if (rootCommandPrefix == null || rootCommandPrefix.isEmpty()) {

Check warning on line 105 in src/main/java/hudson/plugins/ec2/SSHData.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 105 is only partially covered, 2 branches are missing
if (other.rootCommandPrefix != null && !other.rootCommandPrefix.isEmpty()) {

Check warning on line 106 in src/main/java/hudson/plugins/ec2/SSHData.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 106 is not covered by tests
return false;
}
} else if (!rootCommandPrefix.equals(other.rootCommandPrefix)) {
return false;
}
if (StringUtils.isEmpty(slaveCommandPrefix)) {
if (!StringUtils.isEmpty(other.slaveCommandPrefix)) {
if (slaveCommandPrefix == null || slaveCommandPrefix.isEmpty()) {

Check warning on line 112 in src/main/java/hudson/plugins/ec2/SSHData.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 112 is only partially covered, 2 branches are missing
if (other.slaveCommandPrefix != null && !other.slaveCommandPrefix.isEmpty()) {

Check warning on line 113 in src/main/java/hudson/plugins/ec2/SSHData.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 113 is only partially covered, 2 branches are missing
return false;
}
} else if (!slaveCommandPrefix.equals(other.slaveCommandPrefix)) {
return false;
}
if (StringUtils.isEmpty(slaveCommandSuffix)) {
if (!StringUtils.isEmpty(other.slaveCommandSuffix)) {
if (slaveCommandSuffix == null || slaveCommandSuffix.isEmpty()) {

Check warning on line 119 in src/main/java/hudson/plugins/ec2/SSHData.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 119 is only partially covered, 2 branches are missing
if (other.slaveCommandSuffix != null && !other.slaveCommandSuffix.isEmpty()) {

Check warning on line 120 in src/main/java/hudson/plugins/ec2/SSHData.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 120 is only partially covered, 2 branches are missing
return false;
}
} else if (!slaveCommandSuffix.equals(other.slaveCommandSuffix)) {
return false;
}
if (StringUtils.isEmpty(sshPort)) {
if (!StringUtils.isEmpty(other.sshPort)) {
if (sshPort == null || sshPort.isEmpty()) {

Check warning on line 126 in src/main/java/hudson/plugins/ec2/SSHData.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 126 is only partially covered, 2 branches are missing
if (other.sshPort != null && !other.sshPort.isEmpty()) {

Check warning on line 127 in src/main/java/hudson/plugins/ec2/SSHData.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 127 is not covered by tests
return false;
}
} else if (!sshPort.equals(other.sshPort)) {
Expand Down
Loading