forked from I2P_Developers/i2p.i2p
Findbugs all over:
- Serializable - hashCode() - Make DataStructureImpl Serializable (removed from DataStructure in 2005)
This commit is contained in:
@@ -41,7 +41,9 @@ import javax.servlet.http.HttpServletResponse;
|
||||
*
|
||||
*/
|
||||
public class Servlet extends HttpServlet {
|
||||
private DaemonThread thread;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private transient DaemonThread thread;
|
||||
//private String nonce;
|
||||
//private static final String PROP_NONCE = "addressbook.nonce";
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.io.FileOutputStream;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -1969,7 +1970,7 @@ public class SnarkManager implements CompleteListener {
|
||||
* ignore case, current locale
|
||||
* @since 0.9
|
||||
*/
|
||||
private static class IgnoreCaseComparator implements Comparator<Tracker> {
|
||||
private static class IgnoreCaseComparator implements Comparator<Tracker>, Serializable {
|
||||
public int compare(Tracker l, Tracker r) {
|
||||
return l.name.toLowerCase().compareTo(r.name.toLowerCase());
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.klomp.snark.dht;
|
||||
* From zzzot, modded and relicensed to GPLv2
|
||||
*/
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
|
||||
import net.i2p.crypto.SHA1Hash;
|
||||
@@ -15,7 +16,7 @@ import net.i2p.data.DataHelper;
|
||||
* @since 0.9.2
|
||||
* @author zzz
|
||||
*/
|
||||
class NodeInfoComparator implements Comparator<NodeInfo> {
|
||||
class NodeInfoComparator implements Comparator<NodeInfo>, Serializable {
|
||||
private final byte[] _base;
|
||||
|
||||
public NodeInfoComparator(SHA1Hash h) {
|
||||
|
||||
@@ -84,16 +84,17 @@ import net.i2p.util.SystemVersion;
|
||||
*/
|
||||
class BasicServlet extends HttpServlet
|
||||
{
|
||||
protected final I2PAppContext _context;
|
||||
protected final Log _log;
|
||||
private static final long serialVersionUID = 1L;
|
||||
protected transient final I2PAppContext _context;
|
||||
protected transient final Log _log;
|
||||
protected File _resourceBase;
|
||||
private String _warBase;
|
||||
|
||||
private final MimeTypes _mimeTypes;
|
||||
private transient final MimeTypes _mimeTypes;
|
||||
|
||||
/** same as PeerState.PARTSIZE */
|
||||
private static final int BUFSIZE = 16*1024;
|
||||
private ByteCache _cache = ByteCache.getInstance(16, BUFSIZE);
|
||||
private transient ByteCache _cache = ByteCache.getInstance(16, BUFSIZE);
|
||||
|
||||
private static final int WAR_CACHE_CONTROL_SECS = 24*60*60;
|
||||
private static final int FILE_CACHE_CONTROL_SECS = 24*60*60;
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.klomp.snark.web;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.Serializable;
|
||||
import java.text.Collator;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -44,11 +45,13 @@ import org.klomp.snark.dht.DHT;
|
||||
* Refactored to eliminate Jetty dependencies.
|
||||
*/
|
||||
public class I2PSnarkServlet extends BasicServlet {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/** generally "/i2psnark" */
|
||||
private String _contextPath;
|
||||
/** generally "i2psnark" */
|
||||
private String _contextName;
|
||||
private SnarkManager _manager;
|
||||
private transient SnarkManager _manager;
|
||||
private long _nonce;
|
||||
private String _themePath;
|
||||
private String _imgPath;
|
||||
@@ -1111,8 +1114,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
* (I guess this is worth it, a lot of torrents start with "The "
|
||||
* @since 0.7.14
|
||||
*/
|
||||
private static class TorrentNameComparator implements Comparator<Snark> {
|
||||
private final Comparator collator = Collator.getInstance();
|
||||
private static class TorrentNameComparator implements Comparator<Snark>, Serializable {
|
||||
|
||||
public int compare(Snark l, Snark r) {
|
||||
// put downloads and magnets first
|
||||
@@ -1128,7 +1130,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
String rlc = rs.toLowerCase(Locale.US);
|
||||
if (rlc.startsWith("the ") || rlc.startsWith("the.") || rlc.startsWith("the_"))
|
||||
rs = rs.substring(4);
|
||||
return collator.compare(ls, rs);
|
||||
return Collator.getInstance().compare(ls, rs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1627,7 +1629,8 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
* Sort by completeness (seeds first), then by ID
|
||||
* @since 0.8.1
|
||||
*/
|
||||
private static class PeerComparator implements Comparator<Peer> {
|
||||
private static class PeerComparator implements Comparator<Peer>, Serializable {
|
||||
|
||||
public int compare(Peer l, Peer r) {
|
||||
int diff = r.completed() - l.completed(); // reverse
|
||||
if (diff != 0)
|
||||
@@ -2211,15 +2214,14 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
* directories first
|
||||
* @since 0.9.6
|
||||
*/
|
||||
private static class ListingComparator implements Comparator<File> {
|
||||
private final Comparator collator = Collator.getInstance();
|
||||
private static class ListingComparator implements Comparator<File>, Serializable {
|
||||
|
||||
public int compare(File l, File r) {
|
||||
if (l.isDirectory() && !r.isDirectory())
|
||||
return -1;
|
||||
if (r.isDirectory() && !l.isDirectory())
|
||||
return 1;
|
||||
return collator.compare(l.getName(), r.getName());
|
||||
return Collator.getInstance().compare(l.getName(), r.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,9 @@ import net.i2p.data.DataHelper;
|
||||
*/
|
||||
public class I2PSocketAddress extends SocketAddress {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final int _port;
|
||||
private Destination _dest;
|
||||
private transient Destination _dest;
|
||||
private final String _host;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1584,6 +1584,12 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
return super.equals(o) && (o instanceof VersionAvailable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
// findbugs
|
||||
return super.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VersionAvailable \"" + version + "\" " + sourceMap +
|
||||
|
||||
@@ -9,6 +9,7 @@ package net.i2p.router.web;
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.io.Writer;
|
||||
import java.util.Comparator;
|
||||
import java.util.Map;
|
||||
@@ -30,7 +31,7 @@ public class BanlistRenderer {
|
||||
_context = context;
|
||||
}
|
||||
|
||||
private static class HashComparator implements Comparator<Hash> {
|
||||
private static class HashComparator implements Comparator<Hash>, Serializable {
|
||||
public int compare(Hash l, Hash r) {
|
||||
return l.toBase64().compareTo(r.toBase64());
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.text.Collator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -171,6 +171,7 @@ public class ConfigStatsHelper extends HelperBase {
|
||||
|
||||
/**
|
||||
* Translated sort
|
||||
* Inner class, can't be Serializable
|
||||
* @since 0.9.4
|
||||
*/
|
||||
private class AlphaComparator implements Comparator<String> {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.io.Writer;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
@@ -440,7 +441,7 @@ public class GraphHelper extends FormHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private static class AlphaComparator implements Comparator<SummaryListener> {
|
||||
private static class AlphaComparator implements Comparator<SummaryListener>, Serializable {
|
||||
public int compare(SummaryListener l, SummaryListener r) {
|
||||
String lName = l.getRate().getRateStat().getName();
|
||||
String rName = r.getRate().getRateStat().getName();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
@@ -238,7 +239,7 @@ public class HomeHelper extends HelperBase {
|
||||
}
|
||||
|
||||
/** ignore case, current locale */
|
||||
private static class AppComparator implements Comparator<App> {
|
||||
private static class AppComparator implements Comparator<App>, Serializable {
|
||||
public int compare(App l, App r) {
|
||||
return l.name.toLowerCase().compareTo(r.name.toLowerCase());
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.i2p.router.web;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Serializable;
|
||||
import java.io.Writer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -204,14 +205,14 @@ public class JobQueueHelper extends HelperBase {
|
||||
}
|
||||
|
||||
/** @since 0.8.9 */
|
||||
private static class JobStatsComparator implements Comparator<JobStats> {
|
||||
private static class JobStatsComparator implements Comparator<JobStats>, Serializable {
|
||||
public int compare(JobStats l, JobStats r) {
|
||||
return l.getName().compareTo(r.getName());
|
||||
}
|
||||
}
|
||||
|
||||
/** @since 0.9.5 */
|
||||
private static class JobCountComparator implements Comparator<String> {
|
||||
private static class JobCountComparator implements Comparator<String>, Serializable {
|
||||
private final ObjectCounter<String> _counter;
|
||||
|
||||
public JobCountComparator(ObjectCounter<String> counter) {
|
||||
|
||||
@@ -9,6 +9,7 @@ package net.i2p.router.web;
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.io.Writer;
|
||||
import java.math.BigInteger; // debug
|
||||
import java.text.Collator;
|
||||
@@ -46,6 +47,9 @@ public class NetDbRenderer {
|
||||
_context = ctx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inner class, can't be Serializable
|
||||
*/
|
||||
private class LeaseSetComparator implements Comparator<LeaseSet> {
|
||||
public int compare(LeaseSet l, LeaseSet r) {
|
||||
Destination dl = l.getDestination();
|
||||
@@ -59,7 +63,7 @@ public class NetDbRenderer {
|
||||
}
|
||||
|
||||
/** for debugging @since 0.7.14 */
|
||||
private static class LeaseSetRoutingKeyComparator implements Comparator<LeaseSet> {
|
||||
private static class LeaseSetRoutingKeyComparator implements Comparator<LeaseSet>, Serializable {
|
||||
private final Hash _us;
|
||||
public LeaseSetRoutingKeyComparator(Hash us) {
|
||||
_us = us;
|
||||
@@ -69,7 +73,7 @@ public class NetDbRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
private static class RouterInfoComparator implements Comparator<RouterInfo> {
|
||||
private static class RouterInfoComparator implements Comparator<RouterInfo>, Serializable {
|
||||
public int compare(RouterInfo l, RouterInfo r) {
|
||||
return l.getIdentity().getHash().toBase64().compareTo(r.getIdentity().getHash().toBase64());
|
||||
}
|
||||
@@ -365,9 +369,13 @@ public class NetDbRenderer {
|
||||
return Translate.getString(name, _context, Messages.COUNTRY_BUNDLE_NAME);
|
||||
}
|
||||
|
||||
/** sort by translated country name using rules for the current language setting */
|
||||
/**
|
||||
* Sort by translated country name using rules for the current language setting
|
||||
* Inner class, can't be Serializable
|
||||
*/
|
||||
private class CountryComparator implements Comparator<String> {
|
||||
Collator coll;
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final Collator coll;
|
||||
|
||||
public CountryComparator() {
|
||||
super();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.io.Writer;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Comparator;
|
||||
@@ -330,7 +331,7 @@ class ProfileOrganizerRenderer {
|
||||
* Used for floodfill-only page
|
||||
* @since 0.9.8
|
||||
*/
|
||||
private static class HashComparator implements Comparator<PeerProfile> {
|
||||
private static class HashComparator implements Comparator<PeerProfile>, Serializable {
|
||||
public int compare(PeerProfile left, PeerProfile right) {
|
||||
return left.getPeer().toBase64().compareTo(right.getPeer().toBase64());
|
||||
}
|
||||
|
||||
@@ -252,6 +252,7 @@ public class StatsGenerator {
|
||||
|
||||
/**
|
||||
* Translated sort
|
||||
* Inner class, can't be Serializable
|
||||
* @since 0.9.3
|
||||
*/
|
||||
private class AlphaComparator implements Comparator<String> {
|
||||
|
||||
@@ -461,7 +461,10 @@ public class SummaryHelper extends HelperBase {
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/** compare translated nicknames - put "shared clients" first in the sort */
|
||||
/**
|
||||
* Compare translated nicknames - put "shared clients" first in the sort
|
||||
* Inner class, can't be Serializable
|
||||
*/
|
||||
private class AlphaComparator implements Comparator<Destination> {
|
||||
private final String xsc = _("shared clients");
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.io.Writer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -133,7 +134,7 @@ public class TunnelRenderer {
|
||||
out.write("</div>");
|
||||
}
|
||||
|
||||
private static class TunnelComparator implements Comparator<HopConfig> {
|
||||
private static class TunnelComparator implements Comparator<HopConfig>, Serializable {
|
||||
public int compare(HopConfig l, HopConfig r) {
|
||||
return (r.getProcessedMessagesCount() - l.getProcessedMessagesCount());
|
||||
}
|
||||
|
||||
@@ -24,9 +24,10 @@
|
||||
|
||||
package i2p.susi.dns;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
|
||||
public class AddressByNameSorter implements Comparator<AddressBean>
|
||||
public class AddressByNameSorter implements Comparator<AddressBean>, Serializable
|
||||
{
|
||||
public int compare(AddressBean a, AddressBean b)
|
||||
{
|
||||
|
||||
@@ -43,6 +43,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.Serializable;
|
||||
import java.io.StringWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.text.Collator;
|
||||
@@ -235,7 +236,7 @@ public class WebMail extends HttpServlet
|
||||
*
|
||||
* @since 0.9.13
|
||||
*/
|
||||
private abstract static class SorterBase implements Comparator<String> {
|
||||
private abstract static class SorterBase implements Comparator<String>, Serializable {
|
||||
private final MailCache mailCache;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user