more generics

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4414 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
orbiter 2008-01-29 10:12:48 +00:00
parent 974fea7933
commit 0f5c4abaca
49 changed files with 381 additions and 381 deletions

View File

@ -33,6 +33,7 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.Map.Entry;
import de.anomic.http.httpHeader;
import de.anomic.net.natLib;
@ -128,7 +129,7 @@ public class AccessTracker_p {
if ((page == 2) || (page == 4)) {
ArrayList<HashMap<String, Object>> array = (page == 2) ? switchboard.localSearches : switchboard.remoteSearches;
Long trackerHandle;
HashMap searchProfile;
HashMap<String, Object> searchProfile;
int m = Math.min(maxCount, array.size());
long qcountSum = 0;
long qtimeSum = 0;
@ -138,7 +139,7 @@ public class AccessTracker_p {
long rtimeSum = 0;
for (int entCount = 0; entCount < m; entCount++) {
searchProfile = (HashMap<String, Object>) array.get(array.size() - entCount - 1);
searchProfile = array.get(array.size() - entCount - 1);
trackerHandle = (Long) searchProfile.get("time");
// put values in template
@ -154,7 +155,7 @@ public class AccessTracker_p {
} else {
// remote search
prop.putHTML("page_list_" + entCount + "_peername", (String) searchProfile.get("peername"));
prop.put("page_list_" + entCount + "_queryhashes", plasmaSearchQuery.anonymizedQueryHashes((Set) searchProfile.get("queryhashes")));
prop.put("page_list_" + entCount + "_queryhashes", plasmaSearchQuery.anonymizedQueryHashes((Set<String>) searchProfile.get("queryhashes")));
}
prop.putNum("page_list_" + entCount + "_querycount", ((Integer) searchProfile.get("querycount")).longValue());
prop.putNum("page_list_" + entCount + "_querytime", ((Long) searchProfile.get("querytime")).longValue());
@ -183,22 +184,22 @@ public class AccessTracker_p {
prop.putNum("page_total", (page == 2) ? switchboard.localSearches.size() : switchboard.remoteSearches.size());
}
if ((page == 3) || (page == 5)) {
Iterator i = (page == 3) ? switchboard.localSearchTracker.entrySet().iterator() : switchboard.remoteSearchTracker.entrySet().iterator();
Iterator<Entry<String, TreeSet<Long>>> i = (page == 3) ? switchboard.localSearchTracker.entrySet().iterator() : switchboard.remoteSearchTracker.entrySet().iterator();
String host;
TreeSet handles;
TreeSet<Long> handles;
int entCount = 0;
int qphSum = 0;
Map.Entry entry;
try {
while ((entCount < maxCount) && (i.hasNext())) {
entry = (Map.Entry) i.next();
entry = i.next();
host = (String) entry.getKey();
handles = (TreeSet) entry.getValue();
handles = (TreeSet<Long>) entry.getValue();
int dateCount = 0;
Iterator ii = handles.iterator();
Iterator<Long> ii = handles.iterator();
while (ii.hasNext()) {
Long timestamp = (Long) ii.next();
Long timestamp = ii.next();
prop.put("page_list_" + entCount + "_dates_" + dateCount + "_date", serverDate.formatShortSecond(new Date(timestamp.longValue())));
prop.put("page_list_" + entCount + "_dates_" + dateCount + "_timestamp", timestamp.toString());
dateCount++;

View File

@ -232,7 +232,7 @@ public class Blacklist_p {
}
// load blacklist data from file
ArrayList list = listManager.getListArray(new File(listManager.listsPath, blacklistToUse));
ArrayList<String> list = listManager.getListArray(new File(listManager.listsPath, blacklistToUse));
// delete the old entry from file
if (list != null) {
@ -369,7 +369,7 @@ public class Blacklist_p {
}
// load blacklist data from file
ArrayList list = listManager.getListArray(new File(listManager.listsPath, blacklistToUse));
ArrayList<String> list = listManager.getListArray(new File(listManager.listsPath, blacklistToUse));
// delete the old entry from file
if (list != null) {
@ -413,7 +413,7 @@ public class Blacklist_p {
// Read the blacklist items from file
if (blacklistToUse != null) {
int entryCount = 0;
final ArrayList list = listManager.getListArray(new File(listManager.listsPath, blacklistToUse));
final ArrayList<String> list = listManager.getListArray(new File(listManager.listsPath, blacklistToUse));
// sort them
String[] sortedlist = new String[list.size()];
@ -436,16 +436,16 @@ public class Blacklist_p {
if (yacyCore.seedDB != null && yacyCore.seedDB.sizeConnected() > 0) { // no nullpointer error
int peerCount = 0;
try {
TreeMap hostList = new TreeMap();
final Iterator e = yacyCore.seedDB.seedsConnected(true, false, null, (float) 0.0);
TreeMap<String, String> hostList = new TreeMap<String, String>();
final Iterator<yacySeed> e = yacyCore.seedDB.seedsConnected(true, false, null, (float) 0.0);
while (e.hasNext()) {
yacySeed seed = (yacySeed) e.next();
if (seed != null) hostList.put(seed.get(yacySeed.NAME, "nameless"),seed.hash);
}
String peername;
while ((peername = (String) hostList.firstKey()) != null) {
final String Hash = (String) hostList.get(peername);
while ((peername = hostList.firstKey()) != null) {
final String Hash = hostList.get(peername);
prop.put(DISABLED + "otherHosts_" + peerCount + "_hash", Hash);
prop.putHTML(DISABLED + "otherHosts_" + peerCount + "_name", peername, true);
hostList.remove(peername);

View File

@ -44,7 +44,6 @@
// if the shell's current path is HTROOT
import java.io.IOException;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Map;
@ -75,11 +74,11 @@ public class News {
prop.put("AUTHENTICATE", "admin log-in");
return prop; // this button needs authentication, force log-in
}
Enumeration e = post.keys();
Iterator<String> e = post.keySet().iterator();
String check;
String id;
while (e.hasMoreElements()) {
check = (String) e.nextElement();
while (e.hasNext()) {
check = e.next();
if ((check.startsWith("del_")) && (post.get(check, "off").equals("on"))) {
id = check.substring(4);
try {
@ -125,12 +124,12 @@ public class News {
} else {
int maxCount = Math.min(1000, yacyCore.newsPool.size(tableID));
Iterator recordIterator = yacyCore.newsPool.recordIterator(tableID, false);
Iterator<yacyNewsRecord> recordIterator = yacyCore.newsPool.recordIterator(tableID, false);
yacyNewsRecord record;
yacySeed seed;
int i = 0;
while ((recordIterator.hasNext()) && (i < maxCount)) {
record = (yacyNewsRecord) recordIterator.next();
record = recordIterator.next();
if (record == null) continue;
seed = yacyCore.seedDB.getConnected(record.originator());
@ -144,11 +143,11 @@ public class News {
prop.put("table_list_" + i + "_rec", (record.received() == null) ? "-" : serverDate.formatShortSecond(record.received()));
prop.put("table_list_" + i + "_dis", record.distributed());
Map attributeMap = record.attributes();
Map<String, String> attributeMap = record.attributes();
prop.putHTML("table_list_" + i + "_att", attributeMap.toString());
int j = 0;
if (attributeMap.size() > 0) {
Iterator attributeKeys = attributeMap.keySet().iterator();
Iterator<String> attributeKeys = attributeMap.keySet().iterator();
while (attributeKeys.hasNext()) {
String key = (String) attributeKeys.next();
String value = (String) attributeMap.get(key);

View File

@ -49,7 +49,6 @@
import java.net.InetSocketAddress;
import java.net.SocketException;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@ -556,26 +555,26 @@ public class SettingsAck_p {
if (post.containsKey("parserSettings")) {
post.remove("parserSettings");
Set parserModes = plasmaParser.getParserConfigList().keySet();
HashMap newConfigList = new HashMap();
Iterator parserModeIter = parserModes.iterator();
Set<String> parserModes = plasmaParser.getParserConfigList().keySet();
HashMap<String, HashSet> newConfigList = new HashMap<String, HashSet>();
Iterator<String> parserModeIter = parserModes.iterator();
while (parserModeIter.hasNext()) {
String currParserMode = (String)parserModeIter.next();
String currParserMode = parserModeIter.next();
newConfigList.put(currParserMode, new HashSet());
}
// looping through all received settings
int pos;
Enumeration keyEnum = post.keys();
while (keyEnum.hasMoreElements()) {
String key = (String) keyEnum.nextElement();
Iterator<String> keyEnum = post.keySet().iterator();
while (keyEnum.hasNext()) {
String key = keyEnum.next();
if ((pos = key.indexOf(".")) != -1) {
String currParserMode = key.substring(0,pos).trim().toUpperCase();
String currMimeType = key.substring(pos+1).replaceAll("\n", "");
if (parserModes.contains(currParserMode)) {
HashSet currEnabledMimeTypes;
HashSet<String> currEnabledMimeTypes;
assert (newConfigList.containsKey(currParserMode)) : "Unexpected Error";
currEnabledMimeTypes = (HashSet) newConfigList.get(currParserMode);
currEnabledMimeTypes = newConfigList.get(currParserMode);
currEnabledMimeTypes.add(currMimeType);
}
}
@ -585,8 +584,8 @@ public class SettingsAck_p {
StringBuffer currEnabledMimesTxt = new StringBuffer();
parserModeIter = newConfigList.keySet().iterator();
while (parserModeIter.hasNext()) {
String currParserMode = (String)parserModeIter.next();
String[] enabledMimes = plasmaParser.setEnabledParserList(currParserMode, (Set)newConfigList.get(currParserMode));
String currParserMode = parserModeIter.next();
String[] enabledMimes = plasmaParser.setEnabledParserList(currParserMode, newConfigList.get(currParserMode));
Arrays.sort(enabledMimes);
currEnabledMimesTxt.setLength(0);

View File

@ -44,10 +44,10 @@
// if the shell's current path is HTROOT
import java.net.MalformedURLException;
import java.util.Iterator;
import java.util.Map;
import java.util.HashMap;
import de.anomic.http.httpHeader;
import de.anomic.kelondro.kelondroMapObjects;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@ -71,11 +71,11 @@ public class Statistics {
prop.put("page_backlinks", "0");
} else {
prop.put("page_backlinks", "1");
Iterator<Map<String, String>> it = switchboard.facilityDB.maps("backlinks", false, "date");
kelondroMapObjects.mapIterator it = switchboard.facilityDB.maps("backlinks", false, "date");
int count = 0;
int maxCount = 100;
boolean dark = true;
Map<String, String> map;
HashMap<String, String> map;
String urlString;
yacyURL url;
while ((it.hasNext()) && (count < maxCount)) {

View File

@ -51,6 +51,7 @@ import de.anomic.kelondro.kelondroBase64Order;
import de.anomic.kelondro.kelondroException;
import de.anomic.kelondro.kelondroRow;
import de.anomic.kelondro.kelondroStack;
import de.anomic.kelondro.kelondroRow.EntryIndex;
import de.anomic.server.logging.serverLog;
import de.anomic.yacy.yacyURL;
@ -115,15 +116,15 @@ public class URLFetcherStack {
public String[] top(int count) {
try {
final ArrayList ar = new ArrayList();
Iterator it = db.contentRows(500);
final ArrayList<String> ar = new ArrayList<String>();
Iterator<EntryIndex> it = db.contentRows(500);
kelondroRow.EntryIndex ei;
for (int i=0; i<count && it.hasNext(); i++) {
ei = (kelondroRow.EntryIndex)it.next();
ei = it.next();
if (ei == null) continue;
ar.add(ei.getColString(0, null));
}
return (String[])ar.toArray(new String[ar.size()]);
return ar.toArray(new String[ar.size()]);
} catch (kelondroException e) {
this.log.logSevere("error retrieving entry", e);
return null;

View File

@ -37,11 +37,11 @@ public class URLLicense {
// it is used in case of snippet- and preview-Image-fetching to grant also non-authorized users the usage of a image-fetcher servlet
private Random random;
private HashMap permissions;
private HashMap<String, yacyURL> permissions;
private int keylen;
public URLLicense(int keylen) {
this.permissions = new HashMap();
this.permissions = new HashMap<String, yacyURL>();
this.random = new Random(System.currentTimeMillis());
this.keylen = keylen;
}
@ -62,7 +62,7 @@ public class URLLicense {
public yacyURL releaseLicense(String license) {
yacyURL url = null;
synchronized (permissions) {
url = (yacyURL) permissions.remove(license);
url = permissions.remove(license);
}
/*
if (url == null) {

View File

@ -52,7 +52,6 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@ -109,17 +108,17 @@ public class blogBoard {
return wikiBoard.guessAuthor(ip);
}
public entry newEntry(String key, byte[] subject, byte[] author, String ip, Date date, byte[] page, ArrayList comments, String commentMode) {
public entry newEntry(String key, byte[] subject, byte[] author, String ip, Date date, byte[] page, ArrayList<String> comments, String commentMode) {
return new entry(normalize(key), subject, author, ip, date, page, comments, commentMode);
}
public class entry {
String key;
Map record;
HashMap<String, String> record;
public entry(String nkey, byte[] subject, byte[] author, String ip, Date date, byte[] page, ArrayList comments, String commentMode) {
record = new HashMap();
public entry(String nkey, byte[] subject, byte[] author, String ip, Date date, byte[] page, ArrayList<String> comments, String commentMode) {
record = new HashMap<String, String>();
key = nkey;
if (key.length() > keyLength) key = key.substring(0, keyLength);
if(date == null) date = new Date();
@ -132,7 +131,7 @@ public class blogBoard {
record.put("ip", ip);
if (page == null) record.put("page", "");
else record.put("page", kelondroBase64Order.enhancedCoder.encode(page));
if (comments == null) record.put("comments", listManager.collection2string(new ArrayList()));
if (comments == null) record.put("comments", listManager.collection2string(new ArrayList<String>()));
else record.put("comments", listManager.collection2string(comments));
if (commentMode == null) record.put("commentMode", "1");
else record.put("commentMode", commentMode);
@ -141,10 +140,10 @@ public class blogBoard {
//System.out.println("DEBUG: setting author " + author + " for ip = " + ip + ", authors = " + authors.toString());
}
private entry(String key, Map record) {
private entry(String key, HashMap<String, String> record) {
this.key = key;
this.record = record;
if (this.record.get("comments")==null) this.record.put("comments", listManager.collection2string(new ArrayList()));
if (this.record.get("comments")==null) this.record.put("comments", listManager.collection2string(new ArrayList<String>()));
if (this.record.get("commentMode")==null || this.record.get("commentMode").equals("")) this.record.put("commentMode", "1");
}
@ -153,7 +152,7 @@ public class blogBoard {
}
public byte[] subject() {
String m = (String) record.get("subject");
String m = record.get("subject");
if (m == null) return new byte[0];
byte[] b = kelondroBase64Order.enhancedCoder.decode(m, "de.anomic.data.blogBoard.subject()");
if (b == null) return "".getBytes();
@ -162,7 +161,7 @@ public class blogBoard {
public Date date() {
try {
String c = (String) record.get("date");
String c = record.get("date");
if (c == null) {
System.out.println("DEBUG - ERROR: date field missing in blogBoard");
return new Date();
@ -174,7 +173,7 @@ public class blogBoard {
}
public String timestamp() {
String c = (String) record.get("date");
String c = record.get("date");
if (c == null) {
System.out.println("DEBUG - ERROR: date field missing in blogBoard");
return serverDate.formatShortSecond();
@ -183,7 +182,7 @@ public class blogBoard {
}
public byte[] author() {
String m = (String) record.get("author");
String m = record.get("author");
if (m == null) return new byte[0];
byte[] b = kelondroBase64Order.enhancedCoder.decode(m, "de.anomic.data.blogBoard.author()");
if (b == null) return "".getBytes();
@ -191,27 +190,27 @@ public class blogBoard {
}
public byte[] commentsSize() {
ArrayList m = listManager.string2arraylist((String) record.get("comments"));
ArrayList<String> m = listManager.string2arraylist(record.get("comments"));
if (m == null) return new byte[0];
byte[] b = Integer.toString(m.size()).getBytes();
if (b == null) return "".getBytes();
return b;
}
public ArrayList comments() {
ArrayList m = listManager.string2arraylist((String) record.get("comments"));
if (m == null) return new ArrayList();
public ArrayList<String> comments() {
ArrayList<String> m = listManager.string2arraylist(record.get("comments"));
if (m == null) return new ArrayList<String>();
return m;
}
public String ip() {
String a = (String) record.get("ip");
String a = record.get("ip");
if (a == null) return "127.0.0.1";
return a;
}
public byte[] page() {
String m = (String) record.get("page");
String m = record.get("page");
if (m == null) return new byte[0];
byte[] b = kelondroBase64Order.enhancedCoder.decode(m, "de.anomic.data.blogBoard.page()");
if (b == null) return "".getBytes();
@ -219,20 +218,20 @@ public class blogBoard {
}
public void addComment(String commentID) {
ArrayList comments = listManager.string2arraylist((String) record.get("comments"));
ArrayList<String> comments = listManager.string2arraylist(record.get("comments"));
comments.add(commentID);
record.put("comments", listManager.collection2string(comments));
}
public boolean removeComment(String commentID) {
ArrayList comments = listManager.string2arraylist((String) record.get("comments"));
ArrayList<String> comments = listManager.string2arraylist(record.get("comments"));
boolean success = comments.remove(commentID);
record.put("comments", listManager.collection2string(comments));
return success;
}
public int getCommentMode(){
return Integer.parseInt((String) record.get("commentMode"));
return Integer.parseInt(record.get("commentMode"));
}
}
@ -253,7 +252,7 @@ public class blogBoard {
private entry read(String key, kelondroMapObjects base) {
key = normalize(key);
if (key.length() > keyLength) key = key.substring(0, keyLength);
Map record = base.getMap(key);
HashMap<String, String> record = base.getMap(key);
if (record == null) return newEntry(key, "".getBytes(), "anonymous".getBytes(), "127.0.0.1", new Date(), "".getBytes(), null, null);
return new entry(key, record);
}
@ -342,7 +341,7 @@ public class blogBoard {
} catch (IOException e) { }
}
public Iterator keys(boolean up) throws IOException {
public Iterator<String> keys(boolean up) throws IOException {
return datbase.keys(up, false);
}

View File

@ -53,7 +53,6 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.TimeZone;
import javax.xml.parsers.DocumentBuilder;
@ -130,10 +129,10 @@ public class blogBoardComments {
public class CommentEntry {
String key;
Map record;
HashMap<String, String> record;
public CommentEntry(String nkey, byte[] subject, byte[] author, String ip, Date date, byte[] page) {
record = new HashMap();
record = new HashMap<String, String>();
key = nkey;
if (key.length() > keyLength) key = key.substring(0, keyLength);
if(date == null) date = new Date();
@ -151,10 +150,10 @@ public class blogBoardComments {
//System.out.println("DEBUG: setting author " + author + " for ip = " + ip + ", authors = " + authors.toString());
}
private CommentEntry(String key, Map record) {
private CommentEntry(String key, HashMap<String, String> record) {
this.key = key;
this.record = record;
if (this.record.get("comments")==null) this.record.put("comments", listManager.collection2string(new ArrayList()));
if (this.record.get("comments")==null) this.record.put("comments", listManager.collection2string(new ArrayList<String>()));
}
public String key() {
@ -216,13 +215,11 @@ public class blogBoardComments {
}
public boolean isAllowed() {
Boolean moderated = (Boolean) record.get("moderated");
if (moderated == null) return false;
return moderated.booleanValue();
return (record.get("moderated") != null) && record.get("moderated").equals("true");
}
public void allow() {
record.put("moderated", new Boolean(true));
record.put("moderated", "true");
}
}
@ -245,7 +242,7 @@ public class blogBoardComments {
private CommentEntry read(String key, kelondroMapObjects base) {
key = normalize(key);
if (key.length() > keyLength) key = key.substring(0, keyLength);
Map record = base.getMap(key);
HashMap<String, String> record = base.getMap(key);
if (record == null) return newEntry(key, "".getBytes(), "anonymous".getBytes(), "127.0.0.1", new Date(), "".getBytes());
return new CommentEntry(key, record);
}
@ -347,7 +344,7 @@ public class blogBoardComments {
} catch (IOException e) { }
}
public Iterator keys(boolean up) throws IOException {
public Iterator<String> keys(boolean up) throws IOException {
return datbase.keys(up, false);
}

View File

@ -102,7 +102,7 @@ public class bookmarksDB {
// tags
kelondroMapObjects tagsTable;
HashMap tagCache;
HashMap<String, Tag> tagCache;
// dates
kelondroMapObjects datesTable;
@ -114,7 +114,7 @@ public class bookmarksDB {
public bookmarksDB(File bookmarksFile, File tagsFile, File datesFile, long preloadTime) {
// bookmarks
tagCache=new HashMap();
tagCache=new HashMap<String, Tag>();
bookmarkCache=new HashMap();
bookmarksFile.getParentFile().mkdirs();
//this.bookmarksTable = new kelondroMap(kelondroDyn.open(bookmarksFile, bufferkb * 1024, preloadTime, 12, 256, '_', true, false));
@ -164,11 +164,11 @@ public class bookmarksDB {
Set<String> folders = new TreeSet<String>();
String path = "";
Iterator it = this.getTagIterator(priv);
Iterator<Tag> it = this.getTagIterator(priv);
Tag tag;
while(it.hasNext()){
tag=(Tag) it.next();
tag=it.next();
if (tag.getFriendlyName().startsWith("/")) {
path = tag.getFriendlyName();
path = cleanTagsString(path);
@ -282,8 +282,8 @@ public class bookmarksDB {
}
public Iterator getBookmarksIterator(boolean priv){
TreeSet set=new TreeSet(new bookmarkComparator(true));
public Iterator<String> getBookmarksIterator(boolean priv){
TreeSet<String> set=new TreeSet<String>(new bookmarkComparator(true));
Iterator it=bookmarkIterator(true);
Bookmark bm;
while(it.hasNext()){
@ -294,21 +294,21 @@ public class bookmarksDB {
}
return set.iterator();
}
public Iterator getBookmarksIterator(String tagName, boolean priv){
TreeSet set=new TreeSet(new bookmarkComparator(true));
public Iterator<String> getBookmarksIterator(String tagName, boolean priv){
TreeSet<String> set=new TreeSet<String>(new bookmarkComparator(true));
String tagHash=tagHash(tagName);
Tag tag=getTag(tagHash);
Set hashes=new HashSet();
Set<String> hashes=new HashSet<String>();
if(tag != null){
hashes=getTag(tagHash).getUrlHashes();
}
if(priv){
set.addAll(hashes);
}else{
Iterator it=hashes.iterator();
Iterator<String> it=hashes.iterator();
Bookmark bm;
while(it.hasNext()){
bm=getBookmark((String) it.next());
bm=getBookmark(it.next());
if(bm.getPublic()){
set.add(bm.getUrlHash());
}
@ -335,7 +335,7 @@ public class bookmarksDB {
* @param hash an object of type String, containing a tagHash
*/
public Tag loadTag(String hash){ // TODO: check if loadTag() could be private
Map map;
HashMap<String, String> map;
Tag ret=null;
map = tagsTable.getMap(hash);
if(map!=null){
@ -350,7 +350,7 @@ public class bookmarksDB {
*/
public Tag getTag(String hash){
if(tagCache.containsKey(hash)){
return (Tag) tagCache.get(hash);
return tagCache.get(hash);
}
return loadTag(hash); //null if it does not exists
}
@ -377,11 +377,11 @@ public class bookmarksDB {
}
}
public void flushTagCache(){
Iterator it=tagCache.keySet().iterator();
Iterator<String> it=tagCache.keySet().iterator();
while(it.hasNext()){
storeTag((Tag) tagCache.get(it.next()));
storeTag(tagCache.get(it.next()));
}
tagCache=new HashMap();
tagCache=new HashMap<String, Tag>();
}
public String addTag(Tag tag){ // TODO: is addTag() really needed - check storeTag() and saveTag()
//tagsTable.set(tag.getTagName(), tag.getMap());
@ -404,14 +404,14 @@ public class bookmarksDB {
return new HashSet().iterator();
}
}
public Iterator getTagIterator(boolean priv){
public Iterator<Tag> getTagIterator(boolean priv){
return getTagIterator(priv,1);
}
public Iterator getTagIterator(boolean priv, int c){
public Iterator<Tag> getTagIterator(boolean priv, int c){
Comparator comp;
if (c == SORT_SIZE) comp = new tagSizeComparator();
else comp = new tagComparator();
TreeSet set=new TreeSet(comp);
TreeSet<Tag> set=new TreeSet<Tag>(comp);
Iterator it=tagIterator(true);
Tag tag;
while(it.hasNext()){
@ -422,11 +422,11 @@ public class bookmarksDB {
}
return set.iterator();
}
public Iterator getTagIterator(boolean priv, int comp, int max){
public Iterator<Tag> getTagIterator(boolean priv, int comp, int max){
if (max==SHOW_ALL)
return getTagIterator(priv, comp);
Iterator it = getTagIterator(priv, comp);
TreeSet set=new TreeSet(new tagComparator());
Iterator<Tag> it = getTagIterator(priv, comp);
TreeSet<Tag> set=new TreeSet<Tag>(new tagComparator());
int count = 0;
while (it.hasNext() && count<=max) {
set.add(it.next());
@ -434,25 +434,25 @@ public class bookmarksDB {
}
return set.iterator();
}
public Iterator getTagIterator(String tagName, boolean priv){
public Iterator<Tag> getTagIterator(String tagName, boolean priv){
return getTagIterator(tagName, priv, 1);
}
public Iterator getTagIterator(String tagName, boolean priv, int comp){
public Iterator<Tag> getTagIterator(String tagName, boolean priv, int comp){
Comparator c;
if (comp == SORT_SIZE) c = new tagSizeComparator();
else c = new tagComparator();
TreeSet set=new TreeSet(c);
Iterator it=null;
Iterator bit=getBookmarksIterator(tagName, priv);
TreeSet<Tag> set=new TreeSet<Tag>(c);
Iterator<String> it=null;
Iterator<String> bit=getBookmarksIterator(tagName, priv);
Bookmark bm;
Tag tag;
Set<String> tags;
while(bit.hasNext()){
bm=getBookmark((String)bit.next());
bm=getBookmark(bit.next());
tags = bm.getTags();
it = tags.iterator();
while (it.hasNext()) {
tag=getTag( tagHash((String) it.next()) );
tag=getTag( tagHash(it.next()) );
if(priv ||tag.hasPublicItems()){
set.add(tag);
}
@ -460,11 +460,11 @@ public class bookmarksDB {
}
return set.iterator();
}
public Iterator getTagIterator(String tagName, boolean priv, int comp, int max){
public Iterator<Tag> getTagIterator(String tagName, boolean priv, int comp, int max){
if (max==SHOW_ALL)
return getTagIterator(priv, comp);
Iterator it = getTagIterator(tagName, priv, comp);
TreeSet set=new TreeSet(new tagComparator());
Iterator<Tag> it = getTagIterator(tagName, priv, comp);
TreeSet<Tag> set=new TreeSet<Tag>(new tagComparator());
int count = 0;
while (it.hasNext() && count<=max) {
set.add(it.next());
@ -502,7 +502,7 @@ public class bookmarksDB {
// ---------------------------------------
public bookmarksDate getDate(String date){
Map map;
HashMap<String, String> map;
map=datesTable.getMap(date);
if(map==null) return new bookmarksDate(date);
return new bookmarksDate(date, map);
@ -541,7 +541,7 @@ public class bookmarksDB {
removeTag(oldHash);
Iterator it = urlHashes.iterator();
Bookmark bookmark;
Set tags = new HashSet();
Set<String> tags = new HashSet<String>();
String tagsString;
while (it.hasNext()) { // looping through all bookmarks which were tagged with oldName
bookmark = getBookmark((String) it.next());
@ -588,7 +588,7 @@ public class bookmarksDB {
String title;
yacyURL url;
Bookmark bm;
Set tags=listManager.string2set(tag); //this allow multiple default tags
Set<String> tags=listManager.string2set(tag); //this allow multiple default tags
try {
//load the links
htmlFilterContentScraper scraper = new htmlFilterContentScraper(baseURL);
@ -672,7 +672,7 @@ public class bookmarksDB {
if(attributes.getNamedItem("time")!=null){
time=attributes.getNamedItem("time").getNodeValue();
}
Set tags=new HashSet();
Set<String> tags=new HashSet<String>();
if(title != null){
bm.setProperty(Bookmark.BOOKMARK_TITLE, title);
@ -721,32 +721,32 @@ public class bookmarksDB {
public static final String URL_HASHES="urlHashes";
public static final String TAG_NAME="tagName";
private String tagHash;
private Map mem;
private HashMap<String, String> mem;
private Set<String> urlHashes;
public Tag(String hash, Map map){
public Tag(String hash, HashMap<String, String> map){
tagHash=hash;
mem=map;
if(mem.containsKey(URL_HASHES))
urlHashes = listManager.string2set((String) mem.get(URL_HASHES));
urlHashes = listManager.string2set(mem.get(URL_HASHES));
else
urlHashes = new HashSet();
urlHashes = new HashSet<String>();
}
public Tag(String name, HashSet entries){
public Tag(String name, HashSet<String> entries){
tagHash=tagHash(name);
mem=new HashMap();
mem=new HashMap<String, String>();
//mem.put(URL_HASHES, listManager.arraylist2string(entries));
urlHashes=entries;
mem.put(TAG_NAME, name);
}
public Tag(String name){
tagHash=tagHash(name);
mem=new HashMap();
mem=new HashMap<String, String>();
//mem.put(URL_HASHES, "");
urlHashes=new HashSet();
urlHashes=new HashSet<String>();
mem.put(TAG_NAME, name);
}
public Map getMap(){
public HashMap<String, String> getMap(){
mem.put(URL_HASHES, listManager.collection2string(this.urlHashes));
return mem;
}
@ -772,7 +772,7 @@ public class bookmarksDB {
}
return getTagName();*/
if(this.mem.containsKey(TAG_NAME)){
return (String) this.mem.get(TAG_NAME);
return this.mem.get(TAG_NAME);
}
return "notagname";
}
@ -780,7 +780,7 @@ public class bookmarksDB {
return urlHashes;
}
public boolean hasPublicItems(){
Iterator it=getBookmarksIterator(this.getTagHash(), false);
Iterator<String> it=getBookmarksIterator(this.getTagHash(), false);
if(it.hasNext()){
return true;
}
@ -801,34 +801,34 @@ public class bookmarksDB {
*/
public class bookmarksDate{
public static final String URL_HASHES="urlHashes";
private Map mem;
private HashMap<String, String> mem;
String date;
public bookmarksDate(String mydate){
//round to seconds, but store as milliseconds (java timestamp)
date=String.valueOf((Long.parseLong(mydate)/1000)*1000);
mem=new HashMap();
mem=new HashMap<String, String>();
mem.put(URL_HASHES, "");
}
public bookmarksDate(String mydate, Map map){
public bookmarksDate(String mydate, HashMap<String, String> map){
//round to seconds, but store as milliseconds (java timestamp)
date=String.valueOf((Long.parseLong(mydate)/1000)*1000);
mem=map;
}
public bookmarksDate(String mydate, ArrayList entries){
public bookmarksDate(String mydate, ArrayList<String> entries){
//round to seconds, but store as milliseconds (java timestamp)
date=String.valueOf((Long.parseLong(mydate)/1000)*1000);
mem=new HashMap();
mem=new HashMap<String, String>();
mem.put(URL_HASHES, listManager.collection2string(entries));
}
public void add(String urlHash){
String urlHashes = (String)mem.get(URL_HASHES);
ArrayList list;
String urlHashes = mem.get(URL_HASHES);
ArrayList<String> list;
if(urlHashes != null && !urlHashes.equals("")){
list=listManager.string2arraylist(urlHashes);
}else{
list=new ArrayList();
list=new ArrayList<String>();
}
if(!list.contains(urlHash) && urlHash != null && !urlHash.equals("")){
list.add(urlHash);
@ -843,7 +843,7 @@ public class bookmarksDB {
}*/
}
public void delete(String urlHash){
ArrayList list=listManager.string2arraylist((String) this.mem.get(URL_HASHES));
ArrayList<String> list=listManager.string2arraylist(this.mem.get(URL_HASHES));
if(list.contains(urlHash)){
list.remove(urlHash);
}
@ -862,10 +862,10 @@ public class bookmarksDB {
return date;
}
public ArrayList getBookmarkList(){
return listManager.string2arraylist((String)this.mem.get(URL_HASHES));
return listManager.string2arraylist(this.mem.get(URL_HASHES));
}
public int size(){
return listManager.string2arraylist(((String)this.mem.get(URL_HASHES))).size();
return listManager.string2arraylist(this.mem.get(URL_HASHES)).size();
}
}
/**
@ -883,13 +883,13 @@ public class bookmarksDB {
private String urlHash;
private Set<String> tags;
private long timestamp;
public Bookmark(String urlHash, Map map){
public Bookmark(String urlHash, HashMap map){
super(map);
this.urlHash=urlHash;
if(map.containsKey(BOOKMARK_TAGS))
tags=listManager.string2set((String) map.get(BOOKMARK_TAGS));
else
tags=new HashSet();
tags=new HashSet<String>();
loadTimestamp();
}
public Bookmark(String url){
@ -904,14 +904,14 @@ public class bookmarksDB {
}
entry.put(BOOKMARK_URL, url);
this.timestamp=System.currentTimeMillis();
tags=new HashSet();
tags=new HashSet<String>();
Bookmark oldBm=getBookmark(this.urlHash);
if(oldBm!=null && oldBm.entry.containsKey(BOOKMARK_TIMESTAMP)){
entry.put(BOOKMARK_TIMESTAMP, oldBm.entry.get(BOOKMARK_TIMESTAMP)); //preserve timestamp on edit
}else{
entry.put(BOOKMARK_TIMESTAMP, String.valueOf(System.currentTimeMillis()));
}
bookmarksDate bmDate=getDate((String) entry.get(BOOKMARK_TIMESTAMP));
bookmarksDate bmDate=getDate(entry.get(BOOKMARK_TIMESTAMP));
bmDate.add(this.urlHash);
bmDate.setDatesTable();
@ -921,14 +921,14 @@ public class bookmarksDB {
super();
this.urlHash=urlHash;
entry.put(BOOKMARK_URL, url.toNormalform(false, true));
tags=new HashSet();
tags=new HashSet<String>();
timestamp=System.currentTimeMillis();
}
public Bookmark(String urlHash, String url){
super();
this.urlHash=urlHash;
entry.put(BOOKMARK_URL, url);
tags=new HashSet();
tags=new HashSet<String>();
timestamp=System.currentTimeMillis();
}
@ -936,20 +936,20 @@ public class bookmarksDB {
this((new yacyURL((String)map.map().get(BOOKMARK_URL), null)).hash(), map.map());
}
private Map toMap(){
private Map<String, String> toMap(){
entry.put(BOOKMARK_TAGS, listManager.collection2string(tags));
entry.put(BOOKMARK_TIMESTAMP, String.valueOf(this.timestamp));
return entry;
}
private void loadTimestamp(){
if(entry.containsKey(BOOKMARK_TIMESTAMP))
this.timestamp=Long.parseLong((String)entry.get(BOOKMARK_TIMESTAMP));
this.timestamp=Long.parseLong(entry.get(BOOKMARK_TIMESTAMP));
}
public String getUrlHash(){
return urlHash;
}
public String getUrl(){
return (String) entry.get(BOOKMARK_URL);
return entry.get(BOOKMARK_URL);
}
public Set<String> getTags(){
return tags;
@ -976,19 +976,19 @@ public class bookmarksDB {
}
public String getDescription(){
if(entry.containsKey(BOOKMARK_DESCRIPTION)){
return (String) entry.get(BOOKMARK_DESCRIPTION);
return entry.get(BOOKMARK_DESCRIPTION);
}
return "";
}
public String getTitle(){
if(entry.containsKey(BOOKMARK_TITLE)){
return (String) entry.get(BOOKMARK_TITLE);
return entry.get(BOOKMARK_TITLE);
}
return (String) entry.get(BOOKMARK_URL);
return entry.get(BOOKMARK_URL);
}
public String getOwner(){
if(entry.containsKey(BOOKMARK_OWNER)){
return (String) entry.get(BOOKMARK_OWNER);
return entry.get(BOOKMARK_OWNER);
}
return null; //null means admin
}
@ -997,13 +997,13 @@ public class bookmarksDB {
}
public boolean getPublic(){
if(entry.containsKey(BOOKMARK_PUBLIC)){
return ((String) entry.get(BOOKMARK_PUBLIC)).equals("public");
return entry.get(BOOKMARK_PUBLIC).equals("public");
}
return false;
}
public boolean getFeed(){
if(entry.containsKey(BOOKMARK_IS_FEED)){
return ((String) entry.get(BOOKMARK_IS_FEED)).equals("true");
return entry.get(BOOKMARK_IS_FEED).equals("true");
}
return false;
}
@ -1045,7 +1045,7 @@ public class bookmarksDB {
// tags.addAll(tags2); // in order for renameTag() to work I had to change this form 'add' to 'set'
Iterator<String> it=tags.iterator();
while(it.hasNext()){
String tagName=(String) it.next();
String tagName=it.next();
Tag tag=getTag(tagHash(tagName));
if(tag == null){
tag=new Tag(tagName);

View File

@ -54,7 +54,7 @@ import java.util.ArrayList;
*/
public class diff {
private final ArrayList /* of Part */ parts = new ArrayList();
private final ArrayList <Part> parts = new ArrayList<Part>();
private final Object[] o;
private final Object[] n;
@ -191,12 +191,12 @@ public class diff {
* @see Part
* @return all parts this diff consists of in correct order
*/
public Part[] getParts() { return (Part[])this.parts.toArray(new Part[this.parts.size()]); }
public Part[] getParts() { return this.parts.toArray(new Part[this.parts.size()]); }
public String toString() {
StringBuffer sb = new StringBuffer(this.parts.size() * 20);
for (int j=0; j<this.parts.size(); j++)
sb.append(((Part)this.parts.get(j)).toString()).append("\n");
sb.append(this.parts.get(j).toString()).append("\n");
return new String(sb);
}

View File

@ -81,7 +81,7 @@ public class listManager {
* @param setName name of the ListSet
* @return a ListSet from configuration file
*/
public static Set getListSet(String setName) {
public static Set<String> getListSet(String setName) {
return string2set(switchboard.getConfig(setName, ""));
}
@ -93,7 +93,7 @@ public class listManager {
* @param listName name of the element to remove from the ListSet.
*/
public static void removeFromListSet(String setName, String listName) {
Set listSet = getListSet(setName);
Set<String> listSet = getListSet(setName);
if (listSet.size() > 0) {
listSet.remove(listName);
@ -112,7 +112,7 @@ public class listManager {
* @param newListName
*/
public static void updateListSet(String setName, String newListName) {
Set listSet = getListSet(setName);
Set<String> listSet = getListSet(setName);
listSet.add(newListName);
switchboard.setConfig(setName, collection2string(listSet));
@ -125,7 +125,7 @@ public class listManager {
* "listName", <code>false</code> otherwise.
*/
public static boolean listSetContains(String setName, String listName) {
Set Lists = getListSet(setName);
Set<String> Lists = getListSet(setName);
return Lists.contains(listName);
}
@ -139,9 +139,9 @@ public class listManager {
* @param listFile the file
* @return the resulting array as an ArrayList
*/
public static ArrayList getListArray(File listFile){
public static ArrayList<String> getListArray(File listFile){
String line;
ArrayList list = new ArrayList();
ArrayList<String> list = new ArrayList<String>();
int count = 0;
BufferedReader br = null;
try {
@ -269,7 +269,7 @@ public class listManager {
}
// same as below
public static ArrayList getDirsRecursive(File dir, String notdir){
public static ArrayList<File> getDirsRecursive(File dir, String notdir){
return getDirsRecursive(dir, notdir, true);
}
@ -278,11 +278,11 @@ public class listManager {
*
* Warning: untested
*/
public static ArrayList getDirsRecursive(File dir, String notdir, boolean excludeDotfiles){
public static ArrayList<File> getDirsRecursive(File dir, String notdir, boolean excludeDotfiles){
final File[] dirList = dir.listFiles();
final ArrayList resultList = new ArrayList();
ArrayList recursive;
Iterator iter;
final ArrayList<File> resultList = new ArrayList<File>();
ArrayList<File> recursive;
Iterator<File> iter;
for (int i=0;i<dirList.length;i++) {
if (dirList[i].isDirectory() && (!excludeDotfiles || !dirList[i].getName().startsWith(".")) && !dirList[i].getName().equals(notdir)) {
resultList.add(dirList[i]);
@ -307,14 +307,14 @@ public class listManager {
* @param col a Collection of Strings.
* @return String with elements from set separated by comma.
*/
public static String collection2string(Collection col){
public static String collection2string(Collection<String> col){
StringBuffer str = new StringBuffer();
if (col != null && (col.size() > 0)) {
Iterator it = col.iterator();
str.append((String) it.next());
Iterator<String> it = col.iterator();
str.append(it.next());
while(it.hasNext()) {
str.append(",").append((String) it.next());
str.append(",").append(it.next());
}
}
@ -324,13 +324,13 @@ public class listManager {
/**
* @see listManager#string2vector(String)
*/
public static ArrayList string2arraylist(String string){
ArrayList l;
public static ArrayList<String> string2arraylist(String string){
ArrayList<String> l;
if (string != null) {
l = new ArrayList(Arrays.asList(string.split(",")));
l = new ArrayList<String>(Arrays.asList(string.split(",")));
} else {
l = new ArrayList();
l = new ArrayList<String>();
}
return l;
@ -342,13 +342,13 @@ public class listManager {
* @param string list of comma separated Strings
* @return resulting Set or empty Set if string is <code>null</code>
*/
public static Set string2set(String string){
HashSet set;
public static Set<String> string2set(String string){
HashSet<String> set;
if (string != null) {
set = new HashSet(Arrays.asList(string.split(",")));
set = new HashSet<String>(Arrays.asList(string.split(",")));
} else {
set = new HashSet();
set = new HashSet<String>();
}
return set;
@ -361,13 +361,13 @@ public class listManager {
* @param string list of comma separated Strings
* @return resulting Vector or empty Vector if string is <code>null</code>
*/
public static Vector string2vector(String string){
Vector v;
public static Vector<String> string2vector(String string){
Vector<String> v;
if (string != null) {
v = new Vector(Arrays.asList(string.split(",")));
v = new Vector<String>(Arrays.asList(string.split(",")));
} else {
v = new Vector();
v = new Vector<String>();
}
return v;
@ -382,7 +382,7 @@ public class listManager {
String supportedBlacklistTypesStr = abstractURLPattern.BLACKLIST_TYPES_STRING;
String[] supportedBlacklistTypes = supportedBlacklistTypesStr.split(",");
ArrayList blacklistFiles = new ArrayList(supportedBlacklistTypes.length);
ArrayList<blacklistFile> blacklistFiles = new ArrayList<blacklistFile>(supportedBlacklistTypes.length);
for (int i=0; i < supportedBlacklistTypes.length; i++) {
blacklistFile blFile = new blacklistFile(
switchboard.getConfig(
@ -393,7 +393,7 @@ public class listManager {
plasmaSwitchboard.urlBlacklist.clear();
plasmaSwitchboard.urlBlacklist.loadList(
(blacklistFile[])blacklistFiles.toArray(new blacklistFile[blacklistFiles.size()]),
blacklistFiles.toArray(new blacklistFile[blacklistFiles.size()]),
"/");
// switchboard.urlBlacklist.clear();

View File

@ -47,7 +47,6 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.TimeZone;
import de.anomic.kelondro.kelondroBase64Order;
@ -110,13 +109,13 @@ public class messageBoard {
public class entry {
String key; // composed by category and date
Map record; // contains author, target hash, subject and message
HashMap<String, String> record; // contains author, target hash, subject and message
public entry(String category,
String authorName, String authorHash,
String recName, String recHash,
String subject, byte[] message) {
record = new HashMap();
record = new HashMap<String, String>();
key = category;
if (key.length() > categoryLength) key = key.substring(0, categoryLength);
while (key.length() < categoryLength) key += "_";
@ -138,7 +137,7 @@ public class messageBoard {
record.put("read", "false");
}
private entry(String key, Map record) {
private entry(String key, HashMap<String, String> record) {
this.key = key;
this.record = record;
}
@ -162,44 +161,44 @@ public class messageBoard {
}
public String author() {
String a = (String) record.get("author");
String a = record.get("author");
if (a == null) return "anonymous";
return a;
}
public String recipient() {
String a = (String) record.get("recipient");
String a = record.get("recipient");
if (a == null) return "anonymous";
return a;
}
public String authorHash() {
String a = (String) record.get("ahash");
String a = record.get("ahash");
if (a == null) return null;
return a;
}
public String recipientHash() {
String a = (String) record.get("rhash");
String a = record.get("rhash");
if (a == null) return null;
return a;
}
public String subject() {
String s = (String) record.get("subject");
String s = record.get("subject");
if (s == null) return "";
return s;
}
public byte[] message() {
String m = (String) record.get("message");
String m = record.get("message");
if (m == null) return new byte[0];
record.put("read", "true");
return kelondroBase64Order.enhancedCoder.decode(m, "de.anomic.data.messageBoard.message()");
}
public boolean read() {
String r = (String) record.get("read");
String r = record.get("read");
if (r == null) return false;
if (r.equals("false")) return false;
return true;
@ -217,7 +216,7 @@ public class messageBoard {
}
public entry read(String key) {
Map record = database.getMap(key);
HashMap<String, String> record = database.getMap(key);
return new entry(key, record);
}
@ -228,14 +227,14 @@ public class messageBoard {
}
}
public Iterator keys(String category, boolean up) throws IOException {
public Iterator<String> keys(String category, boolean up) throws IOException {
//return database.keys();
return new catIter(category, up);
}
public class catIter implements Iterator {
public class catIter implements Iterator<String> {
Iterator allIter = null;
Iterator<String> allIter = null;
String nextKey = null;
String category = "";
@ -257,7 +256,7 @@ public class messageBoard {
return nextKey != null;
}
public Object next() {
public String next() {
String next = nextKey;
findNext();
return next;

View File

@ -110,6 +110,7 @@ public final class robotsParser{
}
}
@SuppressWarnings("unchecked")
public static Object[] parse(byte[] robotsTxt) throws IOException {
if ((robotsTxt == null)||(robotsTxt.length == 0)) return new Object[]{new ArrayList(0),null,null};
ByteArrayInputStream bin = new ByteArrayInputStream(robotsTxt);
@ -118,8 +119,8 @@ public final class robotsParser{
}
public static Object[] parse(BufferedReader reader) throws IOException{
ArrayList deny4AllAgents = new ArrayList();
ArrayList deny4YaCyAgent = new ArrayList();
ArrayList<String> deny4AllAgents = new ArrayList<String>();
ArrayList<String> deny4YaCyAgent = new ArrayList<String>();
int pos;
String line = null, lineUpper = null, sitemap = null;
@ -223,7 +224,7 @@ public final class robotsParser{
}
}
ArrayList denyList = (rule4YaCyFound)?deny4YaCyAgent:deny4AllAgents;
ArrayList<String> denyList = (rule4YaCyFound) ? deny4YaCyAgent : deny4AllAgents;
return new Object[]{denyList,sitemap,crawlDelay};
}
@ -292,6 +293,7 @@ public final class robotsParser{
return crawlDelay;
}
@SuppressWarnings("unchecked")
public static boolean isDisallowed(yacyURL nexturl) {
if (nexturl == null) throw new IllegalArgumentException();
@ -341,17 +343,17 @@ public final class robotsParser{
}
if ((robotsTxt4Host==null)||((robotsTxt4Host!=null)&&(result!=null))) {
ArrayList denyPath = null;
ArrayList<String> denyPath = null;
String sitemap = null;
Integer crawlDelay = null;
if (accessCompletelyRestricted) {
denyPath = new ArrayList();
denyPath = new ArrayList<String>();
denyPath.add("/");
} else {
// parsing the robots.txt Data and converting it into an arraylist
try {
Object[] parserResult = robotsParser.parse(robotsTxt);
denyPath = (ArrayList) parserResult[0];
denyPath = (ArrayList<String>) parserResult[0];
sitemap = (String) parserResult[1];
crawlDelay = (Integer) parserResult[2];
} catch (IOException e) {

View File

@ -77,18 +77,18 @@ import de.anomic.tools.yFormatter;
* Uses a Property like file with phrases or single words to translate a string or a file
* */
public class translator {
public static String translate(String source, Hashtable translationList){
Enumeration keys = translationList.keys();
public static String translate(String source, Hashtable<String, String> translationList){
Enumeration<String> keys = translationList.keys();
String result = source;
String key = "";
while(keys.hasMoreElements()){
key = (String)keys.nextElement();
key = keys.nextElement();
Pattern pattern = Pattern.compile(key);
Matcher matcher = pattern.matcher(result);
if(matcher.find()){
result = matcher.replaceAll((String)translationList.get(key));
}else{
//Filename not availible, but it will be printed in Log
if (matcher.find()) {
result = matcher.replaceAll(translationList.get(key));
} else {
//Filename not available, but it will be printed in Log
//after all untranslated Strings as "Translated file: "
serverLog.logFine("TRANSLATOR", "Unused String: "+key);
}
@ -100,12 +100,12 @@ public class translator {
* @param translationFile the File, which contains the Lists
* @return a Hashtable, which contains for each File a Hashtable with translations.
*/
public static Hashtable loadTranslationsLists(File translationFile){
Hashtable lists = new Hashtable(); //list of translationLists for different files.
Hashtable translationList = new Hashtable(); //current Translation Table
public static Hashtable<String, Hashtable<String, String>> loadTranslationsLists(File translationFile){
Hashtable<String, Hashtable<String, String>> lists = new Hashtable<String, Hashtable<String, String>>(); //list of translationLists for different files.
Hashtable<String, String> translationList = new Hashtable<String, String>(); //current Translation Table
ArrayList list = listManager.getListArray(translationFile);
Iterator it = list.iterator();
ArrayList<String> list = listManager.getListArray(translationFile);
Iterator<String> it = list.iterator();
String line = "";
String[] splitted;
String forFile="";
@ -128,9 +128,9 @@ public class translator {
forFile=line.substring(6);
}
if(lists.containsKey(forFile)){
translationList=(Hashtable) lists.get(forFile);
translationList=lists.get(forFile);
}else{
translationList=new Hashtable();
translationList=new Hashtable<String, String>();
}
}
}
@ -139,11 +139,11 @@ public class translator {
}
public static boolean translateFile(File sourceFile, File destFile, File translationFile){
Hashtable translationList = (Hashtable)loadTranslationsLists(translationFile).get(sourceFile.getName());
Hashtable<String, String> translationList = loadTranslationsLists(translationFile).get(sourceFile.getName());
return translateFile(sourceFile, destFile, translationList);
}
public static boolean translateFile(File sourceFile, File destFile, Hashtable translationList){
public static boolean translateFile(File sourceFile, File destFile, Hashtable<String, String> translationList){
String content = "";
String line = "";
@ -176,16 +176,16 @@ public class translator {
}
public static boolean translateFiles(File sourceDir, File destDir, File baseDir, File translationFile, String extensions){
Hashtable translationLists = loadTranslationsLists(translationFile);
Hashtable<String, Hashtable<String, String>> translationLists = loadTranslationsLists(translationFile);
return translateFiles(sourceDir, destDir, baseDir, translationLists, extensions);
}
public static boolean translateFiles(File sourceDir, File destDir, File baseDir, Hashtable translationLists, String extensions){
public static boolean translateFiles(File sourceDir, File destDir, File baseDir, Hashtable<String, Hashtable<String, String>> translationLists, String extensions){
destDir.mkdirs();
File[] sourceFiles = sourceDir.listFiles();
Vector exts=listManager.string2vector(extensions);
Vector<String> exts=listManager.string2vector(extensions);
boolean rightExtension;
Iterator it;
Iterator<String> it;
String relativePath;
for(int i=0;i<sourceFiles.length;i++){
it=exts.iterator();
@ -209,7 +209,7 @@ public class translator {
if(!translateFile(
sourceFiles[i]
, new File(destDir, sourceFiles[i].getName().replace('/', File.separatorChar))
, (Hashtable)translationLists.get(relativePath))){
, translationLists.get(relativePath))){
serverLog.logSevere("TRANSLATOR", "File error while translating file "+relativePath);
}
}else{
@ -222,13 +222,13 @@ public class translator {
}
public static boolean translateFilesRecursive(File sourceDir, File destDir, File translationFile, String extensions, String notdir){
ArrayList dirList=listManager.getDirsRecursive(sourceDir, notdir);
ArrayList<File> dirList=listManager.getDirsRecursive(sourceDir, notdir);
dirList.add(sourceDir);
Iterator it=dirList.iterator();
Iterator<File> it=dirList.iterator();
File file=null;
File file2=null;
while(it.hasNext()){
file=(File)it.next();
file=it.next();
//cuts the sourcePath and prepends the destPath
file2=new File(destDir, file.getPath().substring(sourceDir.getPath().length()));
if(file.isDirectory() && !file.getName().equals(notdir)){
@ -238,9 +238,9 @@ public class translator {
return true;
}
public static HashMap langMap(serverSwitch env) {
public static HashMap<String, String> langMap(serverSwitch env) {
String[] ms = env.getConfig("locale.lang", "").split(",");
HashMap map = new HashMap();
HashMap<String, String> map = new HashMap<String, String>();
int p;
for (int i = 0; i < ms.length; i++) {
p = ms[i].indexOf("/");

View File

@ -71,8 +71,8 @@ public final class userDB {
kelondroMapObjects userTable;
private final File userTableFile;
private long preloadTime;
private HashMap ipUsers = new HashMap();
private HashMap cookieUsers = new HashMap();
private HashMap<String, String> ipUsers = new HashMap<String, String>();
private HashMap<String, Object> cookieUsers = new HashMap<String, Object>();
public userDB(File userTableFile, long preloadTime) {
this.userTableFile = userTableFile;
@ -107,12 +107,12 @@ public final class userDB {
if(userName.length()>128){
userName=userName.substring(0, 127);
}
Map record = userTable.getMap(userName);
HashMap<String, String> record = userTable.getMap(userName);
if (record == null) return null;
return new Entry(userName, record);
}
public Entry createEntry(String userName, HashMap userProps) throws IllegalArgumentException{
public Entry createEntry(String userName, HashMap<String, String> userProps) throws IllegalArgumentException{
Entry entry = new Entry(userName,userProps);
return entry;
}
@ -200,7 +200,7 @@ public final class userDB {
*/
public Entry ipAuth(String ip) {
if(this.ipUsers.containsKey(ip)){
String user=(String)this.ipUsers.get(ip);
String user=this.ipUsers.get(ip);
Entry entry=this.getEntry(user);
Long entryTimestamp=entry.getLastAccess();
if(entryTimestamp == null || (System.currentTimeMillis()-entryTimestamp.longValue()) > (1000*60*10) ){ //no timestamp or older than 10 Minutes
@ -327,11 +327,11 @@ public final class userDB {
public static final int PROXY_TIMELIMIT_REACHED = 3;
// this is a simple record structure that hold all properties of a user
private Map mem;
private HashMap<String, String> mem;
private String userName;
private Calendar oldDate, newDate;
public Entry(String userName, Map mem) throws IllegalArgumentException {
public Entry(String userName, HashMap<String, String> mem) throws IllegalArgumentException {
if ((userName == null) || (userName.length() == 0))
throw new IllegalArgumentException("Username needed.");
if(userName.length()>128){
@ -342,7 +342,7 @@ public final class userDB {
if (this.userName.length() < USERNAME_MIN_LENGTH)
throw new IllegalArgumentException("Username to short. Length should be >= " + USERNAME_MIN_LENGTH);
if (mem == null) this.mem = new HashMap();
if (mem == null) this.mem = new HashMap<String, String>();
else this.mem = mem;
if (!mem.containsKey(AUTHENTICATION_METHOD))this.mem.put(AUTHENTICATION_METHOD,"yacy");
@ -355,21 +355,21 @@ public final class userDB {
}
public String getFirstName() {
return (this.mem.containsKey(USER_FIRSTNAME)?(String)this.mem.get(USER_FIRSTNAME):null);
return (this.mem.containsKey(USER_FIRSTNAME)?this.mem.get(USER_FIRSTNAME):null);
}
public String getLastName() {
return (this.mem.containsKey(USER_LASTNAME)?(String)this.mem.get(USER_LASTNAME):null);
return (this.mem.containsKey(USER_LASTNAME)?this.mem.get(USER_LASTNAME):null);
}
public String getAddress() {
return (this.mem.containsKey(USER_ADDRESS)?(String)this.mem.get(USER_ADDRESS):null);
return (this.mem.containsKey(USER_ADDRESS)?this.mem.get(USER_ADDRESS):null);
}
public long getTimeUsed() {
if (this.mem.containsKey(TIME_USED)) {
try{
return Long.valueOf((String)this.mem.get(TIME_USED)).longValue();
return Long.valueOf(this.mem.get(TIME_USED)).longValue();
}catch(NumberFormatException e){
return 0;
}
@ -383,7 +383,7 @@ public final class userDB {
public long getTimeLimit() {
if (this.mem.containsKey(TIME_LIMIT)) {
try{
return Long.valueOf((String)this.mem.get(TIME_LIMIT)).longValue();
return Long.valueOf(this.mem.get(TIME_LIMIT)).longValue();
}catch(NumberFormatException e){
return 0;
}
@ -396,7 +396,7 @@ public final class userDB {
public long getTrafficSize() {
if (this.mem.containsKey(TRAFFIC_SIZE)) {
return Long.valueOf((String)this.mem.get(TRAFFIC_SIZE)).longValue();
return Long.valueOf(this.mem.get(TRAFFIC_SIZE)).longValue();
}
try {
this.setProperty(TRAFFIC_SIZE,"0");
@ -407,7 +407,7 @@ public final class userDB {
}
public Long getTrafficLimit() {
return (this.mem.containsKey(TRAFFIC_LIMIT)?Long.valueOf((String)this.mem.get(TRAFFIC_LIMIT)):null);
return (this.mem.containsKey(TRAFFIC_LIMIT)?Long.valueOf(this.mem.get(TRAFFIC_LIMIT)):null);
}
public long updateTrafficSize(long responseSize) {
@ -424,7 +424,7 @@ public final class userDB {
}
public Long getLastAccess() {
return (this.mem.containsKey(LAST_ACCESS)?Long.valueOf((String)this.mem.get(LAST_ACCESS)):null);
return (this.mem.containsKey(LAST_ACCESS)?Long.valueOf(this.mem.get(LAST_ACCESS)):null);
}
public int surfRight(){
@ -484,10 +484,10 @@ public final class userDB {
}
public String getMD5EncodedUserPwd() {
return (this.mem.containsKey(MD5ENCODED_USERPWD_STRING)?(String)this.mem.get(MD5ENCODED_USERPWD_STRING):null);
return (this.mem.containsKey(MD5ENCODED_USERPWD_STRING)?this.mem.get(MD5ENCODED_USERPWD_STRING):null);
}
public Map getProperties() {
public Map<String, String> getProperties() {
return this.mem;
}
@ -497,10 +497,10 @@ public final class userDB {
}
public String getProperty(String propName, String defaultValue) {
return (this.mem.containsKey(propName)?(String)this.mem.get(propName):defaultValue);
return (this.mem.containsKey(propName)?this.mem.get(propName):defaultValue);
}
public boolean hasRight(String rightName){
return (this.mem.containsKey(rightName)?((String)this.mem.get(rightName)).equals("true"):false);
return (this.mem.containsKey(rightName)?this.mem.get(rightName).equals("true"):false);
}
/**
* @deprecated use hasRight(UPLOAD_RIGHT) instead
@ -545,7 +545,7 @@ public final class userDB {
return this.hasRight(BOOKMARK_RIGHT);
}
public boolean isLoggedOut(){
return (this.mem.containsKey(LOGGED_OUT)?((String)this.mem.get(LOGGED_OUT)).equals("true"):false);
return (this.mem.containsKey(LOGGED_OUT)?this.mem.get(LOGGED_OUT).equals("true"):false);
}
public void logout(String ip, String logintoken){
logout(ip);
@ -578,19 +578,19 @@ public final class userDB {
}
public Iterator iterator(boolean up) {
public Iterator<Entry> iterator(boolean up) {
// enumerates users
try {
return new userIterator(up);
} catch (IOException e) {
return new HashSet().iterator();
return new HashSet<Entry>().iterator();
}
}
public class userIterator implements Iterator {
public class userIterator implements Iterator<Entry> {
// the iterator iterates all userNames
kelondroCloneableIterator userIter;
kelondroCloneableIterator<String> userIter;
userDB.Entry nextEntry;
public userIterator(boolean up) throws IOException {
@ -605,7 +605,7 @@ public final class userDB {
return false;
}
}
public Object next() {
public Entry next() {
try {
return getEntry((String) this.userIter.next());
} catch (kelondroException e) {

View File

@ -47,7 +47,6 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.TimeZone;
import de.anomic.kelondro.kelondroBase64Order;
@ -69,7 +68,7 @@ public class wikiBoard {
private kelondroMapObjects datbase = null;
private kelondroMapObjects bkpbase = null;
private static HashMap authors = new HashMap();
private static HashMap<String, String> authors = new HashMap<String, String>();
public wikiBoard(File actpath, File bkppath, long preloadTime) {
new File(actpath.getParent()).mkdirs();
@ -120,7 +119,7 @@ public class wikiBoard {
}
public static String guessAuthor(String ip) {
String author = (String) authors.get(ip);
String author = authors.get(ip);
//yacyCore.log.logDebug("DEBUG: guessing author for ip = " + ip + " is '" + author + "', authors = " + authors.toString());
return author;
}
@ -136,10 +135,10 @@ public class wikiBoard {
public class entry {
String key;
Map record;
HashMap<String, String> record;
public entry(String subject, String author, String ip, String reason, byte[] page) throws IOException {
record = new HashMap();
record = new HashMap<String, String>();
key = subject;
if (key.length() > keyLength) key = key.substring(0, keyLength);
record.put("date", dateString());
@ -157,7 +156,7 @@ public class wikiBoard {
//System.out.println("DEBUG: setting author " + author + " for ip = " + ip + ", authors = " + authors.toString());
}
private entry(String key, Map record) {
private entry(String key, HashMap<String, String> record) {
this.key = key;
this.record = record;
}
@ -168,7 +167,7 @@ public class wikiBoard {
public Date date() {
try {
String c = (String) record.get("date");
String c = record.get("date");
if (c == null) {
System.out.println("DEBUG - ERROR: date field missing in wikiBoard");
return new Date();
@ -182,7 +181,7 @@ public class wikiBoard {
}
public String author() {
String a = (String) record.get("author");
String a = record.get("author");
if (a == null) return "anonymous";
byte[] b = kelondroBase64Order.enhancedCoder.decode(a, "de.anomic.data.wikiBoard.author()");
if (b == null) return "anonymous";
@ -190,7 +189,7 @@ public class wikiBoard {
}
public String reason() {
String r = (String) record.get("reason");
String r = record.get("reason");
if (r == null) return "";
byte[] b = kelondroBase64Order.enhancedCoder.decode(r, "de.anomic.data.wikiBoard.reason()");
if (b == null) return "unknown";
@ -198,7 +197,7 @@ public class wikiBoard {
}
public byte[] page() {
String m = (String) record.get("page");
String m = record.get("page");
if (m == null) return new byte[0];
byte[] b = kelondroBase64Order.enhancedCoder.decode(m, "de.anomic.data.wikiBoard.page()");
if (b == null) return "".getBytes();
@ -211,7 +210,7 @@ public class wikiBoard {
private Date getAncestorDate() {
try {
String c = (String) record.get("date");
String c = record.get("date");
if (c == null) return null;
synchronized (SimpleFormatter) {
return SimpleFormatter.parse(c);
@ -244,7 +243,7 @@ public class wikiBoard {
}
private String getChildName() {
String c = (String) record.get("child");
String c = record.get("child");
if (c == null) return null;
byte[] subject = kelondroBase64Order.enhancedCoder.decode(c, "de.anomic.data.wikiBoard.getChildName()");
if (subject == null) return null;
@ -252,7 +251,7 @@ public class wikiBoard {
}
public boolean hasChild() {
String c = (String) record.get("child");
String c = record.get("child");
if (c == null) return false;
byte[] subject = kelondroBase64Order.enhancedCoder.decode(c, "de.anomic.data.wikiBoard.hasChild()");
return (subject != null);
@ -295,7 +294,7 @@ public class wikiBoard {
try {
key = normalize(key);
if (key.length() > keyLength) key = key.substring(0, keyLength);
Map record = base.getMap(key);
HashMap<String, String> record = base.getMap(key);
if (record == null) return newEntry(key, "anonymous", "127.0.0.1", "New Page", "".getBytes());
return new entry(key, record);
} catch (IOException e) {
@ -317,11 +316,11 @@ public class wikiBoard {
}
*/
public Iterator keys(boolean up) throws IOException {
public Iterator<String> keys(boolean up) throws IOException {
return datbase.keys(up, false);
}
public Iterator keysBkp(boolean up) throws IOException {
public Iterator<String> keysBkp(boolean up) throws IOException {
return bkpbase.keys(up, false);
}
}

View File

@ -64,7 +64,7 @@ public class wikiCode extends abstractWikiParser implements wikiParser {
/* Table properties */
private static final String[] tps = { "rowspan", "colspan", "vspace", "hspace", "cellspacing", "cellpadding", "border" };
private static final HashMap/* <String,String[]> */ ps = new HashMap();
private static final HashMap/* <String,String[]> */<String, String[]> ps = new HashMap<String, String[]>();
static {
Arrays.sort(tps);
String[] array;
@ -95,7 +95,7 @@ public class wikiCode extends abstractWikiParser implements wikiParser {
private int preindented = 0; //needed for indented <pre>s
private int escindented = 0; //needed for indented [=s
private int headlines = 0; //number of headlines in page
private ArrayList dirElements = new ArrayList(); //list of headlines used to create diectory of page
private ArrayList<String> dirElements = new ArrayList<String>(); //list of headlines used to create diectory of page
/** Constructor of the class wikiCode */
public wikiCode(plasmaSwitchboard switchboard){
@ -221,7 +221,7 @@ public class wikiCode extends abstractWikiParser implements wikiParser {
(key.equals("summary")) ||
(key.equals("bgcolor") && value.matches("#{0,1}[0-9a-fA-F]{1,6}|[a-zA-Z]{3,}")) ||
((key.equals("width") || key.equals("height")) && value.matches("\\d+%{0,1}")) ||
((posVals = (String[])ps.get(key)) != null && Arrays.binarySearch(posVals, value) >= 0) ||
((posVals = ps.get(key)) != null && Arrays.binarySearch(posVals, value) >= 0) ||
(Arrays.binarySearch(tps, key) >= 0 && value.matches("\\d+"))
) {
addPair(key, value, sb);

View File

@ -265,7 +265,7 @@ public final class httpHeader extends TreeMap<String, String> implements Map<Str
}
public httpHeader(HashMap<String, String> reverseMappingCache) {
// this creates a new TreeMap with a case insesitive mapping
// this creates a new TreeMap with a case insensitive mapping
// to provide a put-method that translates given keys into their
// 'proper' appearance, a translation cache is needed.
// upon instantiation, such a mapping cache can be handed over

View File

@ -59,7 +59,6 @@ import java.io.PushbackInputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import de.anomic.server.serverByteBuffer;
@ -229,14 +228,14 @@ public final class httpTemplate {
return false;
}
public static void writeTemplate(InputStream in, OutputStream out, Hashtable<String, String> pattern, byte[] dflt) throws IOException {
public static void writeTemplate(InputStream in, OutputStream out, HashMap<String, String> pattern, byte[] dflt) throws IOException {
writeTemplate(in, out, pattern, dflt, new byte[0]);
}
/**
* Reads a input stream, and writes the data with replaced templates on a output stream
*/
public static byte[] writeTemplate(InputStream in, OutputStream out, Hashtable<String, String> pattern, byte[] dflt, byte[] prefix) throws IOException {
public static byte[] writeTemplate(InputStream in, OutputStream out, HashMap<String, String> pattern, byte[] dflt, byte[] prefix) throws IOException {
PushbackInputStream pis = new PushbackInputStream(in, 100);
ByteArrayOutputStream keyStream;
byte[] key;
@ -487,7 +486,7 @@ public final class httpTemplate {
return structure.getBytes();
}
public static byte[] replacePattern(String key, Hashtable<String, String> pattern, byte dflt[]) {
public static byte[] replacePattern(String key, HashMap<String, String> pattern, byte dflt[]) {
byte[] replacement;
Object value;
if (pattern.containsKey(key)) {
@ -515,7 +514,7 @@ public final class httpTemplate {
// arg1 = test input; arg2 = replacement for pattern 'test'; arg3 = default replacement
try {
InputStream i = new ByteArrayInputStream(args[0].getBytes());
Hashtable<String, String> h = new Hashtable<String, String>();
HashMap<String, String> h = new HashMap<String, String>();
h.put("test", args[1]);
writeTemplate(new PushbackInputStream(i, 100), System.out, h, args[2].getBytes());
System.out.flush();

View File

@ -61,7 +61,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@ -835,13 +834,13 @@ public final class httpc {
if (args.size() != 0) {
// we have values for the POST, start with one boundary
String key, value;
Enumeration<String> e = args.keys();
while (e.hasMoreElements()) {
Iterator<String> e = args.keySet().iterator();
while (e.hasNext()) {
// start with a boundary
out.write(boundary.getBytes("UTF-8"));
out.write(serverCore.CRLF);
// write value
key = (String) e.nextElement();
key = e.next();
value = args.get(key, "");
if ((files != null) && (files.containsKey(key))) {
// we are about to write a file

View File

@ -90,7 +90,6 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URLDecoder;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@ -394,10 +393,10 @@ public final class httpdFileHandler {
// check for cross site scripting - attacks in request arguments
if (argc > 0) {
// check all values for occurrences of script values
Enumeration<String> e = args.elements(); // enumeration of values
Iterator<String> e = args.values().iterator(); // enumeration of values
String val;
while (e.hasMoreElements()) {
val = e.nextElement();
while (e.hasNext()) {
val = e.next();
if ((val != null) && (val.indexOf("<script") >= 0)) {
// deny request
httpd.sendRespondError(conProp,out,4,403,null,"bad post values",null);

View File

@ -49,9 +49,9 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
import de.anomic.server.serverByteBuffer;
@ -213,11 +213,11 @@ abstract class kelondroAbstractRA implements kelondroRA {
write(bb.getBytes());
}
public Map<String, String> readMap() throws IOException {
public HashMap<String, String> readMap() throws IOException {
this.seek(0);
byte[] b = readFully();
BufferedReader br = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(b)));
final TreeMap<String, String> map = new TreeMap<String, String>();
final HashMap<String, String> map = new HashMap<String, String>();
String line;
int pos;
while ((line = br.readLine()) != null) { // very slow readLine????

View File

@ -172,7 +172,7 @@ public class kelondroMapObjects extends kelondroObjects {
this.elementCount = 0;
}
public synchronized void set(String key, Map<String, String> newMap) throws IOException {
public synchronized void set(String key, HashMap<String, String> newMap) throws IOException {
assert (key != null);
assert (key.length() > 0);
assert (newMap != null);
@ -267,7 +267,7 @@ public class kelondroMapObjects extends kelondroObjects {
super.remove(key);
}
public Map<String, String> getMap(String key) {
public HashMap<String, String> getMap(String key) {
try {
kelondroObjectsMapEntry mapEntry = (kelondroObjectsMapEntry) super.get(key);
if (mapEntry == null) return null;
@ -347,7 +347,7 @@ public class kelondroMapObjects extends kelondroObjects {
super.close();
}
public class mapIterator implements Iterator<Map<String, String>> {
public class mapIterator implements Iterator<HashMap<String, String>> {
// enumerates Map-Type elements
// the key is also included in every map that is returned; it's key is 'key'
@ -363,9 +363,9 @@ public class kelondroMapObjects extends kelondroObjects {
return (!(finish)) && (keyIterator != null) && (keyIterator.hasNext());
}
public Map<String, String> next() {
public HashMap<String, String> next() {
String nextKey;
Map<String, String> map;
HashMap<String, String> map;
while (keyIterator.hasNext()) {
nextKey = keyIterator.next();
if (nextKey == null) {

View File

@ -97,7 +97,7 @@ public class kelondroMapTable {
tTables.put(tablename, Tree);
}
public synchronized void update(String tablename, String key, Map<String, String> map) throws IOException {
public synchronized void update(String tablename, String key, HashMap<String, String> map) throws IOException {
kelondroMapObjects table = (kelondroMapObjects) mTables.get(tablename);
if (table == null) throw new RuntimeException("kelondroTables.update: map table '" + tablename + "' does not exist.");
if (key.length() > table.keySize()) key = key.substring(0, table.keySize());

View File

@ -29,17 +29,16 @@ package de.anomic.kelondro;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class kelondroObjectsMapEntry implements kelondroObjectsEntry {
protected Map<String, String> entry;
protected HashMap<String, String> entry;
public kelondroObjectsMapEntry() {
this.entry = new HashMap<String, String>();
}
public kelondroObjectsMapEntry(Map<String, String> map) {
public kelondroObjectsMapEntry(HashMap<String, String> map) {
this.entry = map;
}
@ -63,7 +62,7 @@ public class kelondroObjectsMapEntry implements kelondroObjectsEntry {
}
}
public Map<String, String> map() {
public HashMap<String, String> map() {
return this.entry;
}

View File

@ -51,6 +51,7 @@
package de.anomic.kelondro;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public interface kelondroRA {
@ -92,7 +93,7 @@ public interface kelondroRA {
public String readLine() throws IOException;
public void writeMap(Map<String, String> props, String comment) throws IOException;
public Map<String, String> readMap() throws IOException;
public HashMap<String, String> readMap() throws IOException;
public void writeArray(byte[] b) throws IOException;
public byte[] readArray() throws IOException;

View File

@ -49,7 +49,7 @@
package de.anomic.plasma.cache;
import java.util.Date;
import java.util.Map;
import java.util.TreeMap;
import de.anomic.yacy.yacyURL;
@ -61,7 +61,7 @@ public interface IResourceInfo {
/**
* @return the resource information
*/
public Map<String, String> getMap();
public TreeMap<String, String> getMap();
/**
* @return the URL of this content

View File

@ -47,8 +47,8 @@
package de.anomic.plasma.cache.ftp;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import de.anomic.plasma.cache.IResourceInfo;
import de.anomic.plasma.cache.ResourceInfoFactory;
@ -60,7 +60,7 @@ public class ResourceInfo implements IResourceInfo {
public static final String MODIFICATION_DATE = "modificationDate";
private yacyURL objectURL, refererURL;
private HashMap<String, String> propertyMap;
private TreeMap<String, String> propertyMap;
/**
* Constructor used by the {@link ResourceInfoFactory}
@ -76,7 +76,7 @@ public class ResourceInfo implements IResourceInfo {
this.refererURL = null;
// create the http header object
this.propertyMap = new HashMap<String, String>(objectInfo);
this.propertyMap = new TreeMap<String, String>(objectInfo);
}
public ResourceInfo(yacyURL objectURL, yacyURL refererUrl, String mimeType, Date fileDate) {
@ -86,7 +86,7 @@ public class ResourceInfo implements IResourceInfo {
this.objectURL = objectURL;
// create the http header object
this.propertyMap = new HashMap<String, String>();
this.propertyMap = new TreeMap<String, String>();
if (refererUrl != null)
this.refererURL = refererUrl;
if (mimeType != null)
@ -95,7 +95,7 @@ public class ResourceInfo implements IResourceInfo {
this.propertyMap.put(MODIFICATION_DATE, Long.toString(fileDate.getTime()));
}
public Map<String, String> getMap() {
public TreeMap<String, String> getMap() {
return this.propertyMap;
}

View File

@ -50,6 +50,7 @@ package de.anomic.plasma.cache.http;
import java.util.Date;
import java.util.Map;
import java.util.TreeMap;
import de.anomic.http.httpHeader;
import de.anomic.plasma.plasmaHTCache;
@ -90,7 +91,7 @@ public class ResourceInfo implements IResourceInfo {
this.responseHeader = responseHeaders;
}
public Map<String, String> getMap() {
public TreeMap<String, String> getMap() {
return this.responseHeader;
}

View File

@ -37,7 +37,7 @@ public abstract class AbstractImporter extends Thread implements dbImporter{
/**
* @see dbImporter#init(HashMap)
*/
public void init(HashMap initparams) throws ImporterException {
public void init(HashMap<String, String> initparams) throws ImporterException {
// initializing the logger and setting a more verbose thread name
this.log = new serverLog("IMPORT_" + this.jobType + "_" + this.jobID);
this.setName("IMPORT_" + this.jobType + "_" + this.jobID);

View File

@ -101,7 +101,7 @@ public class SitemapImporter extends AbstractImporter implements dbImporter {
* @see dbImporter#init(HashMap)
* @see AbstractImporter#init(HashMap)
*/
public void init(HashMap initParams) throws ImporterException {
public void init(HashMap<String, String> initParams) throws ImporterException {
super.init(initParams);
if (initParams == null || initParams.size() == 0) throw new IllegalArgumentException("Init parameters are missing");

View File

@ -7,7 +7,7 @@ import de.anomic.server.logging.serverLog;
public class dbImportManager {
public final Vector finishedJobs = new Vector();
public final Vector<dbImporter> finishedJobs = new Vector<dbImporter>();
public final ThreadGroup runningJobs = new ThreadGroup("ImporterThreads");
public int currMaxJobNr = 0;
private plasmaSwitchboard sb;

View File

@ -25,6 +25,6 @@ public interface dbImporter {
public String getError();
public String getStatus();
//public void init(File plasmaPath, File indexPrimaryPath, File indexSecondaryPath, int cacheSize, long preloadTime);
public void init(HashMap initParams) throws ImporterException;
public void init(HashMap<String, String> initParams) throws ImporterException;
public void startIt();
}

View File

@ -5,7 +5,6 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.TreeMap;
import de.anomic.plasma.plasmaCrawlEntry;
import de.anomic.plasma.plasmaCrawlNURL;
@ -47,7 +46,7 @@ public class plasmaCrawlNURLImporter extends AbstractImporter implements dbImpor
return theStatus.toString();
}
public void init(HashMap initParams) throws ImporterException {
public void init(HashMap<String, String> initParams) throws ImporterException {
super.init(initParams);
if (initParams == null || initParams.size() == 0) throw new IllegalArgumentException("Init parameters are missing");
@ -110,6 +109,7 @@ public class plasmaCrawlNURLImporter extends AbstractImporter implements dbImpor
this.importProfileDB = new plasmaCrawlProfile(profileDbFile, 300);
}
@SuppressWarnings("unchecked")
public void run() {
try {
// waiting on init thread to finish
@ -178,7 +178,7 @@ public class plasmaCrawlNURLImporter extends AbstractImporter implements dbImpor
if (sourceEntry != null) {
this.profileCount++;
this.importProfileHandleCache.add(profileHandle);
this.sb.profilesActiveCrawls.newEntry((TreeMap)((TreeMap)sourceEntry.map()).clone());
this.sb.profilesActiveCrawls.newEntry((HashMap<String, String>) sourceEntry.map().clone());
} else {
this.log.logWarning("Profile '" + profileHandle + "' of url entry '" + nextHash + "' unknown.");
continue;

View File

@ -8,8 +8,8 @@ import java.util.TreeSet;
import de.anomic.index.indexContainer;
import de.anomic.index.indexRWIEntry;
import de.anomic.index.indexRWIRowEntry;
import de.anomic.index.indexURLEntry;
import de.anomic.kelondro.kelondroNaturalOrder;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.plasma.plasmaWordIndex;
import de.anomic.server.serverDate;
@ -69,7 +69,7 @@ public class plasmaDbImporter extends AbstractImporter implements dbImporter {
* @throws ImporterException
* @see dbImporter#init(HashMap)
*/
public void init(HashMap initParams) throws ImporterException {
public void init(HashMap<String, String> initParams) throws ImporterException {
super.init(initParams);
if (initParams == null || initParams.size() == 0) throw new IllegalArgumentException("Init parameters are missing");
@ -147,15 +147,15 @@ public class plasmaDbImporter extends AbstractImporter implements dbImporter {
this.log.logInfo("Home word index contains " + homeWordIndex.size() + " words and " + homeWordIndex.loadedURL.size() + " URLs.");
this.log.logInfo("Import word index contains " + this.importWordIndex.size() + " words and " + this.importWordIndex.loadedURL.size() + " URLs.");
HashSet unknownUrlBuffer = new HashSet();
HashSet importedUrlBuffer = new HashSet();
HashSet<String> unknownUrlBuffer = new HashSet<String>();
HashSet<String> importedUrlBuffer = new HashSet<String>();
// iterate over all words from import db
//Iterator importWordHashIterator = this.importWordIndex.wordHashes(this.wordChunkStartHash, plasmaWordIndex.RL_WORDFILES, false);
Iterator indexContainerIterator = this.importWordIndex.indexContainerSet(this.wordChunkStartHash, false, false, 100).iterator();
Iterator<indexContainer> indexContainerIterator = this.importWordIndex.indexContainerSet(this.wordChunkStartHash, false, false, 100).iterator();
while (!isAborted() && indexContainerIterator.hasNext()) {
TreeSet entityUrls = new TreeSet(new kelondroNaturalOrder(true));
TreeSet<String> entityUrls = new TreeSet<String>();
indexContainer newContainer = null;
try {
this.wordCounter++;
@ -164,7 +164,7 @@ public class plasmaDbImporter extends AbstractImporter implements dbImporter {
// loop throug the entities of the container and get the
// urlhash
Iterator importWordIdxEntries = newContainer.entries();
Iterator<indexRWIRowEntry> importWordIdxEntries = newContainer.entries();
indexRWIEntry importWordIdxEntry;
while (importWordIdxEntries.hasNext()) {
// testing if import process was aborted
@ -176,10 +176,10 @@ public class plasmaDbImporter extends AbstractImporter implements dbImporter {
entityUrls.add(urlHash);
}
Iterator urlIter = entityUrls.iterator();
Iterator<String> urlIter = entityUrls.iterator();
while (urlIter.hasNext()) {
if (isAborted()) break;
String urlHash = (String) urlIter.next();
String urlHash = urlIter.next();
if (importedUrlBuffer.contains(urlHash)) {
// already known url
@ -253,7 +253,7 @@ public class plasmaDbImporter extends AbstractImporter implements dbImporter {
if (!indexContainerIterator.hasNext()) {
// We may not be finished yet, try to get the next chunk of wordHashes
TreeSet containers = this.importWordIndex.indexContainerSet(this.wordHash, false, false, 100);
TreeSet<indexContainer> containers = this.importWordIndex.indexContainerSet(this.wordHash, false, false, 100);
indexContainerIterator = containers.iterator();
// Make sure we don't get the same wordhash twice, but don't skip a word
if ((indexContainerIterator.hasNext())&&(!this.wordHash.equals(((indexContainer) indexContainerIterator.next()).getWordHash()))) {

View File

@ -84,7 +84,7 @@ public class bzipParser extends AbstractParser implements Parser {
this.parserName = "Bzip 2 UNIX Compressed File Parser";
}
public Hashtable getSupportedMimeTypes() {
public Hashtable<String, String> getSupportedMimeTypes() {
return SUPPORTED_MIME_TYPES;
}

View File

@ -110,7 +110,7 @@ public class docParser extends AbstractParser implements Parser {
}
}
public java.util.Hashtable getSupportedMimeTypes() {
public java.util.Hashtable<String, String> getSupportedMimeTypes() {
return docParser.SUPPORTED_MIME_TYPES;
}

View File

@ -79,7 +79,7 @@ public class gzipParser extends AbstractParser implements Parser {
this.parserName = "GNU Zip Compressed Archive Parser";
}
public Hashtable getSupportedMimeTypes() {
public Hashtable<String, String> getSupportedMimeTypes() {
return SUPPORTED_MIME_TYPES;
}

View File

@ -103,6 +103,7 @@ public class mimeTypeParser extends AbstractParser implements Parser {
this.parserName = "MimeType Parser";
}
@SuppressWarnings("unchecked")
public String getMimeType (File sourceFile) {
String mimeType = null;
@ -111,9 +112,9 @@ public class mimeTypeParser extends AbstractParser implements Parser {
// if a match was found we can return the new mimeType
if (match!=null) {
Collection subMatches = match.getSubMatches();
Collection<MagicMatch> subMatches = match.getSubMatches();
if ((subMatches != null) && (!subMatches.isEmpty())) {
mimeType = ((MagicMatch) subMatches.iterator().next()).getMimeType();
mimeType = subMatches.iterator().next().getMimeType();
} else {
mimeType = match.getMimeType();
}
@ -125,6 +126,7 @@ public class mimeTypeParser extends AbstractParser implements Parser {
return null;
}
@SuppressWarnings("unchecked")
public plasmaParserDocument parse(yacyURL location, String mimeType, String charset, File sourceFile) throws ParserException, InterruptedException {
String orgMimeType = mimeType;
@ -134,7 +136,7 @@ public class mimeTypeParser extends AbstractParser implements Parser {
// adding current thread to loop detection list
Integer loopDepth = null;
if (threadLoopDetection.containsKey(Thread.currentThread())) {
loopDepth = (Integer) threadLoopDetection.get(Thread.currentThread());
loopDepth = threadLoopDetection.get(Thread.currentThread());
} else {
loopDepth = new Integer(0);
}
@ -149,9 +151,9 @@ public class mimeTypeParser extends AbstractParser implements Parser {
// if a match was found we can return the new mimeType
if (match!=null) {
Collection subMatches = match.getSubMatches();
Collection<MagicMatch> subMatches = match.getSubMatches();
if ((subMatches != null) && (!subMatches.isEmpty())) {
mimeType = ((MagicMatch) subMatches.iterator().next()).getMimeType();
mimeType = subMatches.iterator().next().getMimeType();
if ((mimeType == null)||(mimeType.length() == 0)) mimeType = match.getMimeType();
} else {
mimeType = match.getMimeType();
@ -177,7 +179,7 @@ public class mimeTypeParser extends AbstractParser implements Parser {
throw new ParserException("Unexpected error while detect mimetype of resource. " + e.getMessage(),location);
} finally {
Integer loopDepth = (Integer) threadLoopDetection.get(Thread.currentThread());
Integer loopDepth = threadLoopDetection.get(Thread.currentThread());
if (loopDepth.intValue() <= 1) {
threadLoopDetection.remove(Thread.currentThread());
} else {
@ -200,7 +202,7 @@ public class mimeTypeParser extends AbstractParser implements Parser {
}
public java.util.Hashtable getSupportedMimeTypes() {
public java.util.Hashtable<String, String> getSupportedMimeTypes() {
return mimeTypeParser.SUPPORTED_MIME_TYPES;
}

View File

@ -76,6 +76,7 @@ public class odtDetector implements MagicDetector {
return "0.1";
}
@SuppressWarnings("unchecked")
public String[] process(byte[] data, int offset, int length, long bitmask, char comparator, String mimeType, Map params) {
File dstFile = null;
try {
@ -89,6 +90,7 @@ public class odtDetector implements MagicDetector {
}
}
@SuppressWarnings("unchecked")
public String[] process(File file, int offset, int length, long bitmask, char comparator, String mimeType, Map params) {
try {
// opening the zip file

View File

@ -74,6 +74,7 @@ public class rssDetector implements MagicDetector {
return "0.1";
}
@SuppressWarnings("unchecked")
public String[] process(File file, int offset, int length, long bitmask, char comparator, String mimeType, Map params) {
FileInputStream fileInput = null;
try {
@ -86,6 +87,7 @@ public class rssDetector implements MagicDetector {
}
}
@SuppressWarnings("unchecked")
public String[] process(byte[] data, int offset, int length, long bitmask, char comparator, String mimeType, Map params) {
ByteArrayInputStream input = new ByteArrayInputStream(data);
return detect(input);

View File

@ -140,7 +140,7 @@ public class plasmaCrawlProfile {
} catch (IOException e) {}
}
public entry newEntry(Map<String, String> mem) {
public entry newEntry(HashMap<String, String> mem) {
entry ne = new entry(mem);
try {
profileTable.set(ne.handle(), ne.map());
@ -204,7 +204,7 @@ public class plasmaCrawlProfile {
}
public entry getEntry(String handle) {
Map<String, String> m = profileTable.getMap(handle);
HashMap<String, String> m = profileTable.getMap(handle);
if (m == null) return null;
return new entry(m);
}
@ -254,7 +254,7 @@ public class plasmaCrawlProfile {
public static final String XDSTOPW = "xdstopw";
public static final String XPSTOPW = "xpstopw";
private Map<String, String> mem;
private HashMap<String, String> mem;
private Map<String, DomProfile> doms;
public entry(String name, yacyURL startURL, String generalFilter, String specificFilter,
@ -301,13 +301,13 @@ public class plasmaCrawlProfile {
return str.toString();
}
public entry(Map<String, String> mem) {
public entry(HashMap<String, String> mem) {
this.mem = mem;
this.doms = (HashMap<String, DomProfile>) domsCache.get(this.mem.get(HANDLE));
if (this.doms == null) this.doms = new HashMap<String, DomProfile>();
}
public Map<String, String> map() {
public HashMap<String, String> map() {
return mem;
}
public String handle() {

View File

@ -53,7 +53,6 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
import de.anomic.kelondro.kelondroDyn;
import de.anomic.kelondro.kelondroException;
@ -103,7 +102,7 @@ public class plasmaCrawlRobotsTxt {
public Entry getEntry(String hostName) {
try {
Map<String, String> record = this.robotsTable.getMap(hostName);
HashMap<String, String> record = this.robotsTable.getMap(hostName);
if (record == null) return null;
return new Entry(hostName, record);
} catch (kelondroException e) {
@ -147,11 +146,11 @@ public class plasmaCrawlRobotsTxt {
public static final String CRAWL_DELAY = "crawlDelay";
// this is a simple record structure that hold all properties of a single crawl start
Map<String, String> mem;
HashMap<String, String> mem;
private LinkedList<String> disallowPathList;
String hostName;
public Entry(String hostName, Map<String, String> mem) {
public Entry(String hostName, HashMap<String, String> mem) {
this.hostName = hostName.toLowerCase();
this.mem = mem;

View File

@ -63,6 +63,7 @@ import java.lang.StringBuffer;
import java.net.InetAddress;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
@ -345,7 +346,7 @@ public final class plasmaHTCache {
public static Entry pop() {
synchronized (cacheStack) {
if (cacheStack.size() > 0)
return (Entry) cacheStack.removeFirst();
return cacheStack.removeFirst();
return null;
}
}
@ -1130,7 +1131,9 @@ public final class plasmaHTCache {
public boolean writeResourceInfo() {
if (this.resInfo == null) return false;
try {
responseHeaderDB.set(this.url.hash(), this.resInfo.getMap());
HashMap<String, String> hm = new HashMap<String, String>();
hm.putAll(this.resInfo.getMap());
responseHeaderDB.set(this.url.hash(), hm);
} catch (Exception e) {
resetResponseHeaderDB();
return false;

View File

@ -176,10 +176,10 @@ public final class serverCodings {
return p;
}
public static Map<String, String> string2map(String string, String separator) {
public static HashMap<String, String> string2map(String string, String separator) {
// this can be used to parse a Map.toString() into a Map again
if (string == null) return null;
Map<String, String> map = Collections.synchronizedMap(new HashMap<String, String>());
HashMap<String, String> map = new HashMap<String, String>();
int pos;
if ((pos = string.indexOf("{")) >= 0) string = string.substring(pos + 1).trim();
if ((pos = string.lastIndexOf("}")) >= 0) string = string.substring(0, pos).trim();

View File

@ -68,15 +68,15 @@ import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import de.anomic.data.htmlTools;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.tools.yFormatter;
public class serverObjects extends Hashtable<String, String> implements Cloneable {
public class serverObjects extends HashMap<String, String> implements Cloneable {
private static final long serialVersionUID = 1L;
private boolean localized = true;
@ -280,10 +280,10 @@ public class serverObjects extends Hashtable<String, String> implements Cloneabl
// the keyMapper may contain regular expressions as defined in String.matches
// this method is particulary useful when parsing the result of checkbox forms
ArrayList<String> v = new ArrayList<String>();
Enumeration<String> e = keys();
Iterator<String> e = keySet().iterator();
String key;
while (e.hasMoreElements()) {
key = e.nextElement();
while (e.hasNext()) {
key = e.next();
if (key.matches(keyMapper)) v.add((String) get(key));
}
// make a String[]
@ -294,10 +294,10 @@ public class serverObjects extends Hashtable<String, String> implements Cloneabl
// put all elements of another hashtable into the own table
public void putAll(serverObjects add) {
Enumeration<String> e = add.keys();
Iterator<String> e = add.keySet().iterator();
String k;
while (e.hasMoreElements()) {
k = e.nextElement();
while (e.hasNext()) {
k = e.next();
put(k, add.get(k));
}
}
@ -307,11 +307,11 @@ public class serverObjects extends Hashtable<String, String> implements Cloneabl
BufferedOutputStream fos = null;
try {
fos = new BufferedOutputStream(new FileOutputStream(f));
Enumeration<String> e = keys();
Iterator<String> e = keySet().iterator();
String key, value;
while (e.hasMoreElements()) {
key = e.nextElement();
value = ((String) get(key)).replaceAll("\n", "\\\\n");
while (e.hasNext()) {
key = e.next();
value = get(key).replaceAll("\n", "\\\\n");
fos.write((key + "=" + value + "\r\n").getBytes());
}
} finally {

View File

@ -64,11 +64,9 @@ import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.net.InetAddress;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Random;
import java.util.Set;
@ -180,12 +178,12 @@ public class yacySeed {
/** the peer-hash */
public String hash;
/** a set of identity founding values, eg. IP, name of the peer, YaCy-version, ...*/
private final Map<String, String> dna;
private final HashMap<String, String> dna;
public int available;
public int selectscore = -1; // only for debugging
public String alternativeIP = null;
public yacySeed(String theHash, Map<String, String> theDna) {
public yacySeed(String theHash, HashMap<String, String> theDna) {
// create a seed with a pre-defined hash map
this.hash = theHash;
this.dna = theDna;
@ -195,7 +193,7 @@ public class yacySeed {
}
public yacySeed(String theHash) {
this.dna = Collections.synchronizedMap(new HashMap<String, String>());
this.dna = new HashMap<String, String>();
// settings that can only be computed by originating peer:
// at first startup -
@ -359,7 +357,7 @@ public class yacySeed {
}
/** @return the DNA-map of this peer */
public final Map<String, String> getMap() {
public final HashMap<String, String> getMap() {
return this.dna;
}
@ -793,7 +791,7 @@ public class yacySeed {
if (seedStr == null) { return null; }
final String seed = crypt.simpleDecode(seedStr, key);
if (seed == null) { return null; }
final Map<String, String> dna = serverCodings.string2map(seed, ",");
final HashMap<String, String> dna = serverCodings.string2map(seed, ",");
final String hash = (String) dna.remove(yacySeed.HASH);
final yacySeed resultSeed = new yacySeed(hash, dna);
if (properTest) {

View File

@ -421,7 +421,7 @@ public final class yacySeedDB {
//seed.put(yacySeed.LASTSEEN, yacyCore.shortFormatter.format(new Date(yacyCore.universalTime())));
try {
nameLookupCache.put(seed.getName(), seed);
Map<String, String> seedPropMap = seed.getMap();
HashMap<String, String> seedPropMap = seed.getMap();
synchronized(seedPropMap) {
seedActiveDB.set(seed.hash, seedPropMap);
}
@ -448,7 +448,7 @@ public final class yacySeedDB {
} catch (Exception e) {}
//seed.put(yacySeed.LASTSEEN, yacyCore.shortFormatter.format(new Date(yacyCore.universalTime())));
try {
Map<String, String> seedPropMap = seed.getMap();
HashMap<String, String> seedPropMap = seed.getMap();
synchronized(seedPropMap) {
seedPassiveDB.set(seed.hash, seedPropMap);
}
@ -474,7 +474,7 @@ public final class yacySeedDB {
if (seed.isProper() != null) return;
//seed.put(yacySeed.LASTSEEN, yacyCore.shortFormatter.format(new Date(yacyCore.universalTime())));
try {
Map<String, String> seedPropMap = seed.getMap();
HashMap<String, String> seedPropMap = seed.getMap();
synchronized(seedPropMap) {
seedPotentialDB.set(seed.hash, seedPropMap);
}
@ -531,7 +531,7 @@ public final class yacySeedDB {
private yacySeed get(String hash, kelondroMapObjects database) {
if (hash == null) return null;
if ((this.mySeed != null) && (hash.equals(mySeed.hash))) return mySeed;
Map<String, String> entry = database.getMap(hash);
HashMap<String, String> entry = database.getMap(hash);
if (entry == null) return null;
return new yacySeed(hash, entry);
}
@ -962,7 +962,7 @@ public final class yacySeedDB {
public yacySeed internalNext() {
if ((it == null) || (!(it.hasNext()))) return null;
Map<String, String> dna = it.next();
HashMap<String, String> dna = it.next();
if (dna == null) return null;
String hash = (String) dna.remove("key");
//while (hash.length() < commonHashLength) { hash = hash + "_"; }