Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
eliminate some compiler unchecked and deprecation warnings in nav plugins by explicite type declaration and replacing date.getYear with Calendar.get
reger9b6d1abd9ed7
diff --git a/source/net/yacy/search/navigator/NavigatorPlugins.java b/source/net/yacy/search/navigator/NavigatorPlugins.javaindex b7547bd48..278ff1941 100644--- a/source/net/yacy/search/navigator/NavigatorPlugins.java+++ b/source/net/yacy/search/navigator/NavigatorPlugins.java@@ -39,7 +39,7 @@ public class NavigatorPlugins {* @return Map key=navigatorCfgname, value=std.DisplayName*/static public Map<String, String> listAvailable() {- Map<String, String> defaultnavplugins = new TreeMap();+ Map<String, String> defaultnavplugins = new TreeMap<String, String>();defaultnavplugins.put("filetype", "Filetype");// defaultnavplugins.put("hosts", "Provider");// defaultnavplugins.put("language", "Language");diff --git a/source/net/yacy/search/navigator/YearNavigator.java b/source/net/yacy/search/navigator/YearNavigator.javaindex 5b74da9b8..b3ccab367 100644--- a/source/net/yacy/search/navigator/YearNavigator.java+++ b/source/net/yacy/search/navigator/YearNavigator.java@@ -22,6 +22,7 @@*/package net.yacy.search.navigator;+import java.util.Calendar;import java.util.Collection;import java.util.Collections;import java.util.Date;@@ -97,20 +98,21 @@ public class YearNavigator extends StringNavigator implements Navigator {if (field.getType() == SolrType.date) {Object val = doc.getFieldValue(field.getSolrFieldName());if (val != null) {+ Calendar cal = Calendar.getInstance();if (val instanceof Collection) {Collection<Object> ll = (Collection) val;for (Object o : ll) {if (o instanceof String) {this.inc((String) o);} else if (o instanceof Date) {- Date dd = (Date) o;- String year = Integer.toString(dd.getYear() + 1900);+ cal.setTime((Date) o);+ String year = Integer.toString(cal.get(Calendar.YEAR));this.inc(year);}}} else {- Date dd = (Date) val;- String year = Integer.toString(dd.getYear() + 1900);+ cal.setTime((Date) val);+ String year = Integer.toString(cal.get(Calendar.YEAR));this.inc(year);}}@@ -131,7 +133,7 @@ public class YearNavigator extends StringNavigator implements Navigator {if (up) {years = new TreeSet<String>();} else {- years = new TreeSet(Collections.reverseOrder());+ years = new TreeSet<String>(Collections.reverseOrder());}// make sure keys with high score are included (display may be limited in size)