forked from I2P_Developers/i2p.i2p
Findbugs all over:
- Serializable - hashCode() - Make DataStructureImpl Serializable (removed from DataStructure in 2005)
This commit is contained in:
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user