Permalink
Browse files

eliminate some compiler unchecked and deprecation warnings

in nav plugins by explicite type declaration and replacing date.getYear
with Calendar.get
  • Loading branch information...
reger24 committed Mar 9, 2017
1 parent 6eb7d27 commit 9b6d1abd9ed7b630e1afacb1a91aa9f834f1c174
@@ -39,7 +39,7 @@
* @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");
@@ -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 void incDoc(URIMetadataNode doc) {
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 void incDoc(URIMetadataNode doc) {
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)

0 comments on commit 9b6d1ab

Please sign in to comment.