lint core, i2psnark, jetty, susimail

This commit is contained in:
zzz
2015-10-17 16:49:37 +00:00
parent 5f175455c7
commit 71bc55b470
16 changed files with 37 additions and 26 deletions

View File

@@ -136,6 +136,7 @@ public class I2PSnarkUtil {
public boolean configured() { return _configured; }
@SuppressWarnings({"unchecked", "rawtypes"})
public void setI2CPConfig(String i2cpHost, int i2cpPort, Map opts) {
if (i2cpHost != null)
_i2cpHost = i2cpHost;

View File

@@ -2191,7 +2191,7 @@ public class SnarkManager implements CompleteListener {
*/
private void addMagnets() {
boolean changed = false;
for (Iterator iter = _config.keySet().iterator(); iter.hasNext(); ) {
for (Iterator<?> iter = _config.keySet().iterator(); iter.hasNext(); ) {
String k = (String) iter.next();
if (k.startsWith(PROP_META_MAGNET_PREFIX)) {
String b64 = k.substring(PROP_META_MAGNET_PREFIX.length());

View File

@@ -106,6 +106,7 @@ class DHTTracker {
* @param noSeeds true if we do not want seeds in the result
* @return list or empty list (never null)
*/
@SuppressWarnings({"unchecked", "rawtypes"})
List<Hash> getPeers(InfoHash ih, int max, boolean noSeeds) {
Peers peers = _torrents.get(ih);
if (peers == null || max <= 0)

View File

@@ -243,6 +243,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
* @param maxWait how long to wait for each to reply (not total) must be > 0
* @param parallel how many outstanding at once (unimplemented, always 1)
*/
@SuppressWarnings("unchecked")
private void explore(NID target, int maxNodes, long maxWait, int parallel) {
List<NodeInfo> nodes = _knownNodes.findClosest(target, maxNodes);
if (nodes.isEmpty()) {
@@ -327,6 +328,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
* @param noSeeds true if we do not want seeds in the result
* @return possibly empty (never null)
*/
@SuppressWarnings("unchecked")
public Collection<Hash> getPeersAndAnnounce(byte[] ih, int max, long maxWait,
int annMax, long annMaxWait,
boolean isSeed, boolean noSeeds) {
@@ -858,6 +860,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
* @param repliable true for all but announce
* @return null on error
*/
@SuppressWarnings("unchecked")
private ReplyWaiter sendQuery(NodeInfo nInfo, Map<String, Object> map, boolean repliable) {
if (nInfo.equals(_myNodeInfo))
throw new IllegalArgumentException("wtf don't send to ourselves");
@@ -907,6 +910,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
* @param toPort the query port, we will increment here
* @return success
*/
@SuppressWarnings("unchecked")
private boolean sendResponse(NodeInfo nInfo, MsgID msgID, Map<String, Object> map) {
if (nInfo.equals(_myNodeInfo))
throw new IllegalArgumentException("wtf don't send to ourselves");

View File

@@ -72,6 +72,7 @@ public class JettyStart implements ClientApp {
/**
* Modified from XmlConfiguration.main()
*/
@SuppressWarnings({"unchecked", "rawtypes"})
public void parseArgs(String[] args) throws Exception {
Properties properties=new Properties();
XmlConfiguration last=null;

View File

@@ -84,6 +84,7 @@ public class XSSRequestWrapper extends HttpServletRequestWrapper {
* Parameter names starting with "nofilter_" will not be filtered.
*/
@Override
@SuppressWarnings({"unchecked", "rawtypes"})
public Map getParameterMap() {
Map rv = new HashMap();
for (Enumeration keys = getParameterNames(); keys.hasMoreElements(); ) {

View File

@@ -219,6 +219,7 @@ public class MultiPartRequest
}
/* ------------------------------------------------------------ */
@SuppressWarnings("rawtypes")
public Hashtable[] getMultipleParams(String name)
{
List<Object> parts = _partMap.getValues(name);

View File

@@ -29,7 +29,7 @@ public class ByteArrayPool
public static final int __POOL_SIZE=
Integer.getInteger("org.mortbay.util.ByteArrayPool.pool_size",8).intValue();
public static final ThreadLocal __pools=new BAThreadLocal();
public static final ThreadLocal<byte[][]> __pools = new BAThreadLocal();
public static final AtomicInteger __slot = new AtomicInteger();
/* ------------------------------------------------------------ */
@@ -39,7 +39,7 @@ public class ByteArrayPool
*/
public static byte[] getByteArray(int size)
{
byte[][] pool = (byte[][])__pools.get();
byte[][] pool = __pools.get();
boolean full=true;
for (int i=pool.length;i-->0;)
{
@@ -63,7 +63,7 @@ public class ByteArrayPool
/* ------------------------------------------------------------ */
public static byte[] getByteArrayAtLeast(int minSize)
{
byte[][] pool = (byte[][])__pools.get();
byte[][] pool = __pools.get();
for (int i=pool.length;i-->0;)
{
if (pool[i]!=null && pool[i].length>=minSize)
@@ -84,7 +84,7 @@ public class ByteArrayPool
if (b==null)
return;
byte[][] pool = (byte[][])__pools.get();
byte[][] pool = __pools.get();
for (int i=pool.length;i-->0;)
{
if (pool[i]==null)
@@ -103,9 +103,10 @@ public class ByteArrayPool
/* ------------------------------------------------------------ */
/* ------------------------------------------------------------ */
private static final class BAThreadLocal extends ThreadLocal
private static final class BAThreadLocal extends ThreadLocal<byte[][]>
{
protected Object initialValue()
@Override
protected byte[][] initialValue()
{
return new byte[__POOL_SIZE][];
}

View File

@@ -109,6 +109,7 @@ class MailCache {
* @param mode CACHE_ONLY to not pull from pop server
* @return An e-mail or null
*/
@SuppressWarnings({"unchecked", "rawtypes"})
public Mail getMail(String uidl, FetchMode mode) {
Mail mail = null, newMail = null;
@@ -163,6 +164,7 @@ class MailCache {
* @return true if any were fetched
* @since 0.9.13
*/
@SuppressWarnings({"unchecked", "rawtypes"})
public boolean getMail(FetchMode mode) {
if (mode == FetchMode.CACHE_ONLY)
throw new IllegalArgumentException();

View File

@@ -288,7 +288,7 @@ public class WebMail extends HttpServlet
*/
private static class SenderSorter extends SorterBase {
private final Comparator collator = Collator.getInstance();
private final Comparator<Object> collator = Collator.getInstance();
public SenderSorter( MailCache mailCache )
{
@@ -307,7 +307,7 @@ public class WebMail extends HttpServlet
* @author susi
*/
private static class SubjectSorter extends SorterBase {
private final Comparator collator = Collator.getInstance();
private final Comparator<Object> collator = Collator.getInstance();
public SubjectSorter( MailCache mailCache )
{
@@ -2299,7 +2299,7 @@ public class WebMail extends HttpServlet
/**
* first prev next last
*/
private static void showPageButtons(PrintWriter out, Folder folder) {
private static void showPageButtons(PrintWriter out, Folder<?> folder) {
out.println(
"<br>" +
( folder.isFirstPage() ?