Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
- organize imports - removed potential null pointer accesses - removed unnecessary casts
danielr7feae906aa1d
diff --git a/htroot/AccessTracker_p.java b/htroot/AccessTracker_p.javaindex 7ef23c226..41d664db9 100644--- a/htroot/AccessTracker_p.java+++ b/htroot/AccessTracker_p.java@@ -58,7 +58,7 @@ public class AccessTracker_p {// return variable that accumulates replacementsserverObjects prop = new serverObjects();- prop.setLocalized(!((String)header.get("PATH")).endsWith(".xml"));+ prop.setLocalized(!(header.get("PATH")).endsWith(".xml"));int page = 0;if (post != null) page = post.getInt("page", 0);prop.put("page", page);@@ -72,7 +72,7 @@ public class AccessTracker_p {int entCount = 0;try {while ((entCount < maxCount) && (i.hasNext())) {- host = (String) i.next();+ host = i.next();access = sb.accessTrack(host);prop.putHTML("page_list_" + entCount + "_host", host);prop.putNum("page_list_" + entCount + "_countSecond", access.tailMap(new Long(System.currentTimeMillis() - 1000)).size());@@ -108,8 +108,8 @@ public class AccessTracker_p {while (ii.hasNext()) {entry = ii.next();prop.putHTML("page_list_" + entCount + "_host", host);- prop.put("page_list_" + entCount + "_date", serverDate.formatShortSecond(new Date(((Long) entry.getKey()).longValue())));- prop.putHTML("page_list_" + entCount + "_path", (String) entry.getValue());+ prop.put("page_list_" + entCount + "_date", serverDate.formatShortSecond(new Date((entry.getKey()).longValue())));+ prop.putHTML("page_list_" + entCount + "_path", entry.getValue());entCount++;}} catch (ConcurrentModificationException e) {} // we don't want to synchronize this@@ -118,14 +118,14 @@ public class AccessTracker_p {try {Iterator<String> i = sb.accessHosts();while ((entCount < maxCount) && (i.hasNext())) {- host = (String) i.next();+ host = i.next();access = sb.accessTrack(host);Iterator<Map.Entry<Long, String>> ii = treemapclone(access).entrySet().iterator();while (ii.hasNext()) {entry = ii.next();prop.putHTML("page_list_" + entCount + "_host", host);- prop.put("page_list_" + entCount + "_date", serverDate.formatShortSecond(new Date(((Long) entry.getKey()).longValue())));- prop.putHTML("page_list_" + entCount + "_path", (String) entry.getValue());+ prop.put("page_list_" + entCount + "_date", serverDate.formatShortSecond(new Date((entry.getKey()).longValue())));+ prop.putHTML("page_list_" + entCount + "_path", entry.getValue());entCount++;}}diff --git a/htroot/Banner.java b/htroot/Banner.javaindex bb0ab1bde..71579be9b 100644--- a/htroot/Banner.java+++ b/htroot/Banner.java@@ -44,18 +44,19 @@// the intact and unchanged copyright notice.// Contributions and changes to the program code must be marked as such.+import java.awt.image.BufferedImage;+import java.io.File;+import java.io.IOException;++import javax.imageio.ImageIO;+import de.anomic.http.httpHeader;import de.anomic.plasma.plasmaGrafics;import de.anomic.plasma.plasmaSwitchboard;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;-import de.anomic.ymage.ymageMatrix;import de.anomic.yacy.yacySeed;--import java.awt.image.BufferedImage;-import java.io.File;-import java.io.IOException;-import javax.imageio.ImageIO;+import de.anomic.ymage.ymageMatrix;/** draw a banner with information about the peer */public class Banner {diff --git a/htroot/BlacklistCleaner_p.java b/htroot/BlacklistCleaner_p.javaindex 68924f4fa..ab828288d 100644--- a/htroot/BlacklistCleaner_p.java+++ b/htroot/BlacklistCleaner_p.java@@ -108,7 +108,7 @@ public class BlacklistCleaner_p {}if (post.containsKey("listNames")) {- blacklistToUse = (String)post.get("listNames");+ blacklistToUse = post.get("listNames");if (blacklistToUse.length() == 0 || !listManager.listSetContains("listManager.listsPath", blacklistToUse))prop.put("results", "2");}@@ -186,7 +186,7 @@ public class BlacklistCleaner_p {if (useKeys) {Iterator<String> it = post.keySet().iterator();while (it.hasNext()) {- if ((s = (String)it.next()).indexOf(prefix) == 0) {+ if ((s = it.next()).indexOf(prefix) == 0) {r.add(s.substring(prefix.length()));}}@@ -196,7 +196,7 @@ public class BlacklistCleaner_p {while (it.hasNext()) {entry = it.next();if (entry.getKey().indexOf(prefix) == 0) {- r.add((String) entry.getValue());+ r.add(entry.getValue());}}}@@ -215,7 +215,7 @@ public class BlacklistCleaner_p {if (blEngine instanceof indexDefaultReferenceBlacklist) {int slashPos;while (it.hasNext()) {- s = ((String)it.next()).trim();+ s = (it.next()).trim();// check for double-occuranceif (ok.contains(s)) {@@ -306,7 +306,7 @@ public class BlacklistCleaner_p {}}if (list != null){- listManager.writeList(new File(listManager.listsPath, blacklistToUse), (String[])list.toArray(new String[list.size()]));+ listManager.writeList(new File(listManager.listsPath, blacklistToUse), list.toArray(new String[list.size()]));}return entries.length;}diff --git a/htroot/Blacklist_p.java b/htroot/Blacklist_p.javaindex a5fb66594..c435b26ea 100644--- a/htroot/Blacklist_p.java+++ b/htroot/Blacklist_p.java@@ -117,7 +117,7 @@ prop.putHTML("asd", "0");else prop.put("testlist_url","not valid");}if (post.containsKey("selectList")) {- blacklistToUse = (String)post.get("selectedListName");+ blacklistToUse = post.get("selectedListName");if (blacklistToUse != null && blacklistToUse.length() == 0) blacklistToUse = null;}if (post.containsKey("createNewList")) {@@ -125,7 +125,7 @@ prop.putHTML("asd", "0");* Creation of a new blacklist* =========================================================== */- blacklistToUse = (String)post.get("newListName");+ blacklistToUse = post.get("newListName");if (blacklistToUse.trim().length() == 0) {prop.put("LOCATION","");return prop;@@ -151,7 +151,7 @@ prop.putHTML("asd", "0");* Delete a blacklist* =========================================================== */- blacklistToUse = (String)post.get("selectedListName");+ blacklistToUse = post.get("selectedListName");if (blacklistToUse == null || blacklistToUse.trim().length() == 0) {prop.put("LOCATION","");return prop;@@ -177,7 +177,7 @@ prop.putHTML("asd", "0");* Activate/Deactivate a blacklist* =========================================================== */- blacklistToUse = (String)post.get("selectedListName");+ blacklistToUse = post.get("selectedListName");if (blacklistToUse == null || blacklistToUse.trim().length() == 0) {prop.put("LOCATION", "");return prop;@@ -199,7 +199,7 @@ prop.putHTML("asd", "0");* Share a blacklist* =========================================================== */- blacklistToUse = (String)post.get("selectedListName");+ blacklistToUse = post.get("selectedListName");if (blacklistToUse == null || blacklistToUse.trim().length() == 0) {prop.put("LOCATION", "");return prop;@@ -213,8 +213,8 @@ prop.putHTML("asd", "0");}} else if (post.containsKey("deleteBlacklistEntry")) {- String temp = deleteBlacklistEntry((String)post.get("currentBlacklist"),- (String)post.get("selectedEntry"), header, supportedBlacklistTypes);+ String temp = deleteBlacklistEntry(post.get("currentBlacklist"),+ post.get("selectedEntry"), header, supportedBlacklistTypes);if (temp != null) {prop.put("LOCATION", temp);return prop;@@ -222,8 +222,8 @@ prop.putHTML("asd", "0");} else if (post.containsKey("addBlacklistEntry")) {- String temp = addBlacklistEntry((String)post.get("currentBlacklist"),- (String)post.get("newEntry"), header, supportedBlacklistTypes);+ String temp = addBlacklistEntry(post.get("currentBlacklist"),+ post.get("newEntry"), header, supportedBlacklistTypes);if (temp != null) {prop.put("LOCATION", temp);return prop;@@ -234,8 +234,8 @@ prop.putHTML("asd", "0");/* ===========================================================* First add entry to blacklist item moves to* =========================================================== */- String temp = addBlacklistEntry((String)post.get("targetBlacklist"),- (String)post.get("selectedEntry"), header, supportedBlacklistTypes);+ String temp = addBlacklistEntry(post.get("targetBlacklist"),+ post.get("selectedEntry"), header, supportedBlacklistTypes);if (temp != null) {prop.put("LOCATION", temp);return prop;@@ -244,8 +244,8 @@ prop.putHTML("asd", "0");/* ===========================================================* Then delete item from blacklist it is moved away from* =========================================================== */- temp = deleteBlacklistEntry((String)post.get("currentBlacklist"),- (String)post.get("selectedEntry"), header, supportedBlacklistTypes);+ temp = deleteBlacklistEntry(post.get("currentBlacklist"),+ post.get("selectedEntry"), header, supportedBlacklistTypes);if (temp != null) {prop.put("LOCATION", temp);return prop;@@ -258,8 +258,8 @@ prop.putHTML("asd", "0");/* ===========================================================* First delete old item from blacklist* =========================================================== */- String temp = deleteBlacklistEntry((String)post.get("currentBlacklist"),- (String)post.get("selectedBlacklistEntry"), header, supportedBlacklistTypes);+ String temp = deleteBlacklistEntry(post.get("currentBlacklist"),+ post.get("selectedBlacklistEntry"), header, supportedBlacklistTypes);if (temp != null) {prop.put("LOCATION", temp);return prop;@@ -268,8 +268,8 @@ prop.putHTML("asd", "0");/* ===========================================================* Thent add new entry to blacklist* =========================================================== */- temp = addBlacklistEntry((String)post.get("currentBlacklist"),- (String)post.get("editedBlacklistEntry"), header, supportedBlacklistTypes);+ temp = addBlacklistEntry(post.get("currentBlacklist"),+ post.get("editedBlacklistEntry"), header, supportedBlacklistTypes);if (temp != null) {prop.put("LOCATION", temp);return prop;@@ -277,8 +277,8 @@ prop.putHTML("asd", "0");} else {- String selectedEntry = (String)post.get("selectedEntry");- String currentBlacklist = (String)post.get("currentBlacklist");+ String selectedEntry = post.get("selectedEntry");+ String currentBlacklist = post.get("currentBlacklist");if (selectedEntry != null && currentBlacklist != null) {prop.put(DISABLED + "edit_item", selectedEntry);prop.put(DISABLED + "edit_currentBlacklist", currentBlacklist);@@ -327,7 +327,7 @@ prop.putHTML("asd", "0");TreeMap<String, String> hostList = new TreeMap<String, String>();final Iterator<yacySeed> e = sb.webIndex.seedDB.seedsConnected(true, false, null, (float) 0.0);while (e.hasNext()) {- yacySeed seed = (yacySeed) e.next();+ yacySeed seed = e.next();if (seed != null) hostList.put(seed.get(yacySeed.NAME, "nameless"),seed.hash);}@@ -462,12 +462,12 @@ prop.putHTML("asd", "0");// delete the old entry from fileif (list != null) {for (int i=0; i < list.size(); i++) {- if (((String)list.get(i)).equals(oldEntry)) {+ if ((list.get(i)).equals(oldEntry)) {list.remove(i);break;}}- listManager.writeList(new File(listManager.listsPath, blacklistToUse), (String[])list.toArray(new String[list.size()]));+ listManager.writeList(new File(listManager.listsPath, blacklistToUse), list.toArray(new String[list.size()]));}// remove the entry from the running blacklist enginediff --git a/htroot/Blog.java b/htroot/Blog.javaindex 52f7bc78a..8cd9d4d87 100644--- a/htroot/Blog.java+++ b/htroot/Blog.java@@ -86,7 +86,7 @@ public class Blog {prop.put("display", 1); // Fixed to 1- final boolean xml = ((String)header.get(httpHeader.CONNECTION_PROP_PATH)).endsWith(".xml");+ final boolean xml = (header.get(httpHeader.CONNECTION_PROP_PATH)).endsWith(".xml");final String address = sb.webIndex.seedDB.mySeed().getPublicAddress();if(hasRights) {diff --git a/htroot/BlogComments.java b/htroot/BlogComments.javaindex fbe25123b..886b60060 100644--- a/htroot/BlogComments.java+++ b/htroot/BlogComments.java@@ -196,13 +196,13 @@ public class BlogComments {}if(hasRights && post.containsKey("delete") && post.containsKey("page") && post.containsKey("comment")) {- if(page.removeComment((String) post.get("comment"))) {- sb.blogCommentDB.delete((String) post.get("comment"));+ if(page.removeComment(post.get("comment"))) {+ sb.blogCommentDB.delete(post.get("comment"));}}if(hasRights && post.containsKey("allow") && post.containsKey("page") && post.containsKey("comment")) {- blogBoardComments.CommentEntry entry = sb.blogCommentDB.read((String) post.get("comment"));+ blogBoardComments.CommentEntry entry = sb.blogCommentDB.read(post.get("comment"));entry.allow();sb.blogCommentDB.write(entry);}diff --git a/htroot/Bookmarks.java b/htroot/Bookmarks.javaindex cb60c0e3f..64d79d7e2 100644--- a/htroot/Bookmarks.java+++ b/htroot/Bookmarks.java@@ -137,7 +137,7 @@ public class Bookmarks {prop.put("AUTHENTICATE","admin log-in");}}else if(post.containsKey("mode")){- String mode=(String) post.get("mode");+ String mode=post.get("mode");if(mode.equals("add")){prop.put("mode", "2");}else if(mode.equals("importxml")){@@ -146,11 +146,11 @@ public class Bookmarks {prop.put("mode", "4");}}else if(post.containsKey("add")){ //add an Entry- String url=(String) post.get("url");- String title=(String) post.get("title");- String description=(String) post.get("description");- String tagsString = (String)post.get("tags");- String pathString = (String)post.get("path");+ String url=post.get("url");+ String title=post.get("title");+ String description=post.get("description");+ String tagsString = post.get("tags");+ String pathString = post.get("path");tagsString=tagsString+","+pathString;if(tagsString.equals("")){tagsString="unsorted"; //default tag@@ -163,13 +163,13 @@ public class Bookmarks {if(user!=null){bookmark.setOwner(user.getUserName());}- if(((String) post.get("public")).equals("public")){+ if((post.get("public")).equals("public")){bookmark.setPublic(true);publishNews(url, title, description, tagsString);}else{bookmark.setPublic(false);}- if(post.containsKey("feed") && ((String) post.get("feed")).equals("feed")){+ if(post.containsKey("feed") && (post.get("feed")).equals("feed")){bookmark.setFeed(true);}else{bookmark.setFeed(false);@@ -180,15 +180,15 @@ public class Bookmarks {//ERROR}}else if(post.containsKey("edit")){- String urlHash=(String) post.get("edit");+ String urlHash=post.get("edit");prop.put("mode", "2");if (urlHash.length() == 0) {prop.put("mode_edit", "0"); // create mode- prop.putHTML("mode_title", (String) post.get("title"));- prop.putHTML("mode_description", (String) post.get("description"));- prop.put("mode_url", (String) post.get("url"));- prop.putHTML("mode_tags", (String) post.get("tags"));- prop.putHTML("mode_path", (String) post.get("path"));+ prop.putHTML("mode_title", post.get("title"));+ prop.putHTML("mode_description", post.get("description"));+ prop.put("mode_url", post.get("url"));+ prop.putHTML("mode_tags", post.get("tags"));+ prop.putHTML("mode_path", post.get("path"));prop.put("mode_public", "0");prop.put("mode_feed", "0");} else {@@ -233,37 +233,37 @@ public class Bookmarks {}} else if(post.containsKey("htmlfile")){boolean isPublic=false;- if(((String) post.get("public")).equals("public")){+ if((post.get("public")).equals("public")){isPublic=true;}- String tags=(String) post.get("tags");+ String tags=post.get("tags");if(tags.equals("")){tags="unsorted";}serverLog.logInfo("BOOKMARKS", "I try to import bookmarks from HTML-file");try {- File file=new File((String)post.get("htmlfile"));+ File file=new File(post.get("htmlfile"));sb.bookmarksDB.importFromBookmarks(new yacyURL(file) , post.get("htmlfile$file"), tags, isPublic);} catch (MalformedURLException e) {}serverLog.logInfo("BOOKMARKS", "success!!");}else if(post.containsKey("xmlfile")){boolean isPublic=false;- if(((String) post.get("public")).equals("public")){+ if((post.get("public")).equals("public")){isPublic=true;}sb.bookmarksDB.importFromXML(post.get("xmlfile$file"), isPublic);}else if(post.containsKey("delete")){- String urlHash=(String) post.get("delete");+ String urlHash=post.get("delete");sb.bookmarksDB.removeBookmark(urlHash);}if(post.containsKey("tag")){- tagName=(String) post.get("tag");+ tagName=post.get("tag");}if(post.containsKey("start")){- start=Integer.parseInt((String) post.get("start"));+ start=Integer.parseInt(post.get("start"));}if(post.containsKey("num")){- max_count=Integer.parseInt((String) post.get("num"));+ max_count=Integer.parseInt(post.get("num"));}} // END if(post != null)@@ -304,7 +304,7 @@ public class Bookmarks {count=0;while(count<max_count && it.hasNext()){- bookmark=sb.bookmarksDB.getBookmark((String)it.next());+ bookmark=sb.bookmarksDB.getBookmark(it.next());if(bookmark!=null){if(bookmark.getFeed() && isAdmin)prop.put("bookmarks_"+count+"_link", "/FeedReader_p.html?url="+bookmark.getUrl());@@ -376,7 +376,7 @@ public class Bookmarks {it = sb.bookmarksDB.getTagIterator(tagName, isAdmin, comp, max);}while(it.hasNext()){- tag=(Tag) it.next();+ tag=it.next();if ((!tag.getTagName().startsWith("/")) && (!tag.getTagName().equals(""))) {prop.putHTML(id+"_"+count+"_name", tag.getFriendlyName());prop.putHTML(id+"_"+count+"_tag", tag.getTagName());@@ -419,7 +419,7 @@ public class Bookmarks {count++;Iterator<String> bit=sb.bookmarksDB.getBookmarksIterator(fn, isAdmin);while(bit.hasNext()){- bookmark=sb.bookmarksDB.getBookmark((String)bit.next());+ bookmark=sb.bookmarksDB.getBookmark(bit.next());prop.put("folderlist_"+count+"_folder", "<li><a href=\""+bookmark.getUrl()+"\" title=\""+bookmark.getDescription()+"\">"+ bookmark.getTitle()+"</a></li>");count++;}diff --git a/htroot/CacheAdmin_p.java b/htroot/CacheAdmin_p.javaindex ecb565e6c..c47416918 100644--- a/htroot/CacheAdmin_p.java+++ b/htroot/CacheAdmin_p.java@@ -185,7 +185,7 @@ public class CacheAdmin_p {if (sentences != null)while (sentences.hasNext()) {prop.putHTML("info_type_lines_" + i + "_line",- new String((StringBuffer) sentences.next()).replaceAll("\n", "").trim());+ new String(sentences.next()).replaceAll("\n", "").trim());i++;}prop.put("info_type_lines", i);diff --git a/htroot/Collage.java b/htroot/Collage.javaindex 15b6f7587..3cbd23646 100755--- a/htroot/Collage.java+++ b/htroot/Collage.java@@ -87,8 +87,8 @@ public class Collage {origins[fifoPos] = nextOrigin;float scale = rand.nextFloat() * 1.5f + 1;- imgWidth[fifoPos] = (int) (((float)nextOrigin.imageEntry.width()) / scale);- imgHeight[fifoPos] = (int) (((float)nextOrigin.imageEntry.height()) / scale);+ imgWidth[fifoPos] = (int) ((nextOrigin.imageEntry.width()) / scale);+ imgHeight[fifoPos] = (int) ((nextOrigin.imageEntry.height()) / scale);imgPosX[fifoPos] = rand.nextInt((imgWidth[fifoPos] == 0) ? posXMax / 2 : Math.max(1, posXMax - imgWidth[fifoPos]));imgPosY[fifoPos] = rand.nextInt((imgHeight[fifoPos] == 0) ? posYMax / 2 : Math.max(1, posYMax - imgHeight[fifoPos]));diff --git a/htroot/ConfigAccounts_p.java b/htroot/ConfigAccounts_p.javaindex cc6855c0e..203695823 100644--- a/htroot/ConfigAccounts_p.java+++ b/htroot/ConfigAccounts_p.java@@ -144,10 +144,10 @@ public class ConfigAccounts_p {//user != current_user//user=from userlist//current_user = edited user- } else if(post.containsKey("user") && !((String)post.get("user")).equals("newuser")){+ } else if(post.containsKey("user") && !(post.get("user")).equals("newuser")){if(post.containsKey("change_user")){//defaults for newuser are set above- entry=sb.userDB.getEntry((String)post.get("user"));+ entry=sb.userDB.getEntry(post.get("user"));// program crashes if a submit with emty username was made on previous mask and the user clicked on the// link: "If you want to manage more Users, return to the user page." (parameter "user" is empty)if (entry != null) {@@ -164,29 +164,29 @@ public class ConfigAccounts_p {}prop.put("rights", i);}- }else if( post.containsKey("delete_user") && !((String)post.get("user")).equals("newuser") ){- sb.userDB.removeEntry((String)post.get("user"));+ }else if( post.containsKey("delete_user") && !(post.get("user")).equals("newuser") ){+ sb.userDB.removeEntry(post.get("user"));}} else if(post.containsKey("change")) { //New User / edit Userprop.put("text", "0");prop.put("error", "0");- String username=(String)post.get("username");- String pw1=(String)post.get("password");- String pw2=(String)post.get("password2");+ String username=post.get("username");+ String pw1=post.get("password");+ String pw2=post.get("password2");if(! pw1.equals(pw2)){prop.put("error", "2"); //PW does not matchreturn prop;}- String firstName=(String)post.get("firstname");- String lastName=(String)post.get("lastname");- String address=(String)post.get("address");- String timeLimit=(String)post.get("timelimit");- String timeUsed=(String)post.get("timeused");+ String firstName=post.get("firstname");+ String lastName=post.get("lastname");+ String address=post.get("address");+ String timeLimit=post.get("timelimit");+ String timeUsed=post.get("timeused");HashMap<String, String> rightsSet=new HashMap<String, String>();for(i=0;i<rights.length;i++){- rightsSet.put(rights[i], post.containsKey(rights[i])&&((String)post.get(rights[i])).equals("on") ? "true" : "false");+ rightsSet.put(rights[i], post.containsKey(rights[i])&&(post.get(rights[i])).equals("on") ? "true" : "false");}HashMap<String, String> mem=new HashMap<String, String>();if( post.get("current_user").equals("newuser")){ //new userdiff --git a/htroot/ConfigBasic.java b/htroot/ConfigBasic.javaindex 51398aa44..d82bb4111 100644--- a/htroot/ConfigBasic.java+++ b/htroot/ConfigBasic.java@@ -47,7 +47,6 @@// javac -classpath .:../classes ConfigBasic_p.java// if the shell's current path is HTROOT-import java.lang.Integer;import java.util.regex.Pattern;import de.anomic.data.translator;@@ -103,7 +102,7 @@ public class ConfigBasic {// port settingsString port = env.getConfig("port", "8080"); //this allows a low port, but it will only get one, if the user edits the config himself.- if (post != null && Integer.parseInt((String) post.get("port")) > 1023) {+ if (post != null && Integer.parseInt(post.get("port")) > 1023) {port = post.get("port", "8080");}@@ -127,7 +126,7 @@ public class ConfigBasic {String host = null;if (header.containsKey(httpHeader.HOST)) {- host = (String)header.get(httpHeader.HOST);+ host = header.get(httpHeader.HOST);int idx = host.indexOf(":");if (idx != -1) host = host.substring(0,idx);} else {diff --git a/htroot/ConfigLanguage_p.java b/htroot/ConfigLanguage_p.javaindex 74505399d..8fd16465f 100644--- a/htroot/ConfigLanguage_p.java+++ b/htroot/ConfigLanguage_p.java@@ -82,17 +82,17 @@ public class ConfigLanguage_p {if (post != null){//change language- if(post.containsKey("use_button") && (String)post.get("language") != null){- translator.changeLang(env, langPath, (String)post.get("language"));+ if(post.containsKey("use_button") && post.get("language") != null){+ translator.changeLang(env, langPath, post.get("language"));//delete language file}else if(post.containsKey("delete")){- File langfile= new File(langPath, (String)post.get("language"));+ File langfile= new File(langPath, post.get("language"));langfile.delete();//load language file from URL} else if (post.containsKey("url")){- String url = (String)post.get("url");+ String url = post.get("url");ArrayList<String> langVector;try{yacyURL u = new yacyURL(url, null);@@ -115,7 +115,7 @@ public class ConfigLanguage_p {prop.put("status", "2");//error saving the language filereturn prop;}- if(post.containsKey("use_lang") && ((String)post.get("use_lang")).equals("on")){+ if(post.containsKey("use_lang") && (post.get("use_lang")).equals("on")){translator.changeLang(env, langPath, url.substring(url.lastIndexOf("/"), url.length()));}}@@ -136,7 +136,7 @@ public class ConfigLanguage_p {if(langFiles[i].endsWith(".lng")){//+1 because of the virtual entry "default" at toplangKey = langFiles[i].substring(0, langFiles[i].length() -4);- langName = (String) langNames.get(langKey);+ langName = langNames.get(langKey);prop.put("langlist_"+(i+1)+"_file", langFiles[i]);prop.put("langlist_"+(i+1)+"_name", ((langName == null) ? langKey : langName));if(env.getConfig("locale.language", "default").equals(langKey)) {diff --git a/htroot/ConfigNetwork_p.java b/htroot/ConfigNetwork_p.javaindex 2319be547..bd3fddd3d 100644--- a/htroot/ConfigNetwork_p.java+++ b/htroot/ConfigNetwork_p.java@@ -136,7 +136,7 @@ public class ConfigNetwork_p {}if (post.containsKey("peertags")) {- sb.webIndex.seedDB.mySeed().setPeerTags(serverCodings.string2set(normalizedList((String) post.get("peertags")), ","));+ sb.webIndex.seedDB.mySeed().setPeerTags(serverCodings.string2set(normalizedList(post.get("peertags")), ","));}sb.setConfig("cluster.mode", post.get("cluster.mode", "publicpeer"));diff --git a/htroot/ConfigProfile_p.java b/htroot/ConfigProfile_p.javaindex 0b3e06481..b208c72c9 100644--- a/htroot/ConfigProfile_p.java+++ b/htroot/ConfigProfile_p.java@@ -77,18 +77,18 @@ public class ConfigProfile_p {}if (post != null && post.containsKey("set")) {- profile.setProperty("name", (String)post.get("name"));- profile.setProperty("nickname", (String)post.get("nickname"));- profile.setProperty("homepage", (String)post.get("homepage"));- profile.setProperty("email", (String)post.get("email"));-- profile.setProperty("icq", (String)post.get("icq"));- profile.setProperty("jabber", (String)post.get("jabber"));- profile.setProperty("yahoo", (String)post.get("yahoo"));- profile.setProperty("msn", (String)post.get("msn"));- profile.setProperty("skype", (String)post.get("skype"));-- profile.setProperty("comment", (String)post.get("comment"));+ profile.setProperty("name", post.get("name"));+ profile.setProperty("nickname", post.get("nickname"));+ profile.setProperty("homepage", post.get("homepage"));+ profile.setProperty("email", post.get("email"));++ profile.setProperty("icq", post.get("icq"));+ profile.setProperty("jabber", post.get("jabber"));+ profile.setProperty("yahoo", post.get("yahoo"));+ profile.setProperty("msn", post.get("msn"));+ profile.setProperty("skype", post.get("skype"));++ profile.setProperty("comment", post.get("comment"));prop.putHTML("name", profile.getProperty("name", ""));diff --git a/htroot/ConfigProperties_p.java b/htroot/ConfigProperties_p.javaindex d0544169c..775c64b61 100644--- a/htroot/ConfigProperties_p.java+++ b/htroot/ConfigProperties_p.java@@ -66,8 +66,8 @@ public class ConfigProperties_p {//change a Keyif(post != null && post.containsKey("key") && post.containsKey("value")){- key=(String)post.get("key");- final String value=(String)post.get("value");+ key=post.get("key");+ final String value=post.get("value");if(!key.equals("")){env.setConfig(key, value);}@@ -81,7 +81,7 @@ public class ConfigProperties_p {Collections.sort(list);keys = list.iterator();while(keys.hasNext()){- key = (String) keys.next();+ key = keys.next();prop.putHTML("options_"+count+"_key", key);prop.putHTML("options_"+count+"_value", env.getConfig(key, "ERROR"));count++;diff --git a/htroot/ConfigSkins_p.java b/htroot/ConfigSkins_p.javaindex 39a147c44..14b870286 100644--- a/htroot/ConfigSkins_p.java+++ b/htroot/ConfigSkins_p.java@@ -113,17 +113,17 @@ public class ConfigSkins_p {if (post != null){//change skin- if(post.containsKey("use_button") && (String)post.get("skin") != null){- changeSkin(switchboard, skinPath, (String)post.get("skin"));+ if(post.containsKey("use_button") && post.get("skin") != null){+ changeSkin(switchboard, skinPath, post.get("skin"));//delete skin}else if(post.containsKey("delete")){- File skinfile= new File(skinPath, (String)post.get("skin"));+ File skinfile= new File(skinPath, post.get("skin"));skinfile.delete();//load skin from URL} else if (post.containsKey("url")){- String url = (String)post.get("url");+ String url = post.get("url");ArrayList<String> skinVector;try {yacyURL u = new yacyURL(url, null);@@ -146,7 +146,7 @@ public class ConfigSkins_p {prop.put("status", "2");//error saving the skinreturn prop;}- if (post.containsKey("use_skin") && ((String)post.get("use_skin")).equals("on")){+ if (post.containsKey("use_skin") && (post.get("use_skin")).equals("on")){changeSkin(switchboard, skinPath, url.substring(url.lastIndexOf("/"), url.length()));}}diff --git a/htroot/CrawlProfileEditor_p.java b/htroot/CrawlProfileEditor_p.javaindex e9bc38e9a..bec12361e 100644--- a/htroot/CrawlProfileEditor_p.java+++ b/htroot/CrawlProfileEditor_p.java@@ -136,7 +136,7 @@ public class CrawlProfileEditor_p {eentry tee;while (lit.hasNext()) {tee = lit.next();- String cval = (String) selentry.map().get(tee.name);+ String cval = selentry.map().get(tee.name);String val = (tee.type == eentry.BOOLEAN) ? Boolean.toString(post.containsKey(tee.name)) : post.get(tee.name, cval);if (!cval.equals(val)) sb.webIndex.profilesActiveCrawls.changeEntry(selentry, tee.name, val);}diff --git a/htroot/CrawlResults.java b/htroot/CrawlResults.javaindex 9ec7df05d..d453693ec 100644--- a/htroot/CrawlResults.java+++ b/htroot/CrawlResults.java@@ -75,8 +75,8 @@ public class CrawlResults {// check if authorization is needed and/or givenif (((tabletype > 0) && (tabletype < 6)) ||- (post.containsKey("clearlist")) ||- (post.containsKey("deleteentry"))) {+ (post != null && (post.containsKey("clearlist") ||+ post.containsKey("deleteentry")))) {String authorization = ((String) header.get(httpHeader.AUTHORIZATION, "xxxxxx"));if (authorization.length() != 0) {if (! sb.verifyAuthentication(header, true)){@@ -91,6 +91,7 @@ public class CrawlResults {}}+ if(post != null) {// custom number of linesif (post.containsKey("count")) {lines = Integer.parseInt(post.get("count", "500"));@@ -122,6 +123,7 @@ public class CrawlResults {if (post.get("st").equals("0")) showTitle = false; else showTitle = true;if (post.get("su") != null)if (post.get("su").equals("0")) showURL = false; else showURL = true;+ } // end != null// create tableif (tabletype == 0) {diff --git a/htroot/FeedReader_p.java b/htroot/FeedReader_p.javaindex d8bc0a326..df98f4d02 100644--- a/htroot/FeedReader_p.java+++ b/htroot/FeedReader_p.java@@ -44,7 +44,7 @@ public class FeedReader_p {if (post != null) {yacyURL url;try {- url = new yacyURL((String) post.get("url"), null);+ url = new yacyURL(post.get("url"), null);} catch (MalformedURLException e) {prop.put("page", "2");return prop;diff --git a/htroot/IndexControlRWIs_p.java b/htroot/IndexControlRWIs_p.javaindex 644950e3d..a316e7147 100644--- a/htroot/IndexControlRWIs_p.java+++ b/htroot/IndexControlRWIs_p.java@@ -245,7 +245,7 @@ public class IndexControlRWIs_p {int rows = 0, cols = 0;prop.put("keyhashsimilar", "1");while (containerIt.hasNext() && i < 256) {- container = (indexContainer) containerIt.next();+ container = containerIt.next();prop.put("keyhashsimilar_rows_"+rows+"_cols_"+cols+"_wordHash", container.getWordHash());cols++;if (cols==8) {diff --git a/htroot/IndexControlURLs_p.java b/htroot/IndexControlURLs_p.javaindex bb57ceb0d..4a6cef10d 100644--- a/htroot/IndexControlURLs_p.java+++ b/htroot/IndexControlURLs_p.java@@ -163,14 +163,14 @@ public class IndexControlURLs_p {// generate listif (post.containsKey("urlhashsimilar")) {try {- final Iterator<indexURLReference> entryIt = new kelondroRotateIterator<indexURLReference>(sb.webIndex.entriesURL(true, urlhash), new String(kelondroBase64Order.zero(urlhash.length())), sb.webIndex.size());+ final Iterator<indexURLReference> entryIt = new kelondroRotateIterator<indexURLReference>(sb.webIndex.entriesURL(true, urlhash), new String(kelondroBase64Order.zero((urlhash == null ? 0 : urlhash.length()))), sb.webIndex.size());StringBuffer result = new StringBuffer("Sequential List of URL-Hashes:<br />");indexURLReference entry;int i = 0;int rows = 0, cols = 0;prop.put("urlhashsimilar", "1");while (entryIt.hasNext() && i < 256) {- entry = (indexURLReference) entryIt.next();+ entry = entryIt.next();if (entry == null) break;prop.put("urlhashsimilar_rows_"+rows+"_cols_"+cols+"_urlHash", entry.hash());cols++;diff --git a/htroot/IndexCreateIndexingQueue_p.java b/htroot/IndexCreateIndexingQueue_p.javaindex 6e0c691ce..e9dcdfcb7 100644--- a/htroot/IndexCreateIndexingQueue_p.java+++ b/htroot/IndexCreateIndexingQueue_p.java@@ -46,8 +46,8 @@import java.util.ArrayList;import java.util.Iterator;-import de.anomic.crawler.ZURL;import de.anomic.crawler.IndexingStack;+import de.anomic.crawler.ZURL;import de.anomic.http.httpHeader;import de.anomic.plasma.plasmaHTCache;import de.anomic.plasma.plasmaSwitchboard;@@ -70,7 +70,7 @@ public class IndexCreateIndexingQueue_p {if (post != null) {if (post.containsKey("limit")) {try {- showLimit = Integer.valueOf((String)post.get("limit")).intValue();+ showLimit = Integer.valueOf(post.get("limit")).intValue();} catch (NumberFormatException e) {}}@@ -93,7 +93,7 @@ public class IndexCreateIndexingQueue_p {}} catch (Exception e) {}} else if (post.containsKey("deleteEntry")) {- String urlHash = (String) post.get("deleteEntry");+ String urlHash = post.get("deleteEntry");try {sb.webIndex.queuePreStack.remove(urlHash);} catch (Exception e) {}@@ -131,7 +131,7 @@ public class IndexCreateIndexingQueue_p {for (int i = 0; (i < count) && (entryCount < showLimit); i++) {boolean inProcess = i < inProcessCount;- pcentry = (IndexingStack.QueueEntry) entryList.get(i);+ pcentry = entryList.get(i);if ((pcentry != null)&&(pcentry.url() != null)) {long entrySize = pcentry.size();totalSize += entrySize;diff --git a/htroot/IndexCreateWWWGlobalQueue_p.java b/htroot/IndexCreateWWWGlobalQueue_p.javaindex 4fef0d421..f40ecdc90 100644--- a/htroot/IndexCreateWWWGlobalQueue_p.java+++ b/htroot/IndexCreateWWWGlobalQueue_p.java@@ -73,7 +73,7 @@ public class IndexCreateWWWGlobalQueue_p {if (post != null) {if (post.containsKey("limit")) {try {- showLimit = Integer.valueOf((String)post.get("limit")).intValue();+ showLimit = Integer.valueOf(post.get("limit")).intValue();} catch (NumberFormatException e) {}}@@ -91,7 +91,7 @@ public class IndexCreateWWWGlobalQueue_p {prop.put("info", "3");//crawling queue clearedprop.putNum("info_numEntries", c);} else if (post.containsKey("deleteEntry")) {- String urlHash = (String) post.get("deleteEntry");+ String urlHash = post.get("deleteEntry");sb.crawlQueues.noticeURL.removeByURLHash(urlHash);prop.put("LOCATION","");return prop;diff --git a/htroot/IndexCreateWWWLocalQueue_p.java b/htroot/IndexCreateWWWLocalQueue_p.javaindex 864a1565f..2949f6a98 100644--- a/htroot/IndexCreateWWWLocalQueue_p.java+++ b/htroot/IndexCreateWWWLocalQueue_p.java@@ -86,7 +86,7 @@ public class IndexCreateWWWLocalQueue_p {if (post != null) {if (post.containsKey("limit")) {try {- showLimit = Integer.valueOf((String)post.get("limit")).intValue();+ showLimit = Integer.valueOf(post.get("limit")).intValue();} catch (NumberFormatException e) {}}@@ -159,7 +159,7 @@ public class IndexCreateWWWLocalQueue_p {prop.put("info", "3");//crawling queue clearedprop.putNum("info_numEntries", c);} else if (post.containsKey("deleteEntry")) {- String urlHash = (String) post.get("deleteEntry");+ String urlHash = post.get("deleteEntry");sb.crawlQueues.noticeURL.removeByURLHash(urlHash);prop.put("LOCATION","");return prop;diff --git a/htroot/IndexCreateWWWRemoteQueue_p.java b/htroot/IndexCreateWWWRemoteQueue_p.javaindex c83726709..15d5e1968 100644--- a/htroot/IndexCreateWWWRemoteQueue_p.java+++ b/htroot/IndexCreateWWWRemoteQueue_p.java@@ -73,7 +73,7 @@ public class IndexCreateWWWRemoteQueue_p {if (post != null) {if (post.containsKey("limit")) {try {- showLimit = Integer.parseInt((String)post.get("limit"));+ showLimit = Integer.parseInt(post.get("limit"));} catch (NumberFormatException e) { }}@@ -91,7 +91,7 @@ public class IndexCreateWWWRemoteQueue_p {prop.put("info", "3"); // crawling queue clearedprop.putNum("info_numEntries", c);} else if (post.containsKey("deleteEntry")) {- String urlHash = (String) post.get("deleteEntry");+ String urlHash = post.get("deleteEntry");sb.crawlQueues.noticeURL.removeByURLHash(urlHash);prop.put("LOCATION","");return prop;diff --git a/htroot/IndexImport_p.java b/htroot/IndexImport_p.javaindex 6022aeed6..cae446a18 100644--- a/htroot/IndexImport_p.java+++ b/htroot/IndexImport_p.java@@ -51,8 +51,8 @@import java.io.PrintStream;import java.util.Date;-import de.anomic.crawler.NoticeURLImporter;import de.anomic.crawler.Importer;+import de.anomic.crawler.NoticeURLImporter;import de.anomic.http.httpHeader;import de.anomic.plasma.plasmaSwitchboard;import de.anomic.server.serverByteBuffer;@@ -104,7 +104,7 @@ public final class IndexImport_p {(post.containsKey("continueIndexDbImport"))) {// getting the job nr of the thread- String jobID = (String) post.get("jobNr");+ String jobID = post.get("jobNr");Importer importer = switchboard.dbImportManager.getImporterByID(Integer.valueOf(jobID).intValue());if (importer != null) {if (post.containsKey("stopIndexDbImport")) {diff --git a/htroot/IndexShare_p.java b/htroot/IndexShare_p.javaindex 5795aff9a..8b0f64169 100644--- a/htroot/IndexShare_p.java+++ b/htroot/IndexShare_p.java@@ -51,7 +51,6 @@ import de.anomic.http.httpHeader;import de.anomic.plasma.plasmaSwitchboard;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;-//import de.anomic.htmlFilter.*;public class IndexShare_p {diff --git a/htroot/IndexTransfer_p.java b/htroot/IndexTransfer_p.javaindex 2330a59ff..85f895023 100644--- a/htroot/IndexTransfer_p.java+++ b/htroot/IndexTransfer_p.java@@ -74,8 +74,8 @@ public final class IndexTransfer_p {prop.put("running_status","Disconnected peer");} else {boolean deleteIndex = post.get("deleteIndex", "0").equals("1");- if(prop.containsKey("overwriteIP") && ! ((String)prop.get("overwriteIP")).equals("")){- seed.setIP((String) prop.get("overwriteIP"));+ if(prop.containsKey("overwriteIP") && ! (prop.get("overwriteIP")).equals("")){+ seed.setIP(prop.get("overwriteIP"));}sb.startTransferWholeIndex(seed,deleteIndex);prop.put("LOCATION","");@@ -139,7 +139,7 @@ public final class IndexTransfer_p {String hostName = null;try {- while ((hostName = (String) hostList.firstKey()) != null) {+ while ((hostName = hostList.firstKey()) != null) {prop.put("running_hosts_" + hc + "_hosthash", hostList.get(hostName));prop.putHTML("running_hosts_" + hc + "_hostname", /*seed.hash + " " +*/ hostName);hc++;diff --git a/htroot/MessageSend_p.java b/htroot/MessageSend_p.javaindex 17614b025..bb62ad8fe 100644--- a/htroot/MessageSend_p.java+++ b/htroot/MessageSend_p.java@@ -101,8 +101,8 @@ public class MessageSend_p {}prop.putHTML("mode_permission_peerName", peerName, true);- String response = (result == null) ? "-1" : (String) result.get("response");- if ((response == null) || (response.equals("-1"))) {+ String response = (result == null) ? null : (String) result.get("response");+ if (response == null || result == null) {// we don't have permission or other peer does not existprop.put("mode_permission", "0");@@ -114,8 +114,8 @@ public class MessageSend_p {// write input formtry {- int messagesize = Integer.parseInt((String) result.get("messagesize"));- int attachmentsize = Integer.parseInt((String) result.get("attachmentsize"));+ int messagesize = Integer.parseInt(result.get("messagesize"));+ int attachmentsize = Integer.parseInt(result.get("attachmentsize"));prop.putHTML("mode_permission_response", response, true);prop.put("mode_permission_messagesize", messagesize);@@ -153,7 +153,7 @@ public class MessageSend_p {HashMap<String, String> result = yacyClient.postMessage(sb.webIndex.seedDB, hash, subject, mb);//message has been sent- prop.put("mode_status_response", (String) result.get("response"));+ prop.put("mode_status_response", result.get("response"));} catch (NumberFormatException e) {prop.put("mode_status", "1");diff --git a/htroot/Messages_p.java b/htroot/Messages_p.javaindex c8039a156..b9e04aedd 100644--- a/htroot/Messages_p.java+++ b/htroot/Messages_p.java@@ -120,7 +120,7 @@ public class Messages_p {}if (action.equals("delete")) {- String key = post.get("object", "");+ String key = (post == null ? "" : post.get("object", ""));sb.messageDB.remove(key);action = "list";}@@ -145,7 +145,7 @@ public class Messages_p {prop.putHTML("mode_messages_"+count+"_key", key, true);prop.put("mode_messages_"+count+"_hash", message.authorHash());- if (((String)header.get(httpHeader.CONNECTION_PROP_PATH)).endsWith(".rss")) {+ if ((header.get(httpHeader.CONNECTION_PROP_PATH)).endsWith(".rss")) {// set the peer addressprop.put("mode_messages_"+count+"_peerAddress", peerAddress);@@ -172,7 +172,7 @@ public class Messages_p {if (action.equals("view")) {prop.put("mode", "1"); //view- String key = post.get("object", "");+ String key = (post == null ? "" : post.get("object", ""));message = sb.messageDB.read(key);if (message == null) throw new NullPointerException("Message with ID " + key + " does not exist");diff --git a/htroot/Network.java b/htroot/Network.javaindex 5e1783004..1dba77de7 100644--- a/htroot/Network.java+++ b/htroot/Network.java@@ -78,7 +78,7 @@ public class Network {// return variable that accumulates replacementsfinal serverObjects prop = new serverObjects();- prop.setLocalized(!((String)header.get("PATH")).endsWith(".xml"));+ prop.setLocalized(!(header.get("PATH")).endsWith(".xml"));prop.putHTML("page_networkTitle", sb.getConfig("network.unit.description", "unspecified"));prop.putHTML("page_networkName", sb.getConfig("network.unit.name", "unspecified"));final boolean overview = (post == null) || (post.get("page", "0").equals("0"));@@ -195,7 +195,7 @@ public class Network {}prop.put("table", 2); // triggers overviewprop.put("page", 0);- } else if (Integer.parseInt(post.get("page", "1")) == 4) {+ } else if (post != null && Integer.parseInt(post.get("page", "1")) == 4) {prop.put("table", 4); // triggers overviewprop.put("page", 4);@@ -242,8 +242,8 @@ public class Network {}} else {// generate table- final int page = Integer.parseInt(post.get("page", "1"));- final int maxCount = Integer.parseInt(post.get("maxCount", "300"));+ final int page = (post == null ? 1 : Integer.parseInt(post.get("page", "1")));+ final int maxCount = (post == null ? 300 : Integer.parseInt(post.get("maxCount", "300")));int conCount = 0;if (sb.webIndex.seedDB == null) {prop.put("table", 0);//no remote senior/principal proxies known"@@ -288,12 +288,14 @@ public class Network {boolean dark = true;yacySeed seed;- final boolean complete = post.containsKey("ip");+ final boolean complete = (post != null && post.containsKey("ip"));Iterator<yacySeed> e = null;+ final boolean order = (post != null && post.get("order", "down").equals("up"));+ final String sort = (post == null ? null : post.get("sort", null));switch (page) {- case 1 : e = sb.webIndex.seedDB.seedsSortedConnected(post.get("order", "down").equals("up"), post.get("sort", yacySeed.LCOUNT)); break;- case 2 : e = sb.webIndex.seedDB.seedsSortedDisconnected(post.get("order", "down").equals("up"), post.get("sort", yacySeed.LASTSEEN)); break;- case 3 : e = sb.webIndex.seedDB.seedsSortedPotential(post.get("order", "down").equals("up"), post.get("sort", yacySeed.LASTSEEN)); break;+ case 1 : e = sb.webIndex.seedDB.seedsSortedConnected(order, (sort == null ? yacySeed.LCOUNT : sort)); break;+ case 2 : e = sb.webIndex.seedDB.seedsSortedDisconnected(order, (sort == null ? yacySeed.LASTSEEN : sort)); break;+ case 3 : e = sb.webIndex.seedDB.seedsSortedPotential(order, (sort == null ? yacySeed.LASTSEEN : sort)); break;default: break;}String startURL;@@ -303,22 +305,21 @@ public class Network {int PPM;double QPM;Pattern peerSearchPattern = null;- String wrongregex = null;prop.put("regexerror", 0);prop.put("regexerror_wrongregex", (String)null);- if (post.containsKey("search")) {+ if (post != null && post.containsKey("search")) {try {peerSearchPattern = Pattern.compile(post.get("match", ""), Pattern.CASE_INSENSITIVE);} catch (PatternSyntaxException pse){- wrongregex = pse.getPattern();prop.put("regexerror", 1);- prop.putHTML("regexerror_wrongregex", wrongregex);+ prop.putHTML("regexerror_wrongregex", pse.getPattern());}}+ if(e != null) {while (e.hasNext() && conCount < maxCount) {- seed = (yacySeed) e.next();+ seed = e.next();if (seed != null) {- if((post.containsKey("search")) && (wrongregex == null)) {+ if((post != null && post.containsKey("search")) && peerSearchPattern != null /*(wrongregex == null)*/) {boolean abort = true;Matcher m = peerSearchPattern.matcher (seed.getName());if (m.find ()) {@@ -348,20 +349,20 @@ public class Network {prop.put(STR_TABLE_LIST + conCount + "_updatedWiki", 0);} else {prop.put(STR_TABLE_LIST + conCount + "_updatedWiki", 1);- prop.putHTML(STR_TABLE_LIST + conCount + "_updatedWiki_page", (String) wikiMap.get("page"));+ prop.putHTML(STR_TABLE_LIST + conCount + "_updatedWiki_page", wikiMap.get("page"));prop.put(STR_TABLE_LIST + conCount + "_updatedWiki_address", seed.getPublicAddress());}if ((blogMap = updatedBlog.get(seed.hash)) == null) {prop.put(STR_TABLE_LIST + conCount + "_updatedBlog", 0);} else {prop.put(STR_TABLE_LIST + conCount + "_updatedBlog", 1);- prop.putHTML(STR_TABLE_LIST + conCount + "_updatedBlog_page", (String) blogMap.get("page"));- prop.putHTML(STR_TABLE_LIST + conCount + "_updatedBlog_subject", (String) blogMap.get("subject"));+ prop.putHTML(STR_TABLE_LIST + conCount + "_updatedBlog_page", blogMap.get("page"));+ prop.putHTML(STR_TABLE_LIST + conCount + "_updatedBlog_subject", blogMap.get("subject"));prop.put(STR_TABLE_LIST + conCount + "_updatedBlog_address", seed.getPublicAddress());}PPM = seed.getPPM();QPM = seed.getQPM();- if (((startURL = (String) isCrawling.get(seed.hash)) != null) && (PPM >= 4)) {+ if (((startURL = isCrawling.get(seed.hash)) != null) && (PPM >= 4)) {prop.put(STR_TABLE_LIST + conCount + "_isCrawling", 1);prop.put(STR_TABLE_LIST + conCount + "_isCrawling_page", startURL);}@@ -462,6 +463,7 @@ public class Network {conCount++;} // seed != null} // while+ }if (iAmActive) { sb.webIndex.seedDB.removeMySeed(); }prop.putNum("table_list", conCount);prop.put("table", 1);@@ -472,7 +474,7 @@ public class Network {}prop.put("page", page);prop.put("table_page", page);- prop.putHTML("table_searchpattern", post.get("match", ""));+ prop.putHTML("table_searchpattern", (post == null ? "" : post.get("match", "")));switch (page) {case 1 : prop.putHTML("table_peertype", "senior/principal"); break;case 2 : prop.putHTML("table_peertype", "senior/principal"); break;diff --git a/htroot/News.java b/htroot/News.javaindex d36239f63..7a3d256dd 100644--- a/htroot/News.java+++ b/htroot/News.java@@ -63,7 +63,7 @@ public class News {plasmaSwitchboard sb = (plasmaSwitchboard) env;serverObjects prop = new serverObjects();boolean overview = (post == null) || (post.get("page", "0").equals("0"));- int tableID = (overview) ? -1 : Integer.parseInt(post.get("page", "0")) - 1;+ int tableID = (overview) ? -1 : (post == null ? 0 : Integer.parseInt(post.get("page", "0"))) - 1;// execute commandsif (post != null) {@@ -146,8 +146,8 @@ public class News {if (attributeMap.size() > 0) {Iterator<String> attributeKeys = attributeMap.keySet().iterator();while (attributeKeys.hasNext()) {- String key = (String) attributeKeys.next();- String value = (String) attributeMap.get(key);+ String key = attributeKeys.next();+ String value = attributeMap.get(key);prop.put("table_list_" + i + "_attributes_" + j + "_name",key);prop.putHTML("table_list_" + i + "_attributes_" + j + "_value",value);j++;diff --git a/htroot/PerformanceMemory_p.java b/htroot/PerformanceMemory_p.javaindex 5b1287991..6ac5ce975 100644--- a/htroot/PerformanceMemory_p.java+++ b/htroot/PerformanceMemory_p.java@@ -122,13 +122,13 @@ public class PerformanceMemory_p {int p, c = 0;long mem, totalmem = 0;while (i.hasNext()) {- filename = (String) i.next();+ filename = i.next();map = kelondroFlexTable.memoryStats(filename);- mem = Long.parseLong((String) map.get("tableIndexMem"));+ mem = Long.parseLong(map.get("tableIndexMem"));totalmem += mem;prop.put("TableList_" + c + "_tableIndexPath", ((p = filename.indexOf("DATA")) < 0) ? filename : filename.substring(p));prop.put("TableList_" + c + "_tableIndexChunkSize", map.get("tableIndexChunkSize"));- prop.putNum("TableList_" + c + "_tableIndexCount", (String)map.get("tableIndexCount"));+ prop.putNum("TableList_" + c + "_tableIndexCount", map.get("tableIndexCount"));prop.put("TableList_" + c + "_tableIndexMem", serverMemory.bytesToString(mem));c++;}@@ -140,17 +140,17 @@ public class PerformanceMemory_p {c = 0;totalmem = 0;while (i.hasNext()) {- filename = (String) i.next();+ filename = i.next();map = kelondroEcoTable.memoryStats(filename);prop.put("EcoList_" + c + "_tableIndexPath", ((p = filename.indexOf("DATA")) < 0) ? filename : filename.substring(p));- prop.putNum("EcoList_" + c + "_tableSize", (String) map.get("tableSize"));+ prop.putNum("EcoList_" + c + "_tableSize", map.get("tableSize"));- mem = Long.parseLong((String) map.get("tableKeyMem"));+ mem = Long.parseLong(map.get("tableKeyMem"));totalmem += mem;prop.put("EcoList_" + c + "_tableKeyMem", serverMemory.bytesToString(mem));prop.put("EcoList_" + c + "_tableKeyChunkSize", map.get("tableKeyChunkSize"));- mem = Long.parseLong((String) map.get("tableValueMem"));+ mem = Long.parseLong(map.get("tableValueMem"));totalmem += mem;prop.put("EcoList_" + c + "_tableValueMem", serverMemory.bytesToString(mem));prop.put("EcoList_" + c + "_tableValueChunkSize", map.get("tableValueChunkSize"));@@ -165,20 +165,20 @@ public class PerformanceMemory_p {c = 0;totalmem = 0;while (i.hasNext()) {- filename = (String) i.next();+ filename = i.next();map = kelondroCachedRecords.memoryStats(filename);- mem = Long.parseLong((String) map.get("nodeCacheMem"));+ mem = Long.parseLong(map.get("nodeCacheMem"));totalmem += mem;prop.put("NodeList_" + c + "_nodeCachePath", ((p = filename.indexOf("DATA")) < 0) ? filename : filename.substring(p));prop.put("NodeList_" + c + "_nodeChunkSize", map.get("nodeChunkSize"));- prop.putNum("NodeList_" + c + "_nodeCacheCount", (String)map.get("nodeCacheCount"));+ prop.putNum("NodeList_" + c + "_nodeCacheCount", map.get("nodeCacheCount"));prop.put("NodeList_" + c + "_nodeCacheMem", serverMemory.bytesToString(mem));- prop.putNum("NodeList_" + c + "_nodeCacheReadHit", (String)map.get("nodeCacheReadHit"));- prop.putNum("NodeList_" + c + "_nodeCacheReadMiss", (String)map.get("nodeCacheReadMiss"));- prop.putNum("NodeList_" + c + "_nodeCacheWriteUnique", (String)map.get("nodeCacheWriteUnique"));- prop.putNum("NodeList_" + c + "_nodeCacheWriteDouble", (String)map.get("nodeCacheWriteDouble"));- prop.putNum("NodeList_" + c + "_nodeCacheDeletes", (String)map.get("nodeCacheDeletes"));- prop.putNum("NodeList_" + c + "_nodeCacheFlushes", (String)map.get("nodeCacheFlushes"));+ prop.putNum("NodeList_" + c + "_nodeCacheReadHit", map.get("nodeCacheReadHit"));+ prop.putNum("NodeList_" + c + "_nodeCacheReadMiss", map.get("nodeCacheReadMiss"));+ prop.putNum("NodeList_" + c + "_nodeCacheWriteUnique", map.get("nodeCacheWriteUnique"));+ prop.putNum("NodeList_" + c + "_nodeCacheWriteDouble", map.get("nodeCacheWriteDouble"));+ prop.putNum("NodeList_" + c + "_nodeCacheDeletes", map.get("nodeCacheDeletes"));+ prop.putNum("NodeList_" + c + "_nodeCacheFlushes", map.get("nodeCacheFlushes"));c++;}prop.put("NodeList", c);@@ -191,34 +191,34 @@ public class PerformanceMemory_p {c = 0;long hitmem, missmem, totalhitmem = 0, totalmissmem = 0;while (i.hasNext()) {- filename = (String) i.next();+ filename = i.next();map = kelondroCache.memoryStats(filename);prop.put("ObjectList_" + c + "_objectCachePath", ((p = filename.indexOf("DATA")) < 0) ? filename : filename.substring(p));// hit cache- hitmem = Long.parseLong((String) map.get("objectHitMem"));+ hitmem = Long.parseLong(map.get("objectHitMem"));totalhitmem += hitmem;prop.put("ObjectList_" + c + "_objectHitChunkSize", map.get("objectHitChunkSize"));- prop.putNum("ObjectList_" + c + "_objectHitCacheCount", (String)map.get("objectHitCacheCount"));+ prop.putNum("ObjectList_" + c + "_objectHitCacheCount", map.get("objectHitCacheCount"));prop.put("ObjectList_" + c + "_objectHitCacheMem", serverMemory.bytesToString(hitmem));- prop.putNum("ObjectList_" + c + "_objectHitCacheReadHit", (String)map.get("objectHitCacheReadHit"));- prop.putNum("ObjectList_" + c + "_objectHitCacheReadMiss", (String)map.get("objectHitCacheReadMiss"));- prop.putNum("ObjectList_" + c + "_objectHitCacheWriteUnique", (String)map.get("objectHitCacheWriteUnique"));- prop.putNum("ObjectList_" + c + "_objectHitCacheWriteDouble", (String)map.get("objectHitCacheWriteDouble"));- prop.putNum("ObjectList_" + c + "_objectHitCacheDeletes", (String)map.get("objectHitCacheDeletes"));- prop.putNum("ObjectList_" + c + "_objectHitCacheFlushes", (String)map.get("objectHitCacheFlushes"));+ prop.putNum("ObjectList_" + c + "_objectHitCacheReadHit", map.get("objectHitCacheReadHit"));+ prop.putNum("ObjectList_" + c + "_objectHitCacheReadMiss", map.get("objectHitCacheReadMiss"));+ prop.putNum("ObjectList_" + c + "_objectHitCacheWriteUnique", map.get("objectHitCacheWriteUnique"));+ prop.putNum("ObjectList_" + c + "_objectHitCacheWriteDouble", map.get("objectHitCacheWriteDouble"));+ prop.putNum("ObjectList_" + c + "_objectHitCacheDeletes", map.get("objectHitCacheDeletes"));+ prop.putNum("ObjectList_" + c + "_objectHitCacheFlushes", map.get("objectHitCacheFlushes"));// miss cache- missmem = Long.parseLong((String) map.get("objectMissMem"));+ missmem = Long.parseLong(map.get("objectMissMem"));totalmissmem += missmem;prop.put("ObjectList_" + c + "_objectMissChunkSize", map.get("objectMissChunkSize"));- prop.putNum("ObjectList_" + c + "_objectMissCacheCount", (String)map.get("objectMissCacheCount"));+ prop.putNum("ObjectList_" + c + "_objectMissCacheCount", map.get("objectMissCacheCount"));prop.putHTML("ObjectList_" + c + "_objectMissCacheMem", serverMemory.bytesToString(missmem));- prop.putNum("ObjectList_" + c + "_objectMissCacheReadHit", (String)map.get("objectMissCacheReadHit"));- prop.putNum("ObjectList_" + c + "_objectMissCacheReadMiss", (String)map.get("objectMissCacheReadMiss"));- prop.putNum("ObjectList_" + c + "_objectMissCacheWriteUnique", (String)map.get("objectMissCacheWriteUnique"));- prop.putNum("ObjectList_" + c + "_objectMissCacheWriteDouble", (String)map.get("objectMissCacheWriteDouble"));- prop.putNum("ObjectList_" + c + "_objectMissCacheDeletes", (String)map.get("objectMissCacheDeletes"));+ prop.putNum("ObjectList_" + c + "_objectMissCacheReadHit", map.get("objectMissCacheReadHit"));+ prop.putNum("ObjectList_" + c + "_objectMissCacheReadMiss", map.get("objectMissCacheReadMiss"));+ prop.putNum("ObjectList_" + c + "_objectMissCacheWriteUnique", map.get("objectMissCacheWriteUnique"));+ prop.putNum("ObjectList_" + c + "_objectMissCacheWriteDouble", map.get("objectMissCacheWriteDouble"));+ prop.putNum("ObjectList_" + c + "_objectMissCacheDeletes", map.get("objectMissCacheDeletes"));//prop.put("ObjectList_" + c + "_objectMissCacheFlushes", map.get("objectMissCacheFlushes"));c++;diff --git a/htroot/PerformanceQueues_p.java b/htroot/PerformanceQueues_p.javaindex c129502f8..ddb87e8f9 100644--- a/htroot/PerformanceQueues_p.java+++ b/htroot/PerformanceQueues_p.java@@ -69,13 +69,13 @@ public class PerformanceQueues_p {String threadName;serverBusyThread thread;- boolean xml = ((String)header.get("PATH")).endsWith(".xml");+ boolean xml = (header.get("PATH")).endsWith(".xml");prop.setLocalized(!xml);// calculate totalslong blocktime_total = 0, sleeptime_total = 0, exectime_total = 0;while (threads.hasNext()) {- threadName = (String) threads.next();+ threadName = threads.next();thread = switchboard.getThread(threadName);blocktime_total += thread.getBlockTime();sleeptime_total += thread.getSleepTime();@@ -93,7 +93,7 @@ public class PerformanceQueues_p {int c = 0;long idleCycles, busyCycles, memshortageCycles;while (threads.hasNext()) {- threadName = (String) threads.next();+ threadName = threads.next();thread = switchboard.getThread(threadName);// set values to templates@@ -149,9 +149,9 @@ public class PerformanceQueues_p {switchboard.setConfig(threadName + "_memprereq", memprereq);} if ((post != null) && (post.containsKey("submitdefault"))) {// load with new values- idlesleep = Long.parseLong(d((String) defaultSettings.get(threadName + "_idlesleep"), "1000"));- busysleep = Long.parseLong(d((String) defaultSettings.get(threadName + "_busysleep"), "100"));- memprereq = Long.parseLong(d((String) defaultSettings.get(threadName + "_memprereq"), "0"));+ idlesleep = Long.parseLong(d(defaultSettings.get(threadName + "_idlesleep"), "1000"));+ busysleep = Long.parseLong(d(defaultSettings.get(threadName + "_busysleep"), "100"));+ memprereq = Long.parseLong(d(defaultSettings.get(threadName + "_memprereq"), "0"));// check values to prevent short-cut loopsif (idlesleep < 1000) idlesleep = 1000;diff --git a/htroot/QuickCrawlLink_p.java b/htroot/QuickCrawlLink_p.javaindex 74a89fc87..c3d236141 100644--- a/htroot/QuickCrawlLink_p.java+++ b/htroot/QuickCrawlLink_p.java@@ -80,7 +80,7 @@ public class QuickCrawlLink_p {prop.put("mode", "0");// getting the http host header- String hostSocket = (String) header.get(httpHeader.CONNECTION_PROP_HOST);+ String hostSocket = header.get(httpHeader.CONNECTION_PROP_HOST);//String host = hostSocket;int port = 80, pos = hostSocket.indexOf(":");diff --git a/htroot/Ranking_p.java b/htroot/Ranking_p.javaindex f9fe9a988..2cb5e20c3 100644--- a/htroot/Ranking_p.java+++ b/htroot/Ranking_p.java@@ -108,7 +108,7 @@ public class Ranking_p {String key;int i, j = 0;while (it.hasNext()) {- key = (String)it.next();+ key = it.next();prop.put("attr" + attrExtension + "_" + j + "_name", rankingParameters.get(key.substring(prefix.length())));prop.put("attr" + attrExtension + "_" + j + "_nameorg", key);prop.put("attr" + attrExtension + "_" + j + "_select", maxRankingRange);@@ -117,13 +117,13 @@ public class Ranking_p {prop.put("attr" + attrExtension + "_" + j + "_select_" + i + "_value", i);try {prop.put("attr" + attrExtension + "_" + j + "_select_" + i + "_checked",- (i == Integer.valueOf((String)map.get(key)).intValue()) ? "1" : "0");+ (i == Integer.valueOf(map.get(key)).intValue()) ? "1" : "0");} catch (NumberFormatException e) {prop.put("attr" + attrExtension + "_" + j + "_select_" + i + "_checked", "0");}}prop.put("attr" + attrExtension + "_" + j + "_value",- Integer.valueOf((String)map.get(key)).intValue());+ Integer.valueOf(map.get(key)).intValue());j++;}}diff --git a/htroot/SettingsAck_p.java b/htroot/SettingsAck_p.javaindex 8031a9a0f..73e752845 100644--- a/htroot/SettingsAck_p.java+++ b/htroot/SettingsAck_p.java@@ -84,7 +84,7 @@ public class SettingsAck_p {plasmaSwitchboard sb = (plasmaSwitchboard) env;// get referer for backlink- String referer = (String) header.get(httpHeader.REFERER);+ String referer = header.get(httpHeader.REFERER);prop.put("referer", (referer == null) ? "Settings_p.html" : referer);//if (post == null) System.out.println("POST: NULL"); else System.out.println("POST: " + post.toString());@@ -97,9 +97,9 @@ public class SettingsAck_p {// admin passwordif (post.containsKey("adminaccount")) {// read and process data- String user = (String) post.get("adminuser");- String pw1 = (String) post.get("adminpw1");- String pw2 = (String) post.get("adminpw2");+ String user = post.get("adminuser");+ String pw1 = post.get("adminpw1");+ String pw2 = post.get("adminpw2");// do checksif ((user == null) || (pw1 == null) || (pw2 == null)) {prop.put("info", "1");//error with submitted information@@ -127,7 +127,7 @@ public class SettingsAck_p {/** set new port*/- String port = (String) post.get("port");+ String port = post.get("port");prop.putHTML("info_port", port);if (!env.getConfig("port", port).equals(port)) {// validation port@@ -151,11 +151,11 @@ public class SettingsAck_p {}// read and process data- String filter = ((String) post.get("proxyfilter")).trim();+ String filter = (post.get("proxyfilter")).trim();String use_proxyAccounts="";if(post.containsKey("use_proxyaccounts")){//needed? or set to true by default?- use_proxyAccounts = (((String) post.get("use_proxyaccounts")).equals("on") ? "true" : "false" );+ use_proxyAccounts = ((post.get("use_proxyaccounts")).equals("on") ? "true" : "false" );}else{use_proxyAccounts = "false";}@@ -238,7 +238,7 @@ public class SettingsAck_p {if (post.containsKey("serveraccount")) {// static IP- String staticIP = ((String) post.get("staticIP")).trim();+ String staticIP = (post.get("staticIP")).trim();if (staticIP.startsWith("http://")) {if (staticIP.length() > 7) { staticIP = staticIP.substring(7); } else { staticIP = ""; }} else if (staticIP.startsWith("https://")) {@@ -256,7 +256,7 @@ public class SettingsAck_p {env.setConfig("staticIP", staticIP);// server access data- String filter = ((String) post.get("serverfilter")).trim();+ String filter = (post.get("serverfilter")).trim();/*String user = (String) post.get("serveruser");String pw1 = (String) post.get("serverpw1");String pw2 = (String) post.get("serverpw2");*/@@ -406,9 +406,9 @@ public class SettingsAck_p {if (post.containsKey("seedSettings")) {// getting the currently used uploading methodString oldSeedUploadMethod = env.getConfig("seedUploadMethod","none");- String newSeedUploadMethod = (String)post.get("seedUploadMethod");+ String newSeedUploadMethod = post.get("seedUploadMethod");String oldSeedURLStr = sb.webIndex.seedDB.mySeed().get(yacySeed.SEEDLIST, "");- String newSeedURLStr = (String) post.get("seedURL");+ String newSeedURLStr = post.get("seedURL");boolean seedUrlChanged = !oldSeedURLStr.equals(newSeedURLStr);boolean uploadMethodChanged = !oldSeedUploadMethod.equals(newSeedUploadMethod);@@ -496,13 +496,13 @@ public class SettingsAck_p {*/if (post.containsKey("msgForwarding")) {env.setConfig("msgForwardingEnabled",post.containsKey("msgForwardingEnabled")?"true":"false");- env.setConfig("msgForwardingCmd",(String) post.get("msgForwardingCmd"));- env.setConfig("msgForwardingTo",(String) post.get("msgForwardingTo"));+ env.setConfig("msgForwardingCmd",post.get("msgForwardingCmd"));+ env.setConfig("msgForwardingTo",post.get("msgForwardingTo"));prop.put("info", "21");prop.put("info_msgForwardingEnabled", post.containsKey("msgForwardingEnabled") ? "on" : "off");- prop.put("info_msgForwardingCmd", (String) post.get("msgForwardingCmd"));- prop.putHTML("info_msgForwardingTo", (String) post.get("msgForwardingTo"));+ prop.put("info_msgForwardingCmd", post.get("msgForwardingCmd"));+ prop.putHTML("info_msgForwardingTo", post.get("msgForwardingTo"));return prop;}@@ -566,7 +566,7 @@ public class SettingsAck_p {if (post.containsKey("crawlerSettings")) {// getting Crawler Timeout- String timeoutStr = (String) post.get("crawler.clientTimeout");+ String timeoutStr = post.get("crawler.clientTimeout");if (timeoutStr==null||timeoutStr.length()==0) timeoutStr = "10000";int crawlerTimeout;@@ -581,7 +581,7 @@ public class SettingsAck_p {}// getting maximum http file size- String maxSizeStr = (String) post.get("crawler.http.maxFileSize");+ String maxSizeStr = post.get("crawler.http.maxFileSize");if (maxSizeStr==null||maxSizeStr.length()==0) timeoutStr = "-1";long maxHttpSize;@@ -595,7 +595,7 @@ public class SettingsAck_p {}// getting maximum ftp file size- maxSizeStr = (String) post.get("crawler.ftp.maxFileSize");+ maxSizeStr = post.get("crawler.ftp.maxFileSize");if (maxSizeStr==null||maxSizeStr.length()==0) timeoutStr = "-1";long maxFtpSize;diff --git a/htroot/Settings_p.java b/htroot/Settings_p.javaindex 3ea319391..3cf13255f 100644--- a/htroot/Settings_p.java+++ b/htroot/Settings_p.java@@ -238,7 +238,7 @@ public final class Settings_p {*/HashMap<String, plasmaParserConfig> configList = plasmaParser.getParserConfigList();- plasmaParserConfig[] configArray = (plasmaParserConfig[]) configList.values().toArray(new plasmaParserConfig[configList.size()]);+ plasmaParserConfig[] configArray = configList.values().toArray(new plasmaParserConfig[configList.size()]);HashSet<ParserInfo> parserInfos = new HashSet<ParserInfo>(sb.parser.getAvailableParserList().values());diff --git a/htroot/Statistics.java b/htroot/Statistics.javaindex 8438b18f9..81a7bc12c 100644--- a/htroot/Statistics.java+++ b/htroot/Statistics.java@@ -81,7 +81,7 @@ public class Statistics {while ((it.hasNext()) && (count < maxCount)) {map = it.next();if (count >= maxCount) break;- urlString = (String) map.get("key");+ urlString = map.get("key");try { url = new yacyURL(urlString, null); } catch (MalformedURLException e) { url = null; }if ((url != null) && (!url.isLocal())) {prop.put("page_backlinks_list_" + count + "_dark", dark ? "1" : "0");diff --git a/htroot/Status.java b/htroot/Status.javaindex 9560ef7d1..9c5263fe8 100644--- a/htroot/Status.java+++ b/htroot/Status.java@@ -63,7 +63,6 @@ import de.anomic.server.serverSwitch;import de.anomic.tools.yFormatter;import de.anomic.yacy.yacySeed;import de.anomic.yacy.yacyVersion;-import de.anomic.yacy.resourceObserver;public class Status {@@ -85,14 +84,14 @@ public class Status {prop.put("LOCATION","");return prop;} else if (post.containsKey("pauseCrawlJob")) {- String jobType = (String) post.get("jobType");+ String jobType = post.get("jobType");if (jobType.equals("localCrawl"))sb.pauseCrawlJob(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL);else if (jobType.equals("remoteTriggeredCrawl"))sb.pauseCrawlJob(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL);redirect = true;} else if (post.containsKey("continueCrawlJob")) {- String jobType = (String) post.get("jobType");+ String jobType = post.get("jobType");if (jobType.equals("localCrawl"))sb.continueCrawlJob(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL);else if (jobType.equals("remoteTriggeredCrawl"))@@ -103,7 +102,7 @@ public class Status {httpdByteCountOutputStream.resetCount();redirect = true;} else if (post.containsKey("popup")) {- String trigger_enabled = (String) post.get("popup");+ String trigger_enabled = post.get("popup");if (trigger_enabled.equals("false")) {sb.setConfig("browserPopUpTrigger", "false");} else if (trigger_enabled.equals("true")){diff --git a/htroot/Threaddump_p.java b/htroot/Threaddump_p.javaindex cbcf7a838..071d6badb 100644--- a/htroot/Threaddump_p.java+++ b/htroot/Threaddump_p.java@@ -48,6 +48,11 @@// javac -classpath .:../Classes Blacklist_p.java// if the shell's current path is HTROOT+import java.io.File;+import java.io.IOException;+import java.util.Date;+import java.util.Map;+import de.anomic.data.htmlTools;import de.anomic.http.httpHeader;import de.anomic.plasma.plasmaSwitchboard;@@ -57,12 +62,6 @@ import de.anomic.server.serverSwitch;import de.anomic.tools.nxTools;import de.anomic.yacy.yacyVersion;-import java.util.Map;-import java.lang.StringBuffer;-import java.util.Date;-import java.io.File;-import java.io.IOException;-public class Threaddump_p {private static final serverObjects prop = new serverObjects();diff --git a/htroot/User.java b/htroot/User.javaindex a2ec2cb7e..d7487f6d3 100644--- a/htroot/User.java+++ b/htroot/User.java@@ -109,8 +109,8 @@ public class User{//TODO: this does not work for a static admin, yet.}else if(post != null && post.containsKey("username") && post.containsKey("password")){//entry=sb.userDB.passwordAuth((String)post.get("username"), (String)post.get("password"), (String)header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "xxxxxx"));- String username=(String)post.get("username");- String password=(String)post.get("password");+ String username=post.get("username");+ String password=post.get("password");entry=sb.userDB.passwordAuth(username, password);boolean staticAdmin = sb.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").equals(@@ -134,7 +134,7 @@ public class User{prop.put("logged-in_identified-by", "1");prop.put("logged-in_username", username);if(post.containsKey("returnto")){- prop.put("LOCATION", (String)post.get("returnto"));+ prop.put("LOCATION", post.get("returnto"));}}}diff --git a/htroot/ViewFile.java b/htroot/ViewFile.javaindex 503239449..917371610 100644--- a/htroot/ViewFile.java+++ b/htroot/ViewFile.java@@ -87,7 +87,7 @@ public class ViewFile {plasmaSwitchboard sb = (plasmaSwitchboard)env;if (post != null && post.containsKey("words"))- prop.putHTML("error_words", (String)post.get("words"));+ prop.putHTML("error_words", post.get("words"));else {prop.put("error", "1");prop.put("viewmode", "0");@@ -392,7 +392,7 @@ public class ViewFile {prop.put("viewMode_links_" + c + "_nr", c);prop.put("viewMode_links_" + c + "_dark", ((dark) ? 1 : 0));prop.putHTML("viewMode_links_" + c + "_type", name);- prop.put("viewMode_links_" + c + "_text", markup(wordArray, (String) entry.getValue()));+ prop.put("viewMode_links_" + c + "_text", markup(wordArray, entry.getValue()));prop.put("viewMode_links_" + c + "_link", markup(wordArray, entry.getKey().toNormalform(true, false)));prop.put("viewMode_links_" + c + "_url", entry.getKey().toNormalform(true, false));prop.putHTML("viewMode_links_" + c + "_attr", "");diff --git a/htroot/ViewLog_p.java b/htroot/ViewLog_p.javaindex 4825c6808..decd3f2b0 100644--- a/htroot/ViewLog_p.java+++ b/htroot/ViewLog_p.java@@ -68,14 +68,14 @@ public class ViewLog_p {String filter = ".*.*";if(post != null){- if(post.containsKey("mode") && ((String)post.get("mode")).equals("reversed")){+ if(post.containsKey("mode") && (post.get("mode")).equals("reversed")){reversed=true;}if(post.containsKey("lines")){- lines = Integer.parseInt((String)post.get("lines"));+ lines = Integer.parseInt(post.get("lines"));}if(post.containsKey("filter")){- filter = (String)post.get("filter");+ filter = post.get("filter");}}diff --git a/htroot/ViewProfile.java b/htroot/ViewProfile.javaindex 63cfe4a01..c468e77d0 100644--- a/htroot/ViewProfile.java+++ b/htroot/ViewProfile.java@@ -118,7 +118,7 @@ public class ViewProfile {} catch (IOException e) {}// try to get the profile from remote peer- if (sb.clusterhashes != null) seed.setAlternativeAddress((String) sb.clusterhashes.get(seed.hash));+ if (sb.clusterhashes != null) seed.setAlternativeAddress(sb.clusterhashes.get(seed.hash));profile = yacyClient.getProfile(seed);// if profile did not arrive, say that peer is disconnecteddiff --git a/htroot/WatchCrawler_p.java b/htroot/WatchCrawler_p.javaindex 1f8396422..0cf2a80fb 100644--- a/htroot/WatchCrawler_p.java+++ b/htroot/WatchCrawler_p.java@@ -176,7 +176,7 @@ public class WatchCrawler_p {if (crawlingMode.equals(CRAWLING_MODE_URL)) {// check if pattern matches- if ((crawlingStart == null) /* || (!(crawlingStart.matches(newcrawlingfilter))) */) {+ if ((crawlingStart == null || crawlingStartURL == null) /* || (!(crawlingStart.matches(newcrawlingfilter))) */) {// print error messageprop.put("info", "4"); //crawlfilter does not match urlprop.putHTML("info_newcrawlingfilter", newcrawlingfilter);@@ -208,7 +208,7 @@ public class WatchCrawler_p {if (reasonString == null) {// liftoff!prop.put("info", "8");//start msg- prop.putHTML("info_crawlingURL", ((String) post.get("crawlingURL")));+ prop.putHTML("info_crawlingURL", (post.get("crawlingURL")));// generate a YaCyNews if the global flag was setif (crawlOrder) {@@ -230,7 +230,7 @@ public class WatchCrawler_p {} else {prop.put("info", "5"); //Crawling failed- prop.putHTML("info_crawlingURL", ((String) post.get("crawlingURL")));+ prop.putHTML("info_crawlingURL", (post.get("crawlingURL")));prop.putHTML("info_reasonString", reasonString);ZURL.Entry ee = sb.crawlQueues.errorURL.newEntry(@@ -267,7 +267,7 @@ public class WatchCrawler_p {} else if (crawlingMode.equals(CRAWLING_MODE_FILE)) {if (post.containsKey("crawlingFile")) {// getting the name of the uploaded file- String fileName = (String) post.get("crawlingFile");+ String fileName = post.get("crawlingFile");try {// check if the crawl filter works correctlyPattern.compile(newcrawlingfilter);@@ -308,7 +308,7 @@ public class WatchCrawler_p {nexturl,"",sb.webIndex.seedDB.mySeed().hash,- (String) e.getValue(),+ e.getValue(),new Date(),0,profile);diff --git a/htroot/Wiki.java b/htroot/Wiki.javaindex fff711aa6..807dc2cff 100644--- a/htroot/Wiki.java+++ b/htroot/Wiki.java@@ -86,9 +86,9 @@ public class Wiki {prop.put("display", display);String access = sb.getConfig("WikiAccess", "admin");- String pagename = post.get("page", "start");- String ip = post.get(httpHeader.CONNECTION_PROP_CLIENTIP, "127.0.0.1");- String author = post.get("author", "anonymous");+ String pagename = get(post, "page", "start");+ String ip = get(post, httpHeader.CONNECTION_PROP_CLIENTIP, "127.0.0.1");+ String author = get(post, "author", "anonymous");if (author.equals("anonymous")) {author = wikiBoard.guessAuthor(ip);if (author == null) {@@ -97,7 +97,7 @@ public class Wiki {}}- if (post.containsKey("access")) {+ if (post != null && post.containsKey("access")) {// only the administrator may change the access rightif (!sb.verifyAuthentication(header, true)) {// check access right for admin@@ -113,7 +113,7 @@ public class Wiki {wikiBoard.entry page = sb.wikiDB.read(pagename);- if (post.containsKey("submit")) {+ if (post != null && post.containsKey("submit")) {if ((access.equals("admin") && (!sb.verifyAuthentication(header, true)))) {// check access right for admin@@ -140,7 +140,7 @@ public class Wiki {prop.put("LOCATION", "/Wiki.html?page=" + pagename);}- if (post.containsKey("edit")) {+ if (post != null && post.containsKey("edit")) {if ((access.equals("admin") && (!sb.verifyAuthentication(header, true)))) {// check access right for adminprop.put("AUTHENTICATE", "admin log-in"); // force log-in@@ -157,7 +157,7 @@ public class Wiki {}//contributed by [MN]- else if (post.containsKey("preview")) {+ else if (post != null && post.containsKey("preview")) {// preview the pageprop.put("mode", "2");//previewprop.putHTML("mode_pagename", pagename);@@ -168,7 +168,7 @@ public class Wiki {}//end contrib of [MN]- else if (post.containsKey("index")) {+ else if (post != null && post.containsKey("index")) {// view an indexprop.put("mode", "3"); //IndexString subject;@@ -193,7 +193,7 @@ public class Wiki {prop.putHTML("mode_pagename", pagename);}- else if (post.containsKey("diff")) {+ else if (post != null && post.containsKey("diff")) {// Diffprop.put("mode", "4");prop.putHTML("mode_page", pagename);@@ -277,4 +277,17 @@ public class Wiki {// return rewrite propertiesreturn prop;}+++ /**+ * get key from post, use dflt if (not present or post == null)+ *+ * @param post+ * @param string+ * @param string2+ * @return+ */+ private static String get(serverObjects post, String key, String dflt) {+ return (post == null ? dflt : post.get(key, dflt));+ }}diff --git a/htroot/YaCySearchPluginFF.java b/htroot/YaCySearchPluginFF.javaindex 3969d8ffa..057beed98 100644--- a/htroot/YaCySearchPluginFF.java+++ b/htroot/YaCySearchPluginFF.java@@ -61,7 +61,7 @@ public class YaCySearchPluginFF {serverObjects prop = new serverObjects();// getting the http host header- String hostSocket = (String) header.get(httpHeader.CONNECTION_PROP_HOST);+ String hostSocket = header.get(httpHeader.CONNECTION_PROP_HOST);String host = hostSocket;int port = 80, pos = hostSocket.indexOf(":");diff --git a/htroot/autoconfig.java b/htroot/autoconfig.javaindex cca46f477..3c2583b2b 100644--- a/htroot/autoconfig.java+++ b/htroot/autoconfig.java@@ -62,7 +62,7 @@ public class autoconfig {serverObjects prop = new serverObjects();// getting the http host header- String hostSocket = (String) header.get(httpHeader.CONNECTION_PROP_HOST);+ String hostSocket = header.get(httpHeader.CONNECTION_PROP_HOST);String host = hostSocket;int port = 80, pos = hostSocket.indexOf(":");diff --git a/htroot/rct_p.java b/htroot/rct_p.javaindex 67d5bc8cc..497ed7cd9 100644--- a/htroot/rct_p.java+++ b/htroot/rct_p.java@@ -79,15 +79,15 @@ public class rct_p {if (reasonString == null) {// done- env.getLog().logInfo("crawlOrder: added remote crawl url: " + url.toNormalform(true, false));+ env.getLog().logInfo("crawlOrder: added remote crawl url: " + urlToString(url));} else if (reasonString.startsWith("double")) {// case where we have already the url loaded;- env.getLog().logInfo("crawlOrder: ignored double remote crawl url: " + url.toNormalform(true, false));+ env.getLog().logInfo("crawlOrder: ignored double remote crawl url: " + urlToString(url));} else {- env.getLog().logInfo("crawlOrder: ignored [" + reasonString + "] remote crawl url: " + url.toNormalform(true, false));+ env.getLog().logInfo("crawlOrder: ignored [" + reasonString + "] remote crawl url: " + urlToString(url));}} else {- env.getLog().logWarning("crawlOrder: Rejected URL '" + url.toNormalform(true, false) + "': " + urlRejectReason);+ env.getLog().logWarning("crawlOrder: Rejected URL '" + urlToString(url) + "': " + urlRejectReason);}}}@@ -99,6 +99,14 @@ public class rct_p {// return rewrite propertiesreturn prop;}++ /**+ * @param url+ * @return+ */+ private static String urlToString(yacyURL url) {+ return (url == null ? "null" : url.toNormalform(true, false));+ }private static void listHosts(plasmaSwitchboard sb, serverObjects prop) {// list known hostsdiff --git a/htroot/sharedBlacklist_p.java b/htroot/sharedBlacklist_p.javaindex 4ea9bae7a..f26579f2b 100644--- a/htroot/sharedBlacklist_p.java+++ b/htroot/sharedBlacklist_p.java@@ -83,7 +83,7 @@ public class sharedBlacklist_p {// getting the name of the destination blacklistString selectedBlacklistName = "";if( post != null && post.containsKey("currentBlacklist") ){- selectedBlacklistName = (String)post.get("currentBlacklist");+ selectedBlacklistName = post.get("currentBlacklist");}else{selectedBlacklistName = "shared.black";}@@ -100,7 +100,7 @@ public class sharedBlacklist_p {* ====================================================== */// getting the source peer hash- String Hash = (String) post.get("hash");+ String Hash = post.get("hash");// generate the download URLString downloadURL = null;@@ -142,7 +142,7 @@ public class sharedBlacklist_p {* Download the blacklist from URL* ====================================================== */- String downloadURL = (String)post.get("url");+ String downloadURL = post.get("url");prop.putHTML("page_source", downloadURL);try {@@ -157,7 +157,7 @@ public class sharedBlacklist_p {/* ======================================================* Import the blacklist from file* ====================================================== */- String sourceFileName = (String)post.get("file");+ String sourceFileName = post.get("file");prop.put("page_source", sourceFileName);File sourceFile = new File(listManager.listsPath, sourceFileName);@@ -183,10 +183,10 @@ public class sharedBlacklist_p {pw = new PrintWriter(new FileWriter(new File(listManager.listsPath, selectedBlacklistName), true));// loop through the received entry list- int num = Integer.parseInt( (String)post.get("num") );+ int num = Integer.parseInt( post.get("num") );for(int i=0;i < num; i++){if( post.containsKey("item" + i) ){- String newItem = (String)post.get("item" + i);+ String newItem = post.get("item" + i);//This should not be needed...if ( newItem.startsWith("http://") ){@@ -234,7 +234,7 @@ public class sharedBlacklist_p {HashSet<String> Blacklist = new HashSet<String>(listManager.getListArray(new File(listManager.listsPath, selectedBlacklistName)));// sort the loaded blacklist- String[] sortedlist = (String[])otherBlacklist.toArray(new String[otherBlacklist.size()]);+ String[] sortedlist = otherBlacklist.toArray(new String[otherBlacklist.size()]);Arrays.sort(sortedlist);int count = 0;diff --git a/htroot/xml/blacklists_p.java b/htroot/xml/blacklists_p.javaindex 15c59f4f3..ed7b1b60b 100644--- a/htroot/xml/blacklists_p.java+++ b/htroot/xml/blacklists_p.java@@ -62,7 +62,7 @@ public class blacklists_p {count=0;for (int j=0;j<list.size();++j){- String nextEntry = (String)list.get(j);+ String nextEntry = list.get(j);if (nextEntry.length() == 0) continue;if (nextEntry.startsWith("#")) continue;diff --git a/htroot/xml/bookmarks/posts/all.java b/htroot/xml/bookmarks/posts/all.javaindex af667bf61..4eca93e7b 100644--- a/htroot/xml/bookmarks/posts/all.java+++ b/htroot/xml/bookmarks/posts/all.java@@ -65,7 +65,7 @@ public class all {Iterator<String> it;if(post != null && post.containsKey("tag")){- it=switchboard.bookmarksDB.getBookmarksIterator((String) post.get("tag"), isAdmin);+ it=switchboard.bookmarksDB.getBookmarksIterator(post.get("tag"), isAdmin);}else{it=switchboard.bookmarksDB.getBookmarksIterator(isAdmin);}@@ -77,7 +77,7 @@ public class all {bookmarksDB.Bookmark bookmark;Date date;while(it.hasNext()){- bookmark=switchboard.bookmarksDB.getBookmark((String) it.next());+ bookmark=switchboard.bookmarksDB.getBookmark(it.next());prop.putHTML("posts_"+count+"_url", bookmark.getUrl(), true);prop.putHTML("posts_"+count+"_title", bookmark.getTitle(), true);prop.putHTML("posts_"+count+"_description", bookmark.getDescription(), true);diff --git a/htroot/xml/bookmarks/posts/get.java b/htroot/xml/bookmarks/posts/get.javaindex fd764f983..ebb902e82 100644--- a/htroot/xml/bookmarks/posts/get.java+++ b/htroot/xml/bookmarks/posts/get.java@@ -43,10 +43,10 @@ public class get {//String url=""; //urlfilter not yet implementedif(post != null && post.containsKey("tag")){- tag=(String) post.get("tag");+ tag=post.get("tag");}if(post != null && post.containsKey("date")){- date=(String)post.get("date");+ date=post.get("date");}else{date=serverDate.formatISO8601(new Date(System.currentTimeMillis()));}diff --git a/htroot/xml/bookmarks/tags/get.java b/htroot/xml/bookmarks/tags/get.javaindex b2d3da023..b96425517 100644--- a/htroot/xml/bookmarks/tags/get.java+++ b/htroot/xml/bookmarks/tags/get.java@@ -79,36 +79,38 @@ public class get {prop.put("AUTHENTICATE","admin log-in");}}- }- if(post.containsKey("top")) {- String s_top = (String) post.get("top");- top = Integer.parseInt(s_top);- }- if(post.containsKey("sort")) {- String sort = (String) post.get("sort");- if (sort.equals("size"))- comp = SORT_SIZE;- }- if(post.containsKey("tag")) {- tagName=(String) post.get("tag");- if (!tagName.equals("")) {- it = switchboard.bookmarksDB.getTagIterator(tagName, isAdmin, comp, top);- }- } else {- it = switchboard.bookmarksDB.getTagIterator(isAdmin, comp, top);- }+ if(post.containsKey("top")) {+ String s_top = post.get("top");+ top = Integer.parseInt(s_top);+ }+ if(post.containsKey("sort")) {+ String sort = post.get("sort");+ if (sort.equals("size"))+ comp = SORT_SIZE;+ }+ }+ if(post != null && post.containsKey("tag")) {+ tagName=post.get("tag");+ if (!tagName.equals("")) {+ it = switchboard.bookmarksDB.getTagIterator(tagName, isAdmin, comp, top);+ }+ } else {+ it = switchboard.bookmarksDB.getTagIterator(isAdmin, comp, top);+ }// Iterator<bookmarksDB.Tag> it = switchboard.bookmarksDB.getTagIterator(isAdmin);int count=0;- bookmarksDB.Tag tag;- while (it.hasNext()) {- tag = it.next();- if(!tag.getTagName().startsWith("/")) { // ignore folder tags- prop.putHTML("tags_"+count+"_name", tag.getTagName(), true);- prop.put("tags_"+count+"_count", tag.size());- count++;+ if(it != null) {+ bookmarksDB.Tag tag;+ while (it.hasNext()) {+ tag = it.next();+ if(!tag.getTagName().startsWith("/")) { // ignore folder tags+ prop.putHTML("tags_"+count+"_name", tag.getTagName(), true);+ prop.put("tags_"+count+"_count", tag.size());+ count++;+ }}}prop.put("tags", count);diff --git a/htroot/xml/bookmarks/tags/rename_p.java b/htroot/xml/bookmarks/tags/rename_p.javaindex 287ffd77b..cec861c65 100644--- a/htroot/xml/bookmarks/tags/rename_p.java+++ b/htroot/xml/bookmarks/tags/rename_p.java@@ -59,7 +59,7 @@ public class rename_p {prop.put("result", "0");//error//rename tagsif(post != null && post.containsKey("old") && post.containsKey("new")){- if(switchboard.bookmarksDB.renameTag((String)post.get("old"), (String)post.get("new")))+ if(switchboard.bookmarksDB.renameTag(post.get("old"), post.get("new")))prop.put("result", "1");//success}// return rewrite propertiesdiff --git a/htroot/xml/bookmarks/xbel/xbel.java b/htroot/xml/bookmarks/xbel/xbel.javaindex 02b03f471..d780ece92 100644--- a/htroot/xml/bookmarks/xbel/xbel.java+++ b/htroot/xml/bookmarks/xbel/xbel.java@@ -31,7 +31,7 @@ public class xbel {}}if(post.containsKey("tag")) {- String tagName=(String) post.get("tag");+ String tagName=post.get("tag");prop.put("folder", tagName);if (!tagName.equals("")) {Iterator<String> bit=switchboard.bookmarksDB.getBookmarksIterator(tagName, isAdmin);diff --git a/htroot/xml/config_p.java b/htroot/xml/config_p.javaindex 2bd64f747..85d5ef299 100644--- a/htroot/xml/config_p.java+++ b/htroot/xml/config_p.java@@ -42,8 +42,8 @@ public class config_p {//change a Keyif(post != null && post.containsKey("key") && post.containsKey("value")){- key=(String)post.get("key");- final String value=(String)post.get("value");+ key=post.get("key");+ final String value=post.get("value");if(!key.equals("")){env.setConfig(key, value);}@@ -60,7 +60,7 @@ public class config_p {int count=0;while(keys.hasNext()){- key = (String) keys.next();+ key = keys.next();prop.putHTML("options_"+count+"_key", key);prop.putHTML("options_"+count+"_value", env.getConfig(key, "ERROR"));count++;diff --git a/htroot/xml/queues_p.java b/htroot/xml/queues_p.javaindex acdb6c056..c689d8a4b 100644--- a/htroot/xml/queues_p.java+++ b/htroot/xml/queues_p.java@@ -54,8 +54,8 @@ import java.util.Iterator;import java.util.Locale;import de.anomic.crawler.CrawlEntry;-import de.anomic.crawler.NoticedURL;import de.anomic.crawler.IndexingStack;+import de.anomic.crawler.NoticedURL;import de.anomic.http.httpHeader;import de.anomic.plasma.plasmaSwitchboard;import de.anomic.server.serverObjects;diff --git a/htroot/xml/util/getpageinfo_p.java b/htroot/xml/util/getpageinfo_p.javaindex f058313ed..8242258f5 100644--- a/htroot/xml/util/getpageinfo_p.java+++ b/htroot/xml/util/getpageinfo_p.java@@ -49,7 +49,6 @@ import java.io.IOException;import java.io.Writer;import java.net.MalformedURLException;-import de.anomic.data.robotsParser;import de.anomic.htmlFilter.htmlFilterContentScraper;import de.anomic.htmlFilter.htmlFilterWriter;@@ -70,8 +69,8 @@ public class getpageinfo_p {String actions="title";if(post!=null && post.containsKey("url")){if(post.containsKey("actions"))- actions=(String)post.get("actions");- String url=(String) post.get("url");+ actions=post.get("actions");+ String url=post.get("url");if(url.toLowerCase().startsWith("ftp://")){prop.put("robots-allowed", "1");prop.putHTML("title", "FTP: "+url, true);diff --git a/htroot/yacy/hello.java b/htroot/yacy/hello.javaindex e1ee1f0cd..714d4b162 100644--- a/htroot/yacy/hello.java+++ b/htroot/yacy/hello.java@@ -125,7 +125,7 @@ public final class hello {}int urls = -1;- if (sb.clusterhashes != null) remoteSeed.setAlternativeAddress((String) sb.clusterhashes.get(remoteSeed.hash));+ if (sb.clusterhashes != null) remoteSeed.setAlternativeAddress(sb.clusterhashes.get(remoteSeed.hash));// if the remote client has reported its own IP address and the client supports// the port forwarding feature (if client version >= 0.383) then we try to@@ -138,8 +138,8 @@ public final class hello {remoteSeed.setIP(reportedip);urls = yacyClient.queryUrlCount(remoteSeed);} else {- prop.put("yourip", (ias == null) ? "" : ias.getHostAddress());- remoteSeed.setIP((ias == null) ? "" : ias.getHostAddress());+ prop.put("yourip", ias.getHostAddress());+ remoteSeed.setIP(ias.getHostAddress());}// if the previous attempt (using the reported ip address) was not successful, try the ip where@@ -187,7 +187,7 @@ public final class hello {}}sb.webIndex.peerActions.setUserAgent(clientip, userAgent);- if (!((String)prop.get(yacySeed.YOURTYPE)).equals(reportedPeerType)) {+ if (!(prop.get(yacySeed.YOURTYPE)).equals(reportedPeerType)) {yacyCore.log.logInfo("hello: changing remote peer '" + remoteSeed.getName() +"' [" + reportedip +"] peerType from '" + reportedPeerType +diff --git a/htroot/yacy/list.java b/htroot/yacy/list.javaindex 6f80e67a3..35b3ebe1d 100644--- a/htroot/yacy/list.java+++ b/htroot/yacy/list.java@@ -57,7 +57,7 @@ public final class list {yacySeed bla = sb.webIndex.seedDB.get(post.get("iam", ""));if (bla != null) otherPeerName = bla.getName();}- if (otherPeerName == null) otherPeerName = (String)header.get(httpHeader.CONNECTION_PROP_CLIENTIP);+ if (otherPeerName == null) otherPeerName = header.get(httpHeader.CONNECTION_PROP_CLIENTIP);if ((sb.isRobinsonMode()) && (!sb.isInMyCluster(otherPeerName))) {// if we are a robinson cluster, answer only if this client is known by our network definitiondiff --git a/htroot/yacy/message.java b/htroot/yacy/message.javaindex ce37d4ef4..d88a8366a 100644--- a/htroot/yacy/message.java+++ b/htroot/yacy/message.java@@ -100,7 +100,7 @@ public final class message {if ((sb.isRobinsonMode()) &&(!((sb.isPublicRobinson()) ||- (sb.isInMyCluster((String)header.get(httpHeader.CONNECTION_PROP_CLIENTIP)))))) {+ (sb.isInMyCluster(header.get(httpHeader.CONNECTION_PROP_CLIENTIP)))))) {// if we are a robinson cluster, answer only if this client is known by our network definitionprop.put("response", "-1"); // request rejectedreturn prop;diff --git a/htroot/yacy/profile.java b/htroot/yacy/profile.javaindex d84cf66c9..0a2a97dde 100644--- a/htroot/yacy/profile.java+++ b/htroot/yacy/profile.java@@ -71,7 +71,7 @@ public final class profile {if ((sb.isRobinsonMode()) &&(!sb.isPublicRobinson()) &&- (!sb.isInMyCluster((String)header.get(httpHeader.CONNECTION_PROP_CLIENTIP)))) {+ (!sb.isInMyCluster(header.get(httpHeader.CONNECTION_PROP_CLIENTIP)))) {// if we are a robinson cluster, answer only if this client is known by our network definitionprop.put("list", "0");return prop;diff --git a/htroot/yacy/query.java b/htroot/yacy/query.javaindex c07e23b33..d51156a55 100644--- a/htroot/yacy/query.java+++ b/htroot/yacy/query.java@@ -71,7 +71,7 @@ public final class query {if ((sb.isRobinsonMode()) &&(!sb.isPublicRobinson()) &&- (!sb.isInMyCluster((String)header.get(httpHeader.CONNECTION_PROP_CLIENTIP)))) {+ (!sb.isInMyCluster(header.get(httpHeader.CONNECTION_PROP_CLIENTIP)))) {// if we are a robinson cluster, answer only if we are public robinson peers,// or we are a private cluster and the requester is in our cluster.// if we don't answer, the remote peer will recognize us as junior peer,diff --git a/htroot/yacy/search.java b/htroot/yacy/search.javaindex 8979849d0..ab83b0658 100644--- a/htroot/yacy/search.java+++ b/htroot/yacy/search.java@@ -68,7 +68,7 @@ public final class search {serverObjects prop = new serverObjects();if ((post == null) || (env == null)) return prop;if (!yacyNetwork.authentifyRequest(post, env)) return prop;- String client = (String) header.get(httpHeader.CONNECTION_PROP_CLIENTIP);+ String client = header.get(httpHeader.CONNECTION_PROP_CLIENTIP);//System.out.println("yacy: search received request = " + post.toString());@@ -113,7 +113,7 @@ public final class search {if ((sb.isRobinsonMode()) &&(!((sb.isPublicRobinson()) ||- (sb.isInMyCluster((String)header.get(httpHeader.CONNECTION_PROP_CLIENTIP)))))) {+ (sb.isInMyCluster(header.get(httpHeader.CONNECTION_PROP_CLIENTIP)))))) {// if we are a robinson cluster, answer only if this client is known by our network definitionprop.put("links", "");prop.put("linkcount", "0");@@ -219,16 +219,16 @@ public final class search {Iterator<Map.Entry<String, Integer>> i = theSearch.IACount.entrySet().iterator();while (i.hasNext()) {entry = i.next();- indexcount.append("indexcount.").append((String) entry.getKey()).append('=').append(((Integer) entry.getValue()).toString()).append(serverCore.CRLF_STRING);+ indexcount.append("indexcount.").append(entry.getKey()).append('=').append((entry.getValue()).toString()).append(serverCore.CRLF_STRING);}if (abstractSet != null) {// if a specific index-abstract is demanded, attach it hereIterator<String> j = abstractSet.iterator();String wordhash;while (j.hasNext()) {- wordhash = (String) j.next();- indexabstractContainercount += ((Integer) theSearch.IACount.get(wordhash)).intValue();- indexabstract.append("indexabstract." + wordhash + "=").append((String) theSearch.IAResults.get(wordhash)).append(serverCore.CRLF_STRING);+ wordhash = j.next();+ indexabstractContainercount += (theSearch.IACount.get(wordhash)).intValue();+ indexabstract.append("indexabstract." + wordhash + "=").append(theSearch.IAResults.get(wordhash)).append(serverCore.CRLF_STRING);}}prop.put("indexcount", indexcount.toString());@@ -249,12 +249,12 @@ public final class search {prop.put("indexabstract", "");} else if (abstracts.equals("auto")) {// automatically attach the index abstract for the index that has the most references. This should be our target dht position- indexabstractContainercount += ((Integer) theSearch.IACount.get(theSearch.IAmaxcounthash)).intValue();- indexabstract.append("indexabstract." + theSearch.IAmaxcounthash + "=").append((String) theSearch.IAResults.get(theSearch.IAmaxcounthash)).append(serverCore.CRLF_STRING);+ indexabstractContainercount += (theSearch.IACount.get(theSearch.IAmaxcounthash)).intValue();+ indexabstract.append("indexabstract." + theSearch.IAmaxcounthash + "=").append(theSearch.IAResults.get(theSearch.IAmaxcounthash)).append(serverCore.CRLF_STRING);if ((theSearch.IAneardhthash != null) && (!(theSearch.IAneardhthash.equals(theSearch.IAmaxcounthash)))) {// in case that the neardhthash is different from the maxcounthash attach also the neardhthash-container- indexabstractContainercount += ((Integer) theSearch.IACount.get(theSearch.IAneardhthash)).intValue();- indexabstract.append("indexabstract." + theSearch.IAneardhthash + "=").append((String) theSearch.IAResults.get(theSearch.IAneardhthash)).append(serverCore.CRLF_STRING);+ indexabstractContainercount += (theSearch.IACount.get(theSearch.IAneardhthash)).intValue();+ indexabstract.append("indexabstract." + theSearch.IAneardhthash + "=").append(theSearch.IAResults.get(theSearch.IAneardhthash)).append(serverCore.CRLF_STRING);}//System.out.println("DEBUG-ABSTRACTGENERATION: maxcounthash = " + maxcounthash);//System.out.println("DEBUG-ABSTRACTGENERATION: neardhthash = "+ neardhthash);@@ -269,7 +269,7 @@ public final class search {StringBuffer refstr = new StringBuffer();Iterator<String> j = ws.iterator();while (j.hasNext()) {- refstr.append(",").append((String) j.next());+ refstr.append(",").append(j.next());}prop.put("references", (refstr.length() > 0) ? refstr.substring(1) : refstr.toString());serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(theQuery.id(true), "reference collection", ws.size(), System.currentTimeMillis() - timer));diff --git a/htroot/yacy/transfer.java b/htroot/yacy/transfer.javaindex 4023f8d12..e104d062c 100644--- a/htroot/yacy/transfer.java+++ b/htroot/yacy/transfer.java@@ -90,7 +90,7 @@ public final class transfer {// reject unknown peers: this does not appear fair, but anonymous senders are dangerous// reject paths that contain '..' because they are dangerousif (otherseed == null) sb.getLog().logFine("RankingTransmission: rejected unknown peer '" + otherpeer + "', current IP " + header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "unknown"));- if (filename.indexOf("..") >= 0) sb.getLog().logFine("RankingTransmission: rejected wrong path '" + filename + "' from peer " + otherseed.getName() + "/" + otherseed.getPublicAddress()+ ", current IP " + header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "unknown"));+ if (filename.indexOf("..") >= 0) sb.getLog().logFine("RankingTransmission: rejected wrong path '" + filename + "' from peer " + (otherseed == null ? "null" : otherseed.getName() + "/" + otherseed.getPublicAddress()) + ", current IP " + header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "unknown"));return prop;}@@ -123,7 +123,7 @@ public final class transfer {String md5 = post.get("md5", ""); // one-time authentication//java.util.HashMap perm = sb.rankingPermissions;//System.out.println("PERMISSIONDEBUG: accesscode=" + accesscode + ", permissions=" + perm.toString());- String grantedFile = (String) sb.rankingPermissions.get(accesscode);+ String grantedFile = sb.rankingPermissions.get(accesscode);prop.put("process_tt", "");if ((grantedFile == null) || (!(grantedFile.equals(filename)))) {// fraud-access of this interfacediff --git a/htroot/yacy/transferRWI.java b/htroot/yacy/transferRWI.javaindex c554c0472..dd20d423e 100644--- a/htroot/yacy/transferRWI.java+++ b/htroot/yacy/transferRWI.java@@ -147,7 +147,7 @@ public final class transferRWI {Iterator<String> i = v.iterator();while (i.hasNext()) {serverCore.checkInterruption();- estring = (String) i.next();+ estring = i.next();// check if RWI entry is well-formedp = estring.indexOf("{");diff --git a/htroot/yacy/transferURL.java b/htroot/yacy/transferURL.javaindex ffe588877..47bcc59cf 100644--- a/htroot/yacy/transferURL.java+++ b/htroot/yacy/transferURL.java@@ -53,9 +53,9 @@ import de.anomic.index.indexReferenceBlacklist;import de.anomic.index.indexURLReference;import de.anomic.plasma.plasmaSwitchboard;import de.anomic.server.serverCore;+import de.anomic.server.serverDate;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;-import de.anomic.server.serverDate;import de.anomic.xml.RSSFeed;import de.anomic.xml.RSSMessage;import de.anomic.yacy.yacyCore;@@ -108,7 +108,7 @@ public final class transferURL {serverCore.checkInterruption();// read new lurl-entry- urls = (String) post.get("url" + i);+ urls = post.get("url" + i);if (urls == null) {yacyCore.log.logFine("transferURL: got null URL-string from peer " + otherPeerName);blocked++;diff --git a/htroot/yacy/ui/ymarks.java b/htroot/yacy/ui/ymarks.javaindex 4741adc63..e0c0ba1e8 100644--- a/htroot/yacy/ui/ymarks.java+++ b/htroot/yacy/ui/ymarks.java@@ -136,7 +136,7 @@ public class ymarks {prop.put("AUTHENTICATE","admin log-in");}}else if(post.containsKey("mode")){- String mode=(String) post.get("mode");+ String mode=post.get("mode");if(mode.equals("add")){prop.put("mode", "2");}else if(mode.equals("importxml")){@@ -145,11 +145,11 @@ public class ymarks {prop.put("mode", "4");}}else if(post.containsKey("add")){ //add an Entry- String url=(String) post.get("url");- String title=(String) post.get("title");- String description=(String) post.get("description");- String tagsString = (String)post.get("tags");- String pathString = (String)post.get("path");+ String url=post.get("url");+ String title=post.get("title");+ String description=post.get("description");+ String tagsString = post.get("tags");+ String pathString = post.get("path");tagsString=tagsString+","+pathString;if(tagsString.equals("")){tagsString="unsorted"; //default tag@@ -162,13 +162,13 @@ public class ymarks {if(user!=null){bookmark.setOwner(user.getUserName());}- if(((String) post.get("public")).equals("public")){+ if((post.get("public")).equals("public")){bookmark.setPublic(true);publishNews(sb, url, title, description, tagsString);}else{bookmark.setPublic(false);}- if(post.containsKey("feed") && ((String) post.get("feed")).equals("feed")){+ if(post.containsKey("feed") && (post.get("feed")).equals("feed")){bookmark.setFeed(true);}else{bookmark.setFeed(false);@@ -179,15 +179,15 @@ public class ymarks {//ERROR}}else if(post.containsKey("edit")){- String urlHash=(String) post.get("edit");+ String urlHash=post.get("edit");prop.put("mode", "2");if (urlHash.length() == 0) {prop.put("mode_edit", "0"); // create mode- prop.putHTML("mode_title", (String) post.get("title"));- prop.putHTML("mode_description", (String) post.get("description"));- prop.put("mode_url", (String) post.get("url"));- prop.putHTML("mode_tags", (String) post.get("tags"));- prop.putHTML("mode_path", (String) post.get("path"));+ prop.putHTML("mode_title", post.get("title"));+ prop.putHTML("mode_description", post.get("description"));+ prop.put("mode_url", post.get("url"));+ prop.putHTML("mode_tags", post.get("tags"));+ prop.putHTML("mode_path", post.get("path"));prop.put("mode_public", "0");prop.put("mode_feed", "0");} else {@@ -232,37 +232,37 @@ public class ymarks {}} else if(post.containsKey("htmlfile")){boolean isPublic=false;- if(((String) post.get("public")).equals("public")){+ if((post.get("public")).equals("public")){isPublic=true;}- String tags=(String) post.get("tags");+ String tags=post.get("tags");if(tags.equals("")){tags="unsorted";}serverLog.logInfo("BOOKMARKS", "I try to import bookmarks from HTML-file");try {- File file=new File((String)post.get("htmlfile"));+ File file=new File(post.get("htmlfile"));sb.bookmarksDB.importFromBookmarks(new yacyURL(file) , post.get("htmlfile$file"), tags, isPublic);} catch (MalformedURLException e) {}serverLog.logInfo("BOOKMARKS", "success!!");}else if(post.containsKey("xmlfile")){boolean isPublic=false;- if(((String) post.get("public")).equals("public")){+ if((post.get("public")).equals("public")){isPublic=true;}sb.bookmarksDB.importFromXML(post.get("xmlfile$file"), isPublic);}else if(post.containsKey("delete")){- String urlHash=(String) post.get("delete");+ String urlHash=post.get("delete");sb.bookmarksDB.removeBookmark(urlHash);}if(post.containsKey("tag")){- tagName=(String) post.get("tag");+ tagName=post.get("tag");}if(post.containsKey("start")){- start=Integer.parseInt((String) post.get("start"));+ start=Integer.parseInt(post.get("start"));}if(post.containsKey("num")){- max_count=Integer.parseInt((String) post.get("num"));+ max_count=Integer.parseInt(post.get("num"));}} // END if(post != null)@@ -303,7 +303,7 @@ public class ymarks {count=0;while(count<max_count && it.hasNext()){- bookmark=sb.bookmarksDB.getBookmark((String)it.next());+ bookmark=sb.bookmarksDB.getBookmark(it.next());if(bookmark!=null){if(bookmark.getFeed() && isAdmin)prop.put("bookmarks_"+count+"_link", "/FeedReader_p.html?url="+bookmark.getUrl());@@ -375,7 +375,7 @@ public class ymarks {it = sb.bookmarksDB.getTagIterator(tagName, isAdmin, comp, max);}while(it.hasNext()){- tag=(Tag) it.next();+ tag=it.next();if ((!tag.getTagName().startsWith("/")) && (!tag.getTagName().equals(""))) {prop.putHTML(id+"_"+count+"_name", tag.getFriendlyName());prop.putHTML(id+"_"+count+"_tag", tag.getTagName());@@ -418,7 +418,7 @@ public class ymarks {count++;Iterator<String> bit=sb.bookmarksDB.getBookmarksIterator(fn, isAdmin);while(bit.hasNext()){- bookmark=sb.bookmarksDB.getBookmark((String)bit.next());+ bookmark=sb.bookmarksDB.getBookmark(bit.next());prop.put("folderlist_"+count+"_folder", "<li><a href=\""+bookmark.getUrl()+"\" title=\""+bookmark.getDescription()+"\">"+ bookmark.getTitle()+"</a></li>");count++;}diff --git a/htroot/yacy/user/sidebar_history.java b/htroot/yacy/user/sidebar_history.javaindex 8c9b1312d..efbeefb9f 100644--- a/htroot/yacy/user/sidebar_history.java+++ b/htroot/yacy/user/sidebar_history.java@@ -41,7 +41,7 @@ public class sidebar_history {// list search historyIterator<plasmaSearchQuery> i = sb.localSearches.iterator();- String client = (String) header.get(httpHeader.CONNECTION_PROP_CLIENTIP);+ String client = header.get(httpHeader.CONNECTION_PROP_CLIENTIP);plasmaSearchQuery query;int c = 0;HashSet<String> visibleQueries = new HashSet<String>();diff --git a/htroot/yacy/user/sidebar_navigation.java b/htroot/yacy/user/sidebar_navigation.javaindex bf5f0a997..8304a21d0 100644--- a/htroot/yacy/user/sidebar_navigation.java+++ b/htroot/yacy/user/sidebar_navigation.java@@ -94,7 +94,7 @@ public class sidebar_navigation {int hintcount = 0;final Iterator<String> iter = topwords.iterator();while (iter.hasNext()) {- word = (String) iter.next();+ word = iter.next();if (word != null) {prop.putHTML("rssreferences_words_" + hintcount + "_word", word);}@@ -109,8 +109,8 @@ public class sidebar_navigation {int hintcount = 0;final Iterator<String> iter = topwords.iterator();while (iter.hasNext()) {- word = (String) iter.next();- if ((theQuery == null) || (theQuery.queryString == null)) break;+ word = iter.next();+ if (/*(theQuery == null) ||*/ (theQuery.queryString == null)) break;if (word != null) {prop.putHTML("navigation_topwords_words_" + hintcount + "_word", word);prop.putHTML("navigation_topwords_words_" + hintcount + "_newsearch", theQuery.queryString.replace(' ', '+') + "+" + word);diff --git a/htroot/yacy/user/ysearch.java b/htroot/yacy/user/ysearch.javaindex 667eff9a5..92f00ae1f 100644--- a/htroot/yacy/user/ysearch.java+++ b/htroot/yacy/user/ysearch.java@@ -58,7 +58,7 @@ public class ysearch {String promoteSearchPageGreeting = env.getConfig("promoteSearchPageGreeting", "");if (env.getConfigBool("promoteSearchPageGreeting.useNetworkName", false)) promoteSearchPageGreeting = env.getConfig("network.unit.description", "");if (promoteSearchPageGreeting.length() == 0) promoteSearchPageGreeting = "P2P WEB SEARCH";- String client = (String) header.get(httpHeader.CONNECTION_PROP_CLIENTIP); // the search client who initiated the search+ String client = header.get(httpHeader.CONNECTION_PROP_CLIENTIP); // the search client who initiated the search// get queryString querystring = (post == null) ? "" : post.get("search", "").trim();@@ -111,23 +111,23 @@ public class ysearch {int offset = post.getInt("startRecord", post.getInt("offset", 0));boolean global = (post == null) ? true : post.get("resource", "global").equals("global");- final boolean indexof = post.get("indexof","").equals("on");+ final boolean indexof = (post != null && post.get("indexof","").equals("on"));String urlmask = "";- if (post.containsKey("urlmask") && post.get("urlmask").equals("no")) {+ if (post != null && post.containsKey("urlmask") && post.get("urlmask").equals("no")) {urlmask = ".*";} else {- urlmask = (post.containsKey("urlmaskfilter")) ? (String) post.get("urlmaskfilter") : ".*";+ urlmask = (post != null && post.containsKey("urlmaskfilter")) ? (String) post.get("urlmaskfilter") : ".*";}- String prefermask = post.get("prefermaskfilter", "");+ String prefermask = (post == null ? "" : post.get("prefermaskfilter", ""));if ((prefermask.length() > 0) && (prefermask.indexOf(".*") < 0)) prefermask = ".*" + prefermask + ".*";- kelondroBitfield constraint = ((post.containsKey("constraint")) && (post.get("constraint", "").length() > 0)) ? new kelondroBitfield(4, post.get("constraint", "______")) : null;+ kelondroBitfield constraint = (post != null && post.containsKey("constraint") && post.get("constraint", "").length() > 0) ? new kelondroBitfield(4, post.get("constraint", "______")) : null;if (indexof) {constraint = new kelondroBitfield(4);constraint.set(plasmaCondenser.flag_cat_indexof, true);}- int domainzone = post.getInt("zone", yacyURL.TLD_any_zone_filter);+ int domainzone = (post == null ? yacyURL.TLD_any_zone_filter : post.getInt("zone", yacyURL.TLD_any_zone_filter));// SEARCH//final boolean indexDistributeGranted = sb.getConfig(plasmaSwitchboard.INDEX_DIST_ALLOW, "true").equals("true");@@ -140,7 +140,7 @@ public class ysearch {if (clustersearch) global = true; // switches search on, but search target is limited to cluster nodes// find search domain- int contentdomCode = plasmaSearchQuery.contentdomParser(post.get("contentdom", "text"));+ int contentdomCode = plasmaSearchQuery.contentdomParser((post == null ? "text" : post.get("contentdom", "text")));// patch until better search profiles are availableif ((contentdomCode != plasmaSearchQuery.CONTENTDOM_TEXT) && (itemsPerPage <= 32)) itemsPerPage = 32;@@ -162,7 +162,7 @@ public class ysearch {block = true;} catch (InterruptedException e) { e.printStackTrace(); }- if ((!block) && (post.get("cat", "href").equals("href"))) {+ if ((!block) && (post == null || post.get("cat", "href").equals("href"))) {plasmaSearchRankingProfile ranking = sb.getRanking();final TreeSet<String>[] query = plasmaSearchQuery.cleanQuery(querystring); // converts also umlaute@@ -280,7 +280,7 @@ public class ysearch {}if (prop == null || prop.size() == 0) {- if (post.get("search", "").length() < 3) {+ if (post == null || post.get("search", "").length() < 3) {prop.put("num-results", "2"); // no results - at least 3 chars} else {prop.put("num-results", "1"); // no results@@ -314,7 +314,7 @@ public class ysearch {prop.putHTML("input_prefermaskfilter", prefermask);prop.put("input_indexof", (indexof) ? "on" : "off");prop.put("input_constraint", (constraint == null) ? "" : constraint.exportB64());- prop.put("input_contentdom", post.get("contentdom", "text"));+ prop.put("input_contentdom", (post == null ? "text" : post.get("contentdom", "text")));prop.put("input_contentdomCheckText", (contentdomCode == plasmaSearchQuery.CONTENTDOM_TEXT) ? "1" : "0");prop.put("input_contentdomCheckAudio", (contentdomCode == plasmaSearchQuery.CONTENTDOM_AUDIO) ? "1" : "0");prop.put("input_contentdomCheckVideo", (contentdomCode == plasmaSearchQuery.CONTENTDOM_VIDEO) ? "1" : "0");diff --git a/htroot/yacy/user/ysearchitem.java b/htroot/yacy/user/ysearchitem.javaindex ca8111d67..357ff9573 100644--- a/htroot/yacy/user/ysearchitem.java+++ b/htroot/yacy/user/ysearchitem.java@@ -174,7 +174,7 @@ public class ysearchitem {plasmaSnippetCache.MediaSnippet ms;int c = 0;for (int i = 0; i < media.size(); i++) {- ms = (plasmaSnippetCache.MediaSnippet) media.get(i);+ ms = media.get(i);prop.putHTML("content_items_" + i + "_href", ms.href.toNormalform(true, false));prop.putHTML("content_items_" + i + "_hrefshort", nxTools.shortenURLString(ms.href.toNormalform(true, false), urllength));prop.putHTML("content_items_" + i + "_name", shorten(ms.name, namelength));diff --git a/htroot/yacysearch.java b/htroot/yacysearch.javaindex 6d9a2f549..e97a35b7e 100644--- a/htroot/yacysearch.java+++ b/htroot/yacysearch.java@@ -89,11 +89,11 @@ public class yacysearch {String promoteSearchPageGreeting = env.getConfig("promoteSearchPageGreeting", "");if (env.getConfigBool("promoteSearchPageGreeting.useNetworkName", false)) promoteSearchPageGreeting = env.getConfig("network.unit.description", "");if (promoteSearchPageGreeting.length() == 0) promoteSearchPageGreeting = "P2P WEB SEARCH";- String client = (String) header.get(httpHeader.CONNECTION_PROP_CLIENTIP); // the search client who initiated the search+ String client = header.get(httpHeader.CONNECTION_PROP_CLIENTIP); // the search client who initiated the search// get queryString querystring = (post == null) ? "" : post.get("query", post.get("search", "")).trim(); // SRU compliance- boolean fetchSnippets = post.get("verify", "true").equals("true");+ boolean fetchSnippets = (post == null || post.get("verify", "true").equals("true"));final serverObjects prop = new serverObjects();boolean rss = (post == null) ? false : post.get("rss", "false").equals("true");@@ -143,17 +143,17 @@ public class yacysearch {int offset = post.getInt("startRecord", post.getInt("offset", 0));boolean global = (post == null) ? true : post.get("resource", "global").equals("global");- final boolean indexof = post.get("indexof","").equals("on");+ final boolean indexof = (post != null && post.get("indexof","").equals("on"));String urlmask = "";- if (post.containsKey("urlmask") && post.get("urlmask").equals("no")) {+ if (post != null && post.containsKey("urlmask") && post.get("urlmask").equals("no")) {urlmask = ".*";} else {- urlmask = (post.containsKey("urlmaskfilter")) ? (String) post.get("urlmaskfilter") : ".*";+ urlmask = (post != null && post.containsKey("urlmaskfilter")) ? (String) post.get("urlmaskfilter") : ".*";}- String prefermask = post.get("prefermaskfilter", "");+ String prefermask = (post == null ? "" : post.get("prefermaskfilter", ""));if ((prefermask.length() > 0) && (prefermask.indexOf(".*") < 0)) prefermask = ".*" + prefermask + ".*";- kelondroBitfield constraint = ((post.containsKey("constraint")) && (post.get("constraint", "").length() > 0)) ? new kelondroBitfield(4, post.get("constraint", "______")) : null;+ kelondroBitfield constraint = (post != null && post.containsKey("constraint") && post.get("constraint", "").length() > 0) ? new kelondroBitfield(4, post.get("constraint", "______")) : null;if (indexof) {constraint = new kelondroBitfield(4);constraint.set(plasmaCondenser.flag_cat_indexof, true);@@ -170,7 +170,7 @@ public class yacysearch {if (clustersearch) global = true; // switches search on, but search target is limited to cluster nodes// find search domain- int contentdomCode = plasmaSearchQuery.contentdomParser(post.get("contentdom", "text"));+ int contentdomCode = plasmaSearchQuery.contentdomParser((post == null ? "text" : post.get("contentdom", "text")));// patch until better search profiles are availableif ((contentdomCode != plasmaSearchQuery.CONTENTDOM_TEXT) && (itemsPerPage <= 32)) itemsPerPage = 32;@@ -192,7 +192,7 @@ public class yacysearch {block = true;} catch (InterruptedException e) { e.printStackTrace(); }- if ((!block) && (post.get("cat", "href").equals("href"))) {+ if ((!block) && (post == null || post.get("cat", "href").equals("href"))) {plasmaSearchRankingProfile ranking = sb.getRanking();final TreeSet<String>[] query = plasmaSearchQuery.cleanQuery(querystring); // converts also umlaute@@ -212,7 +212,7 @@ public class yacysearch {}// if a minus-button was hit, remove a special reference first- if (post.containsKey("deleteref")) {+ if (post != null && post.containsKey("deleteref")) {if (!sb.verifyAuthentication(header, true)) {prop.put("AUTHENTICATE", "admin log-in"); // force log-inreturn prop;@@ -231,7 +231,7 @@ public class yacysearch {}// if a plus-button was hit, create new voting message- if (post.containsKey("recommendref")) {+ if (post != null && post.containsKey("recommendref")) {if (!sb.verifyAuthentication(header, true)) {prop.put("AUTHENTICATE", "admin log-in"); // force log-inreturn prop;@@ -247,9 +247,9 @@ public class yacysearch {HashMap<String, String> map = new HashMap<String, String>();map.put("url", comp.url().toNormalform(false, true).replace(',', '|'));map.put("title", comp.dc_title().replace(',', ' '));- map.put("description", ((document == null) ? comp.dc_title() : document.dc_title()).replace(',', ' '));- map.put("author", ((document == null) ? "" : document.dc_creator()));- map.put("tags", ((document == null) ? "" : document.dc_subject(' ')));+ map.put("description", document.dc_title().replace(',', ' '));+ map.put("author", document.dc_creator());+ map.put("tags", document.dc_subject(' '));sb.webIndex.newsPool.publishMyNews(yacyNewsRecord.newRecord(sb.webIndex.seedDB.mySeed(), yacyNewsPool.CATEGORY_SURFTIPP_ADD, map));document.close();}@@ -380,7 +380,7 @@ public class yacysearch {}if (prop == null || prop.size() == 0) {- if (post.get("search", "").length() < 3) {+ if (post == null || post.get("search", "").length() < 3) {prop.put("num-results", "2"); // no results - at least 3 chars} else {prop.put("num-results", "1"); // no results@@ -414,7 +414,7 @@ public class yacysearch {prop.putHTML("input_prefermaskfilter", prefermask);prop.put("input_indexof", (indexof) ? "on" : "off");prop.put("input_constraint", (constraint == null) ? "" : constraint.exportB64());- prop.put("input_contentdom", post.get("contentdom", "text"));+ prop.put("input_contentdom", (post == null ? "text" : post.get("contentdom", "text")));prop.put("input_contentdomCheckText", (contentdomCode == plasmaSearchQuery.CONTENTDOM_TEXT) ? "1" : "0");prop.put("input_contentdomCheckAudio", (contentdomCode == plasmaSearchQuery.CONTENTDOM_AUDIO) ? "1" : "0");prop.put("input_contentdomCheckVideo", (contentdomCode == plasmaSearchQuery.CONTENTDOM_VIDEO) ? "1" : "0");diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.javaindex b8f996492..e7ec4b1bd 100644--- a/htroot/yacysearchitem.java+++ b/htroot/yacysearchitem.java@@ -131,7 +131,7 @@ public class yacysearchitem {int hintcount = 0;final Iterator<String> iter = topwords.iterator();while (iter.hasNext()) {- word = (String) iter.next();+ word = iter.next();if (word != null) {prop.putHTML("rssreferences_words_" + hintcount + "_word", word);}@@ -146,8 +146,8 @@ public class yacysearchitem {int hintcount = 0;final Iterator<String> iter = topwords.iterator();while (iter.hasNext()) {- word = (String) iter.next();- if ((theQuery == null) || (theQuery.queryString == null)) break;+ word = iter.next();+ if (/*(theQuery == null) ||*/ (theQuery.queryString == null)) break;if (word != null) {prop.putHTML("references_words_" + hintcount + "_word", word);prop.putHTML("references_words_" + hintcount + "_newsearch", theQuery.queryString.replace(' ', '+') + "+" + word);@@ -267,7 +267,7 @@ public class yacysearchitem {plasmaSnippetCache.MediaSnippet ms;int c = 0;for (int i = 0; i < media.size(); i++) {- ms = (plasmaSnippetCache.MediaSnippet) media.get(i);+ ms = media.get(i);prop.putHTML("content_items_" + i + "_href", ms.href.toNormalform(true, false));prop.putHTML("content_items_" + i + "_hrefshort", nxTools.shortenURLString(ms.href.toNormalform(true, false), urllength));prop.putHTML("content_items_" + i + "_name", shorten(ms.name, namelength));diff --git a/source/dbtest.java b/source/dbtest.javaindex d4e90e188..1af844322 100644--- a/source/dbtest.java+++ b/source/dbtest.java@@ -329,8 +329,8 @@ public class dbtest {profiles = ((kelondroTree) table_test).profiles();System.out.println("Cache Delta: " + kelondroProfile.delta(profiles[0], cacheProfileAcc).toString());System.out.println("IO Delta: " + kelondroProfile.delta(profiles[1], ioProfileAcc).toString());- cacheProfileAcc = (kelondroProfile) profiles[0].clone();- ioProfileAcc = (kelondroProfile) profiles[1].clone();+ cacheProfileAcc = profiles[0].clone();+ ioProfileAcc = profiles[1].clone();}}}@@ -413,11 +413,13 @@ public class dbtest {kelondroCloneableIterator<kelondroRow.Entry> i = null;if (table_test instanceof kelondroTree) i = ((kelondroTree) table_test).rows(true, null);if (table_test instanceof kelondroSQLTable) i = ((kelondroSQLTable) table_test).rows(true, null);- kelondroRow.Entry row;- while (i.hasNext()) {- row = i.next();- for (int j = 0; j < row.columns(); j++) System.out.print(row.getColString(j, null) + ",");- System.out.println();+ if(i != null) {+ kelondroRow.Entry row;+ while (i.hasNext()) {+ row = i.next();+ for (int j = 0; j < row.columns(); j++) System.out.print(row.getColString(j, null) + ",");+ System.out.println();+ }}}@@ -457,11 +459,11 @@ public class dbtest {if ((ra.size() > 0) && (random.nextLong() % 7 == 0)) {rc++;p = Math.abs(random.nextInt()) % ra.size();- R = (Long) ra.get(p);+ R = ra.get(p);jcontrol.remove(R);kcontrol.removeb((int) R.longValue());System.out.println("remove: " + R.longValue());- serverInstantBusyThread.oneTimeJob(new RemoveJob(table_test, table_reference, ((Long) ra.remove(p)).longValue()), 0, 50);+ serverInstantBusyThread.oneTimeJob(new RemoveJob(table_test, table_reference, (ra.remove(p)).longValue()), 0, 50);}}System.out.println("removed: " + rc + ", size of jcontrol set: " + jcontrol.size() + ", size of kcontrol set: " + kcontrol.size());@@ -498,10 +500,10 @@ public class dbtest {if ((ra.size() > 0) && (random.nextLong() % 7 == 0)) {rc++;p = Math.abs(random.nextInt()) % ra.size();- R = (Long) ra.get(p);+ R = ra.get(p);jcontrol.remove(R);kcontrol.removeb((int) R.longValue());- new RemoveJob(table_test, table_reference, ((Long) ra.remove(p)).longValue()).run();+ new RemoveJob(table_test, table_reference, (ra.remove(p)).longValue()).run();}}try {Thread.sleep(1000);} catch (InterruptedException e) {}diff --git a/source/de/anomic/crawler/Balancer.java b/source/de/anomic/crawler/Balancer.javaindex 450f31c0a..69aed1e2a 100644--- a/source/de/anomic/crawler/Balancer.java+++ b/source/de/anomic/crawler/Balancer.java@@ -179,7 +179,7 @@ public class Balancer {CrawlEntry crawlEntry;long terminate = (timeout > 0) ? System.currentTimeMillis() + timeout : Long.MAX_VALUE;while (i.hasNext() && (System.currentTimeMillis() < terminate)) {- rowEntry = (kelondroRow.Entry) i.next();+ rowEntry = i.next();crawlEntry = new CrawlEntry(rowEntry);if (crawlEntry.profileHandle().equals(profileHandle)) {urlHashes.add(crawlEntry.url().hash());@@ -214,7 +214,7 @@ public class Balancer {Iterator<String> i = urlRAMStack.iterator();String h;while (i.hasNext()) {- h = (String) i.next();+ h = i.next();if (urlHashes.contains(h)) i.remove();}@@ -299,7 +299,7 @@ public class Balancer {if (ram) {urlRAMStack.add(list.removeFirst());} else try {- urlFileStack.push(urlFileStack.row().newEntry(new byte[][] { ((String) list.removeFirst()).getBytes() }));+ urlFileStack.push(urlFileStack.row().newEntry(new byte[][] { (list.removeFirst()).getBytes() }));} catch (IOException e) {e.printStackTrace();}@@ -312,11 +312,11 @@ public class Balancer {private void flushAllRamStack() throws IOException {// this flushes only the ramStack to the fileStack, but does not flush the domainStacksfor (int i = 0; i < urlRAMStack.size() / 2; i++) {- urlFileStack.push(urlFileStack.row().newEntry(new byte[][]{((String) urlRAMStack.get(i)).getBytes()}));- urlFileStack.push(urlFileStack.row().newEntry(new byte[][]{((String) urlRAMStack.get(urlRAMStack.size() - i - 1)).getBytes()}));+ urlFileStack.push(urlFileStack.row().newEntry(new byte[][]{(urlRAMStack.get(i)).getBytes()}));+ urlFileStack.push(urlFileStack.row().newEntry(new byte[][]{(urlRAMStack.get(urlRAMStack.size() - i - 1)).getBytes()}));}if (urlRAMStack.size() % 2 == 1)- urlFileStack.push(urlFileStack.row().newEntry(new byte[][]{((String) urlRAMStack.get(urlRAMStack.size() / 2)).getBytes()}));+ urlFileStack.push(urlFileStack.row().newEntry(new byte[][]{(urlRAMStack.get(urlRAMStack.size() / 2)).getBytes()}));}public synchronized void push(CrawlEntry entry) throws IOException {@@ -358,7 +358,7 @@ public class Balancer {// 1st: check ramStackif (urlRAMStack.size() > 0) {- result = (String) urlRAMStack.remove(0);+ result = urlRAMStack.remove(0);}// 2nd-a: check domainStacks for latest arrivals@@ -374,12 +374,12 @@ public class Balancer {LinkedList<String> domlist;while (i.hasNext()) {entry = i.next();- domhash = (String) entry.getKey();+ domhash = entry.getKey();delta = lastAccessDelta(domhash);if (delta == Integer.MAX_VALUE) {// a brand new domain - we take itdomlist = entry.getValue();- result = (String) domlist.removeFirst();+ result = domlist.removeFirst();if (domlist.size() == 0) i.remove();break;}@@ -391,7 +391,7 @@ public class Balancer {if (maxdelta > maximumAge) {// success - we found an entry from a domain that has not been used for a long timedomlist = domainStacks.get(maxhash);- result = (String) domlist.removeFirst();+ result = domlist.removeFirst();if (domlist.size() == 0) domainStacks.remove(maxhash);}}@@ -420,12 +420,12 @@ public class Balancer {long delta;String maxhash = null;while (hitlist.size() > 0) {- domhash = (String) hitlist.remove(hitlist.lastKey());+ domhash = hitlist.remove(hitlist.lastKey());if (maxhash == null) maxhash = domhash; // remember first entrydelta = lastAccessDelta(domhash);if (delta > minimumGlobalDelta) {domlist = domainStacks.get(domhash);- result = (String) domlist.removeFirst();+ result = domlist.removeFirst();if (domlist.size() == 0) domainStacks.remove(domhash);break;}@@ -434,7 +434,7 @@ public class Balancer {// if we did yet not choose any entry, we simply take that one with the most entriesif ((result == null) && (maxhash != null)) {domlist = domainStacks.get(maxhash);- result = (String) domlist.removeFirst();+ result = domlist.removeFirst();if (domlist.size() == 0) domainStacks.remove(maxhash);}}@@ -532,7 +532,7 @@ public class Balancer {}}if (dist >= urlRAMStack.size()) return null;- String urlhash = (String) urlRAMStack.get(dist);+ String urlhash = urlRAMStack.get(dist);kelondroRow.Entry entry = urlFileIndex.get(urlhash.getBytes());if (entry == null) {if (kelondroAbstractRecords.debugmode) serverLog.logWarning("PLASMA BALANCER", "no entry in index for urlhash " + urlhash);@@ -558,7 +558,7 @@ public class Balancer {}public CrawlEntry next() {- kelondroRow.Entry entry = (kelondroRow.Entry) rowIterator.next();+ kelondroRow.Entry entry = rowIterator.next();try {return (entry == null) ? null : new CrawlEntry(entry);} catch (IOException e) {diff --git a/source/de/anomic/crawler/CrawlProfile.java b/source/de/anomic/crawler/CrawlProfile.javaindex 52fa0c161..6d6a955e2 100644--- a/source/de/anomic/crawler/CrawlProfile.java+++ b/source/de/anomic/crawler/CrawlProfile.java@@ -116,7 +116,7 @@ public class CrawlProfile {}public entry next() {try {- lastkey = (String) handleIterator.next();+ lastkey = handleIterator.next();return getEntry(lastkey);} catch (kelondroException e) {clear();@@ -301,7 +301,7 @@ public class CrawlProfile {public entry(HashMap<String, String> mem) {this.mem = mem;- this.doms = (HashMap<String, DomProfile>) domsCache.get(this.mem.get(HANDLE));+ this.doms = domsCache.get(this.mem.get(HANDLE));if (this.doms == null) this.doms = new HashMap<String, DomProfile>();}@@ -309,27 +309,27 @@ public class CrawlProfile {return mem;}public String handle() {- String r = (String) mem.get(HANDLE);+ String r = mem.get(HANDLE);if (r == null) return null; else return r;}public String name() {- String r = (String) mem.get(NAME);+ String r = mem.get(NAME);if (r == null) return ""; else return r;}public String startURL() {- String r = (String) mem.get(START_URL);+ String r = mem.get(START_URL);if (r == null) return null; else return r;}public String generalFilter() {- String r = (String) mem.get(GENERAL_FILTER);+ String r = mem.get(GENERAL_FILTER);if (r == null) return ".*"; else return r;}public String specificFilter() {- String r = (String) mem.get(SPECIFIC_FILTER);+ String r = mem.get(SPECIFIC_FILTER);if (r == null) return ".*"; else return r;}public int generalDepth() {- String r = (String) mem.get(GENERAL_DEPTH);+ String r = mem.get(GENERAL_DEPTH);if (r == null) return 0; else try {return Integer.parseInt(r);} catch (NumberFormatException e) {@@ -337,7 +337,7 @@ public class CrawlProfile {}}public int specificDepth() {- String r = (String) mem.get(SPECIFIC_DEPTH);+ String r = mem.get(SPECIFIC_DEPTH);if (r == null) return 0; else try {return Integer.parseInt(r);} catch (NumberFormatException e) {@@ -347,7 +347,7 @@ public class CrawlProfile {public long recrawlIfOlder() {// returns a long (millis) that is the minimum age that// an antry must have to be re-crawled- String r = (String) mem.get(RECRAWL_IF_OLDER);+ String r = mem.get(RECRAWL_IF_OLDER);if (r == null) return Long.MAX_VALUE; else try {long l = Long.parseLong(r) * 60000L;return (l < 0) ? Long.MAX_VALUE : l;@@ -359,7 +359,7 @@ public class CrawlProfile {// if the depth is equal or less to this depth,// then the current url feeds with its domain the crawl filter// if this is -1, all domains are feeded- String r = (String) mem.get(DOM_FILTER_DEPTH);+ String r = mem.get(DOM_FILTER_DEPTH);if (r == null) return Integer.MAX_VALUE; else try {int i = Integer.parseInt(r);if (i < 0) return Integer.MAX_VALUE;@@ -371,7 +371,7 @@ public class CrawlProfile {public int domMaxPages() {// this is the maximum number of pages that are crawled for a single domain// if -1, this means no limit- String r = (String) mem.get(DOM_MAX_PAGES);+ String r = mem.get(DOM_MAX_PAGES);if (r == null) return Integer.MAX_VALUE; else try {int i = Integer.parseInt(r);if (i < 0) return Integer.MAX_VALUE;@@ -381,44 +381,44 @@ public class CrawlProfile {}}public boolean crawlingQ() {- String r = (String) mem.get(CRAWLING_Q);+ String r = mem.get(CRAWLING_Q);if (r == null) return false; else return (r.equals(Boolean.TRUE.toString()));}public boolean indexText() {- String r = (String) mem.get(INDEX_TEXT);+ String r = mem.get(INDEX_TEXT);if (r == null) return true; else return (r.equals(Boolean.TRUE.toString()));}public boolean indexMedia() {- String r = (String) mem.get(INDEX_MEDIA);+ String r = mem.get(INDEX_MEDIA);if (r == null) return true; else return (r.equals(Boolean.TRUE.toString()));}public boolean storeHTCache() {- String r = (String) mem.get(STORE_HTCACHE);+ String r = mem.get(STORE_HTCACHE);if (r == null) return false; else return (r.equals(Boolean.TRUE.toString()));}public boolean storeTXCache() {- String r = (String) mem.get(STORE_TXCACHE);+ String r = mem.get(STORE_TXCACHE);if (r == null) return false; else return (r.equals(Boolean.TRUE.toString()));}public boolean remoteIndexing() {- String r = (String) mem.get(REMOTE_INDEXING);+ String r = mem.get(REMOTE_INDEXING);if (r == null) return false; else return (r.equals(Boolean.TRUE.toString()));}public boolean excludeStaticStopwords() {- String r = (String) mem.get(XSSTOPW);+ String r = mem.get(XSSTOPW);if (r == null) return false; else return (r.equals(Boolean.TRUE.toString()));}public boolean excludeDynamicStopwords() {- String r = (String) mem.get(XDSTOPW);+ String r = mem.get(XDSTOPW);if (r == null) return false; else return (r.equals(Boolean.TRUE.toString()));}public boolean excludeParentStopwords() {- String r = (String) mem.get(XPSTOPW);+ String r = mem.get(XPSTOPW);if (r == null) return false; else return (r.equals(Boolean.TRUE.toString()));}public void domInc(String domain, String referrer, int depth) {synchronized (domain.intern()) {- DomProfile dp = (DomProfile) doms.get(domain);+ DomProfile dp = doms.get(domain);if (dp == null) {// new domaindoms.put(domain, new DomProfile(referrer, depth));@@ -434,7 +434,7 @@ public class CrawlProfile {int max = domFilterDepth();if (max == Integer.MAX_VALUE) return true;synchronized (domain.intern()) {- DomProfile dp = (DomProfile) doms.get(domain);+ DomProfile dp = doms.get(domain);if (dp == null) {return 0 < max;} else {@@ -447,7 +447,7 @@ public class CrawlProfile {int max = domMaxPages();if (max == Integer.MAX_VALUE) return true;synchronized (domain.intern()) {- DomProfile dp = (DomProfile) doms.get(domain);+ DomProfile dp = doms.get(domain);if (dp == null) {return 0 < max;} else {diff --git a/source/de/anomic/crawler/CrawlQueues.java b/source/de/anomic/crawler/CrawlQueues.javaindex 6f07e071b..135fd4e4a 100644--- a/source/de/anomic/crawler/CrawlQueues.java+++ b/source/de/anomic/crawler/CrawlQueues.java@@ -198,7 +198,7 @@ public class CrawlQueues {}// if crawling was paused we have to wait until we wer notified to continue- Object[] status = (Object[]) sb.crawlJobsStatus.get(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL);+ Object[] status = sb.crawlJobsStatus.get(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL);synchronized(status[plasmaSwitchboard.CRAWLJOB_SYNC]) {if (((Boolean)status[plasmaSwitchboard.CRAWLJOB_STATUS]).booleanValue()) {try {@@ -299,7 +299,7 @@ public class CrawlQueues {seed = null;String hash = null;while ((seed == null) && (remoteCrawlProviderHashes.size() > 0)) {- hash = (String) remoteCrawlProviderHashes.remove(remoteCrawlProviderHashes.size() - 1);+ hash = remoteCrawlProviderHashes.remove(remoteCrawlProviderHashes.size() - 1);if (hash == null) continue;seed = sb.webIndex.seedDB.get(hash);if (seed == null) continue;@@ -344,19 +344,27 @@ public class CrawlQueues {if (reasonString == null) {// done- log.logInfo("crawlOrder: added remote crawl url: " + url.toNormalform(true, false));+ log.logInfo("crawlOrder: added remote crawl url: " + urlToString(url));} else if (reasonString.startsWith("double")) {// case where we have already the url loaded;- log.logInfo("crawlOrder: ignored double remote crawl url: " + url.toNormalform(true, false));+ log.logInfo("crawlOrder: ignored double remote crawl url: " + urlToString(url));} else {- log.logInfo("crawlOrder: ignored [" + reasonString + "] remote crawl url: " + url.toNormalform(true, false));+ log.logInfo("crawlOrder: ignored [" + reasonString + "] remote crawl url: " + urlToString(url));}} else {- log.logWarning("crawlOrder: Rejected URL '" + url.toNormalform(true, false) + "': " + urlRejectReason);+ log.logWarning("crawlOrder: Rejected URL '" + urlToString(url) + "': " + urlRejectReason);}}return true;}++ /**+ * @param url+ * @return+ */+ private String urlToString(yacyURL url) {+ return (url == null ? "null" : url.toNormalform(true, false));+ }public int limitCrawlJobSize() {return noticeURL.stackSize(NoticedURL.STACK_TYPE_LIMIT);@@ -389,7 +397,7 @@ public class CrawlQueues {}// if crawling was paused we have to wait until we wer notified to continue- Object[] status = (Object[]) sb.crawlJobsStatus.get(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL);+ Object[] status = sb.crawlJobsStatus.get(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL);synchronized(status[plasmaSwitchboard.CRAWLJOB_SYNC]) {if (((Boolean)status[plasmaSwitchboard.CRAWLJOB_STATUS]).booleanValue()) {try {diff --git a/source/de/anomic/crawler/CrawlStacker.java b/source/de/anomic/crawler/CrawlStacker.javaindex 767acc824..ba2ea7c49 100644--- a/source/de/anomic/crawler/CrawlStacker.java+++ b/source/de/anomic/crawler/CrawlStacker.java@@ -114,7 +114,7 @@ public final class CrawlStacker extends Thread {Iterator<kelondroRow.Entry> rows = this.urlEntryCache.rows(true, null);kelondroRow.Entry entry;while (rows.hasNext()) {- entry = (kelondroRow.Entry) rows.next();+ entry = rows.next();if (entry == null) {System.out.println("ERROR! null element found");continue;@@ -149,7 +149,7 @@ public final class CrawlStacker extends Thread {while (!Thread.currentThread().isInterrupted()) { // action loopif (dnsfetchHosts.size() == 0) synchronized (this) { wait(); }synchronized (dnsfetchHosts) {- nextHost = (String) dnsfetchHosts.remove(dnsfetchHosts.size() - 1);+ nextHost = dnsfetchHosts.remove(dnsfetchHosts.size() - 1);}try {serverDomains.dnsResolve(nextHost);@@ -344,7 +344,7 @@ public final class CrawlStacker extends Thread {String urlHash = null;kelondroRow.Entry entry = null;synchronized (this.urlEntryHashCache) {- urlHash = (String) this.urlEntryHashCache.removeFirst();+ urlHash = this.urlEntryHashCache.removeFirst();if (urlHash == null) throw new IOException("urlHash is null");entry = this.urlEntryCache.remove(urlHash.getBytes(), false);}@@ -411,10 +411,10 @@ public final class CrawlStacker extends Thread {String errorMsg = "LOST PROFILE HANDLE '" + entry.profileHandle() + "' for URL " + entry.url();log.logWarning(errorMsg);return errorMsg;- }+ } else {// filter deny- if ((entry.depth() > 0) && (profile != null) && (!(entry.url().toString().matches(profile.generalFilter())))) {+ if ((entry.depth() > 0) && (!(entry.url().toString().matches(profile.generalFilter())))) {reason = ErrorURL.DENIED_URL_DOES_NOT_MATCH_FILTER;if (this.log.isFine()) this.log.logFine("URL '" + entry.url().toString() + "' does not match crawling filter '" + profile.generalFilter() + "'. " +@@ -432,7 +432,7 @@ public final class CrawlStacker extends Thread {}// deny post properties- if ((entry.url().isPOST()) && (profile != null) && (!(profile.crawlingQ()))) {+ if (entry.url().isPOST() && !(profile.crawlingQ())) {reason = ErrorURL.DENIED_POST_URL;if (this.log.isFine()) this.log.logFine("URL '" + entry.url().toString() + "' is post URL. " +@@ -480,7 +480,7 @@ public final class CrawlStacker extends Thread {}// show potential re-crawl- if (recrawl) {+ if (recrawl && oldEntry != null) {if (this.log.isFine()) this.log.logFine("RE-CRAWL of URL '" + entry.url().toString() + "': this url was crawled " +((System.currentTimeMillis() - oldEntry.loaddate().getTime()) / 60000 / 60 / 24) + " days ago.");}@@ -488,7 +488,6 @@ public final class CrawlStacker extends Thread {// store informationboolean local = entry.initiator().equals(sb.webIndex.seedDB.mySeed().hash);boolean global =- (profile != null) &&(profile.remoteIndexing()) /* granted */ &&(entry.depth() == profile.generalDepth()) /* leaf node */ &&//(initiatorHash.equals(yacyCore.seedDB.mySeed.hash)) /* not proxy */ &&@@ -497,7 +496,7 @@ public final class CrawlStacker extends Thread {(sb.webIndex.seedDB.mySeed().isPrincipal())) /* qualified */;- if ((!local)&&(!global)&&(!profile.handle().equals(this.sb.webIndex.defaultRemoteProfile.handle()))) {+ if (!local && !global && !profile.handle().equals(this.sb.webIndex.defaultRemoteProfile.handle())) {this.log.logSevere("URL '" + entry.url().toString() + "' can neither be crawled local nor global.");}@@ -507,6 +506,7 @@ public final class CrawlStacker extends Thread {((local) ? NoticedURL.STACK_TYPE_CORE : NoticedURL.STACK_TYPE_REMOTE)) /*local/remote stack*/,entry);return null;+ }}}diff --git a/source/de/anomic/crawler/HTTPLoader.java b/source/de/anomic/crawler/HTTPLoader.javaindex d23392352..9bd3e354a 100644--- a/source/de/anomic/crawler/HTTPLoader.java+++ b/source/de/anomic/crawler/HTTPLoader.java@@ -226,7 +226,7 @@ public final class HTTPLoader {}// we write the new cache entry to file system directly- ((JakartaCommonsHttpResponse)res).setAccountingName("CRAWLER");+ (res).setAccountingName("CRAWLER");byte[] responseBody = res.getData();fos.write(responseBody);htCache.setCacheArray(responseBody);@@ -256,7 +256,7 @@ public final class HTTPLoader {} else if (res.getStatusLine().startsWith("30")) {if (res.getResponseHeader().containsKey(httpHeader.LOCATION)) {// getting redirection URL- String redirectionUrlString = (String) res.getResponseHeader().get(httpHeader.LOCATION);+ String redirectionUrlString = res.getResponseHeader().get(httpHeader.LOCATION);redirectionUrlString = redirectionUrlString.trim();if (redirectionUrlString.length() == 0) {diff --git a/source/de/anomic/crawler/ImporterManager.java b/source/de/anomic/crawler/ImporterManager.javaindex ce5a8ac1c..c97550b57 100644--- a/source/de/anomic/crawler/ImporterManager.java+++ b/source/de/anomic/crawler/ImporterManager.java@@ -33,7 +33,7 @@ public class ImporterManager {}public Importer[] getFinishedImporter() {- return (Importer[]) this.finishedJobs.toArray(new Importer[this.finishedJobs.size()]);+ return this.finishedJobs.toArray(new Importer[this.finishedJobs.size()]);}public Importer getImporterByID(int jobID) {diff --git a/source/de/anomic/crawler/IndexingStack.java b/source/de/anomic/crawler/IndexingStack.javaindex 7e0d5e0b4..1508f2a12 100644--- a/source/de/anomic/crawler/IndexingStack.java+++ b/source/de/anomic/crawler/IndexingStack.java@@ -100,7 +100,7 @@ public class IndexingStack {kelondroBase64Order.enhancedCoder.encodeLong((entry.ifModifiedSince == null) ? 0 : entry.ifModifiedSince.getTime(), 11).getBytes(),new byte[]{entry.flags},(entry.initiator == null) ? "".getBytes() : entry.initiator.getBytes(),- kelondroBase64Order.enhancedCoder.encodeLong((long) entry.depth, rowdef.width(5)).getBytes(),+ kelondroBase64Order.enhancedCoder.encodeLong(entry.depth, rowdef.width(5)).getBytes(),(entry.profileHandle == null) ? "".getBytes() : entry.profileHandle.getBytes(),(entry.anchorName == null) ? "-".getBytes("UTF-8") : entry.anchorName.getBytes("UTF-8")}));@@ -118,7 +118,7 @@ public class IndexingStack {kelondroRow.Entry rowentry;QueueEntry entry;while (i.hasNext()) {- rowentry = (kelondroRow.Entry) i.next();+ rowentry = i.next();entry = new QueueEntry(rowentry);if (entry.urlHash().equals(urlHash)) {i.remove();@@ -167,7 +167,7 @@ public class IndexingStack {}public QueueEntry next() {- return new QueueEntry((kelondroRow.Entry) rows.next());+ return new QueueEntry(rows.next());}public void remove() {diff --git a/source/de/anomic/crawler/NoticedURL.java b/source/de/anomic/crawler/NoticedURL.javaindex 57e612ed4..0d2c8c67f 100755--- a/source/de/anomic/crawler/NoticedURL.java+++ b/source/de/anomic/crawler/NoticedURL.java@@ -49,8 +49,6 @@ import java.util.ArrayList;import java.util.HashSet;import java.util.Iterator;-import de.anomic.crawler.Balancer;-import de.anomic.crawler.CrawlEntry;import de.anomic.server.logging.serverLog;public class NoticedURL {@@ -255,7 +253,7 @@ public class NoticedURL {break;}}- return (CrawlEntry[]) list.toArray(new CrawlEntry[list.size()]);+ return list.toArray(new CrawlEntry[list.size()]);}public Iterator<CrawlEntry> iterator(int stackType) {diff --git a/source/de/anomic/crawler/ResultURLs.java b/source/de/anomic/crawler/ResultURLs.javaindex fb26a2cea..09d8fb537 100644--- a/source/de/anomic/crawler/ResultURLs.java+++ b/source/de/anomic/crawler/ResultURLs.java@@ -118,36 +118,36 @@ public final class ResultURLs {public synchronized String getUrlHash(int stack, int pos) {switch (stack) {- case 1: return ((String) externResultStack.get(pos)).substring(0, yacySeedDB.commonHashLength);- case 2: return ((String) searchResultStack.get(pos)).substring(0, yacySeedDB.commonHashLength);- case 3: return ((String) transfResultStack.get(pos)).substring(0, yacySeedDB.commonHashLength);- case 4: return ((String) proxyResultStack.get(pos)).substring(0, yacySeedDB.commonHashLength);- case 5: return ((String) lcrawlResultStack.get(pos)).substring(0, yacySeedDB.commonHashLength);- case 6: return ((String) gcrawlResultStack.get(pos)).substring(0, yacySeedDB.commonHashLength);+ case 1: return (externResultStack.get(pos)).substring(0, yacySeedDB.commonHashLength);+ case 2: return (searchResultStack.get(pos)).substring(0, yacySeedDB.commonHashLength);+ case 3: return (transfResultStack.get(pos)).substring(0, yacySeedDB.commonHashLength);+ case 4: return (proxyResultStack.get(pos)).substring(0, yacySeedDB.commonHashLength);+ case 5: return (lcrawlResultStack.get(pos)).substring(0, yacySeedDB.commonHashLength);+ case 6: return (gcrawlResultStack.get(pos)).substring(0, yacySeedDB.commonHashLength);}return null;}public synchronized String getInitiatorHash(int stack, int pos) {switch (stack) {- case 1: return ((String) externResultStack.get(pos)).substring(yacySeedDB.commonHashLength, yacySeedDB.commonHashLength * 2);- case 2: return ((String) searchResultStack.get(pos)).substring(yacySeedDB.commonHashLength, yacySeedDB.commonHashLength * 2);- case 3: return ((String) transfResultStack.get(pos)).substring(yacySeedDB.commonHashLength, yacySeedDB.commonHashLength * 2);- case 4: return ((String) proxyResultStack.get(pos)).substring(yacySeedDB.commonHashLength, yacySeedDB.commonHashLength * 2);- case 5: return ((String) lcrawlResultStack.get(pos)).substring(yacySeedDB.commonHashLength, yacySeedDB.commonHashLength * 2);- case 6: return ((String) gcrawlResultStack.get(pos)).substring(yacySeedDB.commonHashLength, yacySeedDB.commonHashLength * 2);+ case 1: return (externResultStack.get(pos)).substring(yacySeedDB.commonHashLength, yacySeedDB.commonHashLength * 2);+ case 2: return (searchResultStack.get(pos)).substring(yacySeedDB.commonHashLength, yacySeedDB.commonHashLength * 2);+ case 3: return (transfResultStack.get(pos)).substring(yacySeedDB.commonHashLength, yacySeedDB.commonHashLength * 2);+ case 4: return (proxyResultStack.get(pos)).substring(yacySeedDB.commonHashLength, yacySeedDB.commonHashLength * 2);+ case 5: return (lcrawlResultStack.get(pos)).substring(yacySeedDB.commonHashLength, yacySeedDB.commonHashLength * 2);+ case 6: return (gcrawlResultStack.get(pos)).substring(yacySeedDB.commonHashLength, yacySeedDB.commonHashLength * 2);}return null;}public synchronized String getExecutorHash(int stack, int pos) {switch (stack) {- case 1: return ((String) externResultStack.get(pos)).substring(yacySeedDB.commonHashLength * 2, yacySeedDB.commonHashLength * 3);- case 2: return ((String) searchResultStack.get(pos)).substring(yacySeedDB.commonHashLength * 2, yacySeedDB.commonHashLength * 3);- case 3: return ((String) transfResultStack.get(pos)).substring(yacySeedDB.commonHashLength * 2, yacySeedDB.commonHashLength * 3);- case 4: return ((String) proxyResultStack.get(pos)).substring(yacySeedDB.commonHashLength * 2, yacySeedDB.commonHashLength * 3);- case 5: return ((String) lcrawlResultStack.get(pos)).substring(yacySeedDB.commonHashLength * 2, yacySeedDB.commonHashLength * 3);- case 6: return ((String) gcrawlResultStack.get(pos)).substring(yacySeedDB.commonHashLength * 2, yacySeedDB.commonHashLength * 3);+ case 1: return (externResultStack.get(pos)).substring(yacySeedDB.commonHashLength * 2, yacySeedDB.commonHashLength * 3);+ case 2: return (searchResultStack.get(pos)).substring(yacySeedDB.commonHashLength * 2, yacySeedDB.commonHashLength * 3);+ case 3: return (transfResultStack.get(pos)).substring(yacySeedDB.commonHashLength * 2, yacySeedDB.commonHashLength * 3);+ case 4: return (proxyResultStack.get(pos)).substring(yacySeedDB.commonHashLength * 2, yacySeedDB.commonHashLength * 3);+ case 5: return (lcrawlResultStack.get(pos)).substring(yacySeedDB.commonHashLength * 2, yacySeedDB.commonHashLength * 3);+ case 6: return (gcrawlResultStack.get(pos)).substring(yacySeedDB.commonHashLength * 2, yacySeedDB.commonHashLength * 3);}return null;}diff --git a/source/de/anomic/crawler/RobotsTxt.java b/source/de/anomic/crawler/RobotsTxt.javaindex bf9fe5d1e..f40a4d6e6 100644--- a/source/de/anomic/crawler/RobotsTxt.java+++ b/source/de/anomic/crawler/RobotsTxt.java@@ -158,7 +158,7 @@ public class RobotsTxt {if (this.mem.containsKey(DISALLOW_PATH_LIST)) {this.disallowPathList = new LinkedList<String>();- String csPl = (String) this.mem.get(DISALLOW_PATH_LIST);+ String csPl = this.mem.get(DISALLOW_PATH_LIST);if (csPl.length() > 0){String[] pathArray = csPl.split(ROBOTS_DB_PATH_SEPARATOR);if ((pathArray != null)&&(pathArray.length > 0)) {@@ -221,7 +221,7 @@ public class RobotsTxt {public Date getLoadedDate() {if (this.mem.containsKey(LOADED_DATE)) {- return new Date(Long.valueOf((String) this.mem.get(LOADED_DATE)).longValue());+ return new Date(Long.valueOf(this.mem.get(LOADED_DATE)).longValue());}return null;}@@ -234,21 +234,21 @@ public class RobotsTxt {public Date getModDate() {if (this.mem.containsKey(MOD_DATE)) {- return new Date(Long.valueOf((String) this.mem.get(MOD_DATE)).longValue());+ return new Date(Long.valueOf(this.mem.get(MOD_DATE)).longValue());}return null;}public String getETag() {if (this.mem.containsKey(ETAG)) {- return (String) this.mem.get(ETAG);+ return this.mem.get(ETAG);}return null;}public Integer getCrawlDelay() {if (this.mem.containsKey(CRAWL_DELAY)) {- return Integer.valueOf((String)this.mem.get(CRAWL_DELAY));+ return Integer.valueOf(this.mem.get(CRAWL_DELAY));}return null;}diff --git a/source/de/anomic/crawler/ZURL.java b/source/de/anomic/crawler/ZURL.javaindex 20242f745..1821fa34d 100755--- a/source/de/anomic/crawler/ZURL.java+++ b/source/de/anomic/crawler/ZURL.java@@ -32,7 +32,6 @@ import java.util.Date;import java.util.Iterator;import java.util.LinkedList;-import de.anomic.crawler.CrawlEntry;import de.anomic.kelondro.kelondroBase64Order;import de.anomic.kelondro.kelondroEcoTable;import de.anomic.kelondro.kelondroFlexWidthArray;@@ -124,7 +123,7 @@ public class ZURL {String urlhash;synchronized (stack) {if (pos >= stack.size()) return null;- urlhash = (String) stack.get(pos);+ urlhash = stack.get(pos);}if (urlhash == null) return null;return getEntry(urlhash);@@ -261,7 +260,7 @@ public class ZURL {}public Entry next() throws RuntimeException {- kelondroRow.Entry e = (kelondroRow.Entry) i.next();+ kelondroRow.Entry e = i.next();if (e == null) return null;try {return new Entry(e);diff --git a/source/de/anomic/data/SitemapParser.java b/source/de/anomic/data/SitemapParser.javaindex daa586987..eb1e1cba3 100644--- a/source/de/anomic/data/SitemapParser.java+++ b/source/de/anomic/data/SitemapParser.java@@ -53,7 +53,6 @@ import java.util.zip.GZIPInputStream;import javax.xml.parsers.SAXParser;import javax.xml.parsers.SAXParserFactory;-import org.apache.commons.httpclient.protocol.Protocol;import org.xml.sax.Attributes;import org.xml.sax.SAXException;import org.xml.sax.helpers.DefaultHandler;diff --git a/source/de/anomic/data/blogBoard.java b/source/de/anomic/data/blogBoard.javaindex a2121d56c..8d1ee892a 100644--- a/source/de/anomic/data/blogBoard.java+++ b/source/de/anomic/data/blogBoard.java@@ -264,7 +264,7 @@ public class blogBoard {Iterator<BlogEntry> iterator = blogIterator(true);BlogEntry blogEntry;while(iterator.hasNext()){- blogEntry=(BlogEntry)iterator.next();+ blogEntry=iterator.next();if(priv || blogEntry.isPublic()){set.add(blogEntry.getKey());}@@ -300,7 +300,7 @@ public class blogBoard {public BlogEntry next() {try {- return readBlogEntry((String) this.blogIter.next());+ return readBlogEntry(this.blogIter.next());} catch (kelondroException e) {//resetDatabase();return null;diff --git a/source/de/anomic/data/blogBoardComments.java b/source/de/anomic/data/blogBoardComments.javaindex 180d6ce79..d7fe72a20 100644--- a/source/de/anomic/data/blogBoardComments.java+++ b/source/de/anomic/data/blogBoardComments.java@@ -261,7 +261,7 @@ public class blogBoardComments {record.put("subject", kelondroBase64Order.enhancedCoder.encode(subject));}public byte[] getSubject() {- String subject = (String) record.get("subject");+ String subject = record.get("subject");if (subject == null) return new byte[0];byte[] subject_bytes = kelondroBase64Order.enhancedCoder.decode(subject, "de.anomic.data.blogBoardComments.subject()");if (subject_bytes == null) return "".getBytes();@@ -274,7 +274,7 @@ public class blogBoardComments {}public Date getDate() {try {- String date = (String) record.get("date");+ String date = record.get("date");if (date == null) {serverLog.logFinest("Blog", "ERROR: date field missing in blogBoard");return new Date();@@ -288,7 +288,7 @@ public class blogBoardComments {}public String getTimestamp() {- String timestamp = (String) record.get("date");+ String timestamp = record.get("date");if (timestamp == null) {serverLog.logFinest("Blog", "ERROR: date field missing in blogBoard");return dateString(new Date());@@ -302,7 +302,7 @@ public class blogBoardComments {record.put("author", kelondroBase64Order.enhancedCoder.encode(author));}public byte[] getAuthor() {- String author = (String) record.get("author");+ String author = record.get("author");if (author == null)return new byte[0];byte[] author_byte = kelondroBase64Order.enhancedCoder.decode(author, "de.anomic.data.blogBoardComments.author()");@@ -316,7 +316,7 @@ public class blogBoardComments {record.put("ip", ip);}public String getIp() {- String ip = (String) record.get("ip");+ String ip = record.get("ip");if (ip == null)return "127.0.0.1";return ip;@@ -328,7 +328,7 @@ public class blogBoardComments {record.put("page", kelondroBase64Order.enhancedCoder.encode(page));}public byte[] getPage() {- String page = (String) record.get("page");+ String page = record.get("page");if (page == null)return new byte[0];byte[] page_byte = kelondroBase64Order.enhancedCoder.decode(page, "de.anomic.data.blogBoardComments.page()");diff --git a/source/de/anomic/data/bookmarksDB.java b/source/de/anomic/data/bookmarksDB.javaindex 2488efbda..015782365 100644--- a/source/de/anomic/data/bookmarksDB.java+++ b/source/de/anomic/data/bookmarksDB.java@@ -177,7 +177,7 @@ public class bookmarksDB {}}folders.add("\uffff");- return (Iterator<String>) folders.iterator();+ return folders.iterator();}public static String cleanTagsString(String tagsString){@@ -286,7 +286,7 @@ public class bookmarksDB {Iterator<Bookmark> it=bookmarkIterator(true);Bookmark bm;while(it.hasNext()){- bm=(Bookmark)it.next();+ bm=it.next();if(priv || bm.getPublic()){set.add(bm.getUrlHash());}@@ -424,7 +424,7 @@ public class bookmarksDB {Iterator<Tag> it = tagIterator(true);Tag tag;while(it.hasNext()){- tag=(Tag) it.next();+ tag=it.next();if(priv ||tag.hasPublicItems()){set.add(tag);}@@ -500,7 +500,7 @@ public class bookmarksDB {Tag tag;String[] tags;while(it.hasNext()){- bookmark=(Bookmark) it.next();+ bookmark=it.next();tags = cleanTagsString(bookmark.getTagsString() + bookmark.getFoldersString()).split(",");tag=null;for(int i=0;i<tags.length;i++){@@ -534,7 +534,7 @@ public class bookmarksDB {String date;bookmarksDate bmDate;while(it.hasNext()){- bookmark=(Bookmark) it.next();+ bookmark=it.next();date = (new SimpleDateFormat("yyyy-MM-dd")).format(new Date(bookmark.getTimeStamp()));bmDate=getDate(date);if(bmDate==null){@@ -563,7 +563,7 @@ public class bookmarksDB {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());+ bookmark = getBookmark(it.next());tagsString = bookmark.getTagsString();// Set<String> tags is difficult with case sensitivity, so I tried// Set<String> tags = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER), but it didn't do the trick :-(@@ -616,7 +616,7 @@ public class bookmarksDB {Iterator<yacyURL> it = links.keySet().iterator();while (it.hasNext()) {url= it.next();- title=(String) links.get(url);+ title=links.get(url);serverLog.logInfo("BOOKMARKS", "links.get(url)");if(title.equals("")){//cannot be displayedtitle=url.toString();@@ -905,7 +905,7 @@ public class bookmarksDB {super(map);this.urlHash=urlHash;if(map.containsKey(BOOKMARK_TAGS))- tags=listManager.string2set((String) map.get(BOOKMARK_TAGS));+ tags=listManager.string2set(map.get(BOOKMARK_TAGS));elsetags=new HashSet<String>();loadTimestamp();@@ -954,7 +954,7 @@ public class bookmarksDB {}public Bookmark(kelondroObjectsMapEntry map) throws MalformedURLException {- this((new yacyURL((String)map.map().get(BOOKMARK_URL), null)).hash(), map.map());+ this((new yacyURL(map.map().get(BOOKMARK_URL), null)).hash(), map.map());}Map<String, String> toMap() {@@ -1171,7 +1171,7 @@ public class bookmarksDB {public Bookmark next() {try {- return getBookmark((String) this.bookmarkIter.next());+ return getBookmark(this.bookmarkIter.next());} catch (kelondroException e) {//resetDatabase();return null;diff --git a/source/de/anomic/data/messageBoard.java b/source/de/anomic/data/messageBoard.javaindex da9ad1dc6..70c98384f 100644--- a/source/de/anomic/data/messageBoard.java+++ b/source/de/anomic/data/messageBoard.java@@ -246,7 +246,7 @@ public class messageBoard {public void findNext() {while (allIter.hasNext()) {- nextKey = (String) allIter.next();+ nextKey = allIter.next();if (this.category==null || nextKey.startsWith(this.category)) return;}nextKey = null;diff --git a/source/de/anomic/data/robotsParser.java b/source/de/anomic/data/robotsParser.javaindex 6f405d332..4bff91cc9 100644--- a/source/de/anomic/data/robotsParser.java+++ b/source/de/anomic/data/robotsParser.java@@ -372,7 +372,7 @@ public final class robotsParser{}}- if (robotsTxt4Host.isDisallowed(nexturl.getFile())) {+ if (robotsTxt4Host != null && robotsTxt4Host.isDisallowed(nexturl.getFile())) {return true;}return false;@@ -423,7 +423,7 @@ public final class robotsParser{} else {// getting some metadata- eTag = res.getResponseHeader().containsKey(httpHeader.ETAG)?((String)res.getResponseHeader().get(httpHeader.ETAG)).trim():null;+ eTag = res.getResponseHeader().containsKey(httpHeader.ETAG)?(res.getResponseHeader().get(httpHeader.ETAG)).trim():null;lastMod = res.getResponseHeader().lastModified();// if the robots.txt file was not changed we break here@@ -448,22 +448,22 @@ public final class robotsParser{return null;} else if (res.getStatusLine().startsWith("3")) {// getting redirection URL- String redirectionUrlString = (String) res.getResponseHeader().get(httpHeader.LOCATION);+ String redirectionUrlString = res.getResponseHeader().get(httpHeader.LOCATION);if (redirectionUrlString==null) {serverLog.logFinest("ROBOTS","robots.txt could not be downloaded from URL '" + robotsURL + "' because of missing redirecton header. [" + res.getStatusLine() + "].");robotsTxt = null;- }-- redirectionUrlString = redirectionUrlString.trim();-- // generating the new URL object- yacyURL redirectionUrl = yacyURL.newURL(robotsURL, redirectionUrlString);-- // following the redirection- serverLog.logFinest("ROBOTS","Redirection detected for robots.txt with URL '" + robotsURL + "'." +- "\nRedirecting request to: " + redirectionUrl);- return downloadRobotsTxt(redirectionUrl,redirectionCount,entry);+ } else {+ redirectionUrlString = redirectionUrlString.trim();++ // generating the new URL object+ yacyURL redirectionUrl = yacyURL.newURL(robotsURL, redirectionUrlString);++ // following the redirection+ serverLog.logFinest("ROBOTS","Redirection detected for robots.txt with URL '" + robotsURL + "'." ++ "\nRedirecting request to: " + redirectionUrl);+ return downloadRobotsTxt(redirectionUrl,redirectionCount,entry);+ }} else if (res.getStatusCode() == 401 || res.getStatusCode() == 403) {accessCompletelyRestricted = true;serverLog.logFinest("ROBOTS","Access to Robots.txt not allowed on URL '" + robotsURL + "'.");diff --git a/source/de/anomic/data/translator.java b/source/de/anomic/data/translator.javaindex 00f1fe675..529982b72 100644--- a/source/de/anomic/data/translator.java+++ b/source/de/anomic/data/translator.java@@ -111,7 +111,7 @@ public class translator {String forFile="";while(it.hasNext()){- line = (String)it.next();+ line = it.next();if(! line.startsWith("#")){splitted = line.split("==", 2);if(splitted.length == 2){@@ -191,7 +191,7 @@ public class translator {it=exts.iterator();rightExtension=false;while(it.hasNext()){- if(sourceFiles[i].getName().endsWith((String) it.next())){+ if(sourceFiles[i].getName().endsWith(it.next())){rightExtension=true;break;}diff --git a/source/de/anomic/data/userDB.java b/source/de/anomic/data/userDB.javaindex 1b0c21d50..523ab928b 100644--- a/source/de/anomic/data/userDB.java+++ b/source/de/anomic/data/userDB.java@@ -153,7 +153,7 @@ public final class userDB {return null;}public Entry getUser(httpHeader header){- return getUser((String) header.get(httpHeader.AUTHORIZATION), (String)header.get(httpHeader.CONNECTION_PROP_CLIENTIP), header.getHeaderCookies());+ return getUser(header.get(httpHeader.AUTHORIZATION), header.get(httpHeader.CONNECTION_PROP_CLIENTIP), header.getHeaderCookies());}public Entry getUser(String auth, String ip, String cookies){Entry entry=null;@@ -343,7 +343,7 @@ public final class userDB {if (mem == null) this.mem = new HashMap<String, String>();else this.mem = mem;- if (!mem.containsKey(AUTHENTICATION_METHOD))this.mem.put(AUTHENTICATION_METHOD,"yacy");+ if (mem == null || !mem.containsKey(AUTHENTICATION_METHOD))this.mem.put(AUTHENTICATION_METHOD,"yacy");this.oldDate=Calendar.getInstance();this.newDate=Calendar.getInstance();}@@ -605,7 +605,7 @@ public final class userDB {}public Entry next() {try {- return getEntry((String) this.userIter.next());+ return getEntry(this.userIter.next());} catch (kelondroException e) {resetDatabase();return null;diff --git a/source/de/anomic/data/wiki/knwikiParser.java b/source/de/anomic/data/wiki/knwikiParser.javaindex 3f7271198..80784cb7a 100644--- a/source/de/anomic/data/wiki/knwikiParser.java+++ b/source/de/anomic/data/wiki/knwikiParser.java@@ -165,7 +165,7 @@ public class knwikiParser implements wikiParser {}}r.add("hr");- BEs = (String[])r.toArray(new String[r.size()]);+ BEs = r.toArray(new String[r.size()]);Text[] tt = Text.split2Texts(text, "[=", "=]");for (int i=0; i<tt.length; i+=2)@@ -274,7 +274,7 @@ public class knwikiParser implements wikiParser {escaped = !escaped;}r.add(resolve2Text(text, escaped, (escaped) ? j : (j > 0) ? j + endLen : 0, -1, escapeEnd));- return (Text[])r.toArray(new Text[r.size()]);+ return r.toArray(new Text[r.size()]);}private static Text resolve2Text(String text, boolean escaped, int from, int to, String escapeEnd) {diff --git a/source/de/anomic/data/wiki/tokens/LinkToken.java b/source/de/anomic/data/wiki/tokens/LinkToken.javaindex 8df7397c7..6b15e4d40 100644--- a/source/de/anomic/data/wiki/tokens/LinkToken.java+++ b/source/de/anomic/data/wiki/tokens/LinkToken.java@@ -176,7 +176,7 @@ public class LinkToken extends AbstractToken {if ((hash = it.next()) != null)if ((bm = this.sb.bookmarksDB.getBookmark(hash)) != null)r.add(new Link(bm.getUrl(), bm.getTitle(), bm.getDescription()));- return (Link[]) r.toArray(new Link[r.size()]);+ return r.toArray(new Link[r.size()]);}private static class Link {diff --git a/source/de/anomic/data/wiki/tokens/ListToken.java b/source/de/anomic/data/wiki/tokens/ListToken.javaindex 274665501..073771006 100644--- a/source/de/anomic/data/wiki/tokens/ListToken.java+++ b/source/de/anomic/data/wiki/tokens/ListToken.java@@ -73,7 +73,7 @@ public class ListToken extends AbstractToken {if (this.recursion) r.add(this.listBlockElement);if (this.listElement != null) r.add(this.listElement);}- blockElements = (String[])r.toArray(new String[r.size()]);+ blockElements = r.toArray(new String[r.size()]);}public ListToken(char firstChar, String listBlockElement, String listElement) {@@ -87,7 +87,7 @@ public class ListToken extends AbstractToken {if (this.recursion) r.add(this.listBlockElement);if (this.listElement != null) r.add(this.listElement);}- blockElements = (String[])r.toArray(new String[r.size()]);+ blockElements = r.toArray(new String[r.size()]);}public ListToken(char firstChar, String listBlockElement, String listElement, boolean recursion) {@@ -101,7 +101,7 @@ public class ListToken extends AbstractToken {if (this.recursion) r.add(this.listBlockElement);if (this.listElement != null) r.add(this.listElement);}- blockElements = (String[])r.toArray(new String[r.size()]);+ blockElements = r.toArray(new String[r.size()]);}protected void parse() {diff --git a/source/de/anomic/data/wiki/tokens/SimpleToken.java b/source/de/anomic/data/wiki/tokens/SimpleToken.javaindex faa2a0d60..9413e72cb 100644--- a/source/de/anomic/data/wiki/tokens/SimpleToken.java+++ b/source/de/anomic/data/wiki/tokens/SimpleToken.java@@ -72,7 +72,7 @@ public class SimpleToken extends AbstractToken {if (definitionList[i] != null)for (j = 0; j < definitionList[i].length; j++)r.add(definitionList[i][j]);- this.blockElements = (String[]) r.toArray(new String[r.size()]);+ this.blockElements = r.toArray(new String[r.size()]);} else {this.blockElements = null;}diff --git a/source/de/anomic/data/wiki/tokens/TableToken.java b/source/de/anomic/data/wiki/tokens/TableToken.javaindex 2c9819cbd..54bb8167b 100644--- a/source/de/anomic/data/wiki/tokens/TableToken.java+++ b/source/de/anomic/data/wiki/tokens/TableToken.java@@ -72,6 +72,7 @@ public class TableToken extends AbstractToken {for (int i=1, j, a; i<t.length-1; i++) {if (t[i].startsWith("|-")) {if (trOpen) sb.append("\t</tr>\n");+ // TODO is this assignment correct? (please comment) Or should it be a comparison? (please correct)if (trOpen = (i < t.length - 2)) sb.append("\t<tr>\n");} else if (t[i].startsWith("||")) {tds = t[i].split("\\|\\|");@@ -129,7 +130,7 @@ public class TableToken extends AbstractToken {(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);diff --git a/source/de/anomic/htmlFilter/htmlFilterAbstractScraper.java b/source/de/anomic/htmlFilter/htmlFilterAbstractScraper.javaindex e0bbfeb61..e00cb4466 100644--- a/source/de/anomic/htmlFilter/htmlFilterAbstractScraper.java+++ b/source/de/anomic/htmlFilter/htmlFilterAbstractScraper.java@@ -418,7 +418,7 @@ public abstract class htmlFilterAbstractScraper implements htmlFilterScraper {return new char[] {(char) Integer.parseInt((new String(code)).substring(2, code.length - 1))};}} else {- String t = (String) trans.get(new String(code));+ String t = trans.get(new String(code));if (t == null) return new char[0];return t.toCharArray();}@@ -445,7 +445,7 @@ public abstract class htmlFilterAbstractScraper implements htmlFilterScraper {while ((p0 = bb.indexOf(lb, p0)) >= 0) {p1 = bb.indexOf(rb, p0);if (p1 >= 0) {- bb = ((serverCharBuffer)new serverCharBuffer(bb.getChars(0, p0), bb.length() + p0 - p1 + 1).trim().append(32)).append(new serverCharBuffer(bb.getChars(p1 + 1)).trim());+ bb = (new serverCharBuffer(bb.getChars(0, p0), bb.length() + p0 - p1 + 1).trim().append(32)).append(new serverCharBuffer(bb.getChars(p1 + 1)).trim());} else {bb = new serverCharBuffer(bb.getChars(0, p0), bb.length()).trim().append(new serverCharBuffer(bb.getChars(p0 + 1)).trim());}diff --git a/source/de/anomic/htmlFilter/htmlFilterContentScraper.java b/source/de/anomic/htmlFilter/htmlFilterContentScraper.javaindex ff037033f..69eaaecf1 100644--- a/source/de/anomic/htmlFilter/htmlFilterContentScraper.java+++ b/source/de/anomic/htmlFilter/htmlFilterContentScraper.java@@ -297,7 +297,7 @@ public class htmlFilterContentScraper extends htmlFilterAbstractScraper implemen// construct a title string, even if the document has no title// some documents have a title tag as meta tag- String s = (String) metas.get("title");+ String s = metas.get("title");// try to construct the title with the content of the title tagif (title.length() > 0) {@@ -314,7 +314,7 @@ public class htmlFilterContentScraper extends htmlFilterAbstractScraper implemen// otherwise take any headlinefor (int i = 0; i < 4; i++) {- if (headlines[i].size() > 0) return (String) headlines[i].get(0);+ if (headlines[i].size() > 0) return headlines[i].get(0);}// take description tag@@ -331,7 +331,7 @@ public class htmlFilterContentScraper extends htmlFilterAbstractScraper implemenpublic String[] getHeadlines(int i) {assert ((i >= 1) && (i <= 4));String[] s = new String[headlines[i - 1].size()];- for (int j = 0; j < headlines[i - 1].size(); j++) s[j] = (String) headlines[i - 1].get(j);+ for (int j = 0; j < headlines[i - 1].size(); j++) s[j] = headlines[i - 1].get(j);return s;}@@ -415,7 +415,7 @@ public class htmlFilterContentScraper extends htmlFilterAbstractScraper implemen}public int getRefreshSeconds() {- String s = (String) metas.get("refresh");+ String s = metas.get("refresh");if (s == null) return 9999; else try {int pos = s.indexOf(';');if (pos < 0) return 9999;@@ -427,7 +427,7 @@ public class htmlFilterContentScraper extends htmlFilterAbstractScraper implemen}public String getRefreshPath() {- String s = (String) metas.get("refresh");+ String s = metas.get("refresh");if (s == null) return ""; else {int pos = s.indexOf(';');if (pos < 0) return "";diff --git a/source/de/anomic/htmlFilter/htmlFilterContentTransformer.java b/source/de/anomic/htmlFilter/htmlFilterContentTransformer.javaindex 7a5e20c4a..5186d8cba 100644--- a/source/de/anomic/htmlFilter/htmlFilterContentTransformer.java+++ b/source/de/anomic/htmlFilter/htmlFilterContentTransformer.java@@ -120,7 +120,7 @@ public class htmlFilterContentTransformer extends htmlFilterAbstractTransformerif (text == null || bluelist == null) return false;String lc = new String(text).toLowerCase();for (int i = 0; i < bluelist.size(); i++) {- if (lc.indexOf((String) bluelist.get(i)) >= 0) return true;+ if (lc.indexOf(bluelist.get(i)) >= 0) return true;}return false;}diff --git a/source/de/anomic/htmlFilter/htmlFilterImageEntry.java b/source/de/anomic/htmlFilter/htmlFilterImageEntry.javaindex bb0631902..7e861c0a5 100644--- a/source/de/anomic/htmlFilter/htmlFilterImageEntry.java+++ b/source/de/anomic/htmlFilter/htmlFilterImageEntry.java@@ -92,12 +92,12 @@ public class htmlFilterImageEntry implements Comparable<htmlFilterImageEntry> {// assuming that hashCode would return a 'perfect hash' this method would// create a total ordering on images with respect on the image sizeassert (url != null);- if (this.url.toNormalform(true, true).equals(((htmlFilterImageEntry) h).url.toNormalform(true, true))) return 0;+ if (this.url.toNormalform(true, true).equals((h).url.toNormalform(true, true))) return 0;int thc = this.hashCode();- int ohc = ((htmlFilterImageEntry) h).hashCode();+ int ohc = (h).hashCode();if (thc < ohc) return -1;if (thc > ohc) return 1;- return this.url.toString().compareTo(((htmlFilterImageEntry) h).url.toString());+ return this.url.toString().compareTo((h).url.toString());}public boolean equals(htmlFilterImageEntry o) {diff --git a/source/de/anomic/http/EasySSLProtocolSocketFactory.java b/source/de/anomic/http/EasySSLProtocolSocketFactory.javaindex b3479971e..334d0c516 100644--- a/source/de/anomic/http/EasySSLProtocolSocketFactory.java+++ b/source/de/anomic/http/EasySSLProtocolSocketFactory.java@@ -41,17 +41,17 @@ import java.net.Socket;import java.net.SocketAddress;import java.net.UnknownHostException;+import javax.net.SocketFactory;+import javax.net.ssl.SSLContext;+import javax.net.ssl.TrustManager;+import org.apache.commons.httpclient.ConnectTimeoutException;import org.apache.commons.httpclient.HttpClientError;import org.apache.commons.httpclient.params.HttpConnectionParams;import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory;-import org.apache.commons.logging.Log;+import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;-import javax.net.SocketFactory;-import javax.net.ssl.SSLContext;-import javax.net.ssl.TrustManager;-/*** <p>* EasySSLProtocolSocketFactory can be used to creats SSL {@link Socket}sdiff --git a/source/de/anomic/http/EasyX509TrustManager.java b/source/de/anomic/http/EasyX509TrustManager.javaindex 5280f4c03..bd5a8c4d0 100644--- a/source/de/anomic/http/EasyX509TrustManager.java+++ b/source/de/anomic/http/EasyX509TrustManager.java@@ -36,10 +36,11 @@ import java.security.NoSuchAlgorithmException;import java.security.cert.CertificateException;import java.security.cert.X509Certificate;-import javax.net.ssl.TrustManagerFactory;import javax.net.ssl.TrustManager;+import javax.net.ssl.TrustManagerFactory;import javax.net.ssl.X509TrustManager;-import org.apache.commons.logging.Log;++import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;/**diff --git a/source/de/anomic/http/httpHeader.java b/source/de/anomic/http/httpHeader.javaindex 2306ffcea..b7c6cfd67 100644--- a/source/de/anomic/http/httpHeader.java+++ b/source/de/anomic/http/httpHeader.java@@ -364,7 +364,7 @@ public final class httpHeader extends TreeMap<String, String> implements Map<StrString key, value;while (i.hasNext()) {key = i.next();- value = (String) get(key);+ value = get(key);fos.write((key + "=" + value + "\r\n").getBytes());}fos.flush();@@ -388,7 +388,7 @@ public final class httpHeader extends TreeMap<String, String> implements Map<Strprivate Date headerDate(String kind) {if (containsKey(kind)) {- Date parsedDate = serverDate.parseHTTPDate((String) get(kind));+ Date parsedDate = serverDate.parseHTTPDate(get(kind));if (parsedDate == null) parsedDate = new Date();return parsedDate;}@@ -452,7 +452,7 @@ public final class httpHeader extends TreeMap<String, String> implements Map<Strpublic Object ifRange() {if (containsKey(httpHeader.IF_RANGE)) {- Date rangeDate = serverDate.parseHTTPDate((String) get(httpHeader.IF_RANGE));+ Date rangeDate = serverDate.parseHTTPDate(get(httpHeader.IF_RANGE));if (rangeDate != null)return rangeDate;@@ -475,7 +475,7 @@ public final class httpHeader extends TreeMap<String, String> implements Map<Strpublic long contentLength() {if (containsKey(httpHeader.CONTENT_LENGTH)) {try {- return Long.parseLong((String) get(httpHeader.CONTENT_LENGTH));+ return Long.parseLong(get(httpHeader.CONTENT_LENGTH));} catch (NumberFormatException e) {return -1;}@@ -485,12 +485,12 @@ public final class httpHeader extends TreeMap<String, String> implements Map<Strpublic boolean acceptGzip() {return ((containsKey(httpHeader.ACCEPT_ENCODING)) &&- (((String) get(httpHeader.ACCEPT_ENCODING)).toUpperCase().indexOf("GZIP")) != -1);+ ((get(httpHeader.ACCEPT_ENCODING)).toUpperCase().indexOf("GZIP")) != -1);}public boolean gzip() {return ((containsKey(httpHeader.CONTENT_ENCODING)) &&- (((String) get(httpHeader.CONTENT_ENCODING)).toUpperCase().startsWith("GZIP")));+ ((get(httpHeader.CONTENT_ENCODING)).toUpperCase().startsWith("GZIP")));}public static Object[] parseResponseLine(String respLine) {@@ -797,7 +797,7 @@ public final class httpHeader extends TreeMap<String, String> implements Map<Strif (!prop.getProperty(CONNECTION_PROP_HOST).equals(virtualHost)) return;// TODO: we could have problems with connections from extern here ...- String dstHostSocket = (String) header.get(httpHeader.HOST);+ String dstHostSocket = header.get(httpHeader.HOST);prop.setProperty(CONNECTION_PROP_HOST,(httpd.isThisHostName(dstHostSocket)?virtualHost:dstHostSocket));}/*diff --git a/source/de/anomic/http/httpTemplate.java b/source/de/anomic/http/httpTemplate.javaindex e1e30309f..0fadf069f 100644--- a/source/de/anomic/http/httpTemplate.java+++ b/source/de/anomic/http/httpTemplate.java@@ -278,7 +278,7 @@ public final class httpTemplate {String patternKey = getPatternKey(prefix, multi_key);if(pattern.containsKey(patternKey) && pattern.get(patternKey) != null){try{- num=Integer.parseInt((String)pattern.get(patternKey)); // Key contains the iteration number as string+ num=Integer.parseInt(pattern.get(patternKey)); // Key contains the iteration number as string}catch(NumberFormatException e){num=0;}@@ -325,7 +325,7 @@ public final class httpTemplate {byte[] patternName = new byte[0];String patternKey = getPatternKey(prefix, key);if(pattern.containsKey(patternKey) && pattern.get(patternKey) != null){- String patternId=(String)pattern.get(patternKey);+ String patternId=pattern.get(patternKey);try{whichPattern=Integer.parseInt(patternId); //index}catch(NumberFormatException e){diff --git a/source/de/anomic/http/httpd.java b/source/de/anomic/http/httpd.javaindex a865a6427..20cd6e35f 100644--- a/source/de/anomic/http/httpd.java+++ b/source/de/anomic/http/httpd.java@@ -54,7 +54,6 @@ import java.io.PrintStream;import java.io.UnsupportedEncodingException;import java.net.InetAddress;import java.net.MalformedURLException;-import java.net.URLDecoder;import java.net.URLEncoder;import java.util.Arrays;import java.util.Date;diff --git a/source/de/anomic/http/httpdByteCountInputStream.java b/source/de/anomic/http/httpdByteCountInputStream.javaindex 6004f9dec..3802dbd28 100644--- a/source/de/anomic/http/httpdByteCountInputStream.java+++ b/source/de/anomic/http/httpdByteCountInputStream.java@@ -128,7 +128,7 @@ public class httpdByteCountInputStream extends FilterInputStream {public static long getAccountCount(String accountName) {synchronized (syncObject) {if (byteCountInfo.containsKey(accountName)) {- return ((Long)byteCountInfo.get(accountName)).longValue();+ return (byteCountInfo.get(accountName)).longValue();}return 0;}diff --git a/source/de/anomic/http/httpdByteCountOutputStream.java b/source/de/anomic/http/httpdByteCountOutputStream.javaindex 6d502d492..6497ab72c 100644--- a/source/de/anomic/http/httpdByteCountOutputStream.java+++ b/source/de/anomic/http/httpdByteCountOutputStream.java@@ -121,7 +121,7 @@ public class httpdByteCountOutputStream extends BufferedOutputStream {public static long getAccountCount(String accountName) {synchronized (syncObject) {if (byteCountInfo.containsKey(accountName)) {- return ((Long)byteCountInfo.get(accountName)).longValue();+ return (byteCountInfo.get(accountName)).longValue();}return 0;}@@ -143,7 +143,7 @@ public class httpdByteCountOutputStream extends BufferedOutputStream {if (this.byteCountAccountName != null) {long lastByteCount = 0;if (byteCountInfo.containsKey(this.byteCountAccountName)) {- lastByteCount = ((Long)byteCountInfo.get(this.byteCountAccountName)).longValue();+ lastByteCount = (byteCountInfo.get(this.byteCountAccountName)).longValue();}lastByteCount += this.byteCount;byteCountInfo.put(this.byteCountAccountName,new Long(lastByteCount));diff --git a/source/de/anomic/http/httpdFileHandler.java b/source/de/anomic/http/httpdFileHandler.javaindex 15e96b83a..514dbb829 100644--- a/source/de/anomic/http/httpdFileHandler.java+++ b/source/de/anomic/http/httpdFileHandler.java@@ -138,21 +138,21 @@ public final class httpdFileHandler {private static final serverLog theLogger = new serverLog("FILEHANDLER");static {- final serverSwitch<?> switchboard = plasmaSwitchboard.getSwitchboard();- useTemplateCache = switchboard.getConfig("enableTemplateCache","true").equalsIgnoreCase("true");+ final serverSwitch<?> theSwitchboard = plasmaSwitchboard.getSwitchboard();+ useTemplateCache = theSwitchboard.getConfig("enableTemplateCache","true").equalsIgnoreCase("true");templateCache = (useTemplateCache)? new HashMap<File, SoftReference<byte[]>>() : new HashMap<File, SoftReference<byte[]>>(0);templateMethodCache = (useTemplateCache) ? new HashMap<File, SoftReference<Method>>() : new HashMap<File, SoftReference<Method>>(0);if (httpdFileHandler.switchboard == null) {- httpdFileHandler.switchboard = switchboard;+ httpdFileHandler.switchboard = theSwitchboard;if (mimeTable.size() == 0) {// load the mime table- String mimeTablePath = switchboard.getConfig("mimeConfig","");+ String mimeTablePath = theSwitchboard.getConfig("mimeConfig","");BufferedInputStream mimeTableInputStream = null;try {serverLog.logConfig("HTTPDFiles", "Loading mime mapping file " + mimeTablePath);- mimeTableInputStream = new BufferedInputStream(new FileInputStream(new File(switchboard.getRootPath(), mimeTablePath)));+ mimeTableInputStream = new BufferedInputStream(new FileInputStream(new File(theSwitchboard.getRootPath(), mimeTablePath)));mimeTable.load(mimeTableInputStream);} catch (Exception e) {serverLog.logSevere("HTTPDFiles", "ERROR: path to configuration file or configuration invalid\n" + e);@@ -167,13 +167,13 @@ public final class httpdFileHandler {// create a htRootPath: system pagesif (htRootPath == null) {- htRootPath = new File(switchboard.getRootPath(), switchboard.getConfig("htRootPath","htroot"));+ htRootPath = new File(theSwitchboard.getRootPath(), theSwitchboard.getConfig("htRootPath","htroot"));if (!(htRootPath.exists())) htRootPath.mkdir();}// create a htDocsPath: user defined pagesif (htDocsPath == null) {- htDocsPath = switchboard.getConfigPath(plasmaSwitchboard.HTDOCS_PATH, plasmaSwitchboard.HTDOCS_PATH_DEFAULT);+ htDocsPath = theSwitchboard.getConfigPath(plasmaSwitchboard.HTDOCS_PATH, plasmaSwitchboard.HTDOCS_PATH_DEFAULT);if (!(htDocsPath.exists())) htDocsPath.mkdirs();}@@ -183,15 +183,15 @@ public final class httpdFileHandler {// create a htTemplatePathif (htTemplatePath == null) {- htTemplatePath = switchboard.getConfigPath("htTemplatePath","htroot/env/templates");+ htTemplatePath = theSwitchboard.getConfigPath("htTemplatePath","htroot/env/templates");if (!(htTemplatePath.exists())) htTemplatePath.mkdir();}//This is now handles by #%env/templates/foo%#//if (templates.size() == 0) templates.putAll(httpTemplate.loadTemplates(htTemplatePath));// create htLocaleDefault, htLocalePath- if (htDefaultPath == null) htDefaultPath = switchboard.getConfigPath("htDefaultPath", "htroot");- if (htLocalePath == null) htLocalePath = switchboard.getConfigPath("locale.translated_html", "DATA/LOCALE/htroot");+ if (htDefaultPath == null) htDefaultPath = theSwitchboard.getConfigPath("htDefaultPath", "htroot");+ if (htLocalePath == null) htLocalePath = theSwitchboard.getConfigPath("locale.translated_html", "DATA/LOCALE/htroot");}}@@ -302,7 +302,7 @@ public final class httpdFileHandler {}// check permission/granted access- String authorization = (String) requestHeader.get(httpHeader.AUTHORIZATION);+ String authorization = requestHeader.get(httpHeader.AUTHORIZATION);if (authorization != null && authorization.length() == 0) authorization = null;String adminAccountBase64MD5 = switchboard.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "");@@ -335,7 +335,7 @@ public final class httpdFileHandler {} else {// a wrong authentication was given or the userDB user does not have admin access. Ask againserverLog.logInfo("HTTPD", "Wrong log-in for account 'admin' in http file handler for path '" + path + "' from host '" + clientIP + "'");- Integer attempts = (Integer) serverCore.bfHost.get(clientIP);+ Integer attempts = serverCore.bfHost.get(clientIP);if (attempts == null)serverCore.bfHost.put(clientIP, new Integer(1));else@@ -350,7 +350,7 @@ public final class httpdFileHandler {// parse argumentsserverObjects args = new serverObjects();- int argc;+ int argc = 0;if (argsString == null) {// no args here, maybe a POST with multipart extensionint length = 0;@@ -365,7 +365,7 @@ public final class httpdFileHandler {length = -1;gzipBody = new GZIPInputStream(body);} else if (requestHeader.containsKey(httpHeader.CONTENT_LENGTH)) {- length = Integer.parseInt((String) requestHeader.get(httpHeader.CONTENT_LENGTH));+ length = Integer.parseInt(requestHeader.get(httpHeader.CONTENT_LENGTH));}// } else {// httpd.sendRespondError(conProp,out,4,403,null,"bad post values",null);@@ -374,7 +374,7 @@ public final class httpdFileHandler {// if its a POST, it can be either multipart or as args in the bodyif ((requestHeader.containsKey(httpHeader.CONTENT_TYPE)) &&- (((String) requestHeader.get(httpHeader.CONTENT_TYPE)).toLowerCase().startsWith("multipart"))) {+ (requestHeader.get(httpHeader.CONTENT_TYPE).toLowerCase().startsWith("multipart"))) {// parse multipartHashMap<String, byte[]> files = httpd.parseMultipart(requestHeader, args, (gzipBody!=null)?gzipBody:body, length);// integrate these files into the args@@ -386,7 +386,7 @@ public final class httpdFileHandler {args.put(entry.getKey() + "$file", entry.getValue());}}- argc = Integer.parseInt((String) requestHeader.get("ARGC"));+ argc = Integer.parseInt(requestHeader.get("ARGC"));} else {// parse args in bodyargc = httpd.parseArgs(args, (gzipBody!=null)?gzipBody:body, length);@@ -403,7 +403,7 @@ public final class httpdFileHandler {}// check for cross site scripting - attacks in request arguments- if (argc > 0) {+ if (args != null && argc > 0) {// check all values for occurrences of script valuesIterator<String> e = args.values().iterator(); // enumeration of valuesString val;@@ -458,8 +458,8 @@ public final class httpdFileHandler {//no defaultfile, send a dirlistingif (targetFile == null || !targetFile.exists()) {- StringBuffer sb = new StringBuffer();- sb.append("<html>\n<head>\n</head>\n<body>\n<h1>Index of " + path + "</h1>\n <ul>\n");+ StringBuffer aBuffer = new StringBuffer();+ aBuffer.append("<html>\n<head>\n</head>\n<body>\n<h1>Index of " + path + "</h1>\n <ul>\n");File dir = new File(htDocsPath, path);String[] list = dir.list();if (list == null) list = new String[0]; // should not occur!@@ -472,7 +472,7 @@ public final class httpdFileHandler {for (int i = 0; i < list.length; i++) {f = new File(dir, list[i]);if (f.isDirectory()) {- sb.append(" <li><a href=\"" + path + list[i] + "/\">" + list[i] + "/</a><br></li>\n");+ aBuffer.append(" <li><a href=\"" + path + list[i] + "/\">" + list[i] + "/</a><br></li>\n");} else {if (list[i].endsWith("html") || (list[i].endsWith("htm"))) {scraper = htmlFilterContentScraper.parseResource(f);@@ -496,20 +496,20 @@ public final class httpdFileHandler {} else {size = (sz / 1024 / 1024) + " MB";}- sb.append(" <li>");- if ((headline != null) && (headline.length() > 0)) sb.append("<a href=\"" + list[i] + "\"><b>" + headline + "</b></a><br>");- sb.append("<a href=\"" + path + list[i] + "\">" + list[i] + "</a><br>");- if ((author != null) && (author.length() > 0)) sb.append("Author: " + author + "<br>");- if ((description != null) && (description.length() > 0)) sb.append("Description: " + description + "<br>");- sb.append(serverDate.formatShortDay(new Date(f.lastModified())) + ", " + size + ((images > 0) ? ", " + images + " images" : "") + ((links > 0) ? ", " + links + " links" : "") + "<br></li>\n");+ aBuffer.append(" <li>");+ if ((headline != null) && (headline.length() > 0)) aBuffer.append("<a href=\"" + list[i] + "\"><b>" + headline + "</b></a><br>");+ aBuffer.append("<a href=\"" + path + list[i] + "\">" + list[i] + "</a><br>");+ if ((author != null) && (author.length() > 0)) aBuffer.append("Author: " + author + "<br>");+ if ((description != null) && (description.length() > 0)) aBuffer.append("Description: " + description + "<br>");+ aBuffer.append(serverDate.formatShortDay(new Date(f.lastModified())) + ", " + size + ((images > 0) ? ", " + images + " images" : "") + ((links > 0) ? ", " + links + " links" : "") + "<br></li>\n");}}- sb.append(" </ul>\n</body>\n</html>\n");+ aBuffer.append(" </ul>\n</body>\n</html>\n");// write the list to the client- httpd.sendRespondHeader(conProp, out, httpVersion, 200, null, "text/html", sb.length(), new Date(dir.lastModified()), null, new httpHeader(), null, null, true);+ httpd.sendRespondHeader(conProp, out, httpVersion, 200, null, "text/html", aBuffer.length(), new Date(dir.lastModified()), null, new httpHeader(), null, null, true);if (!method.equals(httpHeader.METHOD_HEAD)) {- out.write(sb.toString().getBytes());+ out.write(aBuffer.toString().getBytes());}return;}@@ -645,7 +645,7 @@ public final class httpdFileHandler {// handle brute-force protectionif (authorization != null) {serverLog.logInfo("HTTPD", "dynamic log-in for account 'admin' in http file handler for path '" + path + "' from host '" + clientIP + "'");- Integer attempts = (Integer) serverCore.bfHost.get(clientIP);+ Integer attempts = serverCore.bfHost.get(clientIP);if (attempts == null)serverCore.bfHost.put(clientIP, new Integer(1));else@@ -700,7 +700,7 @@ public final class httpdFileHandler {// read from cacheSoftReference<byte[]> ref = templateCache.get(targetFile);if (ref != null) {- templateContent = (byte[]) ref.get();+ templateContent = ref.get();if (templateContent == null) templateCache.remove(targetFile);}@@ -816,7 +816,7 @@ public final class httpdFileHandler {if ((ifRange == null)||(ifRange instanceof Date && targetFile.lastModified() == ((Date)ifRange).getTime()) ||(ifRange instanceof String && ifRange.equals(targetMD5))) {- String rangeHeaderVal = ((String) requestHeader.get(httpHeader.RANGE)).trim();+ String rangeHeaderVal = requestHeader.get(httpHeader.RANGE).trim();if (rangeHeaderVal.startsWith("bytes=")) {String rangesVal = rangeHeaderVal.substring("bytes=".length());String[] ranges = rangesVal.split(",");@@ -992,7 +992,7 @@ public final class httpdFileHandler {if (useTemplateCache) {SoftReference<Method> ref = templateMethodCache.get(classFile);if (ref != null) {- m = (Method) ref.get();+ m = ref.get();if (m == null) {templateMethodCache.remove(classFile);} else {diff --git a/source/de/anomic/http/httpdProxyHandler.java b/source/de/anomic/http/httpdProxyHandler.javaindex 4539169b9..91047bbe6 100644--- a/source/de/anomic/http/httpdProxyHandler.java+++ b/source/de/anomic/http/httpdProxyHandler.java@@ -626,7 +626,7 @@ public final class httpdProxyHandler {cacheEntry.setCacheArray(cacheArray);plasmaHTCache.push(cacheEntry);conProp.setProperty(httpHeader.CONNECTION_PROP_PROXY_RESPOND_CODE,"TCP_MISS");- } else if (sizeBeforeDelete == cacheArray.length) {+ } else if (cacheArray != null && sizeBeforeDelete == cacheArray.length) {// before we came here we deleted a cache entrycacheArray = null;//cacheEntry.status = plasmaHTCache.CACHE_STALE_RELOAD_BAD;@@ -818,7 +818,7 @@ public final class httpdProxyHandler {if (( !transformer.isIdentityTransformer()) &&(ext == null || !plasmaParser.supportedHTMLFileExtContains(url)) &&(plasmaParser.HTMLParsableMimeTypesContains(cachedResponseHeader.mime()))) {- hfos = new htmlFilterWriter(outStream, charSet, null, transformer, (ext.length() == 0));+ hfos = new htmlFilterWriter(outStream, charSet, null, transformer, (ext == null || ext.length() == 0));} else {hfos = outStream;}@@ -1373,18 +1373,16 @@ public final class httpdProxyHandler {} else {// analyse remoteProxyNoProxy;// set either remoteProxyAllowProxySet or remoteProxyDisallowProxySet accordingly- boolean allowed = true;synchronized (remProxyConfig) {for (final String pattern :remProxyConfig.getProxyNoProxyPatterns()) {if (server.matches(pattern)) {// disallow proxy for this server- allowed = false;remProxyConfig.remoteProxyDisallowProxySet.add(server);remProxyConfig = null;break;}}- if (allowed) {+ if (remProxyConfig != null) {// no pattern matches: allow serverremProxyConfig.remoteProxyAllowProxySet.add(server);}@@ -1643,7 +1641,7 @@ public final class httpdProxyHandler {// getting header set by other proxies in the chainStringBuffer viaValue = new StringBuffer();- if (header.containsKey(httpHeader.VIA)) viaValue.append((String)header.get(httpHeader.VIA));+ if (header.containsKey(httpHeader.VIA)) viaValue.append(header.get(httpHeader.VIA));if (viaValue.length() > 0) viaValue.append(", ");// appending info about this peerdiff --git a/source/de/anomic/icap/icapHeader.java b/source/de/anomic/icap/icapHeader.javaindex 94b7bb220..434d366e5 100644--- a/source/de/anomic/icap/icapHeader.java+++ b/source/de/anomic/icap/icapHeader.java@@ -140,7 +140,7 @@ public class icapHeader extends TreeMap<String, String> implements Map<String, Spublic boolean allow(int statusCode) {if (!super.containsKey("Allow")) return false;- String allow = (String)get("Allow");+ String allow = get("Allow");return (allow.indexOf(Integer.toString(statusCode))!=-1);}@@ -175,7 +175,7 @@ public class icapHeader extends TreeMap<String, String> implements Map<String, Sif ((icapStatusText == null)||(icapStatusText.length()==0)) {if (icapVersion.equals("ICAP/1.0") && icapHeader.icap1_0.containsKey(Integer.toString(icapStatusCode)))- icapStatusText = (String) icapHeader.icap1_0.get(Integer.toString(icapStatusCode));+ icapStatusText = icapHeader.icap1_0.get(Integer.toString(icapStatusCode));}StringBuffer theHeader = new StringBuffer();@@ -191,7 +191,7 @@ public class icapHeader extends TreeMap<String, String> implements Map<String, Schar tag;int count;while (i.hasNext()) {- key = (String) i.next();+ key = i.next();tag = key.charAt(0);if ((tag != '*') && (tag != '#')) { // '#' in key is reserved for proxy attributes as artificial header valuescount = keyCount(key);diff --git a/source/de/anomic/icap/icapd.java b/source/de/anomic/icap/icapd.javaindex 17021566c..5605aa9c8 100644--- a/source/de/anomic/icap/icapd.java+++ b/source/de/anomic/icap/icapd.java@@ -109,9 +109,9 @@ public class icapd implements serverHandler {return new icapd();}- public void initSession(Session session) throws IOException {- this.session = session;- this.userAddress = session.userAddress; // client InetAddress+ public void initSession(Session aSession) throws IOException {+ this.session = aSession;+ this.userAddress = aSession.userAddress; // client InetAddressthis.clientIP = this.userAddress.getHostAddress();if (this.userAddress.isAnyLocalAddress()) this.clientIP = "localhost";if (this.clientIP.startsWith("0:0:0:0:0:0:0:1")) this.clientIP = "localhost";@@ -258,7 +258,7 @@ public class icapd implements serverHandler {* Reading the various message parts into buffers* ========================================================================= */ByteArrayInputStream reqHdrStream = null, resHdrStream = null, resBodyStream = null;- String[] encapsulated = ((String) reqHeader.get(icapHeader.ENCAPSULATED)).split(",");+ String[] encapsulated = (reqHeader.get(icapHeader.ENCAPSULATED)).split(",");int prevLength = 0, currLength=0;for (int i=0; i < encapsulated.length; i++) {// reading the request header@@ -333,14 +333,18 @@ public class icapd implements serverHandler {"\nRequest Method: " + httpReqProps.getProperty(httpHeader.CONNECTION_PROP_METHOD) +"\nRequest Line: " + httpRequestLine);reader.close();- reqHdrStream.close();+ if(reqHdrStream != null) {+ reqHdrStream.close();+ }return;}// reading all request headershttpHeader httpReqHeader = httpHeader.readHttpHeader(reader);reader.close();- reqHdrStream.close();+ if(reqHdrStream != null) {+ reqHdrStream.close();+ }// handle transparent proxy support: this function call is needed to set the host property properlyhttpHeader.handleTransparentProxySupport(httpReqHeader,httpReqProps,virtualHost,true);@@ -363,14 +367,18 @@ public class icapd implements serverHandler {"\nRequest Line: " + httpRequestLine +"\nResponse Line: " + httpRespStatusLine);reader.close();- resHdrStream.close();+ if(resHdrStream != null) {+ resHdrStream.close();+ }return;}// reading all response headershttpHeader httpResHeader = httpHeader.readHttpHeader(reader);reader.close();- resHdrStream.close();+ if(resHdrStream != null) {+ resHdrStream.close();+ }if (!plasmaParser.supportedContent(plasmaParser.PARSER_MODE_ICAP, httpRequestURL, httpResHeader.mime())) {this.log.logInfo("Wrong mimeType or fileExtension for indexing:" +@@ -409,7 +417,9 @@ public class icapd implements serverHandler {// copy the response body into the fileserverFileUtils.copy(resBodyStream,cacheFile);- resBodyStream.close(); resBodyStream = null;+ if(resBodyStream != null) {+ resBodyStream.close(); resBodyStream = null;+ }// indexing the responseplasmaHTCache.push(cacheEntry);diff --git a/source/de/anomic/index/indexAbstractReferenceBlacklist.java b/source/de/anomic/index/indexAbstractReferenceBlacklist.javaindex 8ecd1488e..701ee7331 100644--- a/source/de/anomic/index/indexAbstractReferenceBlacklist.java+++ b/source/de/anomic/index/indexAbstractReferenceBlacklist.java@@ -74,7 +74,7 @@ public abstract class indexAbstractReferenceBlacklist implements indexReferenceBIterator<String> iter = BLACKLIST_TYPES.iterator();while (iter.hasNext()) {- String blacklistType = (String) iter.next();+ String blacklistType = iter.next();//this.hostpaths.put(blacklistType, new HashMap<String, ArrayList<String>>());this.hostpaths_matchable.put(blacklistType, new HashMap<String, ArrayList<String>>());this.hostpaths_notmatchable.put(blacklistType, new HashMap<String, ArrayList<String>>());diff --git a/source/de/anomic/index/indexCollectionRI.java b/source/de/anomic/index/indexCollectionRI.javaindex 5bbb82f57..d22fa632c 100644--- a/source/de/anomic/index/indexCollectionRI.java+++ b/source/de/anomic/index/indexCollectionRI.java@@ -114,7 +114,7 @@ public class indexCollectionRI implements indexRI {}public indexContainer next() {- Object[] oo = (Object[]) wci.next();+ Object[] oo = wci.next();if (oo == null) return null;byte[] key = (byte[]) oo[0];kelondroRowSet collection = (kelondroRowSet) oo[1];diff --git a/source/de/anomic/index/indexContainer.java b/source/de/anomic/index/indexContainer.javaindex 616410d53..8108c814b 100644--- a/source/de/anomic/index/indexContainer.java+++ b/source/de/anomic/index/indexContainer.java@@ -185,7 +185,7 @@ public class indexContainer extends kelondroRowSet {}public indexRWIRowEntry next() {- kelondroRow.Entry rentry = (kelondroRow.Entry) rowEntryIterator.next();+ kelondroRow.Entry rentry = rowEntryIterator.next();if (rentry == null) return null;return new indexRWIRowEntry(rentry);}@@ -239,7 +239,7 @@ public class indexContainer extends kelondroRowSet {int count = 0;while (i.hasNext()) {// get next entity:- singleContainer = (indexContainer) i.next();+ singleContainer = i.next();// check resultif ((singleContainer == null) || (singleContainer.size() == 0)) return null; // as this is a cunjunction of searches, we have no result if any word is not known@@ -254,13 +254,13 @@ public class indexContainer extends kelondroRowSet {// the map now holds the search results in order of number of hits per word// we now must pairwise build up a conjunction of these sets- Long k = (Long) map.firstKey(); // the smallest, which means, the one with the least entries- indexContainer searchA, searchB, searchResult = (indexContainer) map.remove(k);+ Long k = map.firstKey(); // the smallest, which means, the one with the least entries+ indexContainer searchA, searchB, searchResult = map.remove(k);while ((map.size() > 0) && (searchResult.size() > 0)) {// take the first element of map which is a result and combine it with result- k = (Long) map.firstKey(); // the next smallest...+ k = map.firstKey(); // the next smallest...searchA = searchResult;- searchB = (indexContainer) map.remove(k);+ searchB = map.remove(k);searchResult = indexContainer.joinConstructive(searchA, searchB, maxDistance);// free resourcessearchA = null;@@ -279,7 +279,7 @@ public class indexContainer extends kelondroRowSet {Iterator<indexContainer> i = containers.iterator();while (i.hasNext()) {- pivot = excludeDestructive(pivot, (indexContainer) i.next());+ pivot = excludeDestructive(pivot, i.next());if ((pivot == null) || (pivot.size() == 0)) return null;}@@ -403,7 +403,7 @@ public class indexContainer extends kelondroRowSet {Iterator<indexRWIRowEntry> se = (iterate_pivot) ? pivot.entries() : excl.entries();indexRWIEntry ie0, ie1;while (se.hasNext()) {- ie0 = (indexRWIEntry) se.next();+ ie0 = se.next();ie1 = excl.get(ie0.urlHash());if ((ie0 != null) && (ie1 != null)) {assert (ie0.urlHash().length() == keylength) : "ie0.urlHash() = " + ie0.urlHash();@@ -471,7 +471,7 @@ public class indexContainer extends kelondroRowSet {iEntry = i.next();if ((excludeContainer != null) && (excludeContainer.get(iEntry.urlHash()) != null)) continue; // do not include urls that are in excludeContainerdom = iEntry.urlHash().substring(6);- if ((paths = (String) doms.get(dom)) == null) {+ if ((paths = doms.get(dom)) == null) {doms.put(dom, iEntry.urlHash().substring(0, 6));} else {doms.put(dom, paths + iEntry.urlHash().substring(0, 6));@@ -487,9 +487,9 @@ public class indexContainer extends kelondroRowSet {Map.Entry<String, String> entry;while (i.hasNext()) {entry = i.next();- bb.append((String) entry.getKey());+ bb.append(entry.getKey());bb.append(':');- bb.append((String) entry.getValue());+ bb.append(entry.getValue());if (System.currentTimeMillis() > timeout)break;if (i.hasNext())diff --git a/source/de/anomic/index/indexContainerHeap.java b/source/de/anomic/index/indexContainerHeap.javaindex 64890a4f4..1e0542495 100755--- a/source/de/anomic/index/indexContainerHeap.java+++ b/source/de/anomic/index/indexContainerHeap.java@@ -140,7 +140,7 @@ public final class indexContainerHeap {assert this.index == null;this.backupFile = heapFile;if (!(heapFile.exists())) throw new IOException("file " + heapFile + " does not exist");- if (heapFile.length() >= (long) Integer.MAX_VALUE) throw new IOException("file " + heapFile + " too large, index can only be crated for files less than 2GB");+ if (heapFile.length() >= Integer.MAX_VALUE) throw new IOException("file " + heapFile + " too large, index can only be crated for files less than 2GB");if (log != null) log.logInfo("creating index for rwi heap '" + heapFile.getName() + "'");long start = System.currentTimeMillis();@@ -165,11 +165,11 @@ public final class indexContainerHeap {break loop; // terminate loop}wordHash = new String(word);- seek += (long) wordHash.length();+ seek += wordHash.length();// read collectiontry {- seek += (long) kelondroRowSet.skipNextRowSet(is, payloadrow);+ seek += kelondroRowSet.skipNextRowSet(is, payloadrow);} catch (IOException e) {break loop; // terminate loop}@@ -204,9 +204,9 @@ public final class indexContainerHeap {for (int i = 0; i < payloadrow.primaryKeyLength - wordHash.length(); i++) os.write(0);}os.write(container.exportCollection());+ urlcount += container.size();}wordcount++;- urlcount += container.size();}}os.flush();@@ -316,12 +316,12 @@ public final class indexContainerHeap {public indexContainer next() {if (iterator.hasNext()) {- return ((indexContainer) iterator.next()).topLevelClone();+ return (iterator.next()).topLevelClone();} else {// rotation iterationif (rot) {iterator = cache.values().iterator();- return ((indexContainer) iterator.next()).topLevelClone();+ return (iterator.next()).topLevelClone();} else {return null;}@@ -411,7 +411,7 @@ public final class indexContainerHeap {public synchronized boolean removeReference(String wordHash, String urlHash) {assert this.cache != null;assert !this.readOnlyMode;- indexContainer c = (indexContainer) cache.get(wordHash);+ indexContainer c = cache.get(wordHash);if ((c != null) && (c.remove(urlHash) != null)) {// removal successfulif (c.size() == 0) {@@ -428,7 +428,7 @@ public final class indexContainerHeap {assert this.cache != null;assert !this.readOnlyMode;if (urlHashes.size() == 0) return 0;- indexContainer c = (indexContainer) cache.get(wordHash);+ indexContainer c = cache.get(wordHash);int count;if ((c != null) && ((count = c.removeEntries(urlHashes)) > 0)) {// removal successful@@ -451,7 +451,7 @@ public final class indexContainerHeap {// put new words into cacheString wordHash = container.getWordHash();- indexContainer entries = (indexContainer) cache.get(wordHash); // null pointer exception? wordhash != null! must be cache==null+ indexContainer entries = cache.get(wordHash); // null pointer exception? wordhash != null! must be cache==nullif (entries == null) {entries = container.topLevelClone();added = entries.size();@@ -468,7 +468,7 @@ public final class indexContainerHeap {public synchronized void addEntry(String wordHash, indexRWIRowEntry newEntry) {assert this.cache != null;assert !this.readOnlyMode;- indexContainer container = (indexContainer) cache.get(wordHash);+ indexContainer container = cache.get(wordHash);if (container == null) container = new indexContainer(wordHash, this.payloadrow, 1);container.put(newEntry);cache.put(wordHash, container);diff --git a/source/de/anomic/index/indexDefaultReferenceBlacklist.java b/source/de/anomic/index/indexDefaultReferenceBlacklist.javaindex a603ad1dc..3c1f9efb8 100644--- a/source/de/anomic/index/indexDefaultReferenceBlacklist.java+++ b/source/de/anomic/index/indexDefaultReferenceBlacklist.java@@ -58,7 +58,7 @@ public class indexDefaultReferenceBlacklist extends indexAbstractReferenceBlackl// try to match complete domainif (!matched && (app = blacklistMapMatched.get(hostlow)) != null) {for (int i=app.size()-1; !matched && i>-1; i--) {- pp = (String)app.get(i);+ pp = app.get(i);matched |= ((pp.equals("*")) || (path.matches(pp)));}}@@ -68,13 +68,13 @@ public class indexDefaultReferenceBlacklist extends indexAbstractReferenceBlacklwhile (!matched && (index = hostlow.indexOf('.', index + 1)) != -1) {if ((app = blacklistMapMatched.get(hostlow.substring(0, index + 1) + "*")) != null) {for (int i=app.size()-1; !matched && i>-1; i--) {- pp = (String)app.get(i);+ pp = app.get(i);matched |= ((pp.equals("*")) || (path.matches(pp)));}}if ((app = blacklistMapMatched.get(hostlow.substring(0, index))) != null) {for (int i=app.size()-1; !matched && i>-1; i--) {- pp = (String)app.get(i);+ pp = app.get(i);matched |= ((pp.equals("*")) || (path.matches(pp)));}}@@ -83,13 +83,13 @@ public class indexDefaultReferenceBlacklist extends indexAbstractReferenceBlacklwhile (!matched && (index = hostlow.lastIndexOf('.', index - 1)) != -1) {if ((app = blacklistMapMatched.get("*" + hostlow.substring(index, hostlow.length()))) != null) {for (int i=app.size()-1; !matched && i>-1; i--) {- pp = (String)app.get(i);+ pp = app.get(i);matched |= ((pp.equals("*")) || (path.matches(pp)));}}if ((app = blacklistMapMatched.get(hostlow.substring(index +1, hostlow.length()))) != null) {for (int i=app.size()-1; !matched && i>-1; i--) {- pp = (String)app.get(i);+ pp = app.get(i);matched |= ((pp.equals("*")) || (path.matches(pp)));}}diff --git a/source/de/anomic/index/indexRAMRI.java b/source/de/anomic/index/indexRAMRI.javaindex 8d8538cc6..8a56dc598 100644--- a/source/de/anomic/index/indexRAMRI.java+++ b/source/de/anomic/index/indexRAMRI.java@@ -152,7 +152,7 @@ public final class indexRAMRI implements indexRI, indexRIReader {public synchronized String maxScoreWordHash() {if (heap.size() == 0) return null;try {- return (String) hashScore.getMaxObject();+ return hashScore.getMaxObject();} catch (Exception e) {log.logSevere("flushFromMem: " + e.getMessage(), e);}@@ -169,24 +169,24 @@ public final class indexRAMRI implements indexRI, indexRIReader {String hash = null;int count = hashScore.getMaxScore();if ((count >= cacheReferenceCountLimit) &&- ((hash = (String) hashScore.getMaxObject()) != null)) {+ ((hash = hashScore.getMaxObject()) != null)) {// we MUST flush high-score entries, because a loop deletes entries in cache until this condition fails// in this cache we MUST NOT check wCacheMinAgereturn hash;}long oldestTime = longEmit(hashDate.getMinScore());if (((System.currentTimeMillis() - oldestTime) > cacheReferenceAgeLimit) &&- ((hash = (String) hashDate.getMinObject()) != null)) {+ ((hash = hashDate.getMinObject()) != null)) {// flush out-dated entriesreturn hash;}// cases with respect to memory situationif (serverMemory.free() < 100000) {// urgent low-memory case- hash = (String) hashScore.getMaxObject(); // flush high-score entries (saves RAM)+ hash = hashScore.getMaxObject(); // flush high-score entries (saves RAM)} else {// not-efficient-so-far case. cleans up unnecessary cache slots- hash = (String) hashDate.getMinObject(); // flush oldest entries+ hash = hashDate.getMinObject(); // flush oldest entries}if (hash == null) {heap.wordContainers(null, false).next();diff --git a/source/de/anomic/index/indexRWIEntryOrder.java b/source/de/anomic/index/indexRWIEntryOrder.javaindex b0f0bab63..de09b98fc 100644--- a/source/de/anomic/index/indexRWIEntryOrder.java+++ b/source/de/anomic/index/indexRWIEntryOrder.java@@ -72,7 +72,7 @@ public class indexRWIEntryOrder {Iterator<Map.Entry<String, Integer>> di = mmf1.domcount().entrySet().iterator();while (di.hasNext()) {entry = di.next();- this.doms.addScore(entry.getKey(), ((Integer) entry.getValue()).intValue());+ this.doms.addScore(entry.getKey(), (entry.getValue()).intValue());}try {mmf0.join();} catch (InterruptedException e) {} // wait for fork thread to finishif (this.min == null) this.min = mmf0.entryMin.clone(); else this.min.min(mmf0.entryMin);@@ -80,7 +80,7 @@ public class indexRWIEntryOrder {di = mmf0.domcount().entrySet().iterator();while (di.hasNext()) {entry = di.next();- this.doms.addScore(entry.getKey(), ((Integer) entry.getValue()).intValue());+ this.doms.addScore(entry.getKey(), (entry.getValue()).intValue());}result = mmf0.decodedContainer();result.addAll(mmf1.decodedContainer());@@ -96,7 +96,7 @@ public class indexRWIEntryOrder {Iterator<Map.Entry<String, Integer>> di = mmf.domcount().entrySet().iterator();while (di.hasNext()) {entry = di.next();- this.doms.addScore(entry.getKey(), ((Integer) entry.getValue()).intValue());+ this.doms.addScore(entry.getKey(), (entry.getValue()).intValue());}result = mmf.decodedContainer();//long s1= System.currentTimeMillis(), sc = Math.max(1, s1 - s0);@@ -186,7 +186,7 @@ public class indexRWIEntryOrder {if (this.entryMax == null) this.entryMax = iEntry.clone(); else this.entryMax.max(iEntry);// update domcountdom = iEntry.urlHash().substring(6);- count = (Integer) doms.get(dom);+ count = doms.get(dom);if (count == null) {doms.put(dom, int1);} else {diff --git a/source/de/anomic/index/indexReferenceBlacklist.java b/source/de/anomic/index/indexReferenceBlacklist.javaindex edf6bee0c..f816853e7 100644--- a/source/de/anomic/index/indexReferenceBlacklist.java+++ b/source/de/anomic/index/indexReferenceBlacklist.java@@ -63,7 +63,7 @@ public interface indexReferenceBlacklist {public String[] getFileNamesUnified() {HashSet<String> hs = new HashSet<String>(Arrays.asList(this.filename.split(",")));- return (String[]) hs.toArray(new String[hs.size()]);+ return hs.toArray(new String[hs.size()]);}public String getType() { return this.type; }diff --git a/source/de/anomic/index/indexRepositoryReference.java b/source/de/anomic/index/indexRepositoryReference.javaindex 29e905c69..8445f1063 100644--- a/source/de/anomic/index/indexRepositoryReference.java+++ b/source/de/anomic/index/indexRepositoryReference.java@@ -228,7 +228,7 @@ public final class indexRepositoryReference {Iterator<String> eiter2 = damagedURLS.iterator();String urlHash;while (eiter2.hasNext()) {- urlHash = (String) eiter2.next();+ urlHash = eiter2.next();// trying to fix the invalid URLString oldUrlStr = null;@@ -258,13 +258,13 @@ public final class indexRepositoryReference {}}- if (res.getStatusCode() == 200) {+ if (res != null && res.getStatusCode() == 200) {entry.setCol(1, newUrl.toString().getBytes());urlIndexFile.put(entry);log.logInfo("UrlDB-Entry with urlHash '" + urlHash + "' corrected\n\tURL: " + oldUrlStr + " -> " + newUrlStr);} else {remove(urlHash);- log.logInfo("UrlDB-Entry with urlHash '" + urlHash + "' removed\n\tURL: " + oldUrlStr + "\n\tConnection Status: " + res.getStatusLine());+ log.logInfo("UrlDB-Entry with urlHash '" + urlHash + "' removed\n\tURL: " + oldUrlStr + "\n\tConnection Status: " + (res == null ? "null" : res.getStatusLine()));}}} catch (Exception e) {diff --git a/source/de/anomic/index/indexURLReference.java b/source/de/anomic/index/indexURLReference.javaindex 35edcbf13..392df3f11 100644--- a/source/de/anomic/index/indexURLReference.java+++ b/source/de/anomic/index/indexURLReference.java@@ -207,7 +207,7 @@ public class indexURLReference {String ETag = crypt.simpleDecode(prop.getProperty("ETag", ""), null); if (ETag == null) ETag = "";this.entry = rowdef.newEntry();- this.entry.setCol(col_hash, url.hash(), null);+ this.entry.setCol(col_hash, url.hash(), null); // FIXME potential null pointer accessthis.entry.setCol(col_comp, encodeComp(url, descr, dc_creator, tags, ETag));try {encodeDate(col_mod, serverDate.parseShortDay(prop.getProperty("mod", "20000101")));@@ -321,12 +321,12 @@ public class indexURLReference {public indexURLReference.Components comp() {ArrayList<String> cl = nxTools.strings(this.entry.getCol("comp", null), "UTF-8");return new indexURLReference.Components(- (cl.size() > 0) ? ((String) cl.get(0)).trim() : "",+ (cl.size() > 0) ? (cl.get(0)).trim() : "",hash(),- (cl.size() > 1) ? ((String) cl.get(1)).trim() : "",- (cl.size() > 2) ? ((String) cl.get(2)).trim() : "",- (cl.size() > 3) ? ((String) cl.get(3)).trim() : "",- (cl.size() > 4) ? ((String) cl.get(4)).trim() : "");+ (cl.size() > 1) ? (cl.get(1)).trim() : "",+ (cl.size() > 2) ? (cl.get(2)).trim() : "",+ (cl.size() > 3) ? (cl.get(3)).trim() : "",+ (cl.size() > 4) ? (cl.get(4)).trim() : "");}public Date moddate() {diff --git a/source/de/anomic/kelondro/kelondroAbstractIOChunks.java b/source/de/anomic/kelondro/kelondroAbstractIOChunks.javaindex 19be4710c..43aa81514 100644--- a/source/de/anomic/kelondro/kelondroAbstractIOChunks.java+++ b/source/de/anomic/kelondro/kelondroAbstractIOChunks.java@@ -95,7 +95,7 @@ public abstract class kelondroAbstractIOChunks {public synchronized short readShort(long pos) throws IOException {byte[] b = new byte[2];this.readFully(pos, b, 0, 2);- return (short) ((((int) b[0] & 0xFF) << 8) | (((int) b[1] & 0xFF) << 0));+ return (short) (((b[0] & 0xFF) << 8) | ((b[1] & 0xFF) << 0));}public synchronized void writeShort(long pos, final int v) throws IOException {@@ -107,7 +107,7 @@ public abstract class kelondroAbstractIOChunks {public synchronized int readInt(long pos) throws IOException {byte[] b = new byte[4];this.readFully(pos, b, 0, 4);- return (((int) b[0] & 0xFF) << 24) | (((int) b[1] & 0xFF) << 16) | (((int) b[2] & 0xFF) << 8) | ((int) b[3] & 0xFF);+ return ((b[0] & 0xFF) << 24) | ((b[1] & 0xFF) << 16) | ((b[2] & 0xFF) << 8) | (b[3] & 0xFF);}public synchronized void writeInt(long pos, final int v) throws IOException {diff --git a/source/de/anomic/kelondro/kelondroAbstractRecords.java b/source/de/anomic/kelondro/kelondroAbstractRecords.javaindex b329409e1..df6a25106 100644--- a/source/de/anomic/kelondro/kelondroAbstractRecords.java+++ b/source/de/anomic/kelondro/kelondroAbstractRecords.java@@ -310,8 +310,8 @@ public abstract class kelondroAbstractRecords implements kelondroRecords {private synchronized void checkConsistency() {if ((debugmode) && (entryFile != null)) try { // in debug modelong efl = entryFile.length();- assert ((efl - POS_NODES) % ((long) recordsize)) == 0 : "rest = " + ((entryFile.length() - POS_NODES) % ((long) recordsize)) + ", USEDC = " + this.USEDC + ", FREEC = " + this.FREEC + ", recordsize = " + recordsize + ", file = " + filename;- long calculated_used = (efl - POS_NODES) / ((long) recordsize);+ assert ((efl - POS_NODES) % (recordsize)) == 0 : "rest = " + ((entryFile.length() - POS_NODES) % (recordsize)) + ", USEDC = " + this.USEDC + ", FREEC = " + this.FREEC + ", recordsize = " + recordsize + ", file = " + filename;+ long calculated_used = (efl - POS_NODES) / (recordsize);if (calculated_used != this.USEDC + this.FREEC) logFailure("INCONSISTENCY in USED computation: calculated_used = " + calculated_used + ", USEDC = " + this.USEDC + ", FREEC = " + this.FREEC + ", recordsize = " + recordsize + ", file = " + filename);} catch (IOException e) {assert false;@@ -849,7 +849,7 @@ public abstract class kelondroAbstractRecords implements kelondroRecords {Iterator<kelondroHandle> dhi = dh.iterator();kelondroHandle h;while (dhi.hasNext()) {- h = (kelondroHandle) dhi.next();+ h = dhi.next();System.out.print(h.index + ", ");}System.out.println("\n--");@@ -885,7 +885,7 @@ public abstract class kelondroAbstractRecords implements kelondroRecords {return null;}try {- kelondroNode n = (kelondroNode) nodeIterator.next();+ kelondroNode n = nodeIterator.next();return row().newEntryIndex(n.getValueRow(), n.handle().index);} catch (IOException e) {throw new kelondroException(filename, e.getMessage());@@ -995,11 +995,11 @@ public abstract class kelondroAbstractRecords implements kelondroRecords {if (pos.index >= (bulkstart + bulksize)) {bulkstart = pos.index;int maxlength = Math.min(USAGE.allCount() - bulkstart, bulksize);- if ((((long) POS_NODES) + ((long) bulkstart) * ((long) recordsize)) < 0)+ if (((POS_NODES) + ((long) bulkstart) * ((long) recordsize)) < 0)serverLog.logSevere("kelondroCachedRecords", "DEBUG: negative offset. POS_NODES = " + POS_NODES + ", bulkstart = " + bulkstart + ", recordsize = " + recordsize);if ((maxlength * recordsize) < 0)serverLog.logSevere("kelondroCachedRecords", "DEBUG: negative length. maxlength = " + maxlength + ", recordsize = " + recordsize);- entryFile.readFully(((long) POS_NODES) + ((long) bulkstart) * ((long) recordsize), bulk, 0, maxlength * recordsize);+ entryFile.readFully((POS_NODES) + ((long) bulkstart) * ((long) recordsize), bulk, 0, maxlength * recordsize);}/* POS_NODES = 302, bulkstart = 3277, recordsize = 655386POS_NODES = 302, bulkstart = 820, recordsize = 2621466diff --git a/source/de/anomic/kelondro/kelondroAttrSeq.java b/source/de/anomic/kelondro/kelondroAttrSeq.javaindex ef09089a8..a62139696 100644--- a/source/de/anomic/kelondro/kelondroAttrSeq.java+++ b/source/de/anomic/kelondro/kelondroAttrSeq.java@@ -194,7 +194,7 @@ public class kelondroAttrSeq {Object v;while (i.hasNext()) {entry = i.next();- k = (String) entry.getKey();+ k = entry.getKey();v = entry.getValue();sb.append(k); sb.append('=');if (v instanceof String) sb.append((String) v);@@ -293,7 +293,7 @@ public class kelondroAttrSeq {prop_pos = new int[l.size()];p = 0;for (int i = 0; i < l.size(); i++) {- a = (kelondroColumn) l.get(i);+ a = l.get(i);prop_names[i] = a.nickname;prop_len[i] = a.cellwidth;prop_pos[i] = p;@@ -313,7 +313,7 @@ public class kelondroAttrSeq {seq_pos = new int[l.size()];p = 0;for (int i = 0; i < l.size(); i++) {- a = (kelondroColumn) l.get(i);+ a = l.get(i);seq_names[i] = a.nickname;seq_len[i] = a.cellwidth;seq_pos[i] = p;@@ -392,7 +392,7 @@ public class kelondroAttrSeq {}public long getAttr(String key, long dflt) {- Long i = (Long) attrs.get(key);+ Long i = attrs.get(key);if (i == null) return dflt;return i.longValue();}@@ -427,14 +427,14 @@ public class kelondroAttrSeq {StringBuffer sb = new StringBuffer(100 + structure.seq_len[0] * seq.size());Long val;for (int i = 0; i < structure.prop_names.length; i++) {- val = (Long) attrs.get(structure.prop_names[i]);+ val = attrs.get(structure.prop_names[i]);sb.append(kelondroBase64Order.enhancedCoder.encodeLongSmart((val == null) ? 0 : val.longValue(), structure.prop_len[i]));}sb.append('|');Iterator<String> q = seq.iterator();//long[] seqattrs;while (q.hasNext()) {- sb.append((String) q.next());+ sb.append(q.next());//seqattrs = (long[]) entry.getValue();/*for (int i = 1; i < structure.seq_names.length; i++) {diff --git a/source/de/anomic/kelondro/kelondroBase64Order.java b/source/de/anomic/kelondro/kelondroBase64Order.javaindex e23231515..529e3c4ed 100644--- a/source/de/anomic/kelondro/kelondroBase64Order.java+++ b/source/de/anomic/kelondro/kelondroBase64Order.java@@ -134,7 +134,7 @@ public class kelondroBase64Order extends kelondroAbstractOrder<byte[]> implement}public final char encodeByte(byte b) {- return (char) alpha[b];+ return alpha[b];}public final byte decodeByte(char b) {@@ -208,12 +208,12 @@ public class kelondroBase64Order extends kelondroAbstractOrder<byte[]> implementint pos = 0;long l;while (in.length - pos >= 3) {- l = ((((0XffL & (long) in[pos]) << 8) + (0XffL & (long) in[pos + 1])) << 8) + (0XffL & (long) in[pos + 2]);+ l = ((((0XffL & in[pos]) << 8) + (0XffL & in[pos + 1])) << 8) + (0XffL & in[pos + 2]);pos += 3;out = out.append(encodeLong(l, 4));}// now there may be remaining bytes- if (in.length % 3 != 0) out = out.append((in.length % 3 == 2) ? encodeLong((((0XffL & (long) in[pos]) << 8) + (0XffL & (long) in[pos + 1])) << 8, 4).substring(0, 3) : encodeLong((((0XffL & (long) in[pos])) << 8) << 8, 4).substring(0, 2));+ if (in.length % 3 != 0) out = out.append((in.length % 3 == 2) ? encodeLong((((0XffL & in[pos]) << 8) + (0XffL & in[pos + 1])) << 8, 4).substring(0, 3) : encodeLong((((0XffL & in[pos])) << 8) << 8, 4).substring(0, 2));if (rfc1113compliant) while (out.length() % 4 > 0) out.append("=");// return resultreturn new String(out);diff --git a/source/de/anomic/kelondro/kelondroBufferedIOChunks.java b/source/de/anomic/kelondro/kelondroBufferedIOChunks.javaindex 2bbc44b5e..8fcd1c305 100644--- a/source/de/anomic/kelondro/kelondroBufferedIOChunks.java+++ b/source/de/anomic/kelondro/kelondroBufferedIOChunks.java@@ -90,7 +90,7 @@ public final class kelondroBufferedIOChunks extends kelondroAbstractIOChunks imp// do the readsynchronized (this.buffer) {- byte[] bb = (byte[]) buffer.get(new Long(pos));+ byte[] bb = buffer.get(new Long(pos));if (bb == null) {// entry not known, read directly from IOsynchronized (this.ra) {@@ -136,15 +136,15 @@ public final class kelondroBufferedIOChunks extends kelondroAbstractIOChunks impif (buffer.size() == 0) return;Iterator<Map.Entry<Long, byte[]>> i = buffer.entrySet().iterator();Map.Entry<Long, byte[]> entry = i.next();- long lastPos = ((Long) entry.getKey()).longValue();- byte[] lastChunk = (byte[]) entry.getValue();+ long lastPos = (entry.getKey()).longValue();+ byte[] lastChunk = entry.getValue();long nextPos;byte[] nextChunk, tmpChunk;synchronized (this.ra) {while (i.hasNext()) {entry = i.next();- nextPos = ((Long) entry.getKey()).longValue();- nextChunk = (byte[]) entry.getValue();+ nextPos = (entry.getKey()).longValue();+ nextChunk = entry.getValue();if (lastPos + lastChunk.length == nextPos) {// try to combine the new chunk with the previous chunk//System.out.println("combining chunks pos0=" + lastPos + ", chunk0.length=" + lastChunk.length + ", pos1=" + nextPos + ", chunk1.length=" + nextChunk.length);diff --git a/source/de/anomic/kelondro/kelondroCache.java b/source/de/anomic/kelondro/kelondroCache.javaindex fb8661f41..16fee3be0 100644--- a/source/de/anomic/kelondro/kelondroCache.java+++ b/source/de/anomic/kelondro/kelondroCache.java@@ -119,7 +119,7 @@ public class kelondroCache implements kelondroIndex {// returns a map for each file in the tracker;// the map represents properties for each record oobjects,// i.e. for cache memory allocation- kelondroCache theObjectsCache = (kelondroCache) objectTracker.get(filename);+ kelondroCache theObjectsCache = objectTracker.get(filename);return theObjectsCache.memoryStats();}@@ -354,7 +354,7 @@ public class kelondroCache implements kelondroIndex {Iterator<Entry> i = rows.iterator();int c = 0;while (i.hasNext()) {- if (addUnique((Entry) i.next())) c++;+ if (addUnique(i.next())) c++;}return c;}diff --git a/source/de/anomic/kelondro/kelondroCachedRA.java b/source/de/anomic/kelondro/kelondroCachedRA.javaindex 9b27d8e6f..70e6f7ad1 100644--- a/source/de/anomic/kelondro/kelondroCachedRA.java+++ b/source/de/anomic/kelondro/kelondroCachedRA.java@@ -87,13 +87,13 @@ public class kelondroCachedRA extends kelondroAbstractRA implements kelondroRA {private byte[] readCache(int cacheNr) throws IOException {Integer cacheNrI = new Integer(cacheNr);- byte[] cache = (byte[]) cacheMemory.get(cacheNrI);+ byte[] cache = cacheMemory.get(cacheNrI);if (cache == null) {if (cacheMemory.size() >= cacheMaxElements) {// delete elements in buffer if buffer too bigIterator<Integer> it = cacheScore.scores(true);- Integer element = (Integer) it.next();- writeCache((byte[]) cacheMemory.get(element), element.intValue());+ Integer element = it.next();+ writeCache(cacheMemory.get(element), element.intValue());cacheMemory.remove(element);int age = cacheScore.deleteScore(element);de.anomic.server.logging.serverLog.logFine("CACHE: " + name, "GC; age=" + ((((int) (0xFFFFFFFFL & System.currentTimeMillis())) - age) / 1000));@@ -186,7 +186,7 @@ public class kelondroCachedRA extends kelondroAbstractRA implements kelondroRA {Iterator<Integer> it = cacheScore.scores(true);while (it.hasNext()) {Integer element = it.next();- writeCache((byte[]) cacheMemory.get(element), element.intValue());+ writeCache(cacheMemory.get(element), element.intValue());cacheMemory.remove(element);}ra.close();diff --git a/source/de/anomic/kelondro/kelondroCachedRecords.java b/source/de/anomic/kelondro/kelondroCachedRecords.javaindex e3bf2bec7..477321e7c 100644--- a/source/de/anomic/kelondro/kelondroCachedRecords.java+++ b/source/de/anomic/kelondro/kelondroCachedRecords.java@@ -162,7 +162,7 @@ public class kelondroCachedRecords extends kelondroAbstractRecords implements ke// returns a map for each file in the tracker;// the map represents properties for each record oobjects,// i.e. for cache memory allocation- kelondroCachedRecords theRecord = (kelondroCachedRecords) recordTracker.get(filename);+ kelondroCachedRecords theRecord = recordTracker.get(filename);return theRecord.memoryStats();}@@ -273,7 +273,7 @@ public class kelondroCachedRecords extends kelondroAbstractRecords implements keIterator<kelondroNode> i = new contentNodeIterator(-1);kelondroNode n;while (i.hasNext()) {- n = (kelondroNode) i.next();+ n = i.next();System.out.println("NODE: " + n.toString());}}@@ -317,7 +317,7 @@ public class kelondroCachedRecords extends kelondroAbstractRecords implements kepublic CacheNode(byte[] rowinstance) throws IOException {// this initializer is used to create nodes from bulk-read byte arrays- assert ((rowinstance == null) || (rowinstance.length == ROW.objectsize)) : "bulkchunk.length = " + rowinstance.length + ", ROW.width(0) = " + ROW.width(0);+ assert ((rowinstance == null) || (rowinstance.length == ROW.objectsize)) : "bulkchunk.length = " + (rowinstance == null ? "null" : rowinstance.length) + ", ROW.width(0) = " + ROW.width(0);this.handle = new kelondroHandle(USAGE.allocatePayload(rowinstance));// create empty chunks@@ -359,7 +359,7 @@ public class kelondroCachedRecords extends kelondroAbstractRecords implements ke} else {changed = true;}- assert ((bulkchunk == null) || (bulkchunk.length - offset >= recordsize)) : "bulkchunk.length = " + bulkchunk.length + ", offset = " + offset + ", recordsize = " + recordsize;+ assert ((bulkchunk == null) || (bulkchunk.length - offset >= recordsize)) : "bulkchunk.length = " + (bulkchunk == null ? "null" : bulkchunk.length) + ", offset = " + offset + ", recordsize = " + recordsize;// create empty chunksthis.headChunk = new byte[headchunksize];@@ -538,7 +538,7 @@ public class kelondroCachedRecords extends kelondroAbstractRecords implements ke// load all values from the database filethis.tailChunk = new byte[tailchunksize];// read values- entryFile.readFully(seekpos(this.handle) + (long) headchunksize, this.tailChunk, 0, this.tailChunk.length);+ entryFile.readFully(seekpos(this.handle) + headchunksize, this.tailChunk, 0, this.tailChunk.length);}// create return valuediff --git a/source/de/anomic/kelondro/kelondroCollectionIndex.java b/source/de/anomic/kelondro/kelondroCollectionIndex.javaindex f9a73bf5b..8a2e4cbc2 100644--- a/source/de/anomic/kelondro/kelondroCollectionIndex.java+++ b/source/de/anomic/kelondro/kelondroCollectionIndex.java@@ -212,7 +212,7 @@ public class kelondroCollectionIndex {long lastlog = start;int count = 0;while (ei.hasNext()) {- aentry = (kelondroRow.EntryIndex) ei.next();+ aentry = ei.next();key = aentry.getColBytes(0);assert (key != null);if (key == null) continue; // skip deleted entries@@ -278,7 +278,7 @@ public class kelondroCollectionIndex {Map<String, String> props = new HashMap<String, String>();if (propfile.exists()) {props = serverFileUtils.loadHashMap(propfile);- String stored_rowdef = (String) props.get("rowdef");+ String stored_rowdef = props.get("rowdef");if ((stored_rowdef == null) || (!(rowdef.subsumes(new kelondroRow(stored_rowdef, rowdef.objectOrder, 0))))) {System.out.println("FATAL ERROR: stored rowdef '" + stored_rowdef + "' does not match with new rowdef '" +rowdef + "' for array cluster '" + path + "/" + filenameStub + "'");@@ -314,7 +314,7 @@ public class kelondroCollectionIndex {private kelondroFixedWidthArray getArray(int partitionNumber, int serialNumber, kelondroByteOrder indexOrder, int chunksize) {String accessKey = partitionNumber + "-" + chunksize;- kelondroFixedWidthArray array = (kelondroFixedWidthArray) arrays.get(accessKey);+ kelondroFixedWidthArray array = arrays.get(accessKey);if (array != null) return array;try {array = openArrayFile(partitionNumber, serialNumber, indexOrder, true);@@ -390,7 +390,7 @@ public class kelondroCollectionIndex {indexrow.setCol(idx_col_chunkcount, collection.size());indexrow.setCol(idx_col_clusteridx, (byte) partitionNumber);indexrow.setCol(idx_col_flags, (byte) 0);- indexrow.setCol(idx_col_indexpos, (long) newRowNumber);+ indexrow.setCol(idx_col_indexpos, newRowNumber);indexrow.setCol(idx_col_lastread, kelondroRowCollection.daysSince2000(System.currentTimeMillis()));indexrow.setCol(idx_col_lastwrote, kelondroRowCollection.daysSince2000(System.currentTimeMillis()));@@ -416,7 +416,7 @@ public class kelondroCollectionIndex {// store the new row number in the indexindexrow.setCol(idx_col_chunkcount, collection.size());indexrow.setCol(idx_col_clusteridx, (byte) partitionNumber);- indexrow.setCol(idx_col_indexpos, (long) rowNumber);+ indexrow.setCol(idx_col_indexpos, rowNumber);indexrow.setCol(idx_col_lastwrote, kelondroRowCollection.daysSince2000(System.currentTimeMillis()));// after calling this method there must be a index.put(indexrow);@@ -470,7 +470,7 @@ public class kelondroCollectionIndex {//int oldchunksize = (int) indexrow.getColLong(idx_col_chunksize); // needed only for migrationint oldchunkcount = (int) indexrow.getColLong(idx_col_chunkcount); // the number if rows in the collectionint oldrownumber = (int) indexrow.getColLong(idx_col_indexpos); // index of the entry in array- int oldPartitionNumber = (int) indexrow.getColByte(idx_col_clusteridx); // points to array file+ int oldPartitionNumber = indexrow.getColByte(idx_col_clusteridx); // points to array fileassert (oldPartitionNumber >= arrayIndex(oldchunkcount));int newPartitionNumber = arrayIndex(collection.size());@@ -508,13 +508,13 @@ public class kelondroCollectionIndex {} else {// merge with the old collection// attention! this modifies the indexrow entry which must be written with index.put(indexrow) afterwards!- kelondroRowCollection collection = (kelondroRowCollection) container;+ kelondroRowCollection collection = container;// read old informationint oldchunksize = (int) indexrow.getColLong(idx_col_chunksize); // needed only for migrationint oldchunkcount = (int) indexrow.getColLong(idx_col_chunkcount); // the number if rows in the collectionint oldrownumber = (int) indexrow.getColLong(idx_col_indexpos); // index of the entry in array- int oldPartitionNumber = (int) indexrow.getColByte(idx_col_clusteridx); // points to array file+ int oldPartitionNumber = indexrow.getColByte(idx_col_clusteridx); // points to array fileassert (oldPartitionNumber >= arrayIndex(oldchunkcount)) : "oldPartitionNumber = " + oldPartitionNumber + ", arrayIndex(oldchunkcount) = " + arrayIndex(oldchunkcount);int oldSerialNumber = 0;@@ -598,7 +598,7 @@ public class kelondroCollectionIndex {// now delete randomly more entries from the survival collectioni = collection.rows();while (i.hasNext()) {- entry = (kelondroRow.Entry) i.next();+ entry = i.next();ref = entry.getColBytes(0);if (rand.nextInt() % 4 != 0) {t2 = System.currentTimeMillis();@@ -648,7 +648,7 @@ public class kelondroCollectionIndex {int oldchunksize = (int) indexrow.getColLong(idx_col_chunksize); // needed only for migrationint oldchunkcount = (int) indexrow.getColLong(idx_col_chunkcount); // the number if rows in the collectionint oldrownumber = (int) indexrow.getColLong(idx_col_indexpos); // index of the entry in array- int oldPartitionNumber = (int) indexrow.getColByte(idx_col_clusteridx); // points to array file+ int oldPartitionNumber = indexrow.getColByte(idx_col_clusteridx); // points to array fileassert (oldPartitionNumber >= arrayIndex(oldchunkcount));int removed = 0;@@ -728,7 +728,7 @@ public class kelondroCollectionIndex {int chunksize = (int) indexrow.getColLong(idx_col_chunksize);int chunkcount = (int) indexrow.getColLong(idx_col_chunkcount);int rownumber = (int) indexrow.getColLong(idx_col_indexpos);- int partitionnumber = (int) indexrow.getColByte(idx_col_clusteridx);+ int partitionnumber = indexrow.getColByte(idx_col_clusteridx);assert(partitionnumber >= arrayIndex(chunkcount)) : "partitionnumber = " + partitionnumber + ", arrayIndex(chunkcount) = " + arrayIndex(chunkcount);int serialnumber = 0;@@ -762,7 +762,7 @@ public class kelondroCollectionIndex {indexEntry.setCol(idx_col_chunkcount, collection.size());indexEntry.setCol(idx_col_clusteridx, (byte) clusteridx);indexEntry.setCol(idx_col_flags, (byte) 0);- indexEntry.setCol(idx_col_indexpos, (long) rownumber);+ indexEntry.setCol(idx_col_indexpos, rownumber);indexEntry.setCol(idx_col_lastread, kelondroRowCollection.daysSince2000(System.currentTimeMillis()));indexEntry.setCol(idx_col_lastwrote, kelondroRowCollection.daysSince2000(System.currentTimeMillis()));index.put(indexEntry);@@ -804,7 +804,7 @@ public class kelondroCollectionIndex {}public Object[] next() {- kelondroRow.Entry indexrow = (kelondroRow.Entry) indexRowIterator.next();+ kelondroRow.Entry indexrow = indexRowIterator.next();assert (indexrow != null);if (indexrow == null) return null;try {diff --git a/source/de/anomic/kelondro/kelondroDyn.java b/source/de/anomic/kelondro/kelondroDyn.javaindex 015544bc4..c09f39e32 100644--- a/source/de/anomic/kelondro/kelondroDyn.java+++ b/source/de/anomic/kelondro/kelondroDyn.java@@ -195,7 +195,7 @@ public class kelondroDyn {int c;kelondroRow.Entry nt;while (ri.hasNext()) {- nt = (kelondroRow.Entry) ri.next();+ nt = ri.next();if (nt == null) return null;g = nt.getColBytes(0);if (g == null) return null;diff --git a/source/de/anomic/kelondro/kelondroDynTree.java b/source/de/anomic/kelondro/kelondroDynTree.javaindex 962978619..5ec671e46 100644--- a/source/de/anomic/kelondro/kelondroDynTree.java+++ b/source/de/anomic/kelondro/kelondroDynTree.java@@ -82,7 +82,7 @@ public class kelondroDynTree {public void close() throws IOException {Iterator<String> e = treeRAHandles.keySet().iterator();- while (e.hasNext()) closeTree((String) e.next());+ while (e.hasNext()) closeTree(e.next());int size = table.sizeDyn();table.close();if (size == 0) this.file.delete();@@ -120,7 +120,7 @@ public class kelondroDynTree {}protected void closeTree(String key) throws IOException {- kelondroRA ra = (kelondroRA) treeRAHandles.get(key);+ kelondroRA ra = treeRAHandles.get(key);if (ra != null) {ra.close();treeRAHandles.remove(key);@@ -128,7 +128,7 @@ public class kelondroDynTree {}protected void removeTree(String key) throws IOException {- kelondroRA ra = (kelondroRA) treeRAHandles.get(key);+ kelondroRA ra = treeRAHandles.get(key);if (ra != null) {ra.close();treeRAHandles.remove(key);@@ -152,7 +152,7 @@ public class kelondroDynTree {}public kelondroRow.Entry get(byte[] key) throws IOException {- kelondroRow.Entry entry = (kelondroRow.Entry) tcache.get(new String(key));+ kelondroRow.Entry entry = tcache.get(new String(key));if (entry == null) {kelondroTree t = getTree(this.tablename);entry = t.get(key);@@ -205,7 +205,7 @@ public class kelondroDynTree {String key;while (e.hasNext()) {key = e.next();- entry = (kelondroRow.Entry) this.tbuffer.get(key);+ entry = this.tbuffer.get(key);t.put(entry);}t.close();@@ -217,7 +217,7 @@ public class kelondroDynTree {// read cachedpublic synchronized kelondroRow.Entry get(String tablename, byte[] key) throws IOException {- treeCache tc = (treeCache) cache.get(table);+ treeCache tc = cache.get(table);//FIXME shouldn't this be tablename (key is a String) - danielr 2008-06-06if (tc == null) {tc = new treeCache(tablename);cache.put(tablename, tc);@@ -227,11 +227,11 @@ public class kelondroDynTree {// write bufferedpublic synchronized void put(String tablename, kelondroRow.Entry newrow) {- treeBuffer tb = (treeBuffer) buffer.get(tablename);+ treeBuffer tb = buffer.get(tablename);if (tb == null) {tb = new treeBuffer(tablename);}- treeCache tc = (treeCache) cache.get(table);+ treeCache tc = cache.get(table);if (tc == null) {tc = new treeCache(tablename);cache.put(tablename, tc);@@ -242,11 +242,11 @@ public class kelondroDynTree {}public synchronized void remove(String tablename, byte[] key) {- treeBuffer tb = (treeBuffer) buffer.get(tablename);+ treeBuffer tb = buffer.get(tablename);if (tb == null) {tb = new treeBuffer(tablename);}- treeCache tc = (treeCache) cache.get(table);+ treeCache tc = cache.get(table);if (tc == null) {tc = new treeCache(tablename);cache.put(tablename, tc);@@ -275,7 +275,7 @@ public class kelondroDynTree {treeBuffer tb;while (e.hasNext()) {tablename = e.next();- tb = (treeBuffer) buffer.get(tablename);+ tb = buffer.get(tablename);if ((System.currentTimeMillis() - tb.timestamp > this.maxageBuffer) ||(tb.tbuffer.size() > this.maxsizeBuffer) ||(buffer.size() > this.maxcountBuffer)) {diff --git a/source/de/anomic/kelondro/kelondroEcoFS.java b/source/de/anomic/kelondro/kelondroEcoFS.javaindex 532213566..1266f0ac6 100644--- a/source/de/anomic/kelondro/kelondroEcoFS.java+++ b/source/de/anomic/kelondro/kelondroEcoFS.java@@ -90,7 +90,7 @@ public class kelondroEcoFS {// should not happene.printStackTrace();}- try { fos.close(); } catch (IOException e) {}+ try { if (fos != null) fos.close(); } catch (IOException e) {}}// open an existing table file@@ -102,8 +102,8 @@ public class kelondroEcoFS {}// initialize cache and buffer- cache = new byte[Math.max(1, (int) (maxReadCache / recordsize)) * recordsize];- buffer = new byte[Math.max(1, (int) (maxWriteBuffer / recordsize)) * recordsize];+ cache = new byte[Math.max(1, (maxReadCache / recordsize)) * recordsize];+ buffer = new byte[Math.max(1, (maxWriteBuffer / recordsize)) * recordsize];this.buffercount = 0;// first-time read of cache@@ -119,7 +119,7 @@ public class kelondroEcoFS {if (!tablefile.exists()) return 0;long size = tablefile.length();assert size % recordsize == 0;- return size / (long) recordsize;+ return size / recordsize;}/**@@ -127,7 +127,7 @@ public class kelondroEcoFS {* @throws IOException*/public synchronized long size() throws IOException {- return filesize() + (long) this.buffercount;+ return filesize() + this.buffercount;}public File filename() {@@ -139,7 +139,7 @@ public class kelondroEcoFS {* @throws IOException*/private long filesize() throws IOException {- return raf.length() / (long) recordsize;+ return raf.length() / recordsize;}/**@@ -200,7 +200,7 @@ public class kelondroEcoFS {if (this.cachecount == 0) return;// copy records from file to cache- raf.seek((long) this.recordsize * (long) index);+ raf.seek(this.recordsize * index);raf.read(this.cache, 0, this.recordsize * this.cachecount);}@@ -280,7 +280,7 @@ public class kelondroEcoFS {if (p >= 0) {// write entry to the cache and to the fileSystem.arraycopy(b, start, this.cache, p * this.recordsize, this.recordsize);- raf.seek((long) index * (long) this.recordsize);+ raf.seek(index * this.recordsize);raf.write(b, start, this.recordsize);return;}@@ -309,7 +309,7 @@ public class kelondroEcoFS {} else {// write the record directly to the file,// do not care about the cache; this case was checked before- raf.seek((long) index * (long) this.recordsize);+ raf.seek(index * this.recordsize);raf.write(b, start, this.recordsize);}}@@ -413,7 +413,7 @@ public class kelondroEcoFS {// write zero bytes to the cache and to the fileSystem.arraycopy(zero, 0, this.cache, p * this.recordsize, this.recordsize);- this.raf.seek((long) index * (long) this.recordsize);+ this.raf.seek(index * this.recordsize);this.raf.write(zero, 0, this.recordsize);return;}@@ -446,7 +446,7 @@ public class kelondroEcoFS {if (p >= 0) {// write zero bytes to the cache and to the fileSystem.arraycopy(zero, 0, this.cache, p * this.recordsize, this.recordsize);- raf.seek((long) index * (long) this.recordsize);+ raf.seek(index * this.recordsize);raf.write(zero, 0, this.recordsize);return;}@@ -456,7 +456,7 @@ public class kelondroEcoFS {return;}- raf.seek((long) index * (long) this.recordsize);+ raf.seek(index * this.recordsize);raf.write(zero, 0, this.recordsize);}@@ -502,7 +502,7 @@ public class kelondroEcoFS {System.arraycopy(this.cache, p * this.recordsize, b, start, this.recordsize);// shrink cache and fileassert this.buffercount == 0;- this.raf.setLength((long) (s - 1) * (long) this.recordsize);+ this.raf.setLength((s - 1) * this.recordsize);this.cachecount--;return;}@@ -540,7 +540,7 @@ public class kelondroEcoFS {if (p >= 0) {// shrink cache and fileassert this.buffercount == 0;- this.raf.setLength((long) (s - 1) * (long) this.recordsize);+ this.raf.setLength((s - 1) * this.recordsize);this.cachecount--;return;}@@ -552,7 +552,7 @@ public class kelondroEcoFS {}// check if file should shrinkassert this.buffercount == 0;- this.raf.setLength((long) (s - 1) * (long) this.recordsize);+ this.raf.setLength((s - 1) * this.recordsize);}public static class ChunkIterator implements Iterator<byte[]> {diff --git a/source/de/anomic/kelondro/kelondroEcoTable.java b/source/de/anomic/kelondro/kelondroEcoTable.javaindex af354d2c6..c23bd4f60 100644--- a/source/de/anomic/kelondro/kelondroEcoTable.java+++ b/source/de/anomic/kelondro/kelondroEcoTable.java@@ -100,8 +100,8 @@ public class kelondroEcoTable implements kelondroIndex {int fileSize = (int) tableSize(tablefile, rowdef.objectsize);// initialize index and copy table- int records = (int) Math.max(fileSize, initialSpace);- long neededRAM4table = ((long) records) * (((long) rowdef.objectsize) + 4L) * 3L;+ int records = Math.max(fileSize, initialSpace);+ long neededRAM4table = (records) * ((rowdef.objectsize) + 4L) * 3L;table = ((neededRAM4table < maxarraylength) &&((useTailCache == tailCacheForceUsage) ||((useTailCache == tailCacheUsageAuto) && (serverMemory.free() > neededRAM4table + 200 * 1024 * 1024)))) ?diff --git a/source/de/anomic/kelondro/kelondroFlexTable.java b/source/de/anomic/kelondro/kelondroFlexTable.javaindex d4254e53f..f949dd958 100644--- a/source/de/anomic/kelondro/kelondroFlexTable.java+++ b/source/de/anomic/kelondro/kelondroFlexTable.java@@ -411,7 +411,7 @@ public class kelondroFlexTable extends kelondroFlexWidthArray implements kelondrpublic kelondroRow.Entry next() {kelondroRow.Entry idxEntry = null;while ((indexIterator.hasNext()) && (idxEntry == null)) {- idxEntry = (kelondroRow.Entry) indexIterator.next();+ idxEntry = indexIterator.next();}if (idxEntry == null) {serverLog.logSevere("kelondroFlexTable.rowIterator: " + tablename, "indexIterator returned null");@@ -445,7 +445,7 @@ public class kelondroFlexTable extends kelondroFlexWidthArray implements kelondr// returns a map for each file in the tracker;// the map represents properties for each record oobjects,// i.e. for cache memory allocation- kelondroFlexTable theFlexTable = (kelondroFlexTable) tableTracker.get(filename);+ kelondroFlexTable theFlexTable = tableTracker.get(filename);return theFlexTable.profile();}@@ -453,7 +453,7 @@ public class kelondroFlexTable extends kelondroFlexWidthArray implements kelondr// returns a map for each file in the tracker;// the map represents properties for each record objects,// i.e. for cache memory allocation- kelondroFlexTable theFlexTable = (kelondroFlexTable) tableTracker.get(filename);+ kelondroFlexTable theFlexTable = tableTracker.get(filename);return theFlexTable.memoryStats();}diff --git a/source/de/anomic/kelondro/kelondroFullRecords.java b/source/de/anomic/kelondro/kelondroFullRecords.javaindex 67b1da02e..8c359fa78 100644--- a/source/de/anomic/kelondro/kelondroFullRecords.java+++ b/source/de/anomic/kelondro/kelondroFullRecords.java@@ -86,7 +86,7 @@ public class kelondroFullRecords extends kelondroAbstractRecords {public EcoNode(byte[] rowinstance) throws IOException {// this initializer is used to create nodes from bulk-read byte arrays- assert ((rowinstance == null) || (rowinstance.length == ROW.objectsize)) : "bulkchunk.length = " + rowinstance.length + ", ROW.width(0) = " + ROW.width(0);+ assert ((rowinstance == null) || (rowinstance.length == ROW.objectsize)) : "bulkchunk.length = " + (rowinstance == null ? "null" : rowinstance.length) + ", ROW.width(0) = " + ROW.width(0);this.handle = new kelondroHandle(USAGE.allocatePayload(rowinstance));// create chunks@@ -118,7 +118,7 @@ public class kelondroFullRecords extends kelondroAbstractRecords {} else {changed = true;}- assert ((bulkchunk == null) || (bulkchunk.length - offset >= recordsize)) : "bulkchunk.length = " + bulkchunk.length + ", offset = " + offset + ", recordsize = " + recordsize;+ assert ((bulkchunk == null) || (bulkchunk.length - offset >= recordsize)) : "bulkchunk.length = " + (bulkchunk == null ? "null" : bulkchunk.length) + ", offset = " + offset + ", recordsize = " + recordsize;/*if ((offset == 0) && (overhead == 0) && ((bulkchunk == null) || (bulkchunk.length == ROW.objectsize()))) {this.ohChunk = new byte[0];@@ -236,7 +236,7 @@ public class kelondroFullRecords extends kelondroAbstractRecords {// load all values from the database filethis.bodyChunk = new byte[ROW.objectsize];// read values- entryFile.readFully(seekpos(this.handle) + (long) overhead, this.bodyChunk, 0, this.bodyChunk.length);+ entryFile.readFully(seekpos(this.handle) + overhead, this.bodyChunk, 0, this.bodyChunk.length);}return this.bodyChunk;diff --git a/source/de/anomic/kelondro/kelondroHandle.java b/source/de/anomic/kelondro/kelondroHandle.javaindex 312831626..e3b0a9c55 100644--- a/source/de/anomic/kelondro/kelondroHandle.java+++ b/source/de/anomic/kelondro/kelondroHandle.java@@ -63,19 +63,19 @@ public class kelondroHandle implements Comparable<kelondroHandle> {}public int compare(kelondroHandle h0, kelondroHandle h1) {- assert (((kelondroHandle) h0).index != NUL);- assert (((kelondroHandle) h1).index != NUL);- if (((kelondroHandle) h0).index < ((kelondroHandle) h1).index) return -1;- if (((kelondroHandle) h0).index > ((kelondroHandle) h1).index) return 1;+ assert ((h0).index != NUL);+ assert ((h1).index != NUL);+ if ((h0).index < (h1).index) return -1;+ if ((h0).index > (h1).index) return 1;return 0;}public int compareTo(kelondroHandle h) {// this is needed for a TreeMapassert (index != NUL) : "this.index is NUL in compareTo";- assert (((kelondroHandle) h).index != NUL) : "handle.index is NUL in compareTo";- if (index < ((kelondroHandle) h).index) return -1;- if (index > ((kelondroHandle) h).index) return 1;+ assert ((h).index != NUL) : "handle.index is NUL in compareTo";+ if (index < (h).index) return -1;+ if (index > (h).index) return 1;return 0;}diff --git a/source/de/anomic/kelondro/kelondroHashtable.java b/source/de/anomic/kelondro/kelondroHashtable.javaindex 6b63a2eb3..ca1320108 100644--- a/source/de/anomic/kelondro/kelondroHashtable.java+++ b/source/de/anomic/kelondro/kelondroHashtable.java@@ -215,7 +215,7 @@ public class kelondroHashtable {newhkrow.setCol(0, hash.key());newhkrow.setCol(1, rowentry.bytes());hashArray.set(rowNumber, newhkrow);- return hashArray.row().newEntry(oldhkrow.getColBytes(1));+ return (oldhkrow == null ? null : hashArray.row().newEntry(oldhkrow.getColBytes(1)));}private Object[] search(Hash hash) throws IOException {diff --git a/source/de/anomic/kelondro/kelondroHeap.java b/source/de/anomic/kelondro/kelondroHeap.javaindex f4aecf26d..18e204efb 100755--- a/source/de/anomic/kelondro/kelondroHeap.java+++ b/source/de/anomic/kelondro/kelondroHeap.java@@ -37,9 +37,6 @@ import java.io.FileOutputStream;import java.io.IOException;import java.io.RandomAccessFile;-import de.anomic.kelondro.kelondroByteOrder;-import de.anomic.kelondro.kelondroBytesLongMap;-public final class kelondroHeap {private kelondroBytesLongMap index;@@ -60,7 +57,7 @@ public final class kelondroHeap {this.ordering = ordering;this.heapFile = heapFile;if (!(heapFile.exists())) throw new IOException("file " + heapFile + " does not exist");- if (heapFile.length() >= (long) Integer.MAX_VALUE) throw new IOException("file " + heapFile + " too large, index can only be crated for files less than 2GB");+ if (heapFile.length() >= Integer.MAX_VALUE) throw new IOException("file " + heapFile + " too large, index can only be crated for files less than 2GB");this.index = new kelondroBytesLongMap(keylength, this.ordering, 0);DataInputStream is = null;@@ -90,10 +87,10 @@ public final class kelondroHeap {break loop; // terminate loop}keystring = new String(key);- seek += (long) keystring.length();+ seek += keystring.length();// skip content- seek += (long) reclen;+ seek += reclen;while (reclen > 0) reclen -= is.skip(reclen);// store access address to entrydiff --git a/source/de/anomic/kelondro/kelondroIntBytesMap.java b/source/de/anomic/kelondro/kelondroIntBytesMap.javaindex bdc4e1e11..e6eb5ebf7 100644--- a/source/de/anomic/kelondro/kelondroIntBytesMap.java+++ b/source/de/anomic/kelondro/kelondroIntBytesMap.java@@ -62,7 +62,7 @@ public class kelondroIntBytesMap {public byte[] getb(int ii) {assert ii >= 0 : "i = " + ii;- byte[] key = kelondroNaturalOrder.encodeLong((long) ii, 4);+ byte[] key = kelondroNaturalOrder.encodeLong(ii, 4);if (index0 != null) {if (index1 == null) {// finish initialization phase@@ -82,7 +82,7 @@ public class kelondroIntBytesMap {public byte[] putb(int ii, byte[] value) {assert ii >= 0 : "i = " + ii;assert value != null;- byte[] key = kelondroNaturalOrder.encodeLong((long) ii, 4);+ byte[] key = kelondroNaturalOrder.encodeLong(ii, 4);if (index0 != null) {if (index1 == null) {// finish initialization phase@@ -104,7 +104,7 @@ public class kelondroIntBytesMap {assert (index1 != null);kelondroRow.Entry newentry = rowdef.newEntry();- newentry.setCol(0, (long) ii);+ newentry.setCol(0, ii);newentry.setCol(1, value);kelondroRow.Entry oldentry = index1.put(newentry);if (oldentry == null) return null;@@ -116,7 +116,7 @@ public class kelondroIntBytesMap {assert ii >= 0 : "i = " + ii;assert value != null;kelondroRow.Entry newentry = index0.row().newEntry();- newentry.setCol(0, (long) ii);+ newentry.setCol(0, ii);newentry.setCol(1, value);index0.addUnique(newentry);}@@ -124,7 +124,7 @@ public class kelondroIntBytesMap {public byte[] removeb(int ii) {assert ii >= 0 : "i = " + ii;- byte[] key = kelondroNaturalOrder.encodeLong((long) ii, 4);+ byte[] key = kelondroNaturalOrder.encodeLong(ii, 4);if (index0 != null) {if (index1 == null) {// finish initialization phase@@ -239,7 +239,7 @@ public class kelondroIntBytesMap {if ((ra.size() > 0) && (random.nextLong() % 7 == 0)) {rc++;p = Math.abs(random.nextInt()) % ra.size();- R = (Long) ra.get(p);+ R = ra.get(p);//System.out.println("remove " + R.longValue());jcontrol.remove(R);kcontrol.removeb((int) R.longValue());diff --git a/source/de/anomic/kelondro/kelondroMScoreCluster.java b/source/de/anomic/kelondro/kelondroMScoreCluster.javaindex 406f3af6b..c2ff95cbe 100644--- a/source/de/anomic/kelondro/kelondroMScoreCluster.java+++ b/source/de/anomic/kelondro/kelondroMScoreCluster.java@@ -84,7 +84,7 @@ public final class kelondroMScoreCluster<E> {if (o instanceof Integer) return ((Integer) o).intValue();if (o instanceof Long) {long l = ((Long) o).longValue();- if (l < (long) Integer.MAX_VALUE) return (int) l;+ if (l < Integer.MAX_VALUE) return (int) l;o = ((Long) o).toString();}if (o instanceof Double) {@@ -141,7 +141,7 @@ public final class kelondroMScoreCluster<E> {}private long scoreKey(int elementNr, int elementCount) {- return (((long) (elementCount & 0xFFFFFFFFL)) << 32) | ((long) (elementNr & 0xFFFFFFFFL));+ return (((elementCount & 0xFFFFFFFFL)) << 32) | ((elementNr & 0xFFFFFFFFL));}public synchronized long totalCount() {@@ -348,8 +348,8 @@ public final class kelondroMScoreCluster<E> {Long key;int score = (max + min) / 2;while (keyrefDBcopy.size() > 0) {- key = (Long) ((up) ? keyrefDBcopy.firstKey() : keyrefDBcopy.lastKey());- n = (E) keyrefDBcopy.remove(key);+ key = ((up) ? keyrefDBcopy.firstKey() : keyrefDBcopy.lastKey());+ n = keyrefDBcopy.remove(key);score = (int) ((key.longValue() & 0xFFFFFFFF00000000L) >> 32);if ((score >= min) && (score <= max)) return;if (((up) && (score > max)) || ((!(up)) && (score < min))) {diff --git a/source/de/anomic/kelondro/kelondroMSetTools.java b/source/de/anomic/kelondro/kelondroMSetTools.javaindex f010459ed..c52f321b1 100644--- a/source/de/anomic/kelondro/kelondroMSetTools.java+++ b/source/de/anomic/kelondro/kelondroMSetTools.java@@ -104,13 +104,13 @@ public class kelondroMSetTools {if (orderMap.size() == 0) return new TreeMap<A, B>();// we now must pairwise build up a conjunction of these maps- Long k = (Long) orderMap.firstKey(); // the smallest, which means, the one with the least entries- TreeMap<A, B> mapA, mapB, joinResult = (TreeMap<A, B>) orderMap.remove(k);+ Long k = orderMap.firstKey(); // the smallest, which means, the one with the least entries+ TreeMap<A, B> mapA, mapB, joinResult = orderMap.remove(k);while ((orderMap.size() > 0) && (joinResult.size() > 0)) {// take the first element of map which is a result and combine it with result- k = (Long) orderMap.firstKey(); // the next smallest...+ k = orderMap.firstKey(); // the next smallest...mapA = joinResult;- mapB = (TreeMap<A, B>) orderMap.remove(k);+ mapB = orderMap.remove(k);joinResult = joinConstructiveByTest(mapA, mapB, concatStrings); // TODO: better with enumeration?// free resourcesmapA = null;diff --git a/source/de/anomic/kelondro/kelondroMapObjects.java b/source/de/anomic/kelondro/kelondroMapObjects.javaindex 56b799abb..bb1dc1bcf 100644--- a/source/de/anomic/kelondro/kelondroMapObjects.java+++ b/source/de/anomic/kelondro/kelondroMapObjects.java@@ -45,7 +45,7 @@ public class kelondroMapObjects extends kelondroObjects {this(dyn, cachesize, null, null, null, null, null);}- @SuppressWarnings("unchecked")+ @SuppressWarnings({ "unchecked", "null" })public kelondroMapObjects(kelondroDyn dyn, int cachesize, String[] sortfields, String[] longaccfields, String[] doubleaccfields, Method externalInitializer, Object externalHandler) {super(dyn, cachesize);@@ -240,7 +240,7 @@ public class kelondroMapObjects extends kelondroObjects {for (int i = 0; i < sortfields.length; i++) {cell = map.get(sortfields[i]);if (cell != null) {- cluster = (kelondroMScoreCluster<String>) sortClusterMap.get(sortfields[i]);+ cluster = sortClusterMap.get(sortfields[i]);cluster.setScore(key, kelondroMScoreCluster.object2score(cell));sortClusterMap.put(sortfields[i], cluster);}diff --git a/source/de/anomic/kelondro/kelondroMapTable.java b/source/de/anomic/kelondro/kelondroMapTable.javaindex d959ccae9..de07de9ea 100644--- a/source/de/anomic/kelondro/kelondroMapTable.java+++ b/source/de/anomic/kelondro/kelondroMapTable.java@@ -92,7 +92,7 @@ public class kelondroMapTable {}public synchronized void update(String tablename, String key, HashMap<String, String> map) throws IOException {- kelondroMapObjects table = (kelondroMapObjects) mTables.get(tablename);+ kelondroMapObjects table = 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());table.set(key, map);@@ -100,45 +100,45 @@ public class kelondroMapTable {}public synchronized void update(String tablename, kelondroRow.Entry row /* first element is the unique key = index */) throws IOException {- kelondroIndex tree = (kelondroIndex) tTables.get(tablename);+ kelondroIndex tree = tTables.get(tablename);if (tree == null) throw new RuntimeException("kelondroTables.update: tree table '" + tablename + "' does not exist.");tree.put(row);tTables.put(tablename, tree);}public synchronized Map<String, String> selectMap(String tablename, String key) {- kelondroMapObjects table = (kelondroMapObjects) mTables.get(tablename);+ kelondroMapObjects table = mTables.get(tablename);if (table == null) throw new RuntimeException("kelondroTables.selectMap: map table '" + tablename + "' does not exist.");if (key.length() > table.keySize()) key = key.substring(0, table.keySize());return table.getMap(key);}public synchronized kelondroRow.Entry selectByte(String tablename, String key) throws IOException {- kelondroIndex tree = (kelondroIndex) tTables.get(tablename);+ kelondroIndex tree = tTables.get(tablename);if (tree == null) throw new RuntimeException("kelondroTables.selectByte: tree table '" + tablename + "' does not exist.");return tree.get(key.getBytes());}public synchronized kelondroMapObjects.mapIterator /* of Map-Elements */ maps(String tablename, boolean up, boolean rotating) throws IOException {- kelondroMapObjects table = (kelondroMapObjects) mTables.get(tablename);+ kelondroMapObjects table = mTables.get(tablename);if (table == null) throw new RuntimeException("kelondroTables.maps: map table '" + tablename + "' does not exist.");return table.maps(up, rotating);}public synchronized kelondroMapObjects.mapIterator /* of Map-Elements */ maps(String tablename, boolean up, boolean rotating, byte[] firstKey, byte[] secondKey) throws IOException {- kelondroMapObjects table = (kelondroMapObjects) mTables.get(tablename);+ kelondroMapObjects table = mTables.get(tablename);if (table == null) throw new RuntimeException("kelondroTables.maps: map table '" + tablename + "' does not exist.");return table.maps(up, rotating, firstKey, secondKey);}public synchronized kelondroMapObjects.mapIterator /* of Map-Elements */ maps(String tablename, boolean up, String field) {- kelondroMapObjects table = (kelondroMapObjects) mTables.get(tablename);+ kelondroMapObjects table = mTables.get(tablename);if (table == null) throw new RuntimeException("kelondroTables.maps: map table '" + tablename + "' does not exist.");return table.maps(up, field);}public synchronized kelondroCloneableIterator<kelondroRow.Entry> /* of kelondroRow.Entry-Elements */ rows(String tablename, boolean up, boolean rotating, byte[] firstKey, byte[] secondKey) throws IOException {- kelondroIndex tree = (kelondroIndex) tTables.get(tablename);+ kelondroIndex tree = tTables.get(tablename);if (tree == null) throw new RuntimeException("kelondroTables.bytes: tree table '" + tablename + "' does not exist.");kelondroCloneableIterator<kelondroRow.Entry> i = tree.rows(up, firstKey);if (rotating) return new kelondroRotateIterator<kelondroRow.Entry>(i, secondKey, tree.size()); else return i;@@ -147,33 +147,33 @@ public class kelondroMapTable {// if you need the long-values from a row-iteration, please use kelondroRecords.bytes2long to convert from byte[] to longpublic synchronized void delete(String tablename, String key) throws IOException {- kelondroMapObjects table = (kelondroMapObjects) mTables.get(tablename);+ kelondroMapObjects table = mTables.get(tablename);if (key.length() > table.keySize()) key = key.substring(0, table.keySize());if (table != null) {table.remove(key); mTables.put(tablename, table); return;}- kelondroIndex Tree = (kelondroIndex) tTables.get(tablename);+ kelondroIndex Tree = tTables.get(tablename);if (Tree != null) {Tree.remove(key.getBytes(), false); tTables.put(tablename, Tree); return;}throw new RuntimeException("kelondroTables.delete: table '" + tablename + "' does not exist.");}public synchronized long longAccumulator(String tablename, String field) {- kelondroMapObjects table = (kelondroMapObjects) mTables.get(tablename);+ kelondroMapObjects table = mTables.get(tablename);if (table == null) throw new RuntimeException("kelondroTables.accumulator: map table '" + tablename + "' does not exist.");return table.getLongAcc(field);}public synchronized double doubleAccumulator(String tablename, String field) {- kelondroMapObjects table = (kelondroMapObjects) mTables.get(tablename);+ kelondroMapObjects table = mTables.get(tablename);if (table == null) throw new RuntimeException("kelondroTables.accumulator: map table '" + tablename + "' does not exist.");return table.getDoubleAcc(field);}public synchronized int size(String tablename) {- kelondroMapObjects table = (kelondroMapObjects) mTables.get(tablename);+ kelondroMapObjects table = mTables.get(tablename);if (table != null) return table.size();- kelondroIndex Tree = (kelondroIndex) tTables.get(tablename);+ kelondroIndex Tree = tTables.get(tablename);if (Tree != null) return Tree.size();throw new RuntimeException("kelondroTables.accumulator: table '" + tablename + "' does not exist.");@@ -181,11 +181,11 @@ public class kelondroMapTable {public void close() {Iterator<kelondroMapObjects> tablesIt = mTables.values().iterator();- while (tablesIt.hasNext()) ((kelondroMapObjects) tablesIt.next()).close();+ while (tablesIt.hasNext()) (tablesIt.next()).close();mTables = null;Iterator<kelondroIndex> TreeIt = tTables.values().iterator();- while (TreeIt.hasNext()) ((kelondroIndex) TreeIt.next()).close();+ while (TreeIt.hasNext()) (TreeIt.next()).close();tTables = null;}diff --git a/source/de/anomic/kelondro/kelondroMergeIterator.java b/source/de/anomic/kelondro/kelondroMergeIterator.javaindex 0fd372c8f..6594ba871 100644--- a/source/de/anomic/kelondro/kelondroMergeIterator.java+++ b/source/de/anomic/kelondro/kelondroMergeIterator.java@@ -117,7 +117,7 @@ public class kelondroMergeIterator<E> implements kelondroCloneableIterator<E> {if (c == 0) {try {//System.out.print("MERGE OF " + na.toString() + " AND " + nb.toString() + ": ");- s = (E) this.merger.invoke(null, new Object[]{(Object) na, (Object) nb});+ s = (E) this.merger.invoke(null, new Object[]{na, nb});//System.out.println("RESULT IS " + s.toString());} catch (IllegalArgumentException e) {e.printStackTrace();diff --git a/source/de/anomic/kelondro/kelondroNIOFileRA.java b/source/de/anomic/kelondro/kelondroNIOFileRA.javaindex e3defea9c..107be683a 100644--- a/source/de/anomic/kelondro/kelondroNIOFileRA.java+++ b/source/de/anomic/kelondro/kelondroNIOFileRA.java@@ -126,21 +126,21 @@ public class kelondroNIOFileRA extends kelondroAbstractRA implements kelondroRApublic int read() throws IOException {int r;if (seekPos < bodyOffset) {- r = 0xFF & ((int) bufferHead.get((int) seekPos));+ r = 0xFF & (bufferHead.get((int) seekPos));} else if (seekPos < tailOffset) {if (mapBody) {- r = 0xFF & ((int) bufferBody.get((int) (seekPos - bodyOffset)));+ r = 0xFF & (bufferBody.get((int) (seekPos - bodyOffset)));} else {RAFile.seek(seekPos);r = RAFile.read();}} else if (seekPos < (tailOffset + tailCurrSize)) {- r = 0xFF & ((int) bufferTail.get((int) (seekPos - tailOffset)));+ r = 0xFF & (bufferTail.get((int) (seekPos - tailOffset)));} else {r = -1;while (growTail(seekPos)) {if (seekPos < (tailOffset + tailCurrSize)) {- r = 0xFF & ((int) bufferTail.get((int) (seekPos - tailOffset)));+ r = 0xFF & (bufferTail.get((int) (seekPos - tailOffset)));break;} else {RAFile.seek(seekPos);diff --git a/source/de/anomic/kelondro/kelondroNaturalOrder.java b/source/de/anomic/kelondro/kelondroNaturalOrder.javaindex 6e2b3e691..338c60e2c 100644--- a/source/de/anomic/kelondro/kelondroNaturalOrder.java+++ b/source/de/anomic/kelondro/kelondroNaturalOrder.java@@ -179,8 +179,8 @@ public final class kelondroNaturalOrder extends kelondroAbstractOrder<byte[]> imfinal int bl = Math.min(blength, b.length - boffset);int aa, bb;while ((i < al) && (i < bl)) {- aa = 0xff & (int) a[i + aoffset];- bb = 0xff & (int) b[i + boffset];+ aa = 0xff & a[i + aoffset];+ bb = 0xff & b[i + boffset];if (aa > bb) return 1;if (aa < bb) return -1;// else the bytes are equal and it may go on yet undecideddiff --git a/source/de/anomic/kelondro/kelondroObjectSpace.java b/source/de/anomic/kelondro/kelondroObjectSpace.javaindex 87a73a30e..c96d660ee 100644--- a/source/de/anomic/kelondro/kelondroObjectSpace.java+++ b/source/de/anomic/kelondro/kelondroObjectSpace.java@@ -59,7 +59,7 @@ public class kelondroObjectSpace {private static void incAlive(int size) {final Integer s = new Integer(size);synchronized (aliveNow) {- final Integer x = (Integer) aliveNow.get(s);+ final Integer x = aliveNow.get(s);if (x == null) aliveNow.put(s, new Integer(1)); else aliveNow.put(s, new Integer(x.intValue() + 1));}}diff --git a/source/de/anomic/kelondro/kelondroObjects.java b/source/de/anomic/kelondro/kelondroObjects.javaindex 932406d2b..539dc97f2 100644--- a/source/de/anomic/kelondro/kelondroObjects.java+++ b/source/de/anomic/kelondro/kelondroObjects.java@@ -98,7 +98,7 @@ public class kelondroObjects {// load map from cacheassert key != null;if (cache == null) return null; // case may appear during shutdown- kelondroObjectsEntry map = (kelondroObjectsEntry) cache.get(key);+ kelondroObjectsEntry map = cache.get(key);if (map != null) return map;// load map from kra@@ -126,7 +126,7 @@ public class kelondroObjects {if (cache == null) return; // may appear during shutdownif (cache.size() >= cachesize) {// delete one entry- final String delkey = (String) cacheScore.getMinObject();+ final String delkey = cacheScore.getMinObject();cacheScore.deleteScore(delkey);cache.remove(delkey);}@@ -184,7 +184,7 @@ public class kelondroObjects {}public kelondroObjectsEntry next() {- final String nextKey = (String) keyIterator.next();+ final String nextKey = keyIterator.next();if (nextKey == null) {finish = true;return null;diff --git a/source/de/anomic/kelondro/kelondroRotateIterator.java b/source/de/anomic/kelondro/kelondroRotateIterator.javaindex 7dc88f1f5..6e279b705 100644--- a/source/de/anomic/kelondro/kelondroRotateIterator.java+++ b/source/de/anomic/kelondro/kelondroRotateIterator.java@@ -38,7 +38,7 @@ public class kelondroRotateIterator<E> implements kelondroCloneableIterator<E> {this.a = a;this.modifier = modifier;this.terminationCount = terminationCount;- this.clone = (kelondroCloneableIterator<E>) a.clone(modifier);+ this.clone = a.clone(modifier);this.nempty = this.clone.hasNext();}@@ -55,7 +55,7 @@ public class kelondroRotateIterator<E> implements kelondroCloneableIterator<E> {// it must be taken care that a calling method has a termination predicate different// from the hasNext() methodif (!(a.hasNext())) {- a = (kelondroCloneableIterator<E>) clone.clone(modifier);+ a = clone.clone(modifier);assert a.hasNext();}terminationCount--;diff --git a/source/de/anomic/kelondro/kelondroRow.java b/source/de/anomic/kelondro/kelondroRow.javaindex ad4bb663c..3498193c3 100644--- a/source/de/anomic/kelondro/kelondroRow.java+++ b/source/de/anomic/kelondro/kelondroRow.java@@ -87,7 +87,7 @@ public final class kelondroRow {this.objectsize = 0;for (int i = 0; i < l.size(); i++) {this.colstart[i] = this.objectsize;- this.row[i] = (kelondroColumn) l.get(i);+ this.row[i] = l.get(i);this.objectsize += this.row[i].cellwidth;}this.primaryKeyIndex = primaryKey;@@ -323,7 +323,7 @@ public final class kelondroRow {public final int compareTo(Entry o) {// compares only the content of the primary keyif (objectOrder == null) throw new kelondroException("objects cannot be compared, no order given");- return objectOrder.compare(this.getPrimaryKeyBytes(), ((Entry) o).getPrimaryKeyBytes());+ return objectOrder.compare(this.getPrimaryKeyBytes(), (o).getPrimaryKeyBytes());}public final boolean equals(Entry otherEntry) {@@ -367,14 +367,14 @@ public final class kelondroRow {public final void setCol(String nickname, char c) {if (nickref == null) genNickRef();- Object[] ref = (Object[]) nickref.get(nickname);+ Object[] ref = nickref.get(nickname);if (ref == null) return;rowinstance[offset + ((Integer) ref[1]).intValue()] = (byte) c;}public final void setCol(String nickname, byte[] cell) {if (nickref == null) genNickRef();- Object[] ref = (Object[]) nickref.get(nickname);+ Object[] ref = nickref.get(nickname);if (ref == null) return;kelondroColumn col = (kelondroColumn) ref[0];setCol(col.encoder, ((Integer) ref[1]).intValue(), col.cellwidth, cell);@@ -432,7 +432,7 @@ public final class kelondroRow {public final void setCol(String nickname, long cell) {if (nickref == null) genNickRef();- Object[] ref = (Object[]) nickref.get(nickname);+ Object[] ref = nickref.get(nickname);if (ref == null) return;kelondroColumn col = (kelondroColumn) ref[0];setCol(col.encoder, offset + ((Integer) ref[1]).intValue(), col.cellwidth, cell);@@ -460,7 +460,7 @@ public final class kelondroRow {public final byte[] getCol(String nickname, byte[] dflt) {if (nickref == null) genNickRef();- Object[] ref = (Object[]) nickref.get(nickname);+ Object[] ref = nickref.get(nickname);if (ref == null) return dflt;kelondroColumn col = (kelondroColumn) ref[0];byte[] cell = new byte[col.cellwidth];@@ -470,7 +470,7 @@ public final class kelondroRow {public final String getColString(String nickname, String dflt, String encoding) {if (nickref == null) genNickRef();- Object[] ref = (Object[]) nickref.get(nickname);+ Object[] ref = nickref.get(nickname);if (ref == null) return dflt;kelondroColumn col = (kelondroColumn) ref[0];return getColString(col.encoder, ((Integer) ref[1]).intValue(), col.cellwidth, encoding);@@ -497,7 +497,7 @@ public final class kelondroRow {public final long getColLong(String nickname, long dflt) {if (nickref == null) genNickRef();- Object[] ref = (Object[]) nickref.get(nickname);+ Object[] ref = nickref.get(nickname);if (ref == null) return dflt;kelondroColumn col = (kelondroColumn) ref[0];int clstrt = ((Integer) ref[1]).intValue();@@ -533,7 +533,7 @@ public final class kelondroRow {public final byte getColByte(String nickname, byte dflt) {if (nickref == null) genNickRef();- Object[] ref = (Object[]) nickref.get(nickname);+ Object[] ref = nickref.get(nickname);if (ref == null) return dflt;return rowinstance[offset + ((Integer) ref[1]).intValue()];}diff --git a/source/de/anomic/kelondro/kelondroRowCollection.java b/source/de/anomic/kelondro/kelondroRowCollection.javaindex 6e949d5dc..08f4f15f3 100644--- a/source/de/anomic/kelondro/kelondroRowCollection.java+++ b/source/de/anomic/kelondro/kelondroRowCollection.java@@ -494,7 +494,7 @@ public class kelondroRowCollection {Iterator<kelondroRow.Entry> i = rows();kelondroRow.Entry row;while (i.hasNext()) {- row = (kelondroRow.Entry) i.next();+ row = i.next();if (!(keys.contains(row.getColString(0, null)))) i.remove();}}@@ -797,7 +797,7 @@ public class kelondroRowCollection {StringBuffer s = new StringBuffer();Iterator<kelondroRow.Entry> i = rows();if (i.hasNext()) s.append(i.next().toString());- while (i.hasNext()) s.append(", " + ((kelondroRow.Entry) i.next()).toString());+ while (i.hasNext()) s.append(", " + (i.next()).toString());return new String(s);}diff --git a/source/de/anomic/kelondro/kelondroRowSet.java b/source/de/anomic/kelondro/kelondroRowSet.javaindex 5655eb4ca..80ba1db99 100644--- a/source/de/anomic/kelondro/kelondroRowSet.java+++ b/source/de/anomic/kelondro/kelondroRowSet.java@@ -423,8 +423,8 @@ public class kelondroRowSet extends kelondroRowCollection implements kelondroIndSystem.out.print("INPUT-ITERATOR: ");kelondroRow.Entry entry;while (ii.hasNext()) {- entry = (kelondroRow.Entry) ii.next();- s = new String((byte[]) entry.getColBytes(0)).trim();+ entry = ii.next();+ s = new String(entry.getColBytes(0)).trim();System.out.print(s + ", ");if (s.equals("drei")) ii.remove();}diff --git a/source/de/anomic/kelondro/kelondroSQLTable.java b/source/de/anomic/kelondro/kelondroSQLTable.javaindex dfb028d80..7559c086c 100644--- a/source/de/anomic/kelondro/kelondroSQLTable.java+++ b/source/de/anomic/kelondro/kelondroSQLTable.java@@ -37,8 +37,6 @@ import java.util.Date;import java.util.Iterator;import java.util.List;-import de.anomic.kelondro.kelondroRow.Entry;-/** Commands to create a database using mysql:*@@ -174,7 +172,7 @@ public class kelondroSQLTable implements kelondroIndex {public synchronized void putMultiple(List<kelondroRow.Entry> rows) throws IOException {Iterator<kelondroRow.Entry> i = rows.iterator();- while (i.hasNext()) put((Entry) i.next());+ while (i.hasNext()) put(i.next());}public kelondroRow.Entry put(kelondroRow.Entry row, Date entryDate) throws IOException {diff --git a/source/de/anomic/kelondro/kelondroSplitTable.java b/source/de/anomic/kelondro/kelondroSplitTable.javaindex 7e4cb280e..9da966f87 100644--- a/source/de/anomic/kelondro/kelondroSplitTable.java+++ b/source/de/anomic/kelondro/kelondroSplitTable.java@@ -131,15 +131,17 @@ public class kelondroSplitTable implements kelondroIndex {// open next biggest tablet.remove(maxf);- date = maxf.substring(tablename.length() + 1);- f = new File(path, maxf);- if (f.isDirectory()) {- // this is a kelonodroFlex table- table = new kelondroCache(new kelondroFlexTable(path, maxf, rowdef, 0, resetOnFail));- } else {- table = new kelondroEcoTable(f, rowdef, kelondroEcoTable.tailCacheUsageAuto, EcoFSBufferSize, 0);+ if(maxf != null) {+ date = maxf.substring(tablename.length() + 1);+ f = new File(path, maxf);+ if (f.isDirectory()) {+ // this is a kelonodroFlex table+ table = new kelondroCache(new kelondroFlexTable(path, maxf, rowdef, 0, resetOnFail));+ } else {+ table = new kelondroEcoTable(f, rowdef, kelondroEcoTable.tailCacheUsageAuto, EcoFSBufferSize, 0);+ }+ tables.put(date, table);}- tables.put(date, table);}}@@ -187,7 +189,7 @@ public class kelondroSplitTable implements kelondroIndex {kelondroProfile[] profiles = new kelondroProfile[tables.size()];Iterator<kelondroIndex> i = tables.values().iterator();int c = 0;- while (i.hasNext()) profiles[c++] = ((kelondroIndex) i.next()).profile();+ while (i.hasNext()) profiles[c++] = (i.next()).profile();return kelondroProfile.consolidate(profiles);}@@ -228,7 +230,7 @@ public class kelondroSplitTable implements kelondroIndex {if ((entryDate == null) || (entryDate.after(new Date()))) entryDate = new Date(); // fix dateString suffix = dateSuffix(entryDate);if (suffix == null) return null;- kelondroIndex table = (kelondroIndex) tables.get(suffix);+ kelondroIndex table = tables.get(suffix);if (table == null) {// open tableFile f = new File(path, tablename + "." + suffix);@@ -317,7 +319,7 @@ public class kelondroSplitTable implements kelondroIndex {if ((entryDate == null) || (entryDate.after(new Date()))) entryDate = new Date(); // fix dateString suffix = dateSuffix(entryDate);if (suffix == null) return false;- kelondroIndex table = (kelondroIndex) tables.get(suffix);+ kelondroIndex table = tables.get(suffix);if (table == null) {// make new tableif (serverMemory.request(minimumRAM4Eco, true)) {@@ -366,7 +368,7 @@ public class kelondroSplitTable implements kelondroIndex {kelondroIndex table, maxtable = null;int maxcount = -1;while (i.hasNext()) {- table = (kelondroIndex) i.next();+ table = i.next();if (table.size() > maxcount) {maxtable = table;maxcount = table.size();diff --git a/source/de/anomic/kelondro/kelondroTree.java b/source/de/anomic/kelondro/kelondroTree.javaindex b91b6c72e..3d69bef0e 100644--- a/source/de/anomic/kelondro/kelondroTree.java+++ b/source/de/anomic/kelondro/kelondroTree.java@@ -439,7 +439,7 @@ public class kelondroTree extends kelondroCachedRecords implements kelondroIndexparentBalance--;path = "R" + path;}- increasedHight = ((java.lang.Math.abs((int) parentBalance) - java.lang.Math.abs((int) prevHight)) > 0);+ increasedHight = ((java.lang.Math.abs(parentBalance) - java.lang.Math.abs(prevHight)) > 0);parentNode.setOHByte(balance, parentBalance);commitNode(parentNode);@@ -449,7 +449,7 @@ public class kelondroTree extends kelondroCachedRecords implements kelondroIndexif (!(increasedHight)) break; // finished// check rotation need- if (java.lang.Math.abs((int) parentBalance) > 1) {+ if (java.lang.Math.abs(parentBalance) > 1) {// rotate and stop then//System.out.println("* DB DEBUG: " + path.substring(0,2) + " ROTATION AT NODE " + parentNode.handle().toString() + ": BALANCE=" + parentOHByte[balance]);if (path.startsWith("LL")) {@@ -977,7 +977,7 @@ public class kelondroTree extends kelondroCachedRecords implements kelondroIndexwhile ((nodeStack.size() != 0) && (parentpointer == ((up) ? rightchild : leftchild))) {//System.out.println("step up");// go on, walk up further- stacktop = (Object[]) nodeStack.removeLast(); // top of stack: Node/parentpointer pair+ stacktop = nodeStack.removeLast(); // top of stack: Node/parentpointer pairparentNode = (CacheNode) stacktop[0];parentpointer = ((Integer) stacktop[1]).intValue();}@@ -1030,7 +1030,7 @@ public class kelondroTree extends kelondroCachedRecords implements kelondroIndexsynchronized (this) {Iterator<CacheNode> i = (firstKey == null) ? new nodeIterator(up, rotating) : new nodeIterator(up, rotating, firstKey, including);while ((set.size() < count) && (i.hasNext())) {- n = (kelondroNode) i.next();+ n = i.next();if ((n != null) && (n.getKey() != null)) set.add(new String(n.getKey()));}}@@ -1253,7 +1253,7 @@ public class kelondroTree extends kelondroCachedRecords implements kelondroIndexlinelength = width / (thisline.size() * 2);nextline = new Vector<kelondroHandle>();for (int i = 0; i < thisline.size(); i++) {- handle = (kelondroHandle) thisline.elementAt(i);+ handle = thisline.elementAt(i);if (handle == null) {node = null;key = "[..]";@@ -1288,7 +1288,7 @@ public class kelondroTree extends kelondroCachedRecords implements kelondroIndexif ((thisline != null) && (width >= 0)) {linelength = width / thisline.size();for (int i = 0; i < thisline.size(); i++) {- handle = (kelondroHandle) thisline.elementAt(i);+ handle = thisline.elementAt(i);if (handle == null) {node = null;key = "NULL";@@ -1421,7 +1421,7 @@ public class kelondroTree extends kelondroCachedRecords implements kelondroIndexpublic static String[] permutations(int letters) {String p = "";- for (int i = 0; i < letters; i++) p = p + ((char) (((int)'A') + i));+ for (int i = 0; i < letters; i++) p = p + ((char) (('A') + i));return permutations(p);}public static String[] permutations(String source) {@@ -1544,7 +1544,7 @@ public class kelondroTree extends kelondroCachedRecords implements kelondroIndexSystem.out.println("elements: " + c);Iterator<kelondroRow.Entry> i = tt.rows(true, testWord('G'));for (int j = 0; j < c; j++) {- System.out.println("Row " + j + ": " + new String(((kelondroRow.Entry) i.next()).getColBytes(0)));+ System.out.println("Row " + j + ": " + new String((i.next()).getColBytes(0)));}System.out.println("TERMINATED");} catch (IOException e) {diff --git a/source/de/anomic/kelondro/kelondroXMLTables.java b/source/de/anomic/kelondro/kelondroXMLTables.javaindex b8e549002..d25619c1c 100644--- a/source/de/anomic/kelondro/kelondroXMLTables.java+++ b/source/de/anomic/kelondro/kelondroXMLTables.java@@ -152,7 +152,7 @@ public class kelondroXMLTables {if (l == null)throw new RuntimeException("Microtables.get: table does not exist");if (l.containsKey(key))- return (String) l.get(key);+ return l.get(key);elsereturn deflt;}diff --git a/source/de/anomic/language/identification/Identificator.java b/source/de/anomic/language/identification/Identificator.javaindex 26af8a05c..2c55cd301 100644--- a/source/de/anomic/language/identification/Identificator.java+++ b/source/de/anomic/language/identification/Identificator.java@@ -107,7 +107,7 @@ public final class Identificator {float value = 0;float max = 0;while (iter.hasNext()) {- character = (Character) iter.next();+ character = iter.next();value = testStat.get(character);if (value > max) {maxChar = character;@@ -140,7 +140,7 @@ public final class Identificator {while (iter.hasNext()) {minimum = 100.1f;- character = (Character) iter.next();+ character = iter.next();valueCharacter = testStat.get(character);for (int i = 0; i < relevantLanguages.size(); i++) {value = languages.get(relevantLanguages.get(i)).get(character);diff --git a/source/de/anomic/language/identification/LanguageStatistics.java b/source/de/anomic/language/identification/LanguageStatistics.javaindex e8dd144a7..496442963 100644--- a/source/de/anomic/language/identification/LanguageStatistics.java+++ b/source/de/anomic/language/identification/LanguageStatistics.java@@ -43,7 +43,6 @@package de.anomic.language.identification;-import de.anomic.server.logging.serverLog;import java.io.BufferedReader;import java.io.File;import java.io.FileNotFoundException;@@ -53,6 +52,8 @@ import java.util.HashMap;import java.util.Map;import java.util.Set;+import de.anomic.server.logging.serverLog;+/*** This class can store statistical data of a language.*/@@ -149,8 +150,9 @@ public class LanguageStatistics {} catch (IOException ex) {logger.logWarning("ERROR: problems reading file '" + file.getName() + "'", ex);} finally {- try {+ try { if(reader != null) {reader.close();+ }} catch (IOException ex) {logger.logWarning("ERROR: IO trouble ", ex);}diff --git a/source/de/anomic/net/ftpc.java b/source/de/anomic/net/ftpc.javaindex e2e85b17d..3d619eaab 100644--- a/source/de/anomic/net/ftpc.java+++ b/source/de/anomic/net/ftpc.java@@ -869,20 +869,16 @@ public class ftpc {}// copy finished. close source file- if (source != null) {- try {- source.close();- } catch (final IOException e) {- }- }- }- // close the output file- if (dest != null) {try {- dest.close();+ source.close();} catch (final IOException e) {}}+ // close the output file+ try {+ dest.close();+ } catch (final IOException e) {+ }// if we come to this point then everything went fine// if the user wanted to delete the source it is save to do so now@@ -928,14 +924,16 @@ public class ftpc {return true;}int bytes_read = 0;+ FileOutputStream dest = null;+ FileInputStream source = null;try {// open output file- final FileOutputStream dest = new FileOutputStream(dest_file);+ dest = new FileOutputStream(dest_file);final byte[] buffer = new byte[1024];// open the source filefinal File source_file = new File(args[1]);- final FileInputStream source = new FileInputStream(source_file);+ source = new FileInputStream(source_file);// start with the copy of one source filewhile (true) {@@ -946,6 +944,9 @@ public class ftpc {dest.write(buffer, 0, bytes_read);}+ } catch (final FileNotFoundException e) {+ } catch (final IOException e) {+ } finally {// copy finished. close source fileif (source != null) {try {@@ -961,8 +962,6 @@ public class ftpc {} catch (final IOException e) {}}- } catch (final FileNotFoundException e) {- } catch (final IOException e) {}return true;}diff --git a/source/de/anomic/plasma/cache/ftp/ResourceInfo.java b/source/de/anomic/plasma/cache/ftp/ResourceInfo.javaindex 11e741246..b60b8d7a3 100644--- a/source/de/anomic/plasma/cache/ftp/ResourceInfo.java+++ b/source/de/anomic/plasma/cache/ftp/ResourceInfo.java@@ -51,7 +51,6 @@ import java.util.Map;import java.util.TreeMap;import de.anomic.plasma.cache.IResourceInfo;-import de.anomic.plasma.cache.ResourceInfoFactory;import de.anomic.yacy.yacyURL;public class ResourceInfo implements IResourceInfo {@@ -100,12 +99,12 @@ public class ResourceInfo implements IResourceInfo {}public String getMimeType() {- return (String) ((this.propertyMap == null) ? null : this.propertyMap.get(MIMETYPE));+ return ((this.propertyMap == null) ? null : this.propertyMap.get(MIMETYPE));}public Date getModificationDate() {if (this.propertyMap == null || !this.propertyMap.containsKey(MODIFICATION_DATE)) return new Date();- return new Date(Long.valueOf((String) this.propertyMap.get(MODIFICATION_DATE)).longValue());+ return new Date(Long.valueOf(this.propertyMap.get(MODIFICATION_DATE)).longValue());}public yacyURL getRefererUrl() {diff --git a/source/de/anomic/plasma/cache/http/ResourceInfo.java b/source/de/anomic/plasma/cache/http/ResourceInfo.javaindex 54d408f80..9ac074324 100644--- a/source/de/anomic/plasma/cache/http/ResourceInfo.java+++ b/source/de/anomic/plasma/cache/http/ResourceInfo.java@@ -55,7 +55,6 @@ import java.util.TreeMap;import de.anomic.http.httpHeader;import de.anomic.plasma.plasmaHTCache;import de.anomic.plasma.cache.IResourceInfo;-import de.anomic.plasma.cache.ResourceInfoFactory;import de.anomic.server.serverDate;import de.anomic.yacy.yacyURL;@@ -200,7 +199,7 @@ public class ResourceInfo implements IResourceInfo {// -pragma in cached responseif (this.responseHeader.containsKey(httpHeader.PRAGMA) &&- ((String) this.responseHeader.get(httpHeader.PRAGMA)).toUpperCase().equals("NO-CACHE")) {+ (this.responseHeader.get(httpHeader.PRAGMA)).toUpperCase().equals("NO-CACHE")) {return "Denied_(pragma_no_cache)";}@@ -224,7 +223,7 @@ public class ResourceInfo implements IResourceInfo {// -cache-control in cached response// the cache-control has many value options.- String cacheControl = (String) this.responseHeader.get(httpHeader.CACHE_CONTROL);+ String cacheControl = this.responseHeader.get(httpHeader.CACHE_CONTROL);if (cacheControl != null) {cacheControl = cacheControl.trim().toUpperCase();/* we have the following cases for cache-control:@@ -291,7 +290,7 @@ public class ResourceInfo implements IResourceInfo {// -pragma in response// if we have a pragma non-cache, we don't cache. usually if this is wanted from// the server, it makes sense- String cacheControl = (String) this.responseHeader.get(httpHeader.PRAGMA);+ String cacheControl = this.responseHeader.get(httpHeader.PRAGMA);if (cacheControl != null && cacheControl.trim().toUpperCase().equals("NO-CACHE")) { return "controlled_no_cache"; }// -expires in response@@ -300,7 +299,7 @@ public class ResourceInfo implements IResourceInfo {// -cache-control in response// the cache-control has many value options.- cacheControl = (String) this.responseHeader.get(httpHeader.CACHE_CONTROL);+ cacheControl = this.responseHeader.get(httpHeader.CACHE_CONTROL);if (cacheControl != null) {cacheControl = cacheControl.trim().toUpperCase();if (cacheControl.startsWith("MAX-AGE=")) {@@ -334,10 +333,10 @@ public class ResourceInfo implements IResourceInfo {if (this.requestHeader.containsKey(httpHeader.RANGE)) { return false; }// if the client requests a un-cached copy of the resource ...- cacheControl = (String) this.requestHeader.get(httpHeader.PRAGMA);+ cacheControl = this.requestHeader.get(httpHeader.PRAGMA);if (cacheControl != null && cacheControl.trim().toUpperCase().equals("NO-CACHE")) { return false; }- cacheControl = (String) this.requestHeader.get(httpHeader.CACHE_CONTROL);+ cacheControl = this.requestHeader.get(httpHeader.CACHE_CONTROL);if (cacheControl != null) {cacheControl = cacheControl.trim().toUpperCase();if (cacheControl.startsWith("NO-CACHE") || cacheControl.startsWith("MAX-AGE=0")) { return false; }@@ -377,7 +376,7 @@ public class ResourceInfo implements IResourceInfo {// logically, we would not need to care about no-cache pragmas in cached response headers,// because they cannot exist since they are not written to the cache.// So this IF should always fail..- cacheControl = (String) this.responseHeader.get(httpHeader.PRAGMA);+ cacheControl = this.responseHeader.get(httpHeader.PRAGMA);if (cacheControl != null && cacheControl.trim().toUpperCase().equals("NO-CACHE")) { return false; }// see for documentation also:@@ -396,7 +395,7 @@ public class ResourceInfo implements IResourceInfo {if (expires.before(new Date(serverDate.correctedUTCTime()))) { return false; }}Date lastModified = this.responseHeader.lastModified();- cacheControl = (String) this.responseHeader.get(httpHeader.CACHE_CONTROL);+ cacheControl = this.responseHeader.get(httpHeader.CACHE_CONTROL);if (cacheControl == null && lastModified == null && expires == null) { return false; }// -lastModified in cached response@@ -460,7 +459,7 @@ public class ResourceInfo implements IResourceInfo {return (this.requestHeader == null)? false: this.requestHeader.containsKey(httpHeader.X_YACY_INDEX_CONTROL) &&- ((String)this.requestHeader.get(httpHeader.X_YACY_INDEX_CONTROL)).toUpperCase().equals("NO-INDEX");+ (this.requestHeader.get(httpHeader.X_YACY_INDEX_CONTROL)).toUpperCase().equals("NO-INDEX");}public httpHeader getRequestHeader() {diff --git a/source/de/anomic/plasma/parser/odt/odtParser.java b/source/de/anomic/plasma/parser/odt/odtParser.javaindex c117e7895..a9895ee09 100644--- a/source/de/anomic/plasma/parser/odt/odtParser.java+++ b/source/de/anomic/plasma/parser/odt/odtParser.java@@ -116,7 +116,7 @@ public class odtParser extends AbstractParser implements Parser {checkInterruption();// getting the next zip file entry- ZipEntry zipEntry= (ZipEntry) zipEnum.nextElement();+ ZipEntry zipEntry= zipEnum.nextElement();String entryName = zipEntry.getName();// content.xml contains the document content in xml formatdiff --git a/source/de/anomic/plasma/parser/rss/rssParser.java b/source/de/anomic/plasma/parser/rss/rssParser.javaindex 80f8b19db..03cd69ee7 100644--- a/source/de/anomic/plasma/parser/rss/rssParser.java+++ b/source/de/anomic/plasma/parser/rss/rssParser.java@@ -63,8 +63,8 @@ import de.anomic.server.serverByteBuffer;import de.anomic.server.serverCharBuffer;import de.anomic.server.serverFileUtils;import de.anomic.xml.RSSFeed;-import de.anomic.xml.RSSReader;import de.anomic.xml.RSSMessage;+import de.anomic.xml.RSSReader;import de.anomic.yacy.yacyURL;public class rssParser extends AbstractParser implements Parser {@@ -173,7 +173,7 @@ public class rssParser extends AbstractParser implements Parser {null,feedTitle,(authors.length() > 0)?authors.toString(1,authors.length()):"",- (String[]) feedSections.toArray(new String[feedSections.size()]),+ feedSections.toArray(new String[feedSections.size()]),feedDescription,text.getBytes(),anchors,diff --git a/source/de/anomic/plasma/parser/tar/tarParser.java b/source/de/anomic/plasma/parser/tar/tarParser.javaindex 0587f0cf5..2877887e7 100644--- a/source/de/anomic/plasma/parser/tar/tarParser.java+++ b/source/de/anomic/plasma/parser/tar/tarParser.java@@ -210,7 +210,7 @@ public class tarParser extends AbstractParser implements Parser {docKeywords.toString().split(" |,"),docLongTitle.toString(),"", // TODO: AUTHOR- (String[])docSections.toArray(new String[docSections.size()]),+ docSections.toArray(new String[docSections.size()]),docAbstrct.toString(),((serverByteBuffer)docText).getBytes(),docAnchors,@@ -223,7 +223,7 @@ public class tarParser extends AbstractParser implements Parser {docKeywords.toString().split(" |,"),docLongTitle.toString(),"", // TODO: AUTHOR- (String[])docSections.toArray(new String[docSections.size()]),+ docSections.toArray(new String[docSections.size()]),docAbstrct.toString(),outputFile,docAnchors,diff --git a/source/de/anomic/plasma/parser/vcf/vcfParser.java b/source/de/anomic/plasma/parser/vcf/vcfParser.javaindex 9981fec77..8c0a22a88 100644--- a/source/de/anomic/plasma/parser/vcf/vcfParser.java+++ b/source/de/anomic/plasma/parser/vcf/vcfParser.java@@ -183,16 +183,16 @@ public class vcfParser extends AbstractParser implements Parser {// using the name of the current version as section headlineif (parsedData.containsKey("FN")) {- parsedNames.add(name = (String)parsedData.get("FN"));+ parsedNames.add(name = parsedData.get("FN"));} else if (parsedData.containsKey("N")) {- parsedNames.add(name = (String)parsedData.get("N"));+ parsedNames.add(name = parsedData.get("N"));} else {parsedNames.add(name = "unknown name");}// getting the vcard titleif (parsedData.containsKey("TITLE")) {- parsedNames.add(title = (String) parsedData.get("TITLE"));+ parsedNames.add(title = parsedData.get("TITLE"));}if (parsedTitle.length() > 0) parsedTitle.append(", ");@@ -203,7 +203,7 @@ public class vcfParser extends AbstractParser implements Parser {// the text representation of the vCardIterator<String> iter = parsedData.values().iterator();while (iter.hasNext()) {- value = (String) iter.next();+ value = iter.next();parsedDataText.append(value).append("\r\n");}parsedDataText.append("\r\n");@@ -236,7 +236,7 @@ public class vcfParser extends AbstractParser implements Parser {}}- String[] sections = (String[]) parsedNames.toArray(new String[parsedNames.size()]);+ String[] sections = parsedNames.toArray(new String[parsedNames.size()]);byte[] text = parsedDataText.toString().getBytes();plasmaParserDocument theDoc = new plasmaParserDocument(location, // url of the source documentdiff --git a/source/de/anomic/plasma/parser/zip/zipParser.java b/source/de/anomic/plasma/parser/zip/zipParser.javaindex e73c615d5..7b458bc70 100644--- a/source/de/anomic/plasma/parser/zip/zipParser.java+++ b/source/de/anomic/plasma/parser/zip/zipParser.java@@ -194,7 +194,7 @@ public class zipParser extends AbstractParser implements Parser {docKeywords.toString().split(" |,"),docLongTitle.toString(),"", // TODO: AUTHOR- (String[])docSections.toArray(new String[docSections.size()]),+ docSections.toArray(new String[docSections.size()]),docAbstrct.toString(),((serverByteBuffer)docText).getBytes(),docAnchors,@@ -207,7 +207,7 @@ public class zipParser extends AbstractParser implements Parser {docKeywords.toString().split(" |,"),docLongTitle.toString(),"", // TODO: AUTHOR- (String[])docSections.toArray(new String[docSections.size()]),+ docSections.toArray(new String[docSections.size()]),docAbstrct.toString(),outputFile,docAnchors,diff --git a/source/de/anomic/plasma/plasmaCondenser.java b/source/de/anomic/plasma/plasmaCondenser.javaindex 938228276..6f9f7cff0 100644--- a/source/de/anomic/plasma/plasmaCondenser.java+++ b/source/de/anomic/plasma/plasmaCondenser.java@@ -172,7 +172,7 @@ public final class plasmaCondenser {entry = i.next();if ((entry == null) || (entry.getKey() == null)) continue;insertTextToWords(entry.getKey().toNormalform(false, false), 98, indexRWIEntry.flag_app_dc_identifier, RESULT_FLAGS);- insertTextToWords((String) entry.getValue(), 98, indexRWIEntry.flag_app_dc_description, RESULT_FLAGS);+ insertTextToWords(entry.getValue(), 98, indexRWIEntry.flag_app_dc_description, RESULT_FLAGS);}} else {this.RESULT_NUMB_WORDS = 0;@@ -187,7 +187,7 @@ public final class plasmaCondenser {while (i.hasNext()) {entry = i.next();insertTextToWords(entry.getKey().toNormalform(false, false), 99, flag_cat_hasaudio, RESULT_FLAGS);- insertTextToWords((String) entry.getValue(), 99, flag_cat_hasaudio, RESULT_FLAGS);+ insertTextToWords(entry.getValue(), 99, flag_cat_hasaudio, RESULT_FLAGS);}// video@@ -195,7 +195,7 @@ public final class plasmaCondenser {while (i.hasNext()) {entry = i.next();insertTextToWords(entry.getKey().toNormalform(false, false), 99, flag_cat_hasvideo, RESULT_FLAGS);- insertTextToWords((String) entry.getValue(), 99, flag_cat_hasvideo, RESULT_FLAGS);+ insertTextToWords(entry.getValue(), 99, flag_cat_hasvideo, RESULT_FLAGS);}// applications@@ -203,7 +203,7 @@ public final class plasmaCondenser {while (i.hasNext()) {entry = i.next();insertTextToWords(entry.getKey().toNormalform(false, false), 99, flag_cat_hasapp, RESULT_FLAGS);- insertTextToWords((String) entry.getValue(), 99, flag_cat_hasapp, RESULT_FLAGS);+ insertTextToWords(entry.getValue(), 99, flag_cat_hasapp, RESULT_FLAGS);}// images@@ -223,7 +223,7 @@ public final class plasmaCondenser {we = k.next();wprop = we.getValue();if (wprop.flags == null) {- wprop.flags = (kelondroBitfield) RESULT_FLAGS.clone();+ wprop.flags = RESULT_FLAGS.clone();words.put(we.getKey(), wprop);}}@@ -247,10 +247,10 @@ public final class plasmaCondenser {}int pip = 0;while (wordenum.hasMoreElements()) {- word = (new String((StringBuffer) wordenum.nextElement())).toLowerCase();- wprop = (indexWord) words.get(word);+ word = (new String(wordenum.nextElement())).toLowerCase();+ wprop = words.get(word);if (wprop == null) wprop = new indexWord(0, pip, phrase);- if (wprop.flags == null) wprop.flags = (kelondroBitfield) flagstemplate.clone();+ if (wprop.flags == null) wprop.flags = flagstemplate.clone();wprop.flags.set(flagpos, true);words.put(word, wprop);pip++;@@ -321,7 +321,7 @@ public final class plasmaCondenser {// read sourcesievedWordsEnum wordenum = new sievedWordsEnum(is, charset, wordminsize);while (wordenum.hasMoreElements()) {- word = (new String((StringBuffer) wordenum.nextElement())).toLowerCase(); // TODO: does toLowerCase work for non ISO-8859-1 chars?+ word = (new String(wordenum.nextElement())).toLowerCase(); // TODO: does toLowerCase work for non ISO-8859-1 chars?//System.out.println("PARSED-WORD " + word);//This is useful for testing what YaCy "sees" of a website.@@ -355,8 +355,8 @@ public final class plasmaCondenser {// store to the words a link to this sentenceit = currsentwords.iterator();while (it.hasNext()) {- k = (String) it.next();- wsp = (indexWord) words.get(k);+ k = it.next();+ wsp = words.get(k);wsp.check(idx);words.put(k, wsp);}@@ -379,14 +379,14 @@ public final class plasmaCondenser {currsentwords.add(word);if (words.containsKey(word)) {// word already exists- wsp = (indexWord) words.get(word);+ wsp = words.get(word);wordHandle = wsp.posInText;wsp.inc();} else {// word does not yet exist, create new word entrywordHandle = wordHandleCount++;wsp = new indexWord(wordHandle, wordInSentenceCounter, sentences.size() + 100);- wsp.flags = (kelondroBitfield) RESULT_FLAGS.clone();+ wsp.flags = RESULT_FLAGS.clone();}words.put(word, wsp);// we now have the unique handle of the word, put it into the sentence:@@ -399,7 +399,7 @@ public final class plasmaCondenser {allsentencecounter++;sentence.insert(0, "."); // append at beginningif (sentences.containsKey(sentence)) {- psp = (indexPhrase) sentences.get(sentence);+ psp = sentences.get(sentence);psp.inc();sentences.put(sentence, psp);} else {@@ -430,7 +430,7 @@ public final class plasmaCondenser {sentence = (StringBuffer) o;wc = (sentence.length() - 1) / numlength;s = new String[wc + 2];- psp = (indexPhrase) sentences.get(sentence);+ psp = sentences.get(sentence);s[0] = intString(psp.occurrences(), numlength); // number of occurrences of this sentences[1] = sentence.substring(0, 1); // the termination symbol of this sentencefor (int i = 0; i < wc; i++) {@@ -522,7 +522,7 @@ public final class plasmaCondenser {StringBuffer s;char c;loop: while (e.hasMoreElements()) {- s = (StringBuffer) e.nextElement();+ s = e.nextElement();if ((s.length() == 1) && (htmlFilterContentScraper.punctuation(s.charAt(0)))) return s;if ((s.length() < ml) && (!(s.equals("of")))) continue loop;for (int i = 0; i < s.length(); i++) {@@ -572,7 +572,7 @@ public final class plasmaCondenser {char c;while (s.length() == 0) {if (e.hasNext()) {- r = (StringBuffer) e.next();+ r = e.next();if (r == null) return null;r = trim(r);sb = new StringBuffer(r.length() * 2);diff --git a/source/de/anomic/plasma/plasmaDHTChunk.java b/source/de/anomic/plasma/plasmaDHTChunk.javaindex 64d358041..eab381d19 100644--- a/source/de/anomic/plasma/plasmaDHTChunk.java+++ b/source/de/anomic/plasma/plasmaDHTChunk.java@@ -218,12 +218,12 @@ public class plasmaDHTChunk {int wholesize;urlCache = new HashMap<String, indexURLReference>();- final double maximumDistance = ((double) peerRedundancy * 2) / ((double) wordIndex.seedDB.sizeConnected());+ final double maximumDistance = ((double) peerRedundancy * 2) / (wordIndex.seedDB.sizeConnected());final long timeout = (maxtime < 0) ? Long.MAX_VALUE : System.currentTimeMillis() + maxtime;while ((maxcount > refcount) &&(indexContainerIterator.hasNext()) &&- ((container = (indexContainer) indexContainerIterator.next()) != null) &&+ ((container = indexContainerIterator.next()) != null) &&(container.size() > 0) &&((tmpContainers.size() == 0) ||(yacyDHTAction.dhtDistance(container.getWordHash(), tmpContainers.get(0).getWordHash()) < maximumDistance)) &&@@ -275,7 +275,7 @@ public class plasmaDHTChunk {}}// create result- indexContainers = (indexContainer[]) tmpContainers.toArray(new indexContainer[tmpContainers.size()]);+ indexContainers = tmpContainers.toArray(new indexContainer[tmpContainers.size()]);//[C[16GwGuFzwffp] has 1 entries, C[16hGKMAl0w97] has 9 entries, C[17A8cDPF6SfG] has 9 entries, C[17Kdj__WWnUy] has 1 entries, C[1if ((indexContainers == null) || (indexContainers.length == 0)) {if (this.log.isFine()) log.logFine("No index available for index transfer, hash start-point " + startPointHash);diff --git a/source/de/anomic/plasma/plasmaDHTTransfer.java b/source/de/anomic/plasma/plasmaDHTTransfer.javaindex d584d3ce0..521c0f026 100644--- a/source/de/anomic/plasma/plasmaDHTTransfer.java+++ b/source/de/anomic/plasma/plasmaDHTTransfer.java@@ -267,7 +267,7 @@ public class plasmaDHTTransfer extends Thread {Object transferRWIResult = result.get("resultTransferRWI");assert transferRWIResult instanceof HashMap;if (transferRWIResult != null && ((HashMap<String, String>) transferRWIResult).containsKey("pause")) {- String pauseStr = (String) ((HashMap<String, String>) transferRWIResult).get("pause");+ String pauseStr = ((HashMap<String, String>) transferRWIResult).get("pause");try { pause = Integer.valueOf(pauseStr).intValue(); } catch (NumberFormatException numEx){}if (pause < 0) pause = 5000;else if (pause > 30000) pause = 30000;diff --git a/source/de/anomic/plasma/plasmaDbImporter.java b/source/de/anomic/plasma/plasmaDbImporter.javaindex d0f99c218..12587f673 100644--- a/source/de/anomic/plasma/plasmaDbImporter.java+++ b/source/de/anomic/plasma/plasmaDbImporter.java@@ -108,7 +108,7 @@ public class plasmaDbImporter extends AbstractImporter implements Importer {indexContainer newContainer = null;try {this.wordCounter++;- newContainer = (indexContainer) indexContainerIterator.next();+ newContainer = indexContainerIterator.next();this.wordHash = newContainer.getWordHash();// loop throug the entities of the container and get the@@ -120,7 +120,7 @@ public class plasmaDbImporter extends AbstractImporter implements Importer {if (isAborted()) break;// getting next word index entry- importWordIdxEntry = (indexRWIEntry) importWordIdxEntries.next();+ importWordIdxEntry = importWordIdxEntries.next();String urlHash = importWordIdxEntry.urlHash();entityUrls.add(urlHash);}@@ -207,7 +207,7 @@ public class plasmaDbImporter extends AbstractImporter implements Importer {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()))) {+ if ((indexContainerIterator.hasNext())&&(!this.wordHash.equals((indexContainerIterator.next()).getWordHash()))) {indexContainerIterator = containers.iterator();}}diff --git a/source/de/anomic/plasma/plasmaGrafics.java b/source/de/anomic/plasma/plasmaGrafics.javaindex f67e14571..772c8bda0 100644--- a/source/de/anomic/plasma/plasmaGrafics.java+++ b/source/de/anomic/plasma/plasmaGrafics.java@@ -214,7 +214,7 @@ public class plasmaGrafics {Iterator<yacySeed> e = seedDB.seedsConnected(true, false, null, (float) 0.0);while (e.hasNext() && count < maxCount) {- seed = (yacySeed) e.next();+ seed = e.next();if (seed != null) {drawNetworkPicturePeer(networkPicture, width / 2, height / 2 + 20, innerradius, outerradius, seed, COL_ACTIVE_DOT, COL_ACTIVE_LINE, COL_ACTIVE_TEXT, corona);count++;@@ -226,7 +226,7 @@ public class plasmaGrafics {count = 0;e = seedDB.seedsSortedDisconnected(false, yacySeed.LASTSEEN);while (e.hasNext() && count < maxCount) {- seed = (yacySeed) e.next();+ seed = e.next();if (seed != null) {lastseen = Math.abs((System.currentTimeMillis() - seed.getLastSeenUTC()) / 1000 / 60);if (lastseen > passiveLimit) break; // we have enough, this list is sorted so we don't miss anything@@ -240,7 +240,7 @@ public class plasmaGrafics {count = 0;e = seedDB.seedsSortedPotential(false, yacySeed.LASTSEEN);while (e.hasNext() && count < maxCount) {- seed = (yacySeed) e.next();+ seed = e.next();if (seed != null) {lastseen = Math.abs((System.currentTimeMillis() - seed.getLastSeenUTC()) / 1000 / 60);if (lastseen > potentialLimit) break; // we have enough, this list is sorted so we don't miss anything@@ -394,8 +394,8 @@ public class plasmaGrafics {ymageToolPrint.print(bannerPicture, 285, 52, 0, "SPEED: " + addTrailingBlanks(nppm + " PAGES/MINUTE", exprlength), -1);if (logo != null) {- int x = (int)(100/2 - logo.getWidth()/2);- int y = (int)(height/2 - logo.getHeight()/2);+ int x = (100/2 - logo.getWidth()/2);+ int y = (height/2 - logo.getHeight()/2);bannerPicture.insertBitmap(logo, x, y, 0, 0, ymageMatrix.FILTER_ANTIALIASING);}diff --git a/source/de/anomic/plasma/plasmaHTCache.java b/source/de/anomic/plasma/plasmaHTCache.javaindex 80803af04..593edc01a 100644--- a/source/de/anomic/plasma/plasmaHTCache.java+++ b/source/de/anomic/plasma/plasmaHTCache.java@@ -59,7 +59,6 @@ import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.IOException;import java.io.InputStream;-import java.lang.StringBuffer;import java.net.InetAddress;import java.util.Date;import java.util.HashMap;@@ -481,7 +480,7 @@ public final class plasmaHTCache {while (fileEnum.hasMoreElements()) {if (Thread.currentThread().isInterrupted()) return;fileCount++;- File nextFile = (File) fileEnum.nextElement();+ File nextFile = fileEnum.nextElement();long nextFileModDate = nextFile.lastModified();//System.out.println("Cache: " + dom(f));doms.incScore(dom(nextFile));@@ -518,7 +517,7 @@ public final class plasmaHTCache {fileCount = 0;while ((doms.size() > 0) && (fileCount < 50) && ((System.currentTimeMillis() - start) < 60000)) {if (Thread.currentThread().isInterrupted()) return;- dom = (String) doms.getMaxObject();+ dom = doms.getMaxObject();InetAddress ip = serverDomains.dnsResolve(dom);if (ip == null) continue;result += ", " + dom + "=" + ip.getHostAddress();@@ -942,6 +941,7 @@ public final class plasmaHTCache {);}+ @SuppressWarnings("null")public Entry(Date initDate,int depth,yacyURL url,diff --git a/source/de/anomic/plasma/plasmaParser.java b/source/de/anomic/plasma/plasmaParser.javaindex e94fd00f4..d0f744895 100644--- a/source/de/anomic/plasma/plasmaParser.java+++ b/source/de/anomic/plasma/plasmaParser.java@@ -466,7 +466,7 @@ public final class plasmaParser {try {// trying to load the parser class by its nameClass<?> parserClass = Class.forName(fullClassName);- Object theParser0 = (Parser) parserClass.newInstance();+ Object theParser0 = parserClass.newInstance();if (!(theParser0 instanceof Parser)) continue;Parser theParser = (Parser) theParser0;@@ -493,12 +493,12 @@ public final class plasmaParser {parserInfo.parserClassName = fullClassName;parserInfo.libxDependencies = neededLibx;parserInfo.supportedMimeTypes = supportedMimeTypes;- parserInfo.parserVersionNr = ((Parser)theParser).getVersion();- parserInfo.parserName = ((Parser) theParser).getName();+ parserInfo.parserVersionNr = (theParser).getVersion();+ parserInfo.parserName = (theParser).getName();Iterator<String> mimeTypeIterator = supportedMimeTypes.keySet().iterator();while (mimeTypeIterator.hasNext()) {- String mimeType = (String) mimeTypeIterator.next();+ String mimeType = mimeTypeIterator.next();availableParserList.put(mimeType, parserInfo);serverLog.logInfo("PARSER", "Found functional parser for mimeType '" + mimeType + "'." +"\n\tName: " + parserInfo.parserName +@@ -755,7 +755,7 @@ public final class plasmaParser {ParserInfo parserInfo = null;synchronized (plasmaParser.availableParserList) {if (plasmaParser.availableParserList.containsKey(mimeType)) {- parserInfo = (ParserInfo)plasmaParser.availableParserList.get(mimeType);+ parserInfo = plasmaParser.availableParserList.get(mimeType);parserClassName = parserInfo.parserClassName;} else {return null;@@ -977,14 +977,14 @@ public final class plasmaParser {if (url == null) throw new NullPointerException();if (parserMode.equals(PARSER_MODE_IMAGE)) return true;- plasmaParserConfig config = (plasmaParserConfig) parserConfigList.get(parserMode);+ plasmaParserConfig config = parserConfigList.get(parserMode);return (config == null)?false:config.supportedContent(url, mimeType);}public static void initParseableMimeTypes(String parserMode, String configStr) {if (!PARSER_MODE.contains(parserMode)) throw new IllegalArgumentException();- plasmaParserConfig config = (plasmaParserConfig) parserConfigList.get(parserMode);+ plasmaParserConfig config = parserConfigList.get(parserMode);if (config == null) {config = new plasmaParserConfig(parserMode);parserConfigList.put(parserMode, config);@@ -995,7 +995,7 @@ public final class plasmaParser {public static String[] setEnabledParserList(String parserMode, Set<String> mimeTypeSet) {if (!PARSER_MODE.contains(parserMode)) throw new IllegalArgumentException();- plasmaParserConfig config = (plasmaParserConfig) parserConfigList.get(parserMode);+ plasmaParserConfig config = parserConfigList.get(parserMode);if (config == null) {config = new plasmaParserConfig(parserMode);parserConfigList.put(parserMode, config);diff --git a/source/de/anomic/plasma/plasmaParserConfig.java b/source/de/anomic/plasma/plasmaParserConfig.javaindex 808334e99..08a462129 100644--- a/source/de/anomic/plasma/plasmaParserConfig.java+++ b/source/de/anomic/plasma/plasmaParserConfig.java@@ -48,14 +48,12 @@package de.anomic.plasma;import java.util.Arrays;-import java.util.Enumeration;import java.util.HashSet;import java.util.Hashtable;import java.util.Iterator;import java.util.Set;import de.anomic.plasma.parser.Parser;-import de.anomic.plasma.parser.ParserInfo;import de.anomic.server.logging.serverLog;import de.anomic.yacy.yacyURL;@@ -158,12 +156,12 @@ public class plasmaParserConfig {if (mimeTypeSet != null) {Iterator<String> mimeTypes = mimeTypeSet.iterator();while (mimeTypes.hasNext()) {- String mimeType = (String) mimeTypes.next();+ String mimeType = mimeTypes.next();if (plasmaParser.availableParserList.containsKey(mimeType)) {Parser theParser = null;try {// getting the parser- theParser = plasmaParser.makeParser(((ParserInfo)plasmaParser.availableParserList.get(mimeType)).parserClassName);+ theParser = plasmaParser.makeParser((plasmaParser.availableParserList.get(mimeType)).parserClassName);// getting a list of mimeTypes that the parser supportsHashtable<String, String> parserSupportsMimeTypes = theParser.getSupportedMimeTypes();@@ -199,7 +197,7 @@ public class plasmaParserConfig {this.supportedFileExt.addAll(newSupportedFileExt);}- return (String[])newEnabledParsers.toArray(new String[newEnabledParsers.size()]);+ return newEnabledParsers.toArray(new String[newEnabledParsers.size()]);}@SuppressWarnings("unchecked")diff --git a/source/de/anomic/plasma/plasmaParserDocument.java b/source/de/anomic/plasma/plasmaParserDocument.javaindex ce76ca3db..728d8a05f 100644--- a/source/de/anomic/plasma/plasmaParserDocument.java+++ b/source/de/anomic/plasma/plasmaParserDocument.java@@ -48,11 +48,6 @@ import java.io.File;import java.io.FileInputStream;import java.io.IOException;import java.io.InputStream;--import de.anomic.server.serverCachedFileOutputStream;-import de.anomic.server.serverFileUtils;-import de.anomic.yacy.yacyURL;-import java.util.Arrays;import java.util.Date;import java.util.HashMap;@@ -65,6 +60,9 @@ import java.util.TreeSet;import de.anomic.htmlFilter.htmlFilterContentScraper;import de.anomic.htmlFilter.htmlFilterImageEntry;import de.anomic.plasma.parser.Parser;+import de.anomic.server.serverCachedFileOutputStream;+import de.anomic.server.serverFileUtils;+import de.anomic.yacy.yacyURL;public class plasmaParserDocument {@@ -181,7 +179,7 @@ dc_rightsString s;for (int i = 0; i < this.keywords.size(); i++) {if (this.keywords.get(i) == null) continue;- s = ((String)this.keywords.get(i)).trim();+ s = (this.keywords.get(i)).trim();if (s.length() > 0) hs.add(s.toLowerCase());}if (hs.size() == 0) return "";@@ -222,7 +220,7 @@ dc_rightspublic String[] getSectionTitles() {if (sections != null) {- return (String[])sections.toArray(new String[this.sections.size()]);+ return sections.toArray(new String[this.sections.size()]);} else {return new String[] { dc_title() };}@@ -353,7 +351,7 @@ dc_rightsurl = entry.getKey();if (url == null) continue;u = url.toNormalform(true, false);- if ((u != null) && (u.startsWith("mailto:"))) {+ if (u.startsWith("mailto:")) {emaillinks.put(u.substring(7), entry.getValue());} else {extpos = u.lastIndexOf(".");@@ -366,13 +364,13 @@ dc_rightsif (plasmaParser.mediaExtContains(ext)) {// this is not a normal anchor, its a media linkif (plasmaParser.imageExtContains(ext)) {- htmlFilterContentScraper.addImage(collectedImages, new htmlFilterImageEntry(url, (String) entry.getValue(), -1, -1));+ htmlFilterContentScraper.addImage(collectedImages, new htmlFilterImageEntry(url, entry.getValue(), -1, -1));}- else if (plasmaParser.audioExtContains(ext)) audiolinks.put(url, (String)entry.getValue());- else if (plasmaParser.videoExtContains(ext)) videolinks.put(url, (String)entry.getValue());- else if (plasmaParser.appsExtContains(ext)) applinks.put(url, (String)entry.getValue());+ else if (plasmaParser.audioExtContains(ext)) audiolinks.put(url, entry.getValue());+ else if (plasmaParser.videoExtContains(ext)) videolinks.put(url, entry.getValue());+ else if (plasmaParser.appsExtContains(ext)) applinks.put(url, entry.getValue());} else {- hyperlinks.put(url, (String) entry.getValue());+ hyperlinks.put(url, entry.getValue());}}}diff --git a/source/de/anomic/plasma/plasmaProfiling.java b/source/de/anomic/plasma/plasmaProfiling.javaindex 94027fa94..c59cc338a 100644--- a/source/de/anomic/plasma/plasmaProfiling.java+++ b/source/de/anomic/plasma/plasmaProfiling.java@@ -94,7 +94,7 @@ public class plasmaProfiling {i = serverProfiling.history("memory");x0 = 1;while (i.hasNext()) {- event = (serverProfiling.Event) i.next();+ event = i.next();time = event.time - now;bytes = ((Long) event.payload).longValue();x1 = (int) (time/1000);diff --git a/source/de/anomic/plasma/plasmaRankingCRProcess.java b/source/de/anomic/plasma/plasmaRankingCRProcess.javaindex 41b603f8b..714086017 100644--- a/source/de/anomic/plasma/plasmaRankingCRProcess.java+++ b/source/de/anomic/plasma/plasmaRankingCRProcess.java@@ -100,9 +100,9 @@ public class plasmaRankingCRProcess {int FUDate, FDDate, LUDate, UCount, PCount, ACount, VCount, Vita;kelondroBitfield acc_flags, new_flags;while (el.hasNext()) {- key = (String) el.next();+ key = el.next();new_entry = source_cr.getEntry(key);- new_flags = new kelondroBitfield(kelondroBase64Order.enhancedCoder.encodeLong((long) new_entry.getAttr("Flags", 0), 1).getBytes());+ new_flags = new kelondroBitfield(kelondroBase64Order.enhancedCoder.encodeLong(new_entry.getAttr("Flags", 0), 1).getBytes());// enrich information with additional valuesif ((acc_entry = acc.getEntry(key)) != null) {FUDate = (int) acc_entry.getAttr("FUDate", 0);@@ -123,7 +123,7 @@ public class plasmaRankingCRProcess {VCount += (new_flags.get(3)) ? 1 : 0;// 'OR' the flags- acc_flags = new kelondroBitfield(kelondroBase64Order.enhancedCoder.encodeLong((long) acc_entry.getAttr("Flags", 0), 1).getBytes());+ acc_flags = new kelondroBitfield(kelondroBase64Order.enhancedCoder.encodeLong(acc_entry.getAttr("Flags", 0), 1).getBytes());for (int i = 0; i < 6; i++) {if (new_flags.get(i)) acc_flags.set(i, true);}@@ -143,14 +143,14 @@ public class plasmaRankingCRProcess {// make plausibility check?// insert into accumulator- acc_entry.setAttr("FUDate", (long) FUDate);- acc_entry.setAttr("FDDate", (long) FDDate);- acc_entry.setAttr("LUDate", (long) LUDate);- acc_entry.setAttr("UCount", (long) UCount);- acc_entry.setAttr("PCount", (long) PCount);- acc_entry.setAttr("ACount", (long) ACount);- acc_entry.setAttr("VCount", (long) VCount);- acc_entry.setAttr("Vita", (long) Vita);+ acc_entry.setAttr("FUDate", FUDate);+ acc_entry.setAttr("FDDate", FDDate);+ acc_entry.setAttr("LUDate", LUDate);+ acc_entry.setAttr("UCount", UCount);+ acc_entry.setAttr("PCount", PCount);+ acc_entry.setAttr("ACount", ACount);+ acc_entry.setAttr("VCount", VCount);+ acc_entry.setAttr("Vita", Vita);acc.putEntrySmall(acc_entry);}@@ -174,9 +174,9 @@ public class plasmaRankingCRProcess {int FUDate, FDDate, LUDate, UCount, PCount, ACount, VCount, Vita;kelondroBitfield acc_flags, new_flags;while (el.hasNext()) {- key = (String) el.next();+ key = el.next();new_entry = source_cr.getEntry(key);- new_flags = new kelondroBitfield(kelondroBase64Order.enhancedCoder.encodeLong((long) new_entry.getAttr("Flags", 0), 1).getBytes());+ new_flags = new kelondroBitfield(kelondroBase64Order.enhancedCoder.encodeLong(new_entry.getAttr("Flags", 0), 1).getBytes());// enrich information with additional valuesif ((acc_entry = acc.get(key.getBytes())) != null) {FUDate = (int) acc_entry.getColLong("FUDate", 0);@@ -222,20 +222,21 @@ public class plasmaRankingCRProcess {// make plausibility check?// insert into accumulator- acc_entry.setCol("FUDate", (long) FUDate);- acc_entry.setCol("FDDate", (long) FDDate);- acc_entry.setCol("LUDate", (long) LUDate);- acc_entry.setCol("UCount", (long) UCount);- acc_entry.setCol("PCount", (long) PCount);- acc_entry.setCol("ACount", (long) ACount);- acc_entry.setCol("VCount", (long) VCount);- acc_entry.setCol("Vita", (long) Vita);+ acc_entry.setCol("FUDate", FUDate);+ acc_entry.setCol("FDDate", FDDate);+ acc_entry.setCol("LUDate", LUDate);+ acc_entry.setCol("UCount", UCount);+ acc_entry.setCol("PCount", PCount);+ acc_entry.setCol("ACount", ACount);+ acc_entry.setCol("VCount", VCount);+ acc_entry.setCol("Vita", Vita);acc.put(acc_entry);}return true;}+ @SuppressWarnings("null")public static void accumulate(File from_dir, File tmp_dir, File err_dir, File bkp_dir, File to_file, int max_files, boolean newdb) throws IOException {if (!(from_dir.isDirectory())) {System.out.println("source path " + from_dir + " is not a directory.");@@ -414,7 +415,7 @@ public class plasmaRankingCRProcess {while (j.hasNext()) {// get domain of anchorsentry = j.next();- anchor = (String) entry.getColString(0, null);+ anchor = entry.getColString(0, null);if (anchor.length() == 6) anchorDom = anchor; else anchorDom = anchor.substring(6);// update domain-specific entrydiff --git a/source/de/anomic/plasma/plasmaRankingRCIEvaluation.java b/source/de/anomic/plasma/plasmaRankingRCIEvaluation.javaindex 7cc2a1792..35114b595 100644--- a/source/de/anomic/plasma/plasmaRankingRCIEvaluation.java+++ b/source/de/anomic/plasma/plasmaRankingRCIEvaluation.java@@ -98,7 +98,7 @@ public class plasmaRankingRCIEvaluation {public static long sum(int[] c) {long s = 0;- for (int i = 0; i < c.length; i++) s += (long) c[i];+ for (int i = 0; i < c.length; i++) s += c[i];return s;}@@ -161,7 +161,7 @@ public class plasmaRankingRCIEvaluation {String key;kelondroAttrSeq.Entry entry;while (i.hasNext()) {- key = (String) i.next();+ key = i.next();entry = rci.getEntry(key);ranked[orderIntoYBI(partition, entry.getSeqSet().size())].add(key);}diff --git a/source/de/anomic/plasma/plasmaSearchAPI.java b/source/de/anomic/plasma/plasmaSearchAPI.javaindex b59dbd2fa..8fcfd1a96 100644--- a/source/de/anomic/plasma/plasmaSearchAPI.java+++ b/source/de/anomic/plasma/plasmaSearchAPI.java@@ -51,7 +51,7 @@ public class plasmaSearchAPI {if (post.get("allurl", "").equals("on")) return null;if (post.get("flags") != null) {if (post.get("flags","").length() == 0) return null;- return new kelondroBitfield(4, (String) post.get("flags"));+ return new kelondroBitfield(4, post.get("flags"));}if (post.get("description", "").equals("on")) b.set(indexRWIEntry.flag_app_dc_description, true);if (post.get("title", "").equals("on")) b.set(indexRWIEntry.flag_app_dc_title, true);@@ -74,7 +74,7 @@ public class plasmaSearchAPI {prop.put("searchresult_keyhash", startHash);Iterator<yacySeed> e = peerActions.dhtAction.getAcceptRemoteIndexSeeds(startHash);while (e.hasNext()) {- seed = (yacySeed) e.next();+ seed = e.next();if (seed != null) {prop.put("searchresult_hosts_" + hc + "_hosthash", seed.hash);prop.putHTML("searchresult_hosts_" + hc + "_hostname", seed.hash + " " + seed.get(yacySeed.NAME, "nameless"));@@ -181,7 +181,7 @@ public class plasmaSearchAPI {}Iterator<String> iter = ranked.miss(); // iterates url hash stringswhile (iter.hasNext()) {- us = (String) iter.next();+ us = iter.next();prop.put("genUrlList_urlList_"+i+"_urlExists", "0");prop.put("genUrlList_urlList_"+i+"_urlExists_urlhxCount", i);prop.putHTML("genUrlList_urlList_"+i+"_urlExists_urlhxValue", us);diff --git a/source/de/anomic/plasma/plasmaSearchEvent.java b/source/de/anomic/plasma/plasmaSearchEvent.javaindex bc276aa27..1a83f7670 100644--- a/source/de/anomic/plasma/plasmaSearchEvent.java+++ b/source/de/anomic/plasma/plasmaSearchEvent.java@@ -320,7 +320,7 @@ public final class plasmaSearchEvent {(query.constraint.get(plasmaCondenser.flag_cat_indexof)) &&(!(comp.dc_title().startsWith("Index of")))) {final Iterator<String> wi = query.queryHashes.iterator();- while (wi.hasNext()) wordIndex.removeEntry((String) wi.next(), page.hash());+ while (wi.hasNext()) wordIndex.removeEntry(wi.next(), page.hash());registerFailure(page.hash(), "index-of constraint not fullfilled");return null;}@@ -450,7 +450,7 @@ public final class plasmaSearchEvent {}public static plasmaSearchEvent getEvent(String eventID) {- return (plasmaSearchEvent) lastEvents.get(eventID);+ return lastEvents.get(eventID);}public static plasmaSearchEvent getEvent(@@ -690,7 +690,7 @@ public final class plasmaSearchEvent {peer = peers.substring(j, j + 12);if ((peer.equals(mypeerhash)) && (mypeercount++ > 1)) continue;//if (peers.indexOf(peer) < j) continue; // avoid doubles that may appear in the abstractJoin- urls = (String) secondarySearchURLs.get(peer);+ urls = secondarySearchURLs.get(peer);urls = (urls == null) ? url : urls + url;secondarySearchURLs.put(peer, urls);}@@ -706,7 +706,7 @@ public final class plasmaSearchEvent {entry1 = i1.next();peer = entry1.getKey();if (peer.equals(mypeerhash)) continue; // we dont need to ask ourself- urls = (String) entry1.getValue();+ urls = entry1.getValue();words = wordsFromPeer(peer, urls);//System.out.println("DEBUG-INDEXABSTRACT ***: peer " + peer + " has urls: " + urls);//System.out.println("DEBUG-INDEXABSTRACT ***: peer " + peer + " from words: " + words);@@ -735,7 +735,7 @@ public final class plasmaSearchEvent {hasURL = true;for (int j = 0; j < urls.length(); j = j + 12) {url = urls.substring(j, j + 12);- peerlist = (String) urlPeerlist.get(url);+ peerlist = urlPeerlist.get(url);p = (peerlist == null) ? -1 : peerlist.indexOf(peerhash);if ((p < 0) || (p % 12 != 0)) {hasURL = false;diff --git a/source/de/anomic/plasma/plasmaSearchRankingProfile.java b/source/de/anomic/plasma/plasmaSearchRankingProfile.javaindex 50970504d..e2765f37f 100644--- a/source/de/anomic/plasma/plasmaSearchRankingProfile.java+++ b/source/de/anomic/plasma/plasmaSearchRankingProfile.java@@ -184,7 +184,7 @@ public class plasmaSearchRankingProfile {private static int parseMap(HashMap<String, Integer> coeff, String attr, int dflt) {if (coeff.containsKey(attr)) try {- return ((Integer) coeff.get(attr)).intValue();+ return (coeff.get(attr)).intValue();} catch (NumberFormatException e) {return dflt;} else {diff --git a/source/de/anomic/plasma/plasmaSnippetCache.java b/source/de/anomic/plasma/plasmaSnippetCache.javaindex 24a7cda70..c33dff563 100644--- a/source/de/anomic/plasma/plasmaSnippetCache.java+++ b/source/de/anomic/plasma/plasmaSnippetCache.java@@ -480,7 +480,7 @@ public class plasmaSnippetCache {// flush cache if cache is fullwhile (snippetsCache.size() > maxCache) {- key = (String) snippetsScore.getMinObject();+ key = snippetsScore.getMinObject();snippetsScore.deleteScore(key);snippetsCache.remove(key);}diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.javaindex 8ff4df773..9a95e39f2 100644--- a/source/de/anomic/plasma/plasmaSwitchboard.java+++ b/source/de/anomic/plasma/plasmaSwitchboard.java@@ -108,18 +108,17 @@ import java.util.TreeMap;import java.util.TreeSet;import de.anomic.crawler.CrawlEntry;-import de.anomic.crawler.ErrorURL;import de.anomic.crawler.CrawlProfile;import de.anomic.crawler.CrawlQueues;+import de.anomic.crawler.CrawlStacker;+import de.anomic.crawler.ErrorURL;+import de.anomic.crawler.ImporterManager;+import de.anomic.crawler.IndexingStack;import de.anomic.crawler.NoticedURL;import de.anomic.crawler.ResultImages;import de.anomic.crawler.ResultURLs;import de.anomic.crawler.RobotsTxt;-import de.anomic.crawler.CrawlStacker;-import de.anomic.crawler.ProtocolLoader;import de.anomic.crawler.ZURL;-import de.anomic.crawler.ImporterManager;-import de.anomic.crawler.IndexingStack;import de.anomic.data.URLLicense;import de.anomic.data.blogBoard;import de.anomic.data.blogBoardComments;@@ -136,7 +135,6 @@ import de.anomic.http.httpRemoteProxyConfig;import de.anomic.http.httpd;import de.anomic.http.httpdProxyHandler;import de.anomic.http.httpdRobotsTxtConfig;-import de.anomic.index.indexDefaultReferenceBlacklist;import de.anomic.index.indexReferenceBlacklist;import de.anomic.index.indexURLReference;import de.anomic.kelondro.kelondroBitfield;@@ -1648,12 +1646,13 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.public void enQueue(IndexingStack.QueueEntry job) {assert job != null;+ // TODO this should not be possible?!if (!(job instanceof IndexingStack.QueueEntry)) {System.out.println("Internal error at plasmaSwitchboard.enQueue: wrong job type");- System.exit(0);+ System.exit(1);}try {- webIndex.queuePreStack.push((IndexingStack.QueueEntry) job);+ webIndex.queuePreStack.push(job);} catch (IOException e) {log.logSevere("IOError in plasmaSwitchboard.enQueue: " + e.getMessage(), e);}@@ -1907,13 +1906,13 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.deleteQueue.add(seed.hash);}}- for(int i=0;i<deleteQueue.size();++i) this.webIndex.seedDB.removeDisconnected((String)deleteQueue.get(i));+ for(int i=0;i<deleteQueue.size();++i) this.webIndex.seedDB.removeDisconnected(deleteQueue.get(i));deleteQueue.clear();e = this.webIndex.seedDB.seedsSortedPotential(true,yacySeed.LASTSEEN);checkInterruption();//clean potential seedswhile(e.hasNext()) {- seed = (yacySeed)e.next();+ seed = e.next();if(seed != null) {//list is sorted -> break when peers are too young to deleteif(seed.getLastSeenUTC() > (System.currentTimeMillis()-deleteOldSeedsTime))@@ -1921,7 +1920,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.deleteQueue.add(seed.hash);}}- for (int i = 0; i < deleteQueue.size(); ++i) this.webIndex.seedDB.removePotential((String)deleteQueue.get(i));+ for (int i = 0; i < deleteQueue.size(); ++i) this.webIndex.seedDB.removePotential(deleteQueue.get(i));}// check if update is available and@@ -1989,7 +1988,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.* @param jobType*/public void pauseCrawlJob(String jobType) {- Object[] status = (Object[])this.crawlJobsStatus.get(jobType);+ Object[] status = this.crawlJobsStatus.get(jobType);synchronized(status[CRAWLJOB_SYNC]) {status[CRAWLJOB_STATUS] = Boolean.TRUE;}@@ -2001,7 +2000,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.* @param jobType*/public void continueCrawlJob(String jobType) {- Object[] status = (Object[])this.crawlJobsStatus.get(jobType);+ Object[] status = this.crawlJobsStatus.get(jobType);synchronized(status[CRAWLJOB_SYNC]) {if (((Boolean)status[CRAWLJOB_STATUS]).booleanValue()) {status[CRAWLJOB_STATUS] = Boolean.FALSE;@@ -2016,7 +2015,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.* @return <code>true</code> if crawling was paused or <code>false</code> otherwise*/public boolean crawlJobIsPaused(String jobType) {- Object[] status = (Object[])this.crawlJobsStatus.get(jobType);+ Object[] status = this.crawlJobsStatus.get(jobType);synchronized(status[CRAWLJOB_SYNC]) {return ((Boolean)status[CRAWLJOB_STATUS]).booleanValue();}@@ -2231,7 +2230,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.yacySeed initiatorPeer = queueEntry.initiatorPeer();if ((processCase == PROCESSCASE_6_GLOBAL_CRAWLING) && (initiatorPeer != null)) {log.logInfo("Sending crawl receipt for '" + queueEntry.url().toNormalform(false, true) + "' to " + initiatorPeer.getName());- if (clusterhashes != null) initiatorPeer.setAlternativeAddress((String) clusterhashes.get(initiatorPeer.hash));+ if (clusterhashes != null) initiatorPeer.setAlternativeAddress(clusterhashes.get(initiatorPeer.hash));// start a thread for receipt sending to avoid a blocking herenew Thread(new receiptSending(initiatorPeer, newEntry)).start();}@@ -2556,7 +2555,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.checkInterruption();if (seedIter.hasNext()) {- plasmaDHTTransfer t = new plasmaDHTTransfer(log, webIndex.seedDB, webIndex.peerActions, (yacySeed)seedIter.next(), dhtChunk,gzipBody,timeout,retries);+ plasmaDHTTransfer t = new plasmaDHTTransfer(log, webIndex.seedDB, webIndex.peerActions, seedIter.next(), dhtChunk,gzipBody,timeout,retries);t.start();transfer.add(t);} else {@@ -2648,8 +2647,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.//the speed of indexing (pages/minute) of the peertotalPPM = (int) (indexedPages * 60 / Math.max(uptime, 1));- webIndex.seedDB.mySeed().put(yacySeed.ISPEED, Long.toString(Math.round(Math.max((float) indexedcdiff, 0f) * 60f / Math.max((float) uptimediff, 1f))));- totalQPM = requestedQueries * 60d / Math.max((double) uptime, 1d);+ webIndex.seedDB.mySeed().put(yacySeed.ISPEED, Long.toString(Math.round(Math.max(indexedcdiff, 0f) * 60f / Math.max(uptimediff, 1f))));+ totalQPM = requestedQueries * 60d / Math.max(uptime, 1d);webIndex.seedDB.mySeed().put(yacySeed.RSPEED, Double.toString(totalQPM /*Math.max((float) requestcdiff, 0f) * 60f / Math.max((float) uptimediff, 1f)*/ ));webIndex.seedDB.mySeed().put(yacySeed.UPTIME, Long.toString(uptime/60)); // the number of minutes that the peer is up in minutes/day (moving average MA30)@@ -2720,7 +2719,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.enu = seedList.iterator();lc = 0;while (enu.hasNext()) {- ys = yacySeed.genRemoteSeed((String) enu.next(), null, false);+ ys = yacySeed.genRemoteSeed(enu.next(), null, false);if ((ys != null) &&((!webIndex.seedDB.mySeedIsDefined()) || (webIndex.seedDB.mySeed().hash != ys.hash))) {if (webIndex.peerActions.connectPeer(ys, false)) lc++;diff --git a/source/de/anomic/plasma/plasmaWebStructure.java b/source/de/anomic/plasma/plasmaWebStructure.javaindex 858b63c5d..dcda5ee11 100644--- a/source/de/anomic/plasma/plasmaWebStructure.java+++ b/source/de/anomic/plasma/plasmaWebStructure.java@@ -303,7 +303,7 @@ public class plasmaWebStructure {dom = reference.substring(i * 12 + 6, (i + 1) * 12);c = 0;if (refs.containsKey(dom)) {- c = ((Integer) refs.get(dom)).intValue();+ c = (refs.get(dom)).intValue();}refs.put(dom, new Integer(++c));}diff --git a/source/de/anomic/plasma/plasmaWordConnotation.java b/source/de/anomic/plasma/plasmaWordConnotation.javaindex fac2ae6e8..3729892d5 100644--- a/source/de/anomic/plasma/plasmaWordConnotation.java+++ b/source/de/anomic/plasma/plasmaWordConnotation.java@@ -66,11 +66,17 @@ public class plasmaWordConnotation {private void addSingleRef(String word, String reference) throws IOException {//word = word.toLowerCase();//reference = reference.toLowerCase();+ // TODO what if there is no record? Should a new one be created? danielr 2008-06-06kelondroRow.Entry record = refDB.get(word, reference.getBytes());- long c;- if (record == null) c = 0; else c = record.getColLong(1);- record.setCol(1, c++);+ if(record != null) {+ final long c = record.getColLong(1) + 1;+ record.setCol(1, c);+ }refDB.put(word, record);+// long c;+// if (record == null) c = 0; else c = record.getColLong(1);+// record.setCol(1, c++);+// refDB.put(word, record);}public void addSentence(String[] words) throws IOException {diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.javaindex 17f3ee32c..b787baf9f 100644--- a/source/de/anomic/plasma/plasmaWordIndex.java+++ b/source/de/anomic/plasma/plasmaWordIndex.java@@ -93,7 +93,7 @@ public final class plasmaWordIndex implements indexRI {private final indexRAMRI dhtOutCache, dhtInCache;private final indexCollectionRI collections; // new database structure to replace AssortmentCluster and FileClusterprivate serverLog log;- private indexRepositoryReference referenceURL;+ indexRepositoryReference referenceURL;public yacySeedDB seedDB;public yacyNewsPool newsPool;private File primaryRoot, secondaryRoot;@@ -636,7 +636,9 @@ public final class plasmaWordIndex implements indexRI {lm = e.lastModified();}}- container.addUnique(elm.toKelondroEntry());+ if(elm != null) {+ container.addUnique(elm.toKelondroEntry());+ }}if (container.size() < beforeDouble) System.out.println("*** DEBUG DOUBLECHECK - removed " + (beforeDouble - container.size()) + " index entries from word container " + container.getWordHash());@@ -654,7 +656,7 @@ public final class plasmaWordIndex implements indexRI {while (i.hasNext()) {// get next word hash:- singleHash = (String) i.next();+ singleHash = i.next();// retrieve indexsingleContainer = getContainer(singleHash, urlselection);@@ -744,7 +746,7 @@ public final class plasmaWordIndex implements indexRI {Iterator<String> i = wordHashes.iterator();int count = 0;while (i.hasNext()) {- if (removeEntry((String) i.next(), urlHash)) count++;+ if (removeEntry(i.next(), urlHash)) count++;}return count;}@@ -770,7 +772,7 @@ public final class plasmaWordIndex implements indexRI {// this is mainly used when correcting a index after a searchIterator<String> i = wordHashes.iterator();while (i.hasNext()) {- removeEntries((String) i.next(), urlHashes);+ removeEntries(i.next(), urlHashes);}}@@ -781,7 +783,7 @@ public final class plasmaWordIndex implements indexRI {int count = 0;while (iter.hasNext()) {// delete the URL reference in this word index- if (removeEntry(indexWord.word2hash((String) iter.next()), urlhash)) count++;+ if (removeEntry(indexWord.word2hash(iter.next()), urlhash)) count++;}return count;}@@ -935,7 +937,7 @@ public final class plasmaWordIndex implements indexRI {Iterator<indexContainer> indexContainerIterator = indexContainerSet(startHash, false, false, 100).iterator();while (indexContainerIterator.hasNext() && run) {waiter();- container = (indexContainer) indexContainerIterator.next();+ container = indexContainerIterator.next();Iterator<indexRWIRowEntry> containerIterator = container.entries();wordHashNow = container.getWordHash();while (containerIterator.hasNext() && run) {@@ -965,7 +967,7 @@ public final class plasmaWordIndex implements indexRI {TreeSet<indexContainer> containers = indexContainerSet(container.getWordHash(), 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()) && (!container.getWordHash().equals(((indexContainer) indexContainerIterator.next()).getWordHash()))) {+ if ((indexContainerIterator.hasNext()) && (!container.getWordHash().equals(indexContainerIterator.next().getWordHash()))) {indexContainerIterator = containers.iterator();}}diff --git a/source/de/anomic/server/logging/ConsoleOutErrHandler.java b/source/de/anomic/server/logging/ConsoleOutErrHandler.javaindex b6685a241..dac90d0b2 100644--- a/source/de/anomic/server/logging/ConsoleOutErrHandler.java+++ b/source/de/anomic/server/logging/ConsoleOutErrHandler.java@@ -181,8 +181,8 @@ public final class ConsoleOutErrHandler extends Handler{super.setFormatter(newFormatter);if (newFormatter == null) return;try {- this.stdOutHandler.setFormatter((Formatter)newFormatter.getClass().newInstance());- this.stdErrHandler.setFormatter((Formatter)newFormatter.getClass().newInstance());+ this.stdOutHandler.setFormatter(newFormatter.getClass().newInstance());+ this.stdErrHandler.setFormatter(newFormatter.getClass().newInstance());} catch (Exception e) {throw new SecurityException(e.getMessage());}@@ -192,8 +192,8 @@ public final class ConsoleOutErrHandler extends Handler{super.setFilter(newFilter);if (newFilter == null) return;try {- this.stdOutHandler.setFilter((Filter)newFilter.getClass().newInstance());- this.stdErrHandler.setFilter((Filter)newFilter.getClass().newInstance());+ this.stdOutHandler.setFilter(newFilter.getClass().newInstance());+ this.stdErrHandler.setFilter(newFilter.getClass().newInstance());} catch (Exception e) {throw new SecurityException(e.getMessage());}diff --git a/source/de/anomic/server/logging/GuiHandler.java b/source/de/anomic/server/logging/GuiHandler.javaindex 3c32d3685..13a4313b7 100644--- a/source/de/anomic/server/logging/GuiHandler.java+++ b/source/de/anomic/server/logging/GuiHandler.java@@ -164,7 +164,7 @@ public class GuiHandler extends Handler{}}- return (LogRecord[]) tempBuffer.toArray(new LogRecord[tempBuffer.size()]);+ return tempBuffer.toArray(new LogRecord[tempBuffer.size()]);}public synchronized String getLog(boolean reversed, int lineCount) {@@ -210,7 +210,7 @@ public class GuiHandler extends Handler{record = this.buffer[ix];logMessages.add(logFormatter.format(record));}- return (String[])logMessages.toArray(new String[logMessages.size()]);+ return logMessages.toArray(new String[logMessages.size()]);} catch (Exception ex) {// We don't want to throw an exception here, but we// report the exception to any registered ErrorManager.diff --git a/source/de/anomic/server/logging/LogalizerHandler.java b/source/de/anomic/server/logging/LogalizerHandler.javaindex 89805e692..4fa2fd05b 100644--- a/source/de/anomic/server/logging/LogalizerHandler.java+++ b/source/de/anomic/server/logging/LogalizerHandler.java@@ -71,8 +71,9 @@ public class LogalizerHandler extends Handler {configure();}+ @SuppressWarnings("null")private HashMap<String, Object> loadParsers() {- HashMap<String, Object> parsers = new HashMap<String, Object>();+ HashMap<String, Object> logParsers = new HashMap<String, Object>();try {if (debug) System.out.println("Searching for additional content parsers in package " + logParserPackage);// getting an uri to the parser subpackage@@ -83,7 +84,8 @@ public class LogalizerHandler extends Handler {//System.out.println(parserDir.toString());String [] parserDirFiles = parserDir.list(parserNameFilter);if(parserDirFiles == null && debug) {- System.out.println("Can't find any parsers in "+parserDir.getAbsolutePath());+ System.err.println("Can't find any parsers in "+parserDir.getAbsolutePath());+ parserDirFiles = new String[0];}//System.out.println(parserDirFiles.length);for (int i=0; i<parserDirFiles.length; i++) {@@ -96,7 +98,7 @@ public class LogalizerHandler extends Handler {if (theParser instanceof LogParser) {LogParser theLogParser = (LogParser) theParser;//System.out.println(bla.getName() + " is a logParser");- parsers.put(theLogParser.getParserType(), theParser);+ logParsers.put(theLogParser.getParserType(), theParser);if (debug) System.out.println("Added " + theLogParser.getClass().getName() + " as " + theLogParser.getParserType() + " Parser.");}@@ -116,7 +118,7 @@ public class LogalizerHandler extends Handler {} catch (URISyntaxException e) {e.printStackTrace();}- return parsers;+ return logParsers;}/**diff --git a/source/de/anomic/server/logging/logParsers/LogParserPLASMA.java b/source/de/anomic/server/logging/logParsers/LogParserPLASMA.javaindex 7d7ff8fe1..10e18168e 100644--- a/source/de/anomic/server/logging/logParsers/LogParserPLASMA.java+++ b/source/de/anomic/server/logging/logParsers/LogParserPLASMA.java@@ -518,7 +518,7 @@ public class LogParserPLASMA implements LogParser{System.out.println("DHT: Sended " + DHTSendURLs + " URLs via DHT.");System.out.println("DHT: DHT Transfers send to " + DHTPeerNames.size() + " Peernames with " + DHTPeerHashs.size() + " Peerhashs.");System.out.println("DHT: Totally selected " + DHTSelectionWordsCount + " words in " + DHTSelectionWordsTimeCount + " seconds (" + (float)DHTSelectionWordsCount/DHTSelectionWordsTimeCount + " words/s)");- System.out.println("DHT: Selected " + DHTSelectionTargetCount + " possible DHT Targets (min. Distance: " + minDHTDist + " max. Distance: " + maxDHTDist + " avg. Distance: " + ((double)avgDHTDist/DHTSelectionTargetCount));+ System.out.println("DHT: Selected " + DHTSelectionTargetCount + " possible DHT Targets (min. Distance: " + minDHTDist + " max. Distance: " + maxDHTDist + " avg. Distance: " + (avgDHTDist/DHTSelectionTargetCount));System.out.println("DHT: " + busyPeerCount + " times a targetpeer was too busy to accept a transfer.");System.out.println("DHT: " + notEnoughDHTPeers + " times there were not enought targetpeers for the selected DHTChunk");System.out.println("DHT: IndexDistribution failed " + failedIndexDistributionCount + " times.");diff --git a/source/de/anomic/server/serverAbstractSwitch.java b/source/de/anomic/server/serverAbstractSwitch.javaindex bcbcf4d85..1207051f9 100644--- a/source/de/anomic/server/serverAbstractSwitch.java+++ b/source/de/anomic/server/serverAbstractSwitch.java@@ -98,7 +98,7 @@ public abstract class serverAbstractSwitch<E> implements serverSwitch<E> {if (applyPro) {i = new HashMap<String, String>(initProps).keySet().iterator(); // clone the map to avoid concurrent modification exceptionswhile (i.hasNext()) {- prop = (String) i.next();+ prop = i.next();if (prop.endsWith("__pro")) {initProps.put(prop.substring(0, prop.length() - 5), initProps.get(prop));}@@ -107,7 +107,7 @@ public abstract class serverAbstractSwitch<E> implements serverSwitch<E> {// delete the 'pro' init settingsi = initProps.keySet().iterator();while (i.hasNext()) {- prop = (String) i.next();+ prop = i.next();if (prop.endsWith("__pro")) {i.remove();}@@ -379,7 +379,7 @@ public abstract class serverAbstractSwitch<E> implements serverSwitch<E> {}public void undeployAction(String actionName) {- serverSwitchAction action = (serverSwitchAction) switchActions.get(actionName);+ serverSwitchAction action = switchActions.get(actionName);action.close();switchActions.remove(actionName);log.logInfo("Undeployed Action '" + action.getShortDescription() + "', (" + switchActions.size() + " actions registered)");@@ -515,7 +515,7 @@ public abstract class serverAbstractSwitch<E> implements serverSwitch<E> {public String getAuthentifyUser(InetAddress host) {// read user name according to host addresses- String a = (String) authorization.get(host);+ String a = authorization.get(host);if (a == null) return null;int p = a.indexOf("@");if (p < 0) return null;@@ -524,7 +524,7 @@ public abstract class serverAbstractSwitch<E> implements serverSwitch<E> {public String getAuthentifyRights(InetAddress host) {// read access rigths according to host addresses- String a = (String) authorization.get(host);+ String a = authorization.get(host);if (a == null) return null;int p = a.indexOf("@");if (p < 0) return null;diff --git a/source/de/anomic/server/serverByteBuffer.java b/source/de/anomic/server/serverByteBuffer.javaindex 826ce8a5b..077551bbd 100644--- a/source/de/anomic/server/serverByteBuffer.java+++ b/source/de/anomic/server/serverByteBuffer.java@@ -105,7 +105,7 @@ public final class serverByteBuffer extends OutputStream {public serverByteBuffer(File f) throws IOException {// initially fill the byte buffer with the content of a file- if (f.length() > (long) Integer.MAX_VALUE) throw new IOException("file is too large for buffering");+ if (f.length() > Integer.MAX_VALUE) throw new IOException("file is too large for buffering");length = (int) f.length();buffer = new byte[length];diff --git a/source/de/anomic/server/serverClassLoader.java b/source/de/anomic/server/serverClassLoader.javaindex 569d422a8..7dcbdfb8b 100644--- a/source/de/anomic/server/serverClassLoader.java+++ b/source/de/anomic/server/serverClassLoader.java@@ -81,7 +81,7 @@ public final class serverClassLoader extends ClassLoader {// try to load the classsynchronized(classFileName.intern()) {// first try: take the class out of the cache, denoted by the classname- Class<?> c = (Class<?>) this.classes.get(classfile);+ Class<?> c = this.classes.get(classfile);if (c != null) return c;// consider classkey as a file and extract the file namediff --git a/source/de/anomic/server/serverCore.java b/source/de/anomic/server/serverCore.javaindex 37f0395e2..416d6c24c 100644--- a/source/de/anomic/server/serverCore.java+++ b/source/de/anomic/server/serverCore.java@@ -300,7 +300,7 @@ public final class serverCore extends serverAbstractBusyThread implements serverEnumeration<InetAddress> addresses = interf.getInetAddresses();if (addresses != null) {while (addresses.hasMoreElements()) {- InetAddress address = (InetAddress)addresses.nextElement();+ InetAddress address = addresses.nextElement();if (address instanceof Inet4Address) {hostName = address.getHostAddress();break;@@ -353,7 +353,7 @@ public final class serverCore extends serverAbstractBusyThread implements serverString cIP = clientAddress(controlSocket);//System.out.println("server bfHosts=" + bfHost.toString());if (bfHost.get(cIP) != null) {- Integer attempts = (Integer) bfHost.get(cIP);+ Integer attempts = bfHost.get(cIP);if (attempts == null) attempts = new Integer(1); else attempts = new Integer(attempts.intValue() + 1);bfHost.put(cIP, attempts);this.log.logWarning("SLOWING DOWN ACCESS FOR BRUTE-FORCE PREVENTION FROM " + cIP + ", ATTEMPT " + attempts.intValue());@@ -728,7 +728,7 @@ public final class serverCore extends serverAbstractBusyThread implements server// this.commandObj = (serverHandler) serverCore.this.handlerPrototype.clone();// }- this.commandObj = (serverHandler) serverCore.this.handlerPrototype.clone();+ this.commandObj = serverCore.this.handlerPrototype.clone();}// initializing the sessiondiff --git a/source/de/anomic/server/serverDomains.java b/source/de/anomic/server/serverDomains.javaindex ee59f5d93..4f6ba0d96 100644--- a/source/de/anomic/server/serverDomains.java+++ b/source/de/anomic/server/serverDomains.java@@ -423,7 +423,7 @@ public class serverDomains {host = host.toLowerCase().trim();// trying to resolve host by doing a name cache lookup- InetAddress ip = (InetAddress) nameCacheHit.get(host);+ InetAddress ip = nameCacheHit.get(host);if (ip != null) return ip;if (nameCacheMiss.contains(host)) return null;@@ -435,7 +435,7 @@ public class serverDomains {host = host.toLowerCase().trim();// trying to resolve host by doing a name cache lookup- InetAddress ip = (InetAddress) nameCacheHit.get(host);+ InetAddress ip = nameCacheHit.get(host);if (ip != null) return ip;if (nameCacheMiss.contains(host)) return null;@@ -462,7 +462,7 @@ public class serverDomains {}}- if (doCaching) {+ if (doCaching && ip != null) {// remove old entriesflushHitNameCache();@@ -514,7 +514,7 @@ public class serverDomains {int cutofftime = intTime(System.currentTimeMillis()) - maxNameCacheHitAge;String k;while ((nameCacheHitAges.size() > maxNameCacheHitSize) || (nameCacheHitAges.getMinScore() < cutofftime)) {- k = (String) nameCacheHitAges.getMinObject();+ k = nameCacheHitAges.getMinObject();if (nameCacheHit.remove(k) == null) break; // ensure terminationnameCacheHitAges.deleteScore(k);}@@ -528,7 +528,7 @@ public class serverDomains {int cutofftime = intTime(System.currentTimeMillis()) - maxNameCacheMissAge;String k;while ((nameCacheMissAges.size() > maxNameCacheMissSize) || (nameCacheMissAges.getMinScore() < cutofftime)) {- k = (String) nameCacheMissAges.getMinObject();+ k = nameCacheMissAges.getMinObject();if (!nameCacheMiss.remove(k)) break; // ensure terminationnameCacheMissAges.deleteScore(k);}diff --git a/source/de/anomic/server/serverFileUtils.java b/source/de/anomic/server/serverFileUtils.javaindex d512e2e13..e3bd0b8c7 100644--- a/source/de/anomic/server/serverFileUtils.java+++ b/source/de/anomic/server/serverFileUtils.java@@ -438,11 +438,13 @@ public final class serverFileUtils {zos.putNextEntry(new ZipEntry(name + ".txt"));os = zos;}- for (Iterator<String> i = set.iterator(); i.hasNext(); ) {- os.write((i.next().toString()).getBytes());- if (sep != null) os.write(sep.getBytes());+ if(os != null) {+ for (Iterator<String> i = set.iterator(); i.hasNext(); ) {+ os.write((i.next().toString()).getBytes());+ if (sep != null) os.write(sep.getBytes());+ }+ os.close();}- os.close();file.delete();tf.renameTo(file);}@@ -461,18 +463,20 @@ public final class serverFileUtils {zos.putNextEntry(new ZipEntry(name + ".txt"));os = zos;}- Iterator<kelondroRow.Entry> i = set.rows();- String key;- if (i.hasNext()) {- key = new String(i.next().getColBytes(0));- os.write(key.getBytes());- }- while (i.hasNext()) {- key = new String(((kelondroRow.Entry) i.next()).getColBytes(0));- if (sep != null) os.write(sep.getBytes());- os.write(key.getBytes());+ if(os != null) {+ Iterator<kelondroRow.Entry> i = set.rows();+ String key;+ if (i.hasNext()) {+ key = new String(i.next().getColBytes(0));+ os.write(key.getBytes());+ }+ while (i.hasNext()) {+ key = new String((i.next()).getColBytes(0));+ if (sep != null) os.write(sep.getBytes());+ os.write(key.getBytes());+ }+ os.close();}- os.close();file.delete();tf.renameTo(file);}diff --git a/source/de/anomic/server/serverObjects.java b/source/de/anomic/server/serverObjects.javaindex d8b5ea885..fdf6ce51a 100644--- a/source/de/anomic/server/serverObjects.java+++ b/source/de/anomic/server/serverObjects.java@@ -181,7 +181,7 @@ public class serverObjects extends HashMap<String, String> implements Cloneable* replaced in the returned String.*/public String putHTML(String key, String value, boolean forXML) {- return (String) put(key, htmlTools.encodeUnicode2html(value, true, forXML));+ return put(key, htmlTools.encodeUnicode2html(value, true, forXML));}/**@@ -193,7 +193,7 @@ public class serverObjects extends HashMap<String, String> implements Cloneable* @return the String value added to the map.*/public String putNum(String key, long value) {- return (String) this.put(key, yFormatter.number(value, this.localized));+ return this.put(key, yFormatter.number(value, this.localized));}/**@@ -201,7 +201,7 @@ public class serverObjects extends HashMap<String, String> implements Cloneable* @see #putNum(String, long)*/public String putNum(String key, double value) {- return (String) this.put(key, yFormatter.number(value, this.localized));+ return this.put(key, yFormatter.number(value, this.localized));}/**@@ -209,34 +209,34 @@ public class serverObjects extends HashMap<String, String> implements Cloneable* @see #putNum(String, long)*/public String putNum(String key, String value) {- return (String) this.put(key, yFormatter.number(value));+ return this.put(key, yFormatter.number(value));}public String putWiki(String key, String wikiCode){- return (String) this.put(key, plasmaSwitchboard.wikiParser.transform(wikiCode));+ return this.put(key, plasmaSwitchboard.wikiParser.transform(wikiCode));}public String putWiki(String key, byte[] wikiCode) {try {- return (String) this.put(key, plasmaSwitchboard.wikiParser.transform(wikiCode));+ return this.put(key, plasmaSwitchboard.wikiParser.transform(wikiCode));} catch (UnsupportedEncodingException e) {- return (String) this.put(key, "Internal error pasting wiki-code: " + e.getMessage());+ return this.put(key, "Internal error pasting wiki-code: " + e.getMessage());}}public String putWiki(String key, String wikiCode, String publicAddress) {- return (String) this.put(key, plasmaSwitchboard.wikiParser.transform(wikiCode, publicAddress));+ return this.put(key, plasmaSwitchboard.wikiParser.transform(wikiCode, publicAddress));}public String putWiki(String key, byte[] wikiCode, String publicAddress) {try {- return (String) this.put(key, plasmaSwitchboard.wikiParser.transform(wikiCode, "UTF-8", publicAddress));+ return this.put(key, plasmaSwitchboard.wikiParser.transform(wikiCode, "UTF-8", publicAddress));} catch (UnsupportedEncodingException e) {- return (String) this.put(key, "Internal error pasting wiki-code: " + e.getMessage());+ return this.put(key, "Internal error pasting wiki-code: " + e.getMessage());}}// inc variant: for counterspublic long inc(String key) {- String c = (String) super.get(key);+ String c = super.get(key);if (c == null) c = "0";long l = Long.parseLong(c) + 1;super.put(key, Long.toString(l));@@ -256,7 +256,7 @@ public class serverObjects extends HashMap<String, String> implements Cloneable}public int getInt(String key, int dflt) {- String s = (String) super.get(key);+ String s = super.get(key);if (s == null) return dflt;try {return Integer.parseInt(s);@@ -266,7 +266,7 @@ public class serverObjects extends HashMap<String, String> implements Cloneable}public long getLong(String key, long dflt) {- String s = (String) super.get(key);+ String s = super.get(key);if (s == null) return dflt;try {return Long.parseLong(s);@@ -276,7 +276,7 @@ public class serverObjects extends HashMap<String, String> implements Cloneable}public double getDouble(String key, double dflt) {- String s = (String) super.get(key);+ String s = super.get(key);if (s == null) return dflt;try {return Double.parseDouble(s);@@ -294,11 +294,11 @@ public class serverObjects extends HashMap<String, String> implements CloneableString key;while (e.hasNext()) {key = e.next();- if (key.matches(keyMapper)) v.add((String) get(key));+ if (key.matches(keyMapper)) v.add(get(key));}// make a String[]String[] result = new String[v.size()];- for (int i = 0; i < v.size(); i++) result[i] = (String) v.get(i);+ for (int i = 0; i < v.size(); i++) result[i] = v.get(i);return result;}diff --git a/source/de/anomic/server/serverProfiling.java b/source/de/anomic/server/serverProfiling.javaindex 490a7a77b..5df2ce1d1 100644--- a/source/de/anomic/server/serverProfiling.java+++ b/source/de/anomic/server/serverProfiling.java@@ -73,7 +73,7 @@ public class serverProfiling extends Thread {public static void update(String eventName, Object eventPayload) {// get event history container- int counter = eventCounter.containsKey(eventName) ? ((Integer) eventCounter.get(eventName)).intValue() : 0;+ int counter = eventCounter.containsKey(eventName) ? (eventCounter.get(eventName)).intValue() : 0;if (historyMaps.containsKey(eventName)) {ConcurrentLinkedQueue<Event> history = historyMaps.get(eventName);diff --git a/source/de/anomic/server/serverSystem.java b/source/de/anomic/server/serverSystem.javaindex bf32c3e26..56d4d1a8f 100644--- a/source/de/anomic/server/serverSystem.java+++ b/source/de/anomic/server/serverSystem.java@@ -180,7 +180,7 @@ public final class serverSystem {String type = getMacFSType(f);if ((type == null) || (type.equals(blankTypeString))) return false;String ext = name.substring(dot + 1).toLowerCase();- String oldType = (String) macFSTypeCache.get(ext);+ String oldType = macFSTypeCache.get(ext);if ((oldType != null) && (oldType.equals(type))) return false;macFSTypeCache.put(ext, type);return true;@@ -193,7 +193,7 @@ public final class serverSystem {// check creatorString creator = getMacFSCreator(f);if ((creator == null) || (creator.equals(blankTypeString))) return false;- String oldCreator = (String) macFSCreatorCache.get(name);+ String oldCreator = macFSCreatorCache.get(name);if ((oldCreator != null) && (oldCreator.equals(creator))) return false;macFSCreatorCache.put(name, creator);return true;@@ -206,7 +206,7 @@ public final class serverSystem {// reconstruct file typeint dot = name.lastIndexOf(".");if ((dot < 0) || (dot + 1 >= name.length())) return false;- String type = (String) macFSTypeCache.get(name.substring(dot + 1).toLowerCase());+ String type = macFSTypeCache.get(name.substring(dot + 1).toLowerCase());if (type == null) return false;String oldType = getMacFSType(f);if ((oldType != null) && (oldType.equals(type))) return false;@@ -219,7 +219,7 @@ public final class serverSystem {String name = f.toString();// reconstruct file creator- String creator = (String) macFSCreatorCache.get(name);+ String creator = macFSCreatorCache.get(name);if (creator == null) return false;String oldCreator = getMacFSCreator(f);if ((oldCreator != null) && (oldCreator.equals(creator))) return false;diff --git a/source/de/anomic/tools/PKCS12Tool.java b/source/de/anomic/tools/PKCS12Tool.javaindex b813385c7..80b03533f 100644--- a/source/de/anomic/tools/PKCS12Tool.java+++ b/source/de/anomic/tools/PKCS12Tool.java@@ -110,7 +110,7 @@ public class PKCS12Tool {Enumeration<String> pkcs12Aliases = aliases();while (pkcs12Aliases.hasMoreElements()) {- String strAlias = (String)pkcs12Aliases.nextElement();+ String strAlias = pkcs12Aliases.nextElement();System.err.println("Importing Alias '" + strAlias + "'");if (this.kspkcs12.isKeyEntry(strAlias)) {diff --git a/source/de/anomic/tools/cryptbig.java b/source/de/anomic/tools/cryptbig.javaindex dc1444329..9d3d55bc8 100644--- a/source/de/anomic/tools/cryptbig.java+++ b/source/de/anomic/tools/cryptbig.java@@ -220,7 +220,7 @@ public class cryptbig {String method;Iterator<String> i = methods.iterator();while (i.hasNext()) {- method = (String) i.next();+ method = i.next();System.out.print(method + " : ");try {cryptbig crypter = new cryptbig("abrakadabra", method);@@ -352,7 +352,12 @@ public class cryptbig {System.err.println("ERROR: file '" + inFileName + "' not found");} catch (IOException e) {System.err.println("ERROR: IO trouble");- try {fin.close(); fout.close();} catch (Exception ee) {}+ try { if(fin != null) {+ fin.close();+ }} catch (Exception ee) {}+ try { if(fout != null) {+ fout.close();+ }} catch (Exception ee) {}}}diff --git a/source/de/anomic/tools/diskUsage.java b/source/de/anomic/tools/diskUsage.javaindex 1e70cb06a..793859cb5 100644--- a/source/de/anomic/tools/diskUsage.java+++ b/source/de/anomic/tools/diskUsage.java@@ -46,29 +46,18 @@package de.anomic.tools;-import java.lang.String;-import java.lang.Long;-import java.lang.ProcessBuilder;-import java.lang.Process;--import java.util.HashMap;-import java.util.Map;-import java.util.Set;-import java.util.Iterator;-import java.util.ArrayList;-import java.io.BufferedReader;-import java.io.InputStreamReader;-import java.io.IOException;import java.io.File;-import java.io.FileReader;-import java.io.FileNotFoundException;+import java.io.IOException;+import java.io.InputStreamReader;+import java.util.ArrayList;+import java.util.HashMap;import de.anomic.plasma.plasmaSwitchboard;public class diskUsage {- private static final HashMap<String, long[]> diskUsage = new HashMap<String, long[]>();+ private static final HashMap<String, long[]> diskUsages = new HashMap<String, long[]>();private static final ArrayList<String> allVolumes = new ArrayList<String>();private static final ArrayList<String> allMountPoints = new ArrayList<String>();@@ -124,7 +113,7 @@ public class diskUsage {public diskUsage (plasmaSwitchboard sb) {errorMessage = null;- this.sb = sb;+ diskUsage.sb = sb;usedOS = getOS();if (usedOS == -1) {usable = false;@@ -172,7 +161,7 @@ public class diskUsage {dfUnix(false);elsedfWindows ();- return diskUsage;+ return diskUsages;}public boolean getUsable () {@@ -196,7 +185,7 @@ public class diskUsage {private void dfUnix(boolean getVolumesOnly) {if (!getVolumesOnly)- diskUsage.clear ();+ diskUsages.clear ();// -k set blocksize to 1024// confirmed with tests:@@ -270,7 +259,7 @@ nextLine:try { vals[1] = new Long(tokens[3]); } catch (NumberFormatException e) { break nextLine; }vals[0] *= 1024;vals[1] *= 1024;- diskUsage.put (yacyUsedMountPoints.get(i), vals);+ diskUsages.put (yacyUsedMountPoints.get(i), vals);}}}@@ -393,7 +382,7 @@ nextLine:long[] vals = new long[2];vals[0] = -1;try { vals[1] = new Long(tokens[2].replaceAll("[.,]", "")); } catch (NumberFormatException e) {continue;}- diskUsage.put (yacyUsedVolumes.get(i), vals);+ diskUsages.put (yacyUsedVolumes.get(i), vals);}}diff --git a/source/de/anomic/tools/disorderSet.java b/source/de/anomic/tools/disorderSet.javaindex df7c0a3f5..e6e80bcc3 100644--- a/source/de/anomic/tools/disorderSet.java+++ b/source/de/anomic/tools/disorderSet.java@@ -73,7 +73,7 @@ public class disorderSet extends HashSet<String> implements Set<String> {public static void main(String[] args) {disorderSet ds = new disorderSet();for (int i = 0; i < args.length; i++) ds.add(args[i]);- for (int i = 0; i < args.length * 3; i++) System.out.print((String) ds.any() + " ");+ for (int i = 0; i < args.length * 3; i++) System.out.print(ds.any() + " ");System.out.println();}diff --git a/source/de/anomic/tools/enumerateFiles.java b/source/de/anomic/tools/enumerateFiles.javaindex bcb159360..3378447ca 100644--- a/source/de/anomic/tools/enumerateFiles.java+++ b/source/de/anomic/tools/enumerateFiles.java@@ -88,9 +88,9 @@ public class enumerateFiles implements Enumeration<File> {t = null;}}- if ((hierarchy.size() == 0) || (t.size() == 0)) return null; // this is the end+ if ((hierarchy.size() == 0) || (t == null || t.size() == 0)) return null; // this is the end// fetch value- if (incOrder) f = (File) t.first(); else f = (File) t.last();+ if (incOrder) f = t.first(); else f = t.last();t.remove(f);// if the value represents another folder, we step into the next hierarchyif (f.isDirectory()) {diff --git a/source/de/anomic/tools/loaderThreads.java b/source/de/anomic/tools/loaderThreads.javaindex 6c62b00df..b96c6fda6 100644--- a/source/de/anomic/tools/loaderThreads.java+++ b/source/de/anomic/tools/loaderThreads.java@@ -198,7 +198,7 @@ public class loaderThreads {try {while ((this.run) && (line < lines.size())) {// parse line and construct a property- s = (String) lines.get(line);+ s = lines.get(line);if ((s != null) && ((p = s.indexOf('=')) > 0)) {key = s.substring(0, p).trim();value = s.substring(p + 1).trim();diff --git a/source/de/anomic/tools/nxTools.java b/source/de/anomic/tools/nxTools.javaindex 0bf477630..76e96b827 100644--- a/source/de/anomic/tools/nxTools.java+++ b/source/de/anomic/tools/nxTools.java@@ -63,7 +63,7 @@ public class nxTools {String line;HashMap<String, String> props = new HashMap<String, String>(list.size());while (i.hasMoreElements()) {- line = ((String) i.nextElement()).trim();+ line = (i.nextElement()).trim();pos = line.indexOf("=");if (pos > 0) props.put(line.substring(0, pos).trim(), line.substring(pos + 1).trim());}@@ -93,7 +93,7 @@ public class nxTools {String line;HashMap<String, String> props = new HashMap<String, String>(list.size());while (i.hasNext()) {- line = ((String) i.next()).trim();+ line = (i.next()).trim();if (line.startsWith("#")) continue; // exclude comments//System.out.println("NXTOOLS_PROPS - LINE:" + line);pos = line.indexOf("=");@@ -108,7 +108,7 @@ public class nxTools {String line;Vector<String> result = new Vector<String>();while (i.hasMoreElements()) {- line = (String) i.nextElement();+ line = i.nextElement();if (line.indexOf(pattern) >= 0) {result.add(line);ac = afterContext + 1;@@ -126,7 +126,7 @@ public class nxTools {String line;ArrayList<String> result = new ArrayList<String>();while (i.hasNext()) {- line = (String) i.next();+ line = i.next();if (line.indexOf(pattern) >= 0) {result.add(line);ac = afterContext + 1;@@ -140,12 +140,12 @@ public class nxTools {public static String tail1(Vector<String> list) {if ((list == null) || (list.size() == 0)) return "";- return (String) list.lastElement();+ return list.lastElement();}public static String tail1(ArrayList<String> list) {if ((list == null) || (list.size() == 0)) return "";- return (String) list.get(list.size()-1);+ return list.get(list.size()-1);}public static String awk(String sentence, String separator, int count) {diff --git a/source/de/anomic/xml/crawlHandler.java b/source/de/anomic/xml/crawlHandler.javaindex b40f15624..5b96c96b7 100644--- a/source/de/anomic/xml/crawlHandler.java+++ b/source/de/anomic/xml/crawlHandler.java@@ -151,12 +151,12 @@ public class crawlHandler extends DefaultHandler {public Startpoint getStartpoint(int i) {// retrieve item by order number- return getStartpoint((String) startpointsGUID.get(i));+ return getStartpoint(startpointsGUID.get(i));}public Startpoint getStartpoint(String guid) {// retrieve item by guid- return (Startpoint) startpoints.get(guid);+ return startpoints.get(guid);}public int startpoints() {@@ -176,47 +176,47 @@ public class crawlHandler extends DefaultHandler {}public String getAuthor() {- return (String) map.get("author");+ return map.get("author");}public String getCopyright() {- return (String) map.get("copyright");+ return map.get("copyright");}public String getCategory() {- return (String) map.get("category");+ return map.get("category");}public String getTitle() {- return (String) map.get("title");+ return map.get("title");}public String getLink() {- return (String) map.get("link");+ return map.get("link");}public String getLanguage() {- return (String) map.get("language");+ return map.get("language");}public String getDescription() {- return (String) map.get("description");+ return map.get("description");}public String getCreator() {- return (String) map.get("creator");+ return map.get("creator");}public String getPubDate() {- return (String) map.get("pubDate");+ return map.get("pubDate");}public String getGuid() {- return (String) map.get("guid");+ return map.get("guid");}public String getDocs() {- return (String) map.get("docs");+ return map.get("docs");}}@@ -234,47 +234,47 @@ public class crawlHandler extends DefaultHandler {}public String getAuthor() {- return (String) map.get("author");+ return map.get("author");}public String getCopyright() {- return (String) map.get("copyright");+ return map.get("copyright");}public String getCategory() {- return (String) map.get("category");+ return map.get("category");}public String getTitle() {- return (String) map.get("title");+ return map.get("title");}public String getLink() {- return (String) map.get("link");+ return map.get("link");}public String getLanguage() {- return (String) map.get("language");+ return map.get("language");}public String getDescription() {- return (String) map.get("description");+ return map.get("description");}public String getCreator() {- return (String) map.get("creator");+ return map.get("creator");}public String getPubDate() {- return (String) map.get("pubDate");+ return map.get("pubDate");}public String getGuid() {- return (String) map.get("guid");+ return map.get("guid");}public String getDocs() {- return (String) map.get("docs");+ return map.get("docs");}}}\ No newline at end of filediff --git a/source/de/anomic/xml/opensearchdescriptionReader.java b/source/de/anomic/xml/opensearchdescriptionReader.javaindex 917269bd4..f853a8fe4 100644--- a/source/de/anomic/xml/opensearchdescriptionReader.java+++ b/source/de/anomic/xml/opensearchdescriptionReader.java@@ -199,12 +199,12 @@ public class opensearchdescriptionReader extends DefaultHandler {public Item getItem(int i) {// retrieve item by order number- return getItem((String) itemsGUID.get(i));+ return getItem(itemsGUID.get(i));}public Item getItem(String guid) {// retrieve item by guid- return (Item) items.get(guid);+ return items.get(guid);}public int items() {diff --git a/source/de/anomic/yacy/resourceObserver.java b/source/de/anomic/yacy/resourceObserver.javaindex d3b65a8d2..29e0d26ef 100644--- a/source/de/anomic/yacy/resourceObserver.java+++ b/source/de/anomic/yacy/resourceObserver.java@@ -39,15 +39,13 @@package de.anomic.yacy;-import java.lang.String;import java.util.HashMap;-import java.util.Map;-import java.util.Set;import java.util.Iterator;+import java.util.Map;import de.anomic.plasma.plasmaSwitchboard;import de.anomic.server.logging.serverLog;-import de.anomic.tools.diskUsage;+import de.anomic.tools.DiskUsage;public final class resourceObserver {// The minimal free space on every used volume, for now set to 100 MB.@@ -62,7 +60,7 @@ public final class resourceObserver {private final int CHECK_MEMORY_USAGE_FREQ = 1;private serverLog log = new serverLog("RESOURCE OBSERVER");- private diskUsage du;+ private DiskUsage du;private plasmaSwitchboard sb;private int checkDiskUsageCount;@@ -72,7 +70,7 @@ public final class resourceObserver {public resourceObserver(plasmaSwitchboard sb) {this.sb = sb;- du = new diskUsage(sb);+ du = new DiskUsage(sb);if (!du.getUsable ())this.log.logWarning("Disk usage returned: " + du.getErrorMessage());diff --git a/source/de/anomic/yacy/seedUpload/yacySeedUploadFtp.java b/source/de/anomic/yacy/seedUpload/yacySeedUploadFtp.javaindex 5720848b1..69b5c6617 100644--- a/source/de/anomic/yacy/seedUpload/yacySeedUploadFtp.java+++ b/source/de/anomic/yacy/seedUpload/yacySeedUploadFtp.java@@ -77,7 +77,7 @@ public class yacySeedUploadFtp implements yacySeedUploader {return log;}throw new Exception ("Seed upload settings not configured properly. password-len=" +- seedFTPPassword.length() + ", filePath=" ++ (seedFTPPassword == null ? "null" : seedFTPPassword.length()) + ", filePath=" +seedFTPPath);} catch (Exception e) {throw e;diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.javaindex 9ad6a431c..17e2916c3 100644--- a/source/de/anomic/yacy/yacyClient.java+++ b/source/de/anomic/yacy/yacyClient.java@@ -145,7 +145,7 @@ public final class yacyClient {String seed;if ((otherHash != null) &&(otherHash.length() > 0) &&- ((seed = (String) result.get("seed0")) != null)) {+ ((seed = result.get("seed0")) != null)) {if (seed.length() > yacySeed.maxsize) {yacyCore.log.logInfo("hello/client 0: rejected contacting seed; too large (" + seed.length() + " > " + yacySeed.maxsize + ")");} else {@@ -168,7 +168,7 @@ public final class yacyClient {}// change our seed-type- String mytype = (String) result.get(yacySeed.YOURTYPE);+ String mytype = result.get(yacySeed.YOURTYPE);if (mytype == null) { mytype = ""; }yacyAccessible accessible = new yacyAccessible();if (mytype.equals(yacySeed.PEERTYPE_SENIOR)||mytype.equals(yacySeed.PEERTYPE_PRINCIPAL)) {@@ -211,7 +211,7 @@ public final class yacyClient {int i = 0;int count = 0;String seedStr;- while ((seedStr = (String) result.get("seed" + i++)) != null) {+ while ((seedStr = result.get("seed" + i++)) != null) {// integrate new seed into own database// the first seed, "seed0" is the seed of the responding peerif (seedStr.length() > yacySeed.maxsize) {@@ -313,7 +313,7 @@ public final class yacyClient {if (result == null || result.size() == 0) { return null; }//final Date remoteTime = yacyCore.parseUniversalDate((String) result.get(yacySeed.MYTIME)); // read remote time- return yacySeed.genRemoteSeed((String) result.get("response"), salt, false);+ return yacySeed.genRemoteSeed(result.get("response"), salt, false);} catch (Exception e) {yacyCore.log.logSevere("yacyClient.querySeed error:" + e.getMessage());return null;@@ -334,7 +334,7 @@ public final class yacyClient {final HashMap<String, String> result = nxTools.table(content, "UTF-8");if (result == null || result.size() == 0) { return -1; }- return Integer.parseInt((String) result.get("response"));+ return Integer.parseInt(result.get("response"));} catch (Exception e) {yacyCore.log.logSevere("yacyClient.queryRWICount error:" + e.getMessage());return -1;@@ -357,7 +357,7 @@ public final class yacyClient {final HashMap<String, String> result = nxTools.table(content, "UTF-8");if ((result == null) || (result.size() == 0)) return -1;- final String resp = (String) result.get("response");+ final String resp = result.get("response");if (resp == null) {return -1;} else try {@@ -530,7 +530,7 @@ public final class yacyClient {String[] urls = new String[results];for (int n = 0; n < results; n++) {// get one single search result- urlEntry = indexURLReference.importEntry((String) result.get("resource" + n));+ urlEntry = indexURLReference.importEntry(result.get("resource" + n));if (urlEntry == null) continue;assert (urlEntry.hash().length() == 12) : "urlEntry.hash() = " + urlEntry.hash();if (urlEntry.hash().length() != 12) continue; // bad url hash@@ -592,7 +592,7 @@ public final class yacyClient {containerCache.insertRanked(container[0], false, joincount); // one is enough// integrate remote topwords- String references = (String) result.get("references");+ String references = result.get("references");yacyCore.log.logInfo("remote search (client): peer " + target.getName() + " sent references " + references);if (references != null) {// add references twice, so they can be countet (must have at least 2 entries)@@ -613,7 +613,7 @@ public final class yacyClient {if (entry.getKey().startsWith("indexabstract.")) {wordhash = entry.getKey().substring(14);synchronized (abstractCache) {- singleAbstract = (TreeMap<String, String>) abstractCache.get(wordhash); // a mapping from url-hashes to a string of peer-hashes+ singleAbstract = abstractCache.get(wordhash); // a mapping from url-hashes to a string of peer-hashesif (singleAbstract == null) singleAbstract = new TreeMap<String, String>();ci = new serverByteBuffer(entry.getValue().getBytes());//System.out.println("DEBUG-ABSTRACTFETCH: for word hash " + wordhash + " received " + ci.toString());@@ -632,7 +632,7 @@ public final class yacyClient {// generate statisticslong searchtime;try {- searchtime = Integer.parseInt((String) result.get("searchtime"));+ searchtime = Integer.parseInt(result.get("searchtime"));} catch (NumberFormatException e) {searchtime = totalrequesttime;}@@ -764,19 +764,19 @@ public final class yacyClient {public static String transfer(String targetAddress, String filename, byte[] file) {HashMap<String, String> phase1 = transferPermission(targetAddress, file.length, filename);if (phase1 == null) return "no connection to remote address " + targetAddress + "; phase 1";- String access = (String) phase1.get("access");- String nextaddress = (String) phase1.get("address");- String protocol = (String) phase1.get("protocol");+ String access = phase1.get("access");+ String nextaddress = phase1.get("address");+ String protocol = phase1.get("protocol");//String path = (String) phase1.get("path");//String maxsize = (String) phase1.get("maxsize");- String response = (String) phase1.get("response");+ String response = phase1.get("response");if ((response == null) || (protocol == null) || (access == null)) return "wrong return values from other peer; phase 1";if (!(response.equals("ok"))) return "remote peer rejected transfer: " + response;String accesscode = serverCodings.encodeMD5Hex(kelondroBase64Order.standardCoder.encodeString(access));if (protocol.equals("http")) {HashMap<String, String> phase2 = transferStore(nextaddress, accesscode, filename, file);if (phase2 == null) return "no connection to remote address " + targetAddress + "; phase 2";- response = (String) phase2.get("response");+ response = phase2.get("response");if (response == null) return "wrong return values from other peer; phase 2";if (!(response.equals("ok"))) {return "remote peer failed with transfer: " + response;@@ -848,7 +848,7 @@ public final class yacyClient {for (int i = 0; i < indexes.length; i++) {eenum = indexes[i].entries();while (eenum.hasNext()) {- entry = (indexRWIEntry) eenum.next();+ entry = eenum.next();if (urlCache.get(entry.urlHash()) == null) {yacyCore.log.logFine("DEBUG transferIndex: to-send url hash '" + entry.urlHash() + "' is not contained in urlCache");}@@ -865,7 +865,7 @@ public final class yacyClient {}if (in.containsKey("indexPayloadSize")) payloadSize += Integer.parseInt(in.get("indexPayloadSize"));- String result = (String) in.get("result");+ String result = in.get("result");if (result == null) {resultObj.put("result", "no_result_1");return resultObj;@@ -878,7 +878,7 @@ public final class yacyClient {}// in now contains a list of unknown hashes- final String uhss = (String) in.get("unknownURL");+ final String uhss = in.get("unknownURL");if (uhss == null) {resultObj.put("result","no_unknownURL_tag_in_response");return resultObj;@@ -891,7 +891,7 @@ public final class yacyClient {// extract the urlCache from the resultindexURLReference[] urls = new indexURLReference[uhs.length];for (int i = 0; i < uhs.length; i++) {- urls[i] = (indexURLReference) urlCache.get(uhs[i]);+ urls[i] = urlCache.get(uhs[i]);if (urls[i] == null) {yacyCore.log.logFine("DEBUG transferIndex: requested url hash '" + uhs[i] + "', unknownURL='" + uhss + "'");}@@ -906,7 +906,7 @@ public final class yacyClient {}if (in.containsKey("urlPayloadSize")) payloadSize += Integer.parseInt(in.get("urlPayloadSize"));- result = (String) in.get("result");+ result = in.get("result");if (result == null) {resultObj.put("result","no_result_2");return resultObj;@@ -947,7 +947,7 @@ public final class yacyClient {for (int i = 0; i < indexes.length; i++) {eenum = indexes[i].entries();while (eenum.hasNext()) {- entry = (indexRWIEntry) eenum.next();+ entry = eenum.next();entrypost.append(indexes[i].getWordHash()).append(entry.toPropertyForm()).append(serverCore.CRLF_STRING);diff --git a/source/de/anomic/yacy/yacyCore.java b/source/de/anomic/yacy/yacyCore.javaindex 1a887a619..4ec42f262 100644--- a/source/de/anomic/yacy/yacyCore.java+++ b/source/de/anomic/yacy/yacyCore.java@@ -341,7 +341,7 @@ public class yacyCore {Map<String, String> ch = plasmaSwitchboard.getSwitchboard().clusterhashes;seeds = sb.webIndex.seedDB.seedsByAge(true, attempts - ((ch == null) ? 0 : ch.size())); // best for fast connection// add also all peers from cluster if this is a public robinson cluster- if (plasmaSwitchboard.getSwitchboard().clusterhashes != null) {+ if (ch != null) {Iterator<Map.Entry<String, String>> i = ch.entrySet().iterator();String hash;Map.Entry<String, String> entry;@@ -349,12 +349,12 @@ public class yacyCore {while (i.hasNext()) {entry = i.next();hash = entry.getKey();- seed = (yacySeed) seeds.get(hash);+ seed = seeds.get(hash);if (seed == null) {seed = sb.webIndex.seedDB.get(hash);if (seed == null) continue;}- seed.setAlternativeAddress((String) entry.getValue());+ seed.setAlternativeAddress(entry.getValue());seeds.put(hash, seed);}}@@ -402,7 +402,7 @@ public class yacyCore {// going through the peer list and starting a new publisher thread for each peerint i = 0;while (si.hasNext()) {- seed = (yacySeed) si.next();+ seed = si.next();if (seed == null) {sync.P();continue;@@ -457,7 +457,7 @@ public class yacyCore {dbSize = amIAccessibleDB.size();Iterator<String> ai = amIAccessibleDB.keySet().iterator();while (ai.hasNext()) {- yacyAccessible ya = (yacyAccessible) amIAccessibleDB.get(ai.next());+ yacyAccessible ya = amIAccessibleDB.get(ai.next());if (ya.lastUpdated < cutofftime) {ai.remove();} else {@@ -572,7 +572,7 @@ public class yacyCore {String className = null;synchronized (yacyCore.seedUploadMethods) {if (yacyCore.seedUploadMethods.containsKey(methodname)) {- className = (String) yacyCore.seedUploadMethods.get(methodname);+ className = yacyCore.seedUploadMethods.get(methodname);}}diff --git a/source/de/anomic/yacy/yacyDHTAction.java b/source/de/anomic/yacy/yacyDHTAction.javaindex b3da94476..f909eabd4 100644--- a/source/de/anomic/yacy/yacyDHTAction.java+++ b/source/de/anomic/yacy/yacyDHTAction.java@@ -69,7 +69,7 @@ public class yacyDHTAction {Iterator<yacySeed> en = seedDB.seedsConnected(true, false, null, (float) 0.0);yacySeed ys;while (en.hasNext()) {- ys = (yacySeed) en.next();+ ys = en.next();if ((ys != null) && (ys.getVersion() >= ((float) 0.3))) seedCrawlReady.setScore(ys.hash, yacyCore.yacyTime());}} catch (IllegalArgumentException e) {@@ -151,7 +151,7 @@ public class yacyDHTAction {yacySeed s;try {while (se.hasNext()) {- s = (yacySeed) se.next();+ s = se.next();if (s == null) return null;if (s.getLong(yacySeed.RCOUNT, 0) > 0) return s;}@@ -201,7 +201,7 @@ public class yacyDHTAction {yacySeed s;try {while (se.hasNext()) {- s = (yacySeed) se.next();+ s = se.next();if (s == null) return null;if (s.getFlagAcceptRemoteIndex()) return s;}@@ -249,7 +249,7 @@ public class yacyDHTAction {private yacySeed nextInternal() {yacySeed s;while (se.hasNext()) {- s = (yacySeed) se.next();+ s = se.next();if (s == null) return null;s.available = seedCrawlReady.getScore(s.hash);if (available) {@@ -290,7 +290,7 @@ public class yacyDHTAction {hash = i.next();yacySeed seed = seedDB.getConnected(hash);if (seed == null) continue;- seed.setAlternativeAddress((String) clusterhashes.get(hash));+ seed.setAlternativeAddress(clusterhashes.get(hash));return seed;}return null;@@ -333,7 +333,7 @@ public class yacyDHTAction {if (d > 0) {return d; // case where the word is 'before' the peer} else {- return ((double) 1) + d; // wrap-around case+ return (1) + d; // wrap-around case}}@@ -372,19 +372,17 @@ public class yacyDHTAction {int maxloop = Math.min(100, seedDB.sizeConnected()); // to ensure terminationif (log != null) log.logInfo("Collecting DHT target peers for first_hash = " + firstKey + ", last_hash = " + lastKey);while ((e.hasNext()) && (seeds.size() < (primaryPeerCount + reservePeerCount)) && (maxloop-- > 0)) {- seed = (yacySeed) e.next();- if (seeds != null) {- firstdist = yacyDHTAction.dhtDistance(seed.hash, firstKey);- lastdist = yacyDHTAction.dhtDistance(seed.hash, lastKey);- if (lastdist > maxDist) {- if (log != null) log.logFine("Discarded too distant DHT target peer " + seed.getName() + ":" + seed.hash + ", distance2first = " + firstdist + ", distance2last = " + lastdist);- } else if (doublecheck.contains(seed.hash)) {- if (log != null) log.logFine("Discarded double DHT target peer " + seed.getName() + ":" + seed.hash + ", distance2first = " + firstdist + ", distance2last = " + lastdist);- } else {- if (log != null) log.logInfo("Selected " + ((seeds.size() < primaryPeerCount) ? "primary" : "reserve") + " DHT target peer " + seed.getName() + ":" + seed.hash + ", distance2first = " + firstdist + ", distance2last = " + lastdist);- seeds.add(seed);- doublecheck.add(seed.hash);- }+ seed = e.next();+ firstdist = yacyDHTAction.dhtDistance(seed.hash, firstKey);+ lastdist = yacyDHTAction.dhtDistance(seed.hash, lastKey);+ if (lastdist > maxDist) {+ if (log != null) log.logFine("Discarded too distant DHT target peer " + seed.getName() + ":" + seed.hash + ", distance2first = " + firstdist + ", distance2last = " + lastdist);+ } else if (doublecheck.contains(seed.hash)) {+ if (log != null) log.logFine("Discarded double DHT target peer " + seed.getName() + ":" + seed.hash + ", distance2first = " + firstdist + ", distance2last = " + lastdist);+ } else {+ if (log != null) log.logInfo("Selected " + ((seeds.size() < primaryPeerCount) ? "primary" : "reserve") + " DHT target peer " + seed.getName() + ":" + seed.hash + ", distance2first = " + firstdist + ", distance2last = " + lastdist);+ seeds.add(seed);+ doublecheck.add(seed.hash);}}e = null; // finish enumerationdiff --git a/source/de/anomic/yacy/yacyNewsDB.java b/source/de/anomic/yacy/yacyNewsDB.javaindex a36957292..81d90d9a0 100644--- a/source/de/anomic/yacy/yacyNewsDB.java+++ b/source/de/anomic/yacy/yacyNewsDB.java@@ -118,7 +118,7 @@ public class yacyNewsDB {}public yacyNewsRecord next() {- return b2r((kelondroRow.Entry) rowIterator.next());+ return b2r(rowIterator.next());}public void remove() {diff --git a/source/de/anomic/yacy/yacyNewsPool.java b/source/de/anomic/yacy/yacyNewsPool.javaindex cb2fe774f..96957fb4b 100644--- a/source/de/anomic/yacy/yacyNewsPool.java+++ b/source/de/anomic/yacy/yacyNewsPool.java@@ -323,13 +323,13 @@ public class yacyNewsPool {if (record.created().getTime() == 0) return;Map<String, String> attributes = record.attributes();if (attributes.containsKey("url")){- if (plasmaSwitchboard.urlBlacklist.isListed(indexReferenceBlacklist.BLACKLIST_NEWS, new yacyURL((String) attributes.get("url"), null))){+ if (plasmaSwitchboard.urlBlacklist.isListed(indexReferenceBlacklist.BLACKLIST_NEWS, new yacyURL(attributes.get("url"), null))){System.out.println("DEBUG: ignored news-entry url blacklisted: " + attributes.get("url"));return;}}if (attributes.containsKey("startURL")){- if (plasmaSwitchboard.urlBlacklist.isListed(indexReferenceBlacklist.BLACKLIST_NEWS, new yacyURL((String) attributes.get("startURL"), null))){+ if (plasmaSwitchboard.urlBlacklist.isListed(indexReferenceBlacklist.BLACKLIST_NEWS, new yacyURL(attributes.get("startURL"), null))){System.out.println("DEBUG: ignored news-entry url blacklisted: " + attributes.get("startURL"));return;}@@ -359,7 +359,7 @@ public class yacyNewsPool {if (Thread.currentThread().isInterrupted()) throw new InterruptedException("Shutdown in progress");// get next news record- record = (yacyNewsRecord) i.next();+ record = i.next();if (automaticProcessP(seedDB, record)) {this.processedNews.push(record);i.remove();@@ -411,7 +411,7 @@ public class yacyNewsPool {while (i.hasNext()) {record = i.next();if ((record != null) && (record.category().equals(category))) {- s = (String) record.attributes().get(key);+ s = record.attributes().get(key);if ((s != null) && (s.equals(value))) return record;}}@@ -506,7 +506,7 @@ public class yacyNewsPool {if (toqueue == null) return 0;int c = 0;while (i.hasNext()) {- record = (yacyNewsRecord) i.next();+ record = i.next();if (record == null) continue;toqueue.push(record);c++;diff --git a/source/de/anomic/yacy/yacyNewsQueue.java b/source/de/anomic/yacy/yacyNewsQueue.javaindex ded5ee1a1..cdfba2731 100644--- a/source/de/anomic/yacy/yacyNewsQueue.java+++ b/source/de/anomic/yacy/yacyNewsQueue.java@@ -186,7 +186,7 @@ public class yacyNewsQueue {}public yacyNewsRecord next() {- kelondroRow.Entry row = (kelondroRow.Entry) stackNodeIterator.next();+ kelondroRow.Entry row = stackNodeIterator.next();try {return b2r(row);} catch (IOException e) {diff --git a/source/de/anomic/yacy/yacyNewsRecord.java b/source/de/anomic/yacy/yacyNewsRecord.javaindex bd54881c1..da0bd1ae6 100644--- a/source/de/anomic/yacy/yacyNewsRecord.java+++ b/source/de/anomic/yacy/yacyNewsRecord.java@@ -132,9 +132,9 @@ public class yacyNewsRecord {if (attributes.toString().length() > attributesMaxLength) throw new IllegalArgumentException("attributes length (" + attributes.toString().length() + ") exceeds maximum (" + attributesMaxLength + ")");this.category = (attributes.containsKey("cat")) ? (String) attributes.get("cat") : "";if (category.length() > categoryStringLength) throw new IllegalArgumentException("category length (" + category.length() + ") exceeds maximum (" + categoryStringLength + ")");- this.received = (attributes.containsKey("rec")) ? serverDate.parseShortSecond((String) attributes.get("rec"), serverDate.UTCDiffString()) : new Date();- this.created = (attributes.containsKey("cre")) ? serverDate.parseShortSecond((String) attributes.get("cre"), serverDate.UTCDiffString()) : new Date();- this.distributed = (attributes.containsKey("dis")) ? Integer.parseInt((String) attributes.get("dis")) : 0;+ this.received = (attributes.containsKey("rec")) ? serverDate.parseShortSecond(attributes.get("rec"), serverDate.UTCDiffString()) : new Date();+ this.created = (attributes.containsKey("cre")) ? serverDate.parseShortSecond(attributes.get("cre"), serverDate.UTCDiffString()) : new Date();+ this.distributed = (attributes.containsKey("dis")) ? Integer.parseInt(attributes.get("dis")) : 0;this.originator = (attributes.containsKey("ori")) ? (String) attributes.get("ori") : "";removeStandards();}@@ -217,7 +217,7 @@ public class yacyNewsRecord {}public String attribute(String key, String dflt) {- String s = (String) attributes.get(key);+ String s = attributes.get(key);if ((s == null) || (s.length() == 0)) return dflt;return s;}diff --git a/source/de/anomic/yacy/yacyPeerActions.java b/source/de/anomic/yacy/yacyPeerActions.javaindex 8c4b6a7f0..ba3f9f38a 100644--- a/source/de/anomic/yacy/yacyPeerActions.java+++ b/source/de/anomic/yacy/yacyPeerActions.java@@ -45,6 +45,7 @@ package de.anomic.yacy;import java.io.IOException;import java.util.HashMap;+import de.anomic.server.serverCodings;import de.anomic.server.serverDate;import de.anomic.server.logging.serverLog;@@ -251,8 +252,8 @@ public class yacyPeerActions {yacyNewsRecord record = yacyNewsRecord.newRecord(decodedString);if (record != null) {//System.out.println("### news arrival from peer " + peer.getName() + ", decoded=" + decodedString + ", record=" + recordString + ", news=" + record.toString());- String cre1 = (String) serverCodings.string2map(decodedString, ",").get("cre");- String cre2 = (String) serverCodings.string2map(record.toString(), ",").get("cre");+ String cre1 = serverCodings.string2map(decodedString, ",").get("cre");+ String cre2 = serverCodings.string2map(record.toString(), ",").get("cre");if ((cre1 == null) || (cre2 == null) || (!(cre1.equals(cre2)))) {System.out.println("### ERROR - cre are not equal: cre1=" + cre1 + ", cre2=" + cre2);return;@@ -270,7 +271,7 @@ public class yacyPeerActions {}public String getUserAgent(String IP) {- String userAgent = (String) userAgents.get(IP);+ String userAgent = userAgents.get(IP);return (userAgent == null) ? "" : userAgent;}}diff --git a/source/de/anomic/yacy/yacySearch.java b/source/de/anomic/yacy/yacySearch.javaindex aafb6aafb..429998524 100644--- a/source/de/anomic/yacy/yacySearch.java+++ b/source/de/anomic/yacy/yacySearch.java@@ -128,7 +128,7 @@ public class yacySearch extends Thread {public static String set2string(Set<String> hashes) {String wh = "";final Iterator<String> iter = hashes.iterator();- while (iter.hasNext()) { wh = wh + (String) iter.next(); }+ while (iter.hasNext()) { wh = wh + iter.next(); }return wh;}@@ -188,7 +188,7 @@ public class yacySearch extends Thread {dhtEnum = peerActions.dhtAction.getDHTSeeds(true, wordhash, (float) 0.0);c = seedcount;while (dhtEnum.hasNext() && c > 0) {- seed = (yacySeed) dhtEnum.next();+ seed = dhtEnum.next();if (seed == null) continue;distance = yacyDHTAction.dhtDistance(seed.hash, wordhash);if (distance > 0.2) continue; // catch bug in peer selection@@ -239,7 +239,7 @@ public class yacySearch extends Thread {c = 0;iter = ranking.scores(false); // higher are betterwhile (iter.hasNext() && c < result.length) {- seed = (yacySeed) seeds.get((String) iter.next());+ seed = seeds.get(iter.next());seed.selectscore = c;serverLog.logFine("PLASMA", "selectPeers/_lineup_: " + seed.hash + ":" + seed.getName() + " is choice " + c);result[c++] = seed;@@ -292,7 +292,7 @@ public class yacySearch extends Thread {// prepare seed targets and threadsfinal yacySeed targetPeer = wordIndex.seedDB.getConnected(targethash);if (targetPeer == null) return null;- if (clusterselection != null) targetPeer.setAlternativeAddress((String) clusterselection.get(targetPeer.hash));+ if (clusterselection != null) targetPeer.setAlternativeAddress(clusterselection.get(targetPeer.hash));yacySearch searchThread = new yacySearch(wordhashes, excludehashes, urlhashes, "", "", 0, 9999, true, 0, targetPeer,wordIndex, crawlResults, containerCache, new TreeMap<String, TreeMap<String, String>>(), blacklist, rankingProfile, constraint);searchThread.start();diff --git a/source/de/anomic/yacy/yacySeed.java b/source/de/anomic/yacy/yacySeed.javaindex fae10b86f..68b8560d1 100644--- a/source/de/anomic/yacy/yacySeed.java+++ b/source/de/anomic/yacy/yacySeed.java@@ -77,7 +77,6 @@ import de.anomic.index.indexWord;import de.anomic.kelondro.kelondroBase64Order;import de.anomic.net.natLib;import de.anomic.server.serverCodings;-import de.anomic.server.serverCore;import de.anomic.server.serverDate;import de.anomic.server.serverDomains;import de.anomic.server.serverSystem;@@ -190,7 +189,7 @@ public class yacySeed {// create a seed with a pre-defined hash mapthis.hash = theHash;this.dna = theDna;- final String flags = (String) this.dna.get(yacySeed.FLAGS);+ final String flags = this.dna.get(yacySeed.FLAGS);if ((flags == null) || (flags.length() != 4)) { this.dna.put(yacySeed.FLAGS, yacySeed.FLAGSZERO); }this.available = 0;this.dna.put(yacySeed.NAME, checkPeerName(get(yacySeed.NAME, "∅")));@@ -353,7 +352,7 @@ public class yacySeed {} else if (o instanceof Long) {return ((Long) o).longValue();} else if (o instanceof Integer) {- return (long) ((Integer) o).intValue();+ return ((Integer) o).intValue();} else return dflt;}@@ -384,25 +383,25 @@ public class yacySeed {}public final void incSI(int count) {- String v = (String) this.dna.get(yacySeed.INDEX_OUT);+ String v = this.dna.get(yacySeed.INDEX_OUT);if (v == null) { v = yacySeed.ZERO; }dna.put(yacySeed.INDEX_OUT, Integer.toString(Integer.parseInt(v) + count));}public final void incRI(int count) {- String v = (String) this.dna.get(yacySeed.INDEX_IN);+ String v = this.dna.get(yacySeed.INDEX_IN);if (v == null) { v = yacySeed.ZERO; }dna.put(yacySeed.INDEX_IN, Integer.toString(Integer.parseInt(v) + count));}public final void incSU(int count) {- String v = (String) this.dna.get(yacySeed.URL_OUT);+ String v = this.dna.get(yacySeed.URL_OUT);if (v == null) { v = yacySeed.ZERO; }dna.put(yacySeed.URL_OUT, Integer.toString(Integer.parseInt(v) + count));}public final void incRU(int count) {- String v = (String) this.dna.get(yacySeed.URL_IN);+ String v = this.dna.get(yacySeed.URL_IN);if (v == null) { v = yacySeed.ZERO; }dna.put(yacySeed.URL_IN, Integer.toString(Integer.parseInt(v) + count));}@@ -476,13 +475,13 @@ public class yacySeed {* either the IP or the port could be retrieved from this yacySeed object*/public final String getPublicAddress() {- String ip = (String) this.dna.get(yacySeed.IP);+ String ip = this.dna.get(yacySeed.IP);if (ip == null) { return null; }if (ip.length() < 8) { return null; } // 10.0.0.0// if (ip.equals(yacyCore.seedDB.mySeed.dna.get(yacySeed.IP))) ip = "127.0.0.1";// if (this.hash.equals("xxxxxxxxxxxx")) return "192.168.100.1:3300";- final String port = (String) this.dna.get(yacySeed.PORT);+ final String port = this.dna.get(yacySeed.PORT);if ((port == null) || (port.length() < 2)) return null;return ip + ":" + port;@@ -498,7 +497,7 @@ public class yacySeed {public final String getClusterAddress() {if (this.alternativeIP == null) return getPublicAddress();- final String port = (String) this.dna.get(yacySeed.PORT);+ final String port = this.dna.get(yacySeed.PORT);if ((port == null) || (port.length() < 2)) return null;return this.alternativeIP + ":" + port;@@ -513,7 +512,7 @@ public class yacySeed {/** @return the portnumber of this seed or <code>-1</code> if not present */public final int getPort() {- final String port = (String) this.dna.get(yacySeed.PORT);+ final String port = this.dna.get(yacySeed.PORT);if (port == null) return -1;/*if (port.length() < 2) return -1; It is possible to use port 0-9*/return Integer.parseInt(port);@@ -525,7 +524,7 @@ public class yacySeed {* the difference to <code>+0130</code> if not present or <code>0</code> if an error occured during conversion*/public final long getUTCDiff() {- String utc = (String) this.dna.get(yacySeed.UTC);+ String utc = this.dna.get(yacySeed.UTC);if (utc == null) { utc = "+0130"; }try {return serverDate.UTCDiff(utc);@@ -595,7 +594,7 @@ public class yacySeed {Set<String> tags = serverCodings.string2set(get(PEERTAGS, ""), "|");Iterator<String> i = tags.iterator();while (i.hasNext()) {- if (searchHashes.contains(indexWord.word2hash((String) i.next()))) return true;+ if (searchHashes.contains(indexWord.word2hash(i.next()))) return true;}return false;}diff --git a/source/de/anomic/yacy/yacySeedDB.java b/source/de/anomic/yacy/yacySeedDB.javaindex bc6011397..11dac1c13 100644--- a/source/de/anomic/yacy/yacySeedDB.java+++ b/source/de/anomic/yacy/yacySeedDB.java@@ -373,7 +373,7 @@ public final class yacySeedDB implements httpdAlternativeDomainNames {public yacySeed anySeedVersion(float minVersion) {// return just any seed that has a specific minimum version numberIterator<yacySeed> e = seedsConnected(true, true, yacySeed.randomHash(), minVersion);- return (yacySeed) e.next();+ return e.next();}public HashMap<String, yacySeed> seedsByAge(boolean up, int count) {@@ -404,7 +404,7 @@ public final class yacySeedDB implements httpdAlternativeDomainNames {int c = 0;while ((c < count) && (it.hasNext())) {c++;- ys = getConnected((String) it.next());+ ys = getConnected(it.next());if ((ys != null) && (ys.hash != null)) result.put(ys.hash, ys);}return result;@@ -617,7 +617,7 @@ public final class yacySeedDB implements httpdAlternativeDomainNames {}// then try to use the cache- yacySeed seed = (yacySeed) nameLookupCache.get(peerName);+ yacySeed seed = nameLookupCache.get(peerName);if (seed != null) return seed;// enumerate the cache and simultanous insert values@@ -625,7 +625,7 @@ public final class yacySeedDB implements httpdAlternativeDomainNames {for (int table = 0; table < 2; table++) {Iterator<yacySeed> e = (table == 0) ? seedsConnected(true, false, null, (float) 0.0) : seedsDisconnected(true, false, null, (float) 0.0);while (e.hasNext()) {- seed = (yacySeed) e.next();+ seed = e.next();if (seed != null) {name = seed.getName().toLowerCase();if (seed.isProper(false) == null) nameLookupCache.put(name, seed);@@ -661,7 +661,7 @@ public final class yacySeedDB implements httpdAlternativeDomainNames {// then try to use the cacheSoftReference<yacySeed> ref = ipLookupCache.get(peerIP);if (ref != null) {- seed = (yacySeed) ref.get();+ seed = ref.get();if (seed != null) return seed;}@@ -675,7 +675,7 @@ public final class yacySeedDB implements httpdAlternativeDomainNames {Iterator<yacySeed> e = seedsConnected(true, false, null, (float) 0.0);while (e.hasNext()) {try {- seed = (yacySeed) e.next();+ seed = e.next();if (seed != null) {addressStr = seed.getPublicAddress();if (addressStr == null) {@@ -704,7 +704,7 @@ public final class yacySeedDB implements httpdAlternativeDomainNames {while (e.hasNext()) {try {- seed = (yacySeed) e.next();+ seed = e.next();if (seed != null) {addressStr = seed.getPublicAddress();if (addressStr == null) {@@ -733,7 +733,7 @@ public final class yacySeedDB implements httpdAlternativeDomainNames {while (e.hasNext()) {try {- seed = (yacySeed) e.next();+ seed = e.next();if ((seed != null) && ((addressStr = seed.getPublicAddress()) != null)) {if ((pos = addressStr.indexOf(":"))!= -1) {addressStr = addressStr.substring(0,pos);@@ -788,7 +788,7 @@ public final class yacySeedDB implements httpdAlternativeDomainNames {yacySeed ys;Iterator<yacySeed> se = seedsConnected(true, false, null, (float) 0.0);while (se.hasNext()) {- ys = (yacySeed) se.next();+ ys = se.next();if (ys != null) {line = ys.genSeedStr(null);v.add(line);@@ -895,7 +895,7 @@ public final class yacySeedDB implements httpdAlternativeDomainNames {serverLog.logFine("YACY","SaveSeedList: Comparing local and uploades seed-list entries ...");int i;for (i = 0; i < uv.size(); i++) {- if (!(((String) uv.get(i)).equals((String) check.get(i)))) return "Element at position " + i + " is different.";+ if (!((uv.get(i)).equals(check.get(i)))) return "Element at position " + i + " is different.";}// no difference found@@ -1011,7 +1011,7 @@ public final class yacySeedDB implements httpdAlternativeDomainNames {try {HashMap<String, String> dna = it.next();if (dna == null) return null;- String hash = (String) dna.remove("key");+ String hash = dna.remove("key");//while (hash.length() < commonHashLength) { hash = hash + "_"; }return new yacySeed(hash, dna);} catch (Exception e) {diff --git a/source/de/anomic/yacy/yacyVersion.java b/source/de/anomic/yacy/yacyVersion.javaindex 95f034259..90ec5ba5d 100644--- a/source/de/anomic/yacy/yacyVersion.java+++ b/source/de/anomic/yacy/yacyVersion.java@@ -120,7 +120,7 @@ public final class yacyVersion implements Comparator<yacyVersion>, Comparable<ya} catch (NumberFormatException e) {throw new RuntimeException("release file name '" + release + "' is not valid, '" + comp[0] + "' should be a float number");}- this.mainRelease = ((int) (this.releaseNr * (float) 1000)) % 10 == 0;+ this.mainRelease = ((int) (this.releaseNr * 1000)) % 10 == 0;//System.out.println("Release version " + this.releaseNr + " is " + ((this.mainRelease) ? "main" : "std"));this.dateStamp = comp[1];if (this.dateStamp.length() != 8) {@@ -236,7 +236,7 @@ public final class yacyVersion implements Comparator<yacyVersion>, Comparable<ya// consider a main releaseif ((Float.toString(latestmain.releaseNr).matches(blacklist))) {yacyCore.log.logInfo(- "rulebasedUpdateInfo: latest dev " + latestdev.name ++ "rulebasedUpdateInfo: latest dev " + (latestdev == null ? "null" : latestdev.name) +" matches with blacklist '" + blacklist + "'");return null;}@@ -283,17 +283,17 @@ public final class yacyVersion implements Comparator<yacyVersion>, Comparable<yaprivate static DevMain getReleases(yacyURL location, boolean force) {// get release info from a internet resource- DevMain latestRelease = latestReleases.get(location);+ DevMain locLatestRelease = latestReleases.get(location);if (force ||- (latestRelease == null) /*||+ (locLatestRelease == null) /*||((latestRelease[0].size() == 0) &&(latestRelease[1].size() == 0) &&(latestRelease[2].size() == 0) &&(latestRelease[3].size() == 0) )*/) {- latestRelease = allReleaseFrom(location);- latestReleases.put(location, latestRelease);+ locLatestRelease = allReleaseFrom(location);+ latestReleases.put(location, locLatestRelease);}- return latestRelease;+ return locLatestRelease;}private static DevMain allReleaseFrom(yacyURL url) {@@ -355,7 +355,7 @@ public final class yacyVersion implements Comparator<yacyVersion>, Comparable<yaif ((!download.exists()) || (download.length() == 0)) throw new IOException("wget of url " + release.url + " failed");} catch (IOException e) {serverLog.logSevere("yacyVersion", "download of " + release.name + " failed: " + e.getMessage());- if (download.exists()) download.delete();+ if (download != null && download.exists()) download.delete();download = null;} finally {if (res != null) {@@ -562,7 +562,7 @@ public final class yacyVersion implements Comparator<yacyVersion>, Comparable<ya* @return String with the combined version.*/public static double versvn2combinedVersion(double version, int svn) {- return (Math.rint((version*100000000.0) + ((double)svn))/100000000);+ return (Math.rint((version*100000000.0) + (svn))/100000000);}public static void main(String[] args) {diff --git a/source/de/anomic/ymage/AnimGifEncoder.java b/source/de/anomic/ymage/AnimGifEncoder.javaindex 018665448..b4b224457 100644--- a/source/de/anomic/ymage/AnimGifEncoder.java+++ b/source/de/anomic/ymage/AnimGifEncoder.java@@ -243,7 +243,7 @@ public class AnimGifEncoder {* table and the complete output size.*/for (int i = 0; i < m_ima_ar.size(); i++) {- AnIma ai = (AnIma) m_ima_ar.get(i);+ AnIma ai = m_ima_ar.get(i);genImage(ai);ai.m_rgb = null;}@@ -307,7 +307,7 @@ public class AnimGifEncoder {if(m_color_ix >= 256)throw new IOException("More than 255 colors in this GIF are not allowed.");m_ccolor_ar[i] = color;- m_cindex_ar[i] = (short) m_color_ix;+ m_cindex_ar[i] = m_color_ix;return m_color_ix++;}@@ -447,7 +447,7 @@ public class AnimGifEncoder {short ii = map[rcolor + 0x80];if (ii == -1){ // Unknown map?//-- New color. Get it's translated RGB value,- int rix = (int)rcolor & 0xff; // Translate to unsigned+ int rix = rcolor & 0xff; // Translate to unsignedint rgb = cm.getRGB(rix); // Get RGB value for this input index,if(rgb >= 0) { // Transparant color?//-- If there is a transparant color index use it...diff --git a/source/de/anomic/ymage/ymageBMPParser.java b/source/de/anomic/ymage/ymageBMPParser.javaindex bdee9c589..318b41044 100644--- a/source/de/anomic/ymage/ymageBMPParser.java+++ b/source/de/anomic/ymage/ymageBMPParser.java@@ -254,11 +254,9 @@ public class ymageBMPParser {FileInputStream fis = null;try {fis = new FileInputStream(in);+ fis.read(file);} catch (FileNotFoundException e) {e.printStackTrace();- }- try {- fis.read(file);} catch (IOException e) {e.printStackTrace();}diff --git a/source/de/anomic/ymage/ymageICOParser.java b/source/de/anomic/ymage/ymageICOParser.javaindex 58472e753..621fceacb 100644--- a/source/de/anomic/ymage/ymageICOParser.java+++ b/source/de/anomic/ymage/ymageICOParser.java@@ -101,11 +101,9 @@ public class ymageICOParser {FileInputStream fis = null;try {fis = new FileInputStream(in);+ fis.read(file);} catch (FileNotFoundException e) {e.printStackTrace();- }- try {- fis.read(file);} catch (IOException e) {e.printStackTrace();}diff --git a/source/de/anomic/ymage/ymageMatrix.java b/source/de/anomic/ymage/ymageMatrix.javaindex 7b7bed3ae..c4ac70d18 100644--- a/source/de/anomic/ymage/ymageMatrix.java+++ b/source/de/anomic/ymage/ymageMatrix.java@@ -245,7 +245,7 @@ public class ymageMatrix {double angle = (x1 - x0 > 0) ? Math.atan(((double) (y0 - y1)) / ((double) (x1 - x0))) : Math.PI - Math.atan(((double) (y0 - y1)) / ((double) (x0 - x1)));// now find two more points in between// first calculate the radius' of the points- double ra = Math.sqrt((double) ((x0 - x1) * (x0 - x1) + (y0 - y1) * (y0 - y1))); // from a known point x1, y1+ double ra = Math.sqrt(((x0 - x1) * (x0 - x1) + (y0 - y1) * (y0 - y1))); // from a known point x1, y1double rb = ra - radius - distance;double rc = rb - radius;//System.out.println("CONTROL angle = " + angle);@@ -594,9 +594,9 @@ public class ymageMatrix {}// calculating the average- rgbR = (int) (rgbR / numberOfNeighbours);- rgbG = (int) (rgbG / numberOfNeighbours);- rgbB = (int) (rgbB / numberOfNeighbours);+ rgbR = (rgbR / numberOfNeighbours);+ rgbG = (rgbG / numberOfNeighbours);+ rgbB = (rgbB / numberOfNeighbours);rgb = (rgbR << 16) | (rgbG << 8) | rgbB;diff --git a/source/de/anomic/ymage/ymageToolPrint.java b/source/de/anomic/ymage/ymageToolPrint.javaindex 377530ead..720f8b4e5 100644--- a/source/de/anomic/ymage/ymageToolPrint.java+++ b/source/de/anomic/ymage/ymageToolPrint.java@@ -45,7 +45,7 @@ public class ymageToolPrint {};private static void print(ymageMatrix matrix, int x, int y, int angle, char letter) {- int index = (int) letter - 0x20;+ int index = letter - 0x20;if (index >= font.length) return;long character = font[index];long row;diff --git a/source/yacy.java b/source/yacy.javaindex 45072c111..c595fec12 100644--- a/source/yacy.java+++ b/source/yacy.java@@ -68,10 +68,10 @@ import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;import de.anomic.data.translator;import de.anomic.http.HttpClient;+import de.anomic.http.JakartaCommonsHttpClient;import de.anomic.http.JakartaCommonsHttpResponse;import de.anomic.http.httpHeader;import de.anomic.http.httpd;-import de.anomic.http.JakartaCommonsHttpClient;import de.anomic.index.indexContainer;import de.anomic.index.indexRWIEntry;import de.anomic.index.indexRWIRowEntry;@@ -600,7 +600,7 @@ public final class yacy {String h;kelondroMScoreCluster<String> hs = new kelondroMScoreCluster<String>();while (ef.hasMoreElements()) {- f = (File) ef.nextElement();+ f = ef.nextElement();h = f.getName().substring(0, yacySeedDB.commonHashLength);hs.addScore(h, (int) f.length());}@@ -660,7 +660,7 @@ public final class yacy {Iterator<indexRWIRowEntry> wordIdxEntries = wordIdxContainer.entries();indexRWIEntry iEntry;while (wordIdxEntries.hasNext()) {- iEntry = (indexRWIEntry) wordIdxEntries.next();+ iEntry = wordIdxEntries.next();String urlHash = iEntry.urlHash();if ((currentUrlDB.exists(urlHash)) && (!minimizedUrlDB.exists(urlHash))) try {indexURLReference urlEntry = currentUrlDB.load(urlHash, null, 0);@@ -768,7 +768,7 @@ public final class yacy {count = count - wordset.size();BufferedWriter bw = new BufferedWriter(new PrintWriter(new FileWriter(wordlist)));while (wordset.size() > 0) {- word = (String) wordset.first();+ word = wordset.first();bw.write(word + "\n");wordset.remove(word);}@@ -845,13 +845,15 @@ public final class yacy {File file = new File(root, targetName + ".zip");ZipOutputStream bos = new ZipOutputStream(new FileOutputStream(file));bos.putNextEntry(zipEntry);- while (indexContainerIterator.hasNext()) {- counter++;- container = indexContainerIterator.next();- bos.write((container.getWordHash()).getBytes());- bos.write(serverCore.CRLF);- if (counter % 500 == 0) {- log.logInfo("Found " + counter + " Hashs until now. Last found Hash: " + container.getWordHash());+ if(indexContainerIterator != null) {+ while (indexContainerIterator.hasNext()) {+ counter++;+ container = indexContainerIterator.next();+ bos.write((container.getWordHash()).getBytes());+ bos.write(serverCore.CRLF);+ if (counter % 500 == 0) {+ log.logInfo("Found " + counter + " Hashs until now. Last found Hash: " + container.getWordHash());+ }}}bos.flush();@@ -860,19 +862,21 @@ public final class yacy {log.logInfo("Writing Hashlist to TXT-file: " + targetName + ".txt");File file = new File(root, targetName + ".txt");BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file));- while (indexContainerIterator.hasNext()) {- counter++;- container = indexContainerIterator.next();- bos.write((container.getWordHash()).getBytes());- bos.write(serverCore.CRLF);- if (counter % 500 == 0) {- log.logInfo("Found " + counter + " Hashs until now. Last found Hash: " + container.getWordHash());+ if(indexContainerIterator != null) {+ while (indexContainerIterator.hasNext()) {+ counter++;+ container = indexContainerIterator.next();+ bos.write((container.getWordHash()).getBytes());+ bos.write(serverCore.CRLF);+ if (counter % 500 == 0) {+ log.logInfo("Found " + counter + " Hashs until now. Last found Hash: " + container.getWordHash());+ }}}bos.flush();bos.close();}- log.logInfo("Total number of Hashs: " + counter + ". Last found Hash: " + container.getWordHash());+ log.logInfo("Total number of Hashs: " + counter + ". Last found Hash: " + (container == null ? "null" : container.getWordHash()));} catch (IOException e) {log.logSevere("IOException", e);}@@ -900,11 +904,11 @@ public final class yacy {it = db.maps(true, false);while (it.hasNext()) {Map<String, String> dna = it.next();- String peerHash = (String) dna.get("key");+ String peerHash = dna.get("key");if (peerHash.length() < yacySeedDB.commonHashLength) {- String peerName = (String) dna.get("Name");- String peerIP = (String) dna.get("IP");- String peerPort = (String) dna.get("Port");+ String peerName = dna.get("Name");+ String peerIP = dna.get("IP");+ String peerPort = dna.get("Port");while (peerHash.length() < yacySeedDB.commonHashLength) { peerHash = peerHash + "_"; }System.err.println("Invalid Peer-Hash found in '" + dbFileNames[i] + "': " + peerName + ":" + peerHash + ", http://" + peerIP + ":" + peerPort);