From 53623da2eb4d797e04008b102cf7eb7b15612d07 Mon Sep 17 00:00:00 2001 From: str4d <str4d@mail.i2p> Date: Wed, 20 Nov 2013 23:14:40 +0000 Subject: [PATCH] addressbook: type arguments, unused imports --- .../java/src/net/i2p/addressbook/AddressBook.java | 6 +++--- .../src/net/i2p/addressbook/ConfigIterator.java | 3 ++- .../java/src/net/i2p/addressbook/ConfigParser.java | 4 ++-- .../java/src/net/i2p/addressbook/Daemon.java | 4 ++-- .../net/i2p/addressbook/SubscriptionIterator.java | 2 +- .../src/net/i2p/addressbook/SubscriptionList.java | 14 +++++++------- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/apps/addressbook/java/src/net/i2p/addressbook/AddressBook.java b/apps/addressbook/java/src/net/i2p/addressbook/AddressBook.java index c480d86889..4a124e4886 100644 --- a/apps/addressbook/java/src/net/i2p/addressbook/AddressBook.java +++ b/apps/addressbook/java/src/net/i2p/addressbook/AddressBook.java @@ -120,11 +120,11 @@ class AddressBook { subscription.setLastFetched(I2PAppContext.getGlobalContext().clock().now()); subf = tmp; } else { - a = Collections.EMPTY_MAP; + a = Collections.emptyMap(); tmp.delete(); } } catch (IOException ioe) { - a = Collections.EMPTY_MAP; + a = Collections.emptyMap(); } this.addresses = a; this.subFile = subf; @@ -148,7 +148,7 @@ class AddressBook { try { a = ConfigParser.parse(file); } catch (IOException exp) { - a = new HashMap(); + a = new HashMap<String, String>(); } this.addresses = a; this.subFile = null; diff --git a/apps/addressbook/java/src/net/i2p/addressbook/ConfigIterator.java b/apps/addressbook/java/src/net/i2p/addressbook/ConfigIterator.java index 044f41c3c8..955363eafd 100644 --- a/apps/addressbook/java/src/net/i2p/addressbook/ConfigIterator.java +++ b/apps/addressbook/java/src/net/i2p/addressbook/ConfigIterator.java @@ -138,7 +138,8 @@ class ConfigIterator implements Iterator<Map.Entry<String, String>> { public boolean equals(Object o) { if (!(o instanceof Map.Entry)) return false; - Map.Entry e = (Map.Entry) o; + @SuppressWarnings("unchecked") + Map.Entry<Object, Object> e = (Map.Entry<Object, Object>) o; return key.equals(e.getKey()) && value.equals(e.getValue()); } } diff --git a/apps/addressbook/java/src/net/i2p/addressbook/ConfigParser.java b/apps/addressbook/java/src/net/i2p/addressbook/ConfigParser.java index e80aa8c74e..e6e5eefab9 100644 --- a/apps/addressbook/java/src/net/i2p/addressbook/ConfigParser.java +++ b/apps/addressbook/java/src/net/i2p/addressbook/ConfigParser.java @@ -87,7 +87,7 @@ class ConfigParser { * */ public static Map<String, String> parse(BufferedReader input) throws IOException { - Map<String, String> result = new HashMap(); + Map<String, String> result = new HashMap<String, String>(); String inputLine; inputLine = input.readLine(); while (inputLine != null) { @@ -179,7 +179,7 @@ class ConfigParser { */ public static List<String> parseSubscriptions(BufferedReader input) throws IOException { - List<String> result = new LinkedList(); + List<String> result = new LinkedList<String>(); String inputLine = input.readLine(); while (inputLine != null) { inputLine = ConfigParser.stripComments(inputLine).trim(); diff --git a/apps/addressbook/java/src/net/i2p/addressbook/Daemon.java b/apps/addressbook/java/src/net/i2p/addressbook/Daemon.java index 968be72685..d22ac75345 100644 --- a/apps/addressbook/java/src/net/i2p/addressbook/Daemon.java +++ b/apps/addressbook/java/src/net/i2p/addressbook/Daemon.java @@ -251,7 +251,7 @@ public class Daemon { } delay *= 60 * 60 * 1000; - List<String> defaultSubs = new LinkedList(); + List<String> defaultSubs = new LinkedList<String>(); // defaultSubs.add("http://i2p/NF2RLVUxVulR3IqK0sGJR0dHQcGXAzwa6rEO4WAWYXOHw-DoZhKnlbf1nzHXwMEJoex5nFTyiNMqxJMWlY54cvU~UenZdkyQQeUSBZXyuSweflUXFqKN-y8xIoK2w9Ylq1k8IcrAFDsITyOzjUKoOPfVq34rKNDo7fYyis4kT5bAHy~2N1EVMs34pi2RFabATIOBk38Qhab57Umpa6yEoE~rbyR~suDRvD7gjBvBiIKFqhFueXsR2uSrPB-yzwAGofTXuklofK3DdKspciclTVzqbDjsk5UXfu2nTrC1agkhLyqlOfjhyqC~t1IXm-Vs2o7911k7KKLGjB4lmH508YJ7G9fLAUyjuB-wwwhejoWqvg7oWvqo4oIok8LG6ECR71C3dzCvIjY2QcrhoaazA9G4zcGMm6NKND-H4XY6tUWhpB~5GefB3YczOqMbHq4wi0O9MzBFrOJEOs3X4hwboKWANf7DT5PZKJZ5KorQPsYRSq0E3wSOsFCSsdVCKUGsAAAA/i2p/hosts.txt"); defaultSubs.add("http://www.i2p2.i2p/hosts.txt"); @@ -331,7 +331,7 @@ public class Daemon { homeFile = new SecureDirectory(System.getProperty("user.dir")); } - Map<String, String> defaultSettings = new HashMap(); + Map<String, String> defaultSettings = new HashMap<String, String>(); defaultSettings.put("proxy_host", "127.0.0.1"); defaultSettings.put("proxy_port", "4444"); defaultSettings.put("master_addressbook", "../userhosts.txt"); diff --git a/apps/addressbook/java/src/net/i2p/addressbook/SubscriptionIterator.java b/apps/addressbook/java/src/net/i2p/addressbook/SubscriptionIterator.java index 22113f52e7..cf7b04fc04 100644 --- a/apps/addressbook/java/src/net/i2p/addressbook/SubscriptionIterator.java +++ b/apps/addressbook/java/src/net/i2p/addressbook/SubscriptionIterator.java @@ -81,7 +81,7 @@ class SubscriptionIterator implements Iterator<AddressBook> { // DataHelper.formatDuration(I2PAppContext.getGlobalContext().clock().now() - sub.getLastFetched()) + // " ago but the minimum delay is " + // DataHelper.formatDuration(this.delay)); - return new AddressBook(Collections.EMPTY_MAP); + return new AddressBook(Collections.<String, String> emptyMap()); } } diff --git a/apps/addressbook/java/src/net/i2p/addressbook/SubscriptionList.java b/apps/addressbook/java/src/net/i2p/addressbook/SubscriptionList.java index 9b64bb3166..6aab49b224 100644 --- a/apps/addressbook/java/src/net/i2p/addressbook/SubscriptionList.java +++ b/apps/addressbook/java/src/net/i2p/addressbook/SubscriptionList.java @@ -69,7 +69,7 @@ class SubscriptionList { public SubscriptionList(File locationsFile, File etagsFile, File lastModifiedFile, File lastFetchedFile, long delay, List<String> defaultSubs, String proxyHost, int proxyPort) { - this.subscriptions = new LinkedList(); + this.subscriptions = new LinkedList<Subscription>(); this.etagsFile = etagsFile; this.lastModifiedFile = lastModifiedFile; this.lastFetchedFile = lastFetchedFile; @@ -84,17 +84,17 @@ class SubscriptionList { try { etags = ConfigParser.parse(etagsFile); } catch (IOException exp) { - etags = new HashMap(); + etags = new HashMap<String, String>(); } try { lastModified = ConfigParser.parse(lastModifiedFile); } catch (IOException exp) { - lastModified = new HashMap(); + lastModified = new HashMap<String, String>(); } try { lastFetched = ConfigParser.parse(lastFetchedFile); } catch (IOException exp) { - lastFetched = new HashMap(); + lastFetched = new HashMap<String, String>(); } for (String location : locations) { this.subscriptions.add(new Subscription(location, etags.get(location), @@ -121,9 +121,9 @@ class SubscriptionList { * won't be read back correctly; the '=' should be escaped. */ public void write() { - Map<String, String> etags = new HashMap(); - Map<String, String> lastModified = new HashMap(); - Map<String, String> lastFetched = new HashMap(); + Map<String, String> etags = new HashMap<String, String>(); + Map<String, String> lastModified = new HashMap<String, String>(); + Map<String, String> lastFetched = new HashMap<String, String>(); for (Subscription sub : this.subscriptions) { if (sub.getEtag() != null) { etags.put(sub.getLocation(), sub.getEtag()); -- GitLab