Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
enable warnings and fix most of it
f1orif814e0fa813d
diff --git a/build.xml b/build.xmlindex 46c95e91a..6608c8e6f 100644--- a/build.xml+++ b/build.xml@@ -202,7 +202,7 @@includes="de/anomic/yacy/yacyBuildProperties.java"source="${javacSource}" target="${javacTarget}"><classpath refid="project.class.path" />- <!--<compilerarg value="-Xlint"/>-->+ <compilerarg value="-Xlint"/></javac><delete file="${build}/BuildProperties.java" />@@ -212,7 +212,7 @@debug="true" debuglevel="lines,vars,source"source="${javacSource}" target="${javacTarget}"><classpath refid="project.class.path" />- <!--<compilerarg value="-Xlint"/>-->+ <compilerarg value="-Xlint"/></javac><!-- compiling htroot, htroot/yacy and htroot/htdocsdefault -->@@ -221,7 +221,7 @@classpathref="project.class.path"debug="true" debuglevel="lines,vars,source"source="${javacSource}" target="${javacTarget}">- <!--<compilerarg value="-Xlint"/>-->+ <compilerarg value="-Xlint"/></javac></target>diff --git a/htroot/Blog.java b/htroot/Blog.javaindex 9d7fa7c49..2bce969e0 100644--- a/htroot/Blog.java+++ b/htroot/Blog.java@@ -87,7 +87,7 @@ public class Blog {final int num = post.getInt("num",10); //indicates how many entries should be shownif(!hasRights){- final userDB.Entry userentry = sb.userDB.proxyAuth((String)header.get(httpRequestHeader.AUTHORIZATION, "xxxxxx"));+ final userDB.Entry userentry = sb.userDB.proxyAuth(header.get(httpRequestHeader.AUTHORIZATION, "xxxxxx"));if(userentry != null && userentry.hasRight(userDB.Entry.BLOG_RIGHT)){hasRights=true;} else if(post.containsKey("login")) {@@ -97,7 +97,7 @@ public class Blog {}String pagename = post.get("page", DEFAULT_PAGE);- final String ip = (String)header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "127.0.0.1");+ final String ip = header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "127.0.0.1");String StrAuthor = post.get("author", "");diff --git a/htroot/BlogComments.java b/htroot/BlogComments.javaindex f8442150e..c5a609cde 100644--- a/htroot/BlogComments.java+++ b/htroot/BlogComments.java@@ -73,7 +73,7 @@ public class BlogComments {}if(!hasRights){- final userDB.Entry userentry = sb.userDB.proxyAuth((String)header.get(httpRequestHeader.AUTHORIZATION, "xxxxxx"));+ final userDB.Entry userentry = sb.userDB.proxyAuth(header.get(httpRequestHeader.AUTHORIZATION, "xxxxxx"));if(userentry != null && userentry.hasRight(userDB.Entry.BLOG_RIGHT)){hasRights=true;}diff --git a/htroot/ConfigAccounts_p.java b/htroot/ConfigAccounts_p.javaindex 9babd6adf..1a1e25a7b 100644--- a/htroot/ConfigAccounts_p.java+++ b/htroot/ConfigAccounts_p.java@@ -50,9 +50,9 @@ public class ConfigAccounts_p {boolean localhostAccess = sb.getConfigBool("adminAccountForLocalhost", false);if ((post != null) && (post.containsKey("setAdmin"))) {localhostAccess = post.get("access", "").equals("localhost");- final String user = (post == null) ? "" : (String) post.get("adminuser", "");- final String pw1 = (post == null) ? "" : (String) post.get("adminpw1", "");- final String pw2 = (post == null) ? "" : (String) post.get("adminpw2", "");+ final String user = (post == null) ? "" : post.get("adminuser", "");+ final String pw1 = (post == null) ? "" : post.get("adminpw1", "");+ final String pw2 = (post == null) ? "" : post.get("adminpw2", "");// may be overwritten if new password is givenif ((user.length() > 0) && (pw1.length() > 3) && (pw1.equals(pw2))) {diff --git a/htroot/ConfigBasic.java b/htroot/ConfigBasic.javaindex 635a940b4..36bec9b6b 100644--- a/htroot/ConfigBasic.java+++ b/htroot/ConfigBasic.java@@ -83,7 +83,7 @@ public class ConfigBasic {}// peer name settings- final String peerName = (post == null) ? env.getConfig("peerName","") : (String) post.get("peername", "");+ final String peerName = (post == null) ? env.getConfig("peerName","") : post.get("peername", "");// port settingslong port = env.getConfigLong("port", 8080); //this allows a low port, but it will only get one, if the user edits the config himself.diff --git a/htroot/ConfigLanguage_p.java b/htroot/ConfigLanguage_p.javaindex dea3aabf0..8a2683ec8 100644--- a/htroot/ConfigLanguage_p.java+++ b/htroot/ConfigLanguage_p.java@@ -114,7 +114,7 @@ public class ConfigLanguage_p {//virtual entryprop.put("langlist_0_file", "default");- prop.put("langlist_0_name", ((langNames.get("default") == null) ? "default" : (String) langNames.get("default")));+ prop.put("langlist_0_name", ((langNames.get("default") == null) ? "default" : langNames.get("default")));prop.put("langlist_0_selected", "selected=\"selected\"");int count = 0;diff --git a/htroot/CrawlResults.java b/htroot/CrawlResults.javaindex 49ce6647b..6893c88d7 100644--- a/htroot/CrawlResults.java+++ b/htroot/CrawlResults.java@@ -77,7 +77,7 @@ public class CrawlResults {if (((tabletype > 0) && (tabletype < 6)) ||(post != null && (post.containsKey("clearlist") ||post.containsKey("deleteentry")))) {- final String authorization = ((String) header.get(httpRequestHeader.AUTHORIZATION, "xxxxxx"));+ final String authorization = (header.get(httpRequestHeader.AUTHORIZATION, "xxxxxx"));if (authorization.length() != 0) {if (! sb.verifyAuthentication(header, true)){// force log-in (again, because wrong password was given)diff --git a/htroot/MessageSend_p.java b/htroot/MessageSend_p.javaindex 5bb5008d6..92338da11 100644--- a/htroot/MessageSend_p.java+++ b/htroot/MessageSend_p.java@@ -82,7 +82,7 @@ public class MessageSend_p {}prop.putXML("mode_permission_peerName", peerName);- final String response = (result == null) ? null : (String) result.get("response");+ final String response = (result == null) ? null : result.get("response");if (response == null || result == null) {// we don't have permission or other peer does not existprop.put("mode_permission", "0");diff --git a/htroot/SearchEventPicture.java b/htroot/SearchEventPicture.javaindex a49797ec1..9083ee555 100644--- a/htroot/SearchEventPicture.java+++ b/htroot/SearchEventPicture.java@@ -39,7 +39,7 @@ public class SearchEventPicture {public static ymageMatrix respond(final httpRequestHeader header, final serverObjects post, final serverSwitch<?> env) {final plasmaSwitchboard sb = (plasmaSwitchboard) env;- final String eventID = (String) header.get("event", QueryEvent.lastEventID);+ final String eventID = header.get("event", QueryEvent.lastEventID);if (eventID == null) return null;final ymageMatrix yp = plasmaGrafics.getSearchEventPicture(sb.peers, eventID);if (yp == null) return new ymageMatrix(1, 1, ymageMatrix.MODE_SUB, "000000"); // empty imagediff --git a/htroot/Settings_p.java b/htroot/Settings_p.javaindex 94ef674af..7ab24102e 100644--- a/htroot/Settings_p.java+++ b/htroot/Settings_p.java@@ -160,7 +160,7 @@ public final class Settings_p {}// clientIP- prop.putXML("clientIP", (String) header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "<unknown>")); // read an artificial header addendum+ prop.putXML("clientIP", header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "<unknown>")); // read an artificial header addendum/** seed upload settingsdiff --git a/htroot/User.java b/htroot/User.javaindex e8e5aff23..e90142da8 100644--- a/htroot/User.java+++ b/htroot/User.java@@ -53,7 +53,7 @@ public class User{prop.put("logged-in_limit", "0");prop.put("status", "0");//identified via HTTPPassword- entry=sb.userDB.proxyAuth(((String) requestHeader.get(httpRequestHeader.AUTHORIZATION, "xxxxxx")));+ entry=sb.userDB.proxyAuth((requestHeader.get(httpRequestHeader.AUTHORIZATION, "xxxxxx")));if(entry != null){prop.put("logged-in_identified-by", "1");//try via cookie@@ -62,7 +62,7 @@ public class User{prop.put("logged-in_identified-by", "2");//try via ipif(entry == null){- entry=sb.userDB.ipAuth(((String)requestHeader.get(httpHeader.CONNECTION_PROP_CLIENTIP, "xxxxxx")));+ entry=sb.userDB.ipAuth((requestHeader.get(httpHeader.CONNECTION_PROP_CLIENTIP, "xxxxxx")));if(entry != null){prop.put("logged-in_identified-by", "0");}@@ -145,7 +145,7 @@ public class User{if(post!=null && post.containsKey("logout")){prop.put("logged-in", "0");if(entry != null){- entry.logout(((String)requestHeader.get(httpHeader.CONNECTION_PROP_CLIENTIP, "xxxxxx")), userDB.getLoginToken(requestHeader.getHeaderCookies())); //todo: logout cookie+ entry.logout((requestHeader.get(httpHeader.CONNECTION_PROP_CLIENTIP, "xxxxxx")), userDB.getLoginToken(requestHeader.getHeaderCookies())); //todo: logout cookie}else{sb.userDB.adminLogout(userDB.getLoginToken(requestHeader.getHeaderCookies()));}diff --git a/source/de/anomic/crawler/NoticeURLImporter.java b/source/de/anomic/crawler/NoticeURLImporter.javaindex 81e829203..45f09b7bf 100644--- a/source/de/anomic/crawler/NoticeURLImporter.java+++ b/source/de/anomic/crawler/NoticeURLImporter.java@@ -179,7 +179,7 @@ public class NoticeURLImporter extends AbstractImporter implements Importer {this.importProfileHandleCache.add(profileHandle);HashMap<String, String> mapclone = new HashMap<String, String>();mapclone.putAll(sourceEntry.map());- this.activeCrawls.newEntry((HashMap<String, String>) mapclone);+ this.activeCrawls.newEntry(mapclone);} else {this.log.logWarning("Profile '" + profileHandle + "' of url entry '" + nextHash + "' unknown.");continue;diff --git a/source/de/anomic/crawler/RobotsTxt.java b/source/de/anomic/crawler/RobotsTxt.javaindex e57e214db..e090ed61e 100644--- a/source/de/anomic/crawler/RobotsTxt.java+++ b/source/de/anomic/crawler/RobotsTxt.java@@ -367,7 +367,7 @@ public class RobotsTxt {}public String getSitemap() {- return this.mem.containsKey(SITEMAP)? (String)this.mem.get(SITEMAP): null;+ return this.mem.containsKey(SITEMAP)? this.mem.get(SITEMAP): null;}public Date getLoadedDate() {diff --git a/source/de/anomic/http/httpDocument.java b/source/de/anomic/http/httpDocument.javaindex 01e03391a..676cd59f2 100755--- a/source/de/anomic/http/httpDocument.java+++ b/source/de/anomic/http/httpDocument.java@@ -493,7 +493,7 @@ public class httpDocument {public yacyURL referrerURL() {if (requestHeader == null) return null;try {- return new yacyURL((String) requestHeader.get(httpRequestHeader.REFERER, ""), null);+ return new yacyURL(requestHeader.get(httpRequestHeader.REFERER, ""), null);} catch (final Exception e) {return null;}diff --git a/source/de/anomic/http/httpHeader.java b/source/de/anomic/http/httpHeader.javaindex 837388e35..aa3a9cbf7 100644--- a/source/de/anomic/http/httpHeader.java+++ b/source/de/anomic/http/httpHeader.java@@ -326,7 +326,7 @@ public class httpHeader extends TreeMap<String, String> implements Map<String, S*/public String mime() {- return (String) get(CONTENT_TYPE, "application/octet-stream");+ return get(CONTENT_TYPE, "application/octet-stream");}/*@@ -450,7 +450,7 @@ public class httpHeader extends TreeMap<String, String> implements Map<String, Sif ((tag != '*') && (tag != '#')) { // '#' in key is reserved for proxy attributes as artificial header valuescount = keyCount(key);for (int j = 0; j < count; j++) {- theHeader.append(key).append(": ").append((String) getSingle(key, j)).append("\r\n");+ theHeader.append(key).append(": ").append(getSingle(key, j)).append("\r\n");}}}diff --git a/source/de/anomic/http/httpRequestHeader.java b/source/de/anomic/http/httpRequestHeader.javaindex ff977f16e..f2fca6576 100755--- a/source/de/anomic/http/httpRequestHeader.java+++ b/source/de/anomic/http/httpRequestHeader.java@@ -74,7 +74,7 @@ public class httpRequestHeader extends httpHeader {}public String referer() {- return (String) get(REFERER, "");+ return get(REFERER, "");}public String refererHost() {@@ -100,7 +100,7 @@ public class httpRequestHeader extends httpHeader {}public String userAgent() {- return (String) get(USER_AGENT, "");+ return get(USER_AGENT, "");}public boolean acceptGzip() {diff --git a/source/de/anomic/http/httpd.java b/source/de/anomic/http/httpd.javaindex 7b1a5154a..965643fa6 100644--- a/source/de/anomic/http/httpd.java+++ b/source/de/anomic/http/httpd.java@@ -273,12 +273,12 @@ public final class httpd implements serverHandler, Cloneable {// persistent by default, but closed with the "Connection: close"// property.boolean persistent = !(httpVersion.equals(httpHeader.HTTP_VERSION_0_9) || httpVersion.equals(httpHeader.HTTP_VERSION_1_0));- if (((String)header.get(httpRequestHeader.CONNECTION, "keep-alive")).toLowerCase().indexOf("close") != -1 ||- ((String)header.get(httpRequestHeader.PROXY_CONNECTION, "keep-alive")).toLowerCase().indexOf("close") != -1) {+ if ((header.get(httpRequestHeader.CONNECTION, "keep-alive")).toLowerCase().indexOf("close") != -1 ||+ (header.get(httpRequestHeader.PROXY_CONNECTION, "keep-alive")).toLowerCase().indexOf("close") != -1) {persistent = false;}- final String transferEncoding = (String) header.get(httpHeader.TRANSFER_ENCODING, "identity");+ final String transferEncoding = header.get(httpHeader.TRANSFER_ENCODING, "identity");final boolean isPostRequest = this.prop.getProperty(httpHeader.CONNECTION_PROP_METHOD).equals(httpHeader.METHOD_POST);final boolean hasContentLength = header.containsKey(httpHeader.CONTENT_LENGTH);final boolean hasTransferEncoding = header.containsKey(httpHeader.TRANSFER_ENCODING) && !transferEncoding.equalsIgnoreCase("identity");@@ -357,14 +357,14 @@ public final class httpd implements serverHandler, Cloneable {// the accessing client must identify with user:password, where// user = addressed peer name// pw = addressed peer hash (b64-hash)- final String auth = (String) header.get(httpRequestHeader.PROXY_AUTHORIZATION,"xxxxxx");+ final String auth = header.get(httpRequestHeader.PROXY_AUTHORIZATION,"xxxxxx");if (getAlternativeResolver() != null) {final String test = Base64Order.standardCoder.encodeString(getAlternativeResolver().myName() + ":" + getAlternativeResolver().myID());if (!test.equals(auth.trim().substring(6))) return false;}// the accessing client must use a yacy user-agent- if (!(((String) header.get(httpHeader.USER_AGENT,"")).startsWith("yacy"))) return false;+ if (!((header.get(httpHeader.USER_AGENT,"")).startsWith("yacy"))) return false;// furthermore, YaCy hops must not exceed a specific access frequency@@ -399,7 +399,7 @@ public final class httpd implements serverHandler, Cloneable {}if (this.use_proxyAccounts) {- final String auth = (String) header.get(httpRequestHeader.PROXY_AUTHORIZATION,"xxxxxx");+ final String auth = header.get(httpRequestHeader.PROXY_AUTHORIZATION,"xxxxxx");userDB.Entry entry=switchboard.userDB.ipAuth(this.clientIP);if(entry == null){entry=switchboard.userDB.proxyAuth(auth, this.clientIP);@@ -1395,7 +1395,7 @@ public final class httpd implements serverHandler, Cloneable {if ((tag != '*') && (tag != '#')) { // '#' in key is reserved for proxy attributes as artificial header valuescount = responseHeader.keyCount(key);for (int j = 0; j < count; j++) {- header.append(key).append(": ").append((String) responseHeader.getSingle(key, j)).append("\r\n");+ header.append(key).append(": ").append(responseHeader.getSingle(key, j)).append("\r\n");}//System.out.println("#" + key + ": " + value);}diff --git a/source/de/anomic/http/httpdFileHandler.java b/source/de/anomic/http/httpdFileHandler.javaindex 5bfa67de7..46a85b3b2 100644--- a/source/de/anomic/http/httpdFileHandler.java+++ b/source/de/anomic/http/httpdFileHandler.java@@ -1008,7 +1008,7 @@ public final class httpdFileHandler {try {newOut.flush();}catch (final Exception e) {}// wait a little time until everything closes so that clients can read from the streams/sockets- if ((contentLength >= 0) && ((String)requestHeader.get(httpRequestHeader.CONNECTION, "close")).indexOf("keep-alive") == -1) {+ if ((contentLength >= 0) && (requestHeader.get(httpRequestHeader.CONNECTION, "close")).indexOf("keep-alive") == -1) {// in case that the client knows the size in advance (contentLength present) the waiting will have no effect on the interface performance// but if the client waits on a connection interruption this will slow down.try {Thread.sleep(2000);} catch (final InterruptedException e) {} // FIXME: is this necessary?diff --git a/source/de/anomic/http/httpdProxyHandler.java b/source/de/anomic/http/httpdProxyHandler.javaindex f365ae71b..e590182c2 100644--- a/source/de/anomic/http/httpdProxyHandler.java+++ b/source/de/anomic/http/httpdProxyHandler.java@@ -1010,7 +1010,7 @@ public final class httpdProxyHandler {}// only gzip-encoding is supported, remove other encodings (e. g. deflate)- if (((String)requestHeader.get(httpHeader.ACCEPT_ENCODING,"")).indexOf("gzip") != -1) {+ if ((requestHeader.get(httpHeader.ACCEPT_ENCODING,"")).indexOf("gzip") != -1) {requestHeader.put(httpHeader.ACCEPT_ENCODING, "gzip");} else {requestHeader.put(httpHeader.ACCEPT_ENCODING, "");@@ -1538,7 +1538,7 @@ public final class httpdProxyHandler {private static synchronized String generateUserAgent(final httpHeader requestHeaders) {userAgentStr.setLength(0);- final String browserUserAgent = (String) requestHeaders.get(httpHeader.USER_AGENT, HTTPLoader.yacyUserAgent);+ final String browserUserAgent = requestHeaders.get(httpHeader.USER_AGENT, HTTPLoader.yacyUserAgent);final int pos = browserUserAgent.lastIndexOf(')');if (pos >= 0) {userAgentStrdiff --git a/source/de/anomic/kelondro/index/HandleMap.java b/source/de/anomic/kelondro/index/HandleMap.javaindex af24ce1bf..00381604c 100644--- a/source/de/anomic/kelondro/index/HandleMap.java+++ b/source/de/anomic/kelondro/index/HandleMap.java@@ -371,8 +371,8 @@ public class HandleMap implements Iterable<Row.Entry> {} catch (InterruptedException e) {e.printStackTrace();}- if (sortAtEnd && map.index instanceof ObjectIndexCache) {- ((ObjectIndexCache) map.index).finishInitialization();+ if (sortAtEnd) {+ map.index.finishInitialization();}return map;}diff --git a/source/de/anomic/kelondro/text/IODispatcher.java b/source/de/anomic/kelondro/text/IODispatcher.javaindex 9fac1c40f..6f4d98c9a 100644--- a/source/de/anomic/kelondro/text/IODispatcher.java+++ b/source/de/anomic/kelondro/text/IODispatcher.java@@ -83,7 +83,7 @@ public class IODispatcher extends Thread {Log.logWarning("IODispatcher", "emergency dump of file " + file.getName());cache.dump(file, (int) Math.min(MemoryControl.available() / 3, writeBufferSize));} else {- DumpJob<? extends Reference> job = new DumpJob(cache, file, array);+ DumpJob<? extends Reference> job = (DumpJob<? extends Reference>)new DumpJob(cache, file, array);try {this.dumpQueue.put(job);this.controlQueue.release();diff --git a/source/de/anomic/kelondro/text/citationPrototype/CitationReferenceRow.java b/source/de/anomic/kelondro/text/citationPrototype/CitationReferenceRow.javaindex 2402c31d6..29a73c5c8 100644--- a/source/de/anomic/kelondro/text/citationPrototype/CitationReferenceRow.java+++ b/source/de/anomic/kelondro/text/citationPrototype/CitationReferenceRow.java@@ -91,7 +91,7 @@ public final class CitationReferenceRow implements Reference /*, Cloneable*/ {this.entry.setCol(col_lother, lother);this.entry.setCol(col_urlLength, urlLength);this.entry.setCol(col_urlComps, urlComps);- this.entry.setCol(col_typeofurl, new byte[]{(byte) typeofurl});+ this.entry.setCol(col_typeofurl, new byte[]{typeofurl});this.entry.setCol(col_reserve, 0);}diff --git a/source/de/anomic/tools/DidYouMean.java b/source/de/anomic/tools/DidYouMean.javaindex 45c9105d0..40b68cf8a 100644--- a/source/de/anomic/tools/DidYouMean.java+++ b/source/de/anomic/tools/DidYouMean.java@@ -225,7 +225,7 @@ public class DidYouMean {public void run() {try {while(true) {- String s = (String)queue.take();+ String s = queue.take();if(s.equals("\n"))this.interrupt();elsediff --git a/source/de/anomic/yacy/yacyNewsRecord.java b/source/de/anomic/yacy/yacyNewsRecord.javaindex c4546cab7..6325f6ec7 100644--- a/source/de/anomic/yacy/yacyNewsRecord.java+++ b/source/de/anomic/yacy/yacyNewsRecord.java@@ -130,12 +130,12 @@ public class yacyNewsRecord {public yacyNewsRecord(final String newsString) {this.attributes = serverCodings.string2map(newsString, ",");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") : "";+ this.category = (attributes.containsKey("cat")) ? attributes.get("cat") : "";if (category.length() > categoryStringLength) throw new IllegalArgumentException("category length (" + category.length() + ") exceeds maximum (" + categoryStringLength + ")");this.received = (attributes.containsKey("rec")) ? DateFormatter.parseShortSecond(attributes.get("rec"), DateFormatter.UTCDiffString()) : new Date();this.created = (attributes.containsKey("cre")) ? DateFormatter.parseShortSecond(attributes.get("cre"), DateFormatter.UTCDiffString()) : new Date();this.distributed = (attributes.containsKey("dis")) ? Integer.parseInt(attributes.get("dis")) : 0;- this.originator = (attributes.containsKey("ori")) ? (String) attributes.get("ori") : "";+ this.originator = (attributes.containsKey("ori")) ? attributes.get("ori") : "";removeStandards();}@@ -225,4 +225,4 @@ public class yacyNewsRecord {public static void main(final String[] args) {System.out.println((newRecord(args[0])).toString());}-}\ No newline at end of file+}