Skip to content

Commit

Permalink
Merge branch 'scalable-icon-support-2-sidebar' into scalable-icon-sup…
Browse files Browse the repository at this point in the history
…port-2-build-status
  • Loading branch information
janfaracik committed Feb 16, 2022
2 parents c9b5785 + a280b7e commit 616f5cf
Show file tree
Hide file tree
Showing 190 changed files with 1,823 additions and 1,946 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/AboutJenkins.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
public class AboutJenkins extends ManagementLink {
@Override
public String getIconFileName() {
return "symbol-help-circle";
return "symbol-jenkins";
}

@Override
Expand Down
6 changes: 6 additions & 0 deletions core/src/main/java/hudson/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.CopyOption;
import java.nio.file.FileAlreadyExistsException;
import java.nio.file.FileSystemException;
import java.nio.file.FileSystems;
Expand Down Expand Up @@ -1071,7 +1072,12 @@ public static void touch(@NonNull File file) throws IOException {

/**
* Copies a single file by using Ant.
*
* @deprecated since TODO; use {@link Files#copy(Path, Path, CopyOption...)} directly
*/
@Deprecated
@Restricted(NoExternalUse.class)
@RestrictedSince("TODO")
public static void copyFile(@NonNull File src, @NonNull File dst) throws BuildException {
Copy cp = new Copy();
cp.setProject(new Project());
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/diagnosis/OldDataMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ public Category getCategory() {

@Override
public String getIconFileName() {
return "document.svg";
return "symbol-cube";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private WindowsInstallerLink(File jenkinsWar) {

@Override
public String getIconFileName() {
return "installer.svg";
return "symbol-windows";
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/hudson/model/AllView.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import jenkins.util.SystemProperties;
import org.apache.commons.lang.StringUtils;
import org.jenkinsci.Symbol;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;
Expand Down Expand Up @@ -146,7 +146,7 @@ public static String migrateLegacyPrimaryAllViewLocalizedName(@NonNull List<View
// name conflict, we cannot rename the all view anyway
return primaryView;
}
if (StringUtils.equals(v.getViewName(), primaryView)) {
if (Objects.equals(v.getViewName(), primaryView)) {
if (v instanceof AllView) {
allView = (AllView) v;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.jenkinsci.Symbol;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
Expand All @@ -39,7 +38,7 @@ public class ChoiceParameterDefinition extends SimpleParameterDefinition {

public static boolean areValidChoices(@NonNull String choices) {
String strippedChoices = choices.trim();
return !StringUtils.isEmpty(strippedChoices) && strippedChoices.split(CHOICES_DELIMITER).length > 0;
return strippedChoices != null && !strippedChoices.isEmpty() && strippedChoices.split(CHOICES_DELIMITER).length > 0;
}

public ChoiceParameterDefinition(@NonNull String name, @NonNull String choices, @CheckForNull String description) {
Expand Down
12 changes: 6 additions & 6 deletions core/src/main/java/hudson/model/Computer.java
Original file line number Diff line number Diff line change
Expand Up @@ -727,10 +727,10 @@ public void setTemporarilyOffline(boolean temporarilyOffline, OfflineCause cause
@Exported
public String getIcon() {
// The machine was taken offline by someone
if (isTemporarilyOffline() && getOfflineCause() instanceof OfflineCause.UserCause) return "computer-user-offline.svg";
if (isTemporarilyOffline() && getOfflineCause() instanceof OfflineCause.UserCause) return "symbol-computer-disconnected";
// There is a "technical" reason the computer will not accept new builds
if (isOffline() || !isAcceptingTasks()) return "computer-x.svg";
return "computer.svg";
if (isOffline() || !isAcceptingTasks()) return "symbol-computer-offline";
return "symbol-computer";
}

/**
Expand All @@ -747,10 +747,10 @@ public String getIcon() {
@Exported
public String getIconClassName() {
// The machine was taken offline by someone
if (isTemporarilyOffline() && getOfflineCause() instanceof OfflineCause.UserCause) return "icon-computer-user-offline";
if (isTemporarilyOffline() && getOfflineCause() instanceof OfflineCause.UserCause) return "symbol-computer-disconnected";
// There is a "technical" reason the computer will not accept new builds
if (isOffline() || !isAcceptingTasks()) return "icon-computer-x";
return "icon-computer";
if (isOffline() || !isAcceptingTasks()) return "symbol-computer-offline";
return "symbol-computer";
}

public String getIconAltText() {
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/hudson/model/FileParameterValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import org.apache.commons.fileupload.util.FileItemHeadersImpl;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.DataBoundConstructor;
Expand Down Expand Up @@ -158,7 +157,7 @@ public BuildWrapper createBuildWrapper(AbstractBuild<?, ?> build) {
@SuppressFBWarnings(value = {"FILE_UPLOAD_FILENAME", "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"}, justification = "TODO needs triage")
@Override
public Environment setUp(AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException {
if (!StringUtils.isEmpty(location) && !StringUtils.isEmpty(file.getName())) {
if (location != null && !location.isEmpty() && file.getName() != null && !file.getName().isEmpty()) {
listener.getLogger().println("Copying file to " + location);
FilePath ws = build.getWorkspace();
if (ws == null) {
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/hudson/model/Items.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
import jenkins.model.Jenkins;
import jenkins.util.MemoryReductionUtil;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.security.core.Authentication;

/**
Expand Down Expand Up @@ -236,7 +235,7 @@ public static <T extends Item> List<T> fromNameList(ItemGroup context, @NonNull
StringTokenizer tokens = new StringTokenizer(list, ",");
while (tokens.hasMoreTokens()) {
String fullName = tokens.nextToken().trim();
if (StringUtils.isNotEmpty(fullName)) {
if (fullName != null && !fullName.isEmpty()) {
T item = jenkins.getItem(fullName, context, type);
if (item != null)
r.add(item);
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/model/Slave.java
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public void setUserId(String userId){
}

public ComputerLauncher getLauncher() {
if (launcher == null && !StringUtils.isEmpty(agentCommand)) {
if (launcher == null && agentCommand != null && !agentCommand.isEmpty()) {
try {
launcher = (ComputerLauncher) Jenkins.get().getPluginManager().uberClassLoader.loadClass("hudson.slaves.CommandLauncher").getConstructor(String.class, EnvVars.class).newInstance(agentCommand, null);
agentCommand = null;
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/hudson/model/ViewDescriptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import hudson.views.ViewJobFilter;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import jenkins.model.DirectlyModifiableTopLevelItemGroup;
import jenkins.model.Jenkins;
import org.apache.commons.lang.StringUtils;
Expand Down Expand Up @@ -147,7 +148,7 @@ protected FormValidation checkDisplayName(@NonNull View view, @CheckForNull Stri
if (v.getViewName().equals(view.getViewName())) {
continue;
}
if (StringUtils.equals(v.getDisplayName(), value)) {
if (Objects.equals(v.getDisplayName(), value)) {
return FormValidation.warning(Messages.View_DisplayNameNotUniqueWarning(value));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public String getDescription() {

@Override
public String getIconFileName() {
return "secure.svg";
return "symbol-lock-closed";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.springframework.security.authentication.InsufficientAuthenticationException;
Expand Down Expand Up @@ -81,7 +80,7 @@ public void commence(HttpServletRequest req, HttpServletResponse rsp, Authentica
} else {
// give the opportunity to include the target URL
String uriFrom = req.getRequestURI();
if (!StringUtils.isEmpty(req.getQueryString())) uriFrom += "?" + req.getQueryString();
if (req.getQueryString() != null && !req.getQueryString().isEmpty()) uriFrom += "?" + req.getQueryString();
String loginForm = req.getContextPath() + loginFormUrl;
loginForm = MessageFormat.format(loginForm, URLEncoder.encode(uriFrom, "UTF-8"));
req.setAttribute("loginForm", loginForm);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ public static final class ManageUserLinks extends ManagementLink {
@Override
public String getIconFileName() {
if (Jenkins.get().getSecurityRealm() instanceof HudsonPrivateSecurityRealm)
return "user.svg";
return "symbol-people";
else
return null; // not applicable now
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/slaves/SlaveComputer.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public TaskListener getListener() {
public String getIconClassName() {
Future<?> l = lastConnectActivity;
if (l != null && !l.isDone())
return "icon-computer-flash";
return "icon-computer";
return super.getIconClassName();
}

Expand Down
5 changes: 1 addition & 4 deletions core/src/main/java/hudson/tasks/UserAvatarResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@
import hudson.Extension;
import hudson.ExtensionList;
import hudson.ExtensionPoint;
import hudson.Functions;
import hudson.model.User;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import jenkins.model.Jenkins;

/**
* Infers avatar image URLs for users
Expand Down Expand Up @@ -87,8 +85,7 @@ public abstract class UserAvatarResolver implements ExtensionPoint {
*/
public static String resolve(User u, String avatarSize) {
String avatar = resolveOrNull(u, avatarSize);
return avatar != null ? avatar : Jenkins.get().getRootUrl() + Functions.getResourcePath() +
"/images/svgs/person.svg";
return avatar != null ? avatar : "symbol-person-circle";
}

/**
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jenkins/management/CliLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class CliLink extends ManagementLink {

@Override
public String getIconFileName() {
return "terminal.svg";
return "symbol-terminal";
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jenkins/management/ConsoleLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class ConsoleLink extends ManagementLink {

@Override
public String getIconFileName() {
return "notepad.svg";
return "symbol-code-working";
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jenkins/management/NodesLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class NodesLink extends ManagementLink {

@Override
public String getIconFileName() {
return "network.svg";
return "symbol-cloud";
}

@Override
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/jenkins/management/PluginsLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ public Category getCategory() {
}

@Restricted(NoExternalUse.class)
public boolean hasUpdates() {
public int getUpdateCount() {
final UpdateCenter updateCenter = Jenkins.get().getUpdateCenter();
if (!updateCenter.isSiteDataReady()) {
// Do not display message during this page load, but possibly later.
return false;
return 0;
}
return !updateCenter.getUpdates().isEmpty();
return updateCenter.getUpdates().size();
}
}
2 changes: 1 addition & 1 deletion core/src/main/java/jenkins/management/ReloadLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class ReloadLink extends ManagementLink {

@Override
public String getIconFileName() {
return "refresh.svg";
return "symbol-reload";
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jenkins/management/ShutdownLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class ShutdownLink extends ManagementLink {

@Override
public String getIconFileName() {
return "system-log-out.svg";
return "symbol-power";
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jenkins/management/StatisticsLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class StatisticsLink extends ManagementLink {

@Override
public String getIconFileName() {
return "monitor.svg";
return "symbol-analytics";
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jenkins/management/SystemInfoLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class SystemInfoLink extends ManagementLink {

@Override
public String getIconFileName() {
return "computer.svg";
return "symbol-server";
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jenkins/management/SystemLogLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class SystemLogLink extends ManagementLink {

@Override
public String getIconFileName() {
return "clipboard.svg";
return "symbol-file-tray";
}

@Override
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/jenkins/model/IdStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
import java.io.Serializable;
import java.util.Comparator;
import java.util.Locale;
import java.util.Objects;
import java.util.function.Function;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang.StringUtils;
import org.jenkinsci.Symbol;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.ProtectedExternally;
Expand Down Expand Up @@ -253,7 +253,7 @@ private Character convertCapitalizedAscii(String encoded) {

@Override
public boolean equals(@NonNull String id1, @NonNull String id2) {
return StringUtils.equals(id1, id2);
return Objects.equals(id1, id2);
}

@Override
Expand Down Expand Up @@ -289,7 +289,7 @@ public CaseSensitiveEmailAddress() {}

@Override
public boolean equals(@NonNull String id1, @NonNull String id2) {
return StringUtils.equals(keyFor(id1), keyFor(id2));
return Objects.equals(keyFor(id1), keyFor(id2));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public PatternProjectNamingStrategy(String namePattern, String description, bool
public void checkName(String name) {
if (StringUtils.isNotBlank(namePattern) && StringUtils.isNotBlank(name)) {
if (!Pattern.matches(namePattern, name)) {
throw new Failure(StringUtils.isEmpty(description) ?
throw new Failure(description == null || description.isEmpty() ?
Messages.Hudson_JobNameConventionNotApplyed(name, namePattern) :
description);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import hudson.FilePath;
import hudson.model.AbstractBuild;
import hudson.model.TaskListener;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.stapler.DataBoundConstructor;

/**
Expand All @@ -27,7 +26,7 @@ public String getPath() {

@Override
public FilePath supplySettings(AbstractBuild<?, ?> build, TaskListener listener) {
if (StringUtils.isEmpty(path)) {
if (path == null || path.isEmpty()) {
return null;
}

Expand Down
Loading

0 comments on commit 616f5cf

Please sign in to comment.