[JENKINS-36720] - Fix Spotbugs issues (SE_COMPARATOR_SHOULD_BE_SERIALIZABLE, ES_COMPARING_STRINGS_WITH_EQ) (#4379)

* fixed Spotbugs issues (SE_COMPARATOR_SHOULD_BE_SERIALIZABLE, ES_COMPARING_STRINGS_WITH_EQ)

* replaced wildcard import with specific imports

* added missing import

* fixed spotbugs issues

* removed accidently added import
This commit is contained in:
StefanSpieker authored and Oleg Nenashev committed 2020-01-11 00:04:02 +01:00
1 parent 073122f13b
commit bef9ded543
6 files changed
+34 -10

No files matched your search

+11 -4
View File
@@ -84,9 +84,12 @@ import hudson.views.MyViewsTabBar;
import hudson.views.ViewsTabBar;
import hudson.widgets.RenderOnDemandClosure;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.Serializable;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.lang.management.LockInfo;
@@ -158,7 +161,7 @@ import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import hudson.model.PasswordParameterDefinition;
import hudson.util.RunList;
import java.io.PrintStream;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
@@ -1310,7 +1313,7 @@ public class Functions {
private static class ThreadSorterBase {
protected Map<Long,String> map = new HashMap<>();
private ThreadSorterBase() {
public ThreadSorterBase() {
ThreadGroup tg = Thread.currentThread().getThreadGroup();
while (tg.getParent() != null) tg = tg.getParent();
Thread[] threads = new Thread[tg.activeCount()*2];
@@ -1330,7 +1333,9 @@ public class Functions {
}
}
public static class ThreadGroupMap extends ThreadSorterBase implements Comparator<ThreadInfo> {
public static class ThreadGroupMap extends ThreadSorterBase implements Comparator<ThreadInfo>, Serializable {
private static final long serialVersionUID = 7803975728695308444L;
/**
* @return ThreadGroup name or null if unknown
@@ -1347,7 +1352,9 @@ public class Functions {
}
}
private static class ThreadSorter extends ThreadSorterBase implements Comparator<Thread> {
private static class ThreadSorter extends ThreadSorterBase implements Comparator<Thread>, Serializable {
private static final long serialVersionUID = 5053631350439192685L;
public int compare(Thread a, Thread b) {
int result = compare(a.getId(), b.getId());