Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove usage of org.apache.commons.lang.Validate #9084

Merged
merged 1 commit into from Mar 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 8 additions & 3 deletions core/src/main/java/hudson/slaves/Cloud.java
Expand Up @@ -54,7 +54,6 @@
import javax.servlet.ServletException;
import jenkins.model.Jenkins;
import net.sf.json.JSONObject;
import org.apache.commons.lang.Validate;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.DoNotUse;
import org.kohsuke.stapler.DataBoundConstructor;
Expand Down Expand Up @@ -118,8 +117,14 @@
public String name;

protected Cloud(String name) {
Validate.notEmpty(name, Messages.Cloud_RequiredName());
this.name = name;
this.name = validateNotEmpty(name);
}

private static String validateNotEmpty(String name) {
if (name == null || name.isEmpty()) {

Check warning on line 124 in core/src/main/java/hudson/slaves/Cloud.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 124 is only partially covered, 2 branches are missing
throw new IllegalArgumentException(Messages.Cloud_RequiredName());

Check warning on line 125 in core/src/main/java/hudson/slaves/Cloud.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 125 is not covered by tests
}
return name;
}

@Override
Expand Down