Skip to content

Commit

Permalink
Use String#isEmpty where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed Dec 17, 2024
1 parent f2721f0 commit c55c3d4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/java/hudson/plugins/ec2/EC2SpotSlave.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public void terminate() {
}

// Terminate the agent if it is running
if (instanceId != null && !instanceId.equals("")) {
if (instanceId != null && !instanceId.isEmpty()) {
if (!super.isAlive(true)) {
/*
* The node has been killed externally, so we've nothing to do here
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hudson/plugins/ec2/SlaveTemplate.java
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@ public Set<String> getSecurityGroupSet() {
}

public Set<String> parseSecurityGroups() {
if (securityGroups == null || "".equals(securityGroups.trim())) {
if (securityGroups == null || securityGroups.trim().isEmpty()) {
return Collections.emptySet();
} else {
return new HashSet<>(Arrays.asList(securityGroups.split("\\s*,\\s*")));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hudson/plugins/ec2/Tenancy.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public String toString() {
}

public static Tenancy fromValue(String value) {
if (value != null && !"".equals(value)) {
if (value != null && !value.isEmpty()) {
for (Tenancy enumEntry : values()) {
if (enumEntry.toString().equals(value)) {
return enumEntry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected void launchScript(EC2Computer computer, TaskListener listener)

try {
String initScript = node.initScript;
String tmpDir = (node.tmpDir != null && !node.tmpDir.equals("")
String tmpDir = (node.tmpDir != null && !node.tmpDir.isEmpty()
? WindowsUtil.quoteArgument(Util.ensureEndsWith(node.tmpDir, "\\"))
: "C:\\Windows\\Temp\\");

Expand Down

0 comments on commit c55c3d4

Please sign in to comment.