Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
removed (not all) warnings
Michael Peter Christen89142d1e8d1e
diff --git a/htroot/Banner.java b/htroot/Banner.javaindex 9fad6e8d3..2521f9914 100644--- a/htroot/Banner.java+++ b/htroot/Banner.java@@ -34,7 +34,6 @@ import javax.imageio.ImageIO;import net.yacy.cora.protocol.RequestHeader;import net.yacy.peers.Seed;import net.yacy.peers.graphics.BannerData;-import net.yacy.peers.graphics.NetworkGraph;import net.yacy.search.Switchboard;import net.yacy.search.SwitchboardConstants;import net.yacy.visualization.RasterPlotter;@@ -111,12 +110,12 @@ public class Banner {}}- final BannerData data =+ final BannerData data =new BannerData(width, height, bgcolor, textcolor, bordercolor, name, links,words, type, myppm, network, peers, nlinks, nwords,nqph, nppm);-+if (!net.yacy.peers.graphics.Banner.logoIsLoaded()) {// do not write a cache to disc; keep in RAMImageIO.setUseCache(false);diff --git a/htroot/Table_API_p.java b/htroot/Table_API_p.javaindex 5320f2deb..9b2bb29f6 100644--- a/htroot/Table_API_p.java+++ b/htroot/Table_API_p.java@@ -36,7 +36,6 @@ import net.yacy.kelondro.logging.Log;import net.yacy.search.Switchboard;import net.yacy.search.SwitchboardConstants;import net.yacy.search.query.QueryParams;-import de.anomic.data.WorkTables;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;@@ -73,7 +72,6 @@ public class Table_API_p {typefilter = Pattern.compile(post.get("filter", ".*"));}- String pk;boolean scheduleevent = false; // flag if schedule info of row changesString current_schedule_pk = ""; // pk of changed schedule data rowif (post != null && post.containsKey("scheduleevent")) {diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.javaindex 4e864831a..9f92e1c8b 100644--- a/htroot/yacysearchitem.java+++ b/htroot/yacysearchitem.java@@ -61,7 +61,7 @@ public class yacysearchitem {private static final int MAX_NAME_LENGTH = 60;private static final int MAX_URL_LENGTH = 120;- private static boolean col = true;+ //private static boolean col = true;public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {final Switchboard sb = (Switchboard) env;diff --git a/source/de/anomic/data/ymark/YMarkAutoTagger.java b/source/de/anomic/data/ymark/YMarkAutoTagger.javaindex 1176836a8..34a3c57d8 100644--- a/source/de/anomic/data/ymark/YMarkAutoTagger.java+++ b/source/de/anomic/data/ymark/YMarkAutoTagger.java@@ -4,13 +4,13 @@ import java.io.ByteArrayInputStream;import java.io.IOException;import java.net.MalformedURLException;import java.util.Arrays;-import java.util.Enumeration;import java.util.HashSet;import java.util.Iterator;import java.util.Map;import java.util.TreeMap;import java.util.TreeSet;import java.util.concurrent.ArrayBlockingQueue;+import net.yacy.cora.document.UTF8;import net.yacy.cora.services.federated.yacy.CacheStrategy;import net.yacy.document.Condenser;@@ -28,11 +28,11 @@ import de.anomic.crawler.retrieval.Response;public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandler {private static final String EMPTY_STRING = new String();--++public final static String SPACE = " ";public final static String POISON = "";- public final static HashSet<String> stopwords = new HashSet<String>(Arrays.asList(".", "!", "?", "nbsp", "uuml", "ouml", "auml", "amp", "quot", "laquo", "raquo",+ public final static HashSet<String> stopwords = new HashSet<String>(Arrays.asList(".", "!", "?", "nbsp", "uuml", "ouml", "auml", "amp", "quot", "laquo", "raquo","and", "with", "the", "gt", "lt"));@@ -81,10 +81,10 @@ public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandlereturn null;}}-+public static String autoTag(final Document document, final int max, final TreeMap<String, YMarkTag> tags) {final TreeSet<YMarkTag> topwords = new TreeSet<YMarkTag>();- StringBuilder token;+ StringBuilder token;if(document == null) {return EMPTY_STRING;@@ -92,7 +92,7 @@ public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandle//get words from documentfinal Map<String, Word> words = new Condenser(document, true, true, LibraryProvider.dymLib).words();-+// generate potential tags from document title, description and subjectfinal int bufferSize = document.dc_title().length() + document.dc_description().length() + document.dc_subject(' ').length() + 32;final StringBuilder buffer = new StringBuilder(bufferSize);@@ -103,21 +103,21 @@ public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandlefinal WordTokenizer tokens = new WordTokenizer(new ByteArrayInputStream(UTF8.getBytes(buffer.toString())), LibraryProvider.dymLib);try {int score = 0;-+// get phrasesfinal TreeMap<String, YMarkTag> phrases = getPhrases(document, 2);phrases.putAll(getPhrases(document, 3));final Iterator<String> iter = phrases.keySet().iterator();while(iter.hasNext()) {score = 10;- final String phrase = iter.next();+ final String phrase = iter.next();if(phrases.get(phrase).size() > 3 && phrases.get(phrase).size() < 10) {score = phrases.get(phrase).size() * phrase.split(" ").length * 20;}if(isDigitSpace(phrase)) {score = 10;}- if(phrases.get(phrase).size() > 2 && buffer.indexOf(phrase) > 1) {+ if(phrases.get(phrase).size() > 2 && buffer.indexOf(phrase) > 1) {score = score * 10;}if (tags.containsKey(phrase)) {@@ -127,14 +127,14 @@ public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandlepwords.append(phrase);pwords.append(' ');}-+// loop through potential tag and rank them- while(tokens.hasMoreElements()) {+ while(tokens.hasMoreElements()) {score = 0;token = tokens.nextElement();-+// check if the token appears in the text- if (words.containsKey(token.toString())) {+ if (words.containsKey(token.toString())) {final Word word = words.get(token.toString());// token appears in text and matches an existing bookmark tagif (tags.containsKey(token.toString())) {@@ -172,8 +172,8 @@ public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandle} finally {tokens.close();}- }-+ }+private static TreeMap<String, YMarkTag> getPhrases(final Document document, final int size) {final TreeMap<String, YMarkTag> phrases = new TreeMap<String, YMarkTag>();final StringBuilder phrase = new StringBuilder(128);@@ -181,33 +181,33 @@ public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandletry {StringBuilder token;int count = 0;-+// loop through text- while(tokens.hasMoreElements()) {-- token = tokens.nextElement();+ while(tokens.hasMoreElements()) {++ token = tokens.nextElement();if(stopwords.contains(token.toString()) || isDigitSpace(token.toString()))- continue;-+ continue;+// if we have a full phrase, delete the first tokencount++;if(count > size)phrase.delete(0, phrase.indexOf(SPACE)+1);-+// append new tokenif(phrase.length() > 1)- phrase.append(SPACE);+ phrase.append(SPACE);phrase.append(token);-+if(count >= size) { // make sure we really have a phraseif(phrases.containsKey(phrase.toString())) {phrases.get(phrase.toString()).inc();} else {phrases.put(phrase.toString(), new YMarkTag(phrase.toString()));}- }+ }}-+return phrases;} finally {tokens.close();@@ -221,7 +221,7 @@ public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandleelsereturn "/IOExceptions";}-+public static boolean isDigitSpace(String str) {if (str == null) {return false;@@ -235,7 +235,8 @@ public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandlereturn true;}- public void run() {+ @Override+ public void run() {Log.logInfo(YMarkTables.BOOKMARKS_LOG, "autoTagger run()");Thread.currentThread().setUncaughtExceptionHandler(this);String url = null;@@ -247,9 +248,9 @@ public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandlewhile((url = this.bmkQueue.take()) != POISON) {tagString = autoTag(url, this.loader, 5, tags);if (tagString.equals("/IOExceptions")) {- this.ymarks.addFolder(bmk_user, url, tagString);+ this.ymarks.addFolder(this.bmk_user, url, tagString);tagString = "";- }+ }// update tagsthis.ymarks.addTags(this.bmk_user, url, tagString, this.merge);@@ -275,7 +276,8 @@ public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandle}}- public void uncaughtException(final Thread t, final Throwable e) {+ @Override+ public void uncaughtException(final Thread t, final Throwable e) {Log.logWarning(YMarkTables.BOOKMARKS_LOG, "I caught an uncaughtException in thread "+t.getName());Log.logException(e);}diff --git a/source/de/anomic/http/server/TemplateEngine.java b/source/de/anomic/http/server/TemplateEngine.javaindex a047689f7..0b31aca1c 100644--- a/source/de/anomic/http/server/TemplateEngine.java+++ b/source/de/anomic/http/server/TemplateEngine.java@@ -129,7 +129,7 @@ public final class TemplateEngine {private final static byte lbr = (byte)'[';private final static byte rbr = (byte)']';- private final static byte[] pOpen = {hashChar, lbr};+ //private final static byte[] pOpen = {hashChar, lbr};private final static byte[] pClose = {rbr, hashChar};private final static byte lcbr = (byte)'{';@@ -142,7 +142,7 @@ public final class TemplateEngine {private final static byte[] aOpen = {hashChar, lrbr};private final static byte[] aClose = {rrbr, hashChar};- private final static byte[] iOpen = {hashChar, pcChar};+ //private final static byte[] iOpen = {hashChar, pcChar};private final static byte[] iClose = {pcChar, hashChar};private final static byte[] ul = "_".getBytes();diff --git a/source/de/anomic/tools/loaderThreads.java b/source/de/anomic/tools/loaderThreads.javaindex 176525bda..784c124d7 100644--- a/source/de/anomic/tools/loaderThreads.java+++ b/source/de/anomic/tools/loaderThreads.java@@ -1,4 +1,4 @@-// loaderThreads.java+// loaderThreads.java// ---------------------------// (C) by Michael Peter Christen; [email protected]// first published on http://www.anomic.de@@ -24,7 +24,6 @@package de.anomic.tools;-import java.util.Collection;import java.util.HashMap;import java.util.Map;@@ -33,7 +32,7 @@ import net.yacy.cora.protocol.http.ProxySettings;import net.yacy.kelondro.data.meta.DigestURI;public class loaderThreads {-+// global values for loader threadsprotected int timeout;protected String user;@@ -41,16 +40,16 @@ public class loaderThreads {protected ProxySettings remoteProxyConfig;// management objects for collection of threads- private Map<String, Thread> threads;+ private final Map<String, Thread> threads;private int completed, failed;-+public loaderThreads() {this(10000, null, null);}-+public loaderThreads(- final int timeout,- final String user,+ final int timeout,+ final String user,final String password) {this.timeout = timeout;@@ -60,45 +59,45 @@ public class loaderThreads {this.completed = 0;this.failed = 0;}-+public void newThread(final String name, final DigestURI url, final loaderProcess process) {final Thread t = new loaderThread(url, process);- threads.put(name, t);+ this.threads.put(name, t);t.start();}-+public void terminateThread(final String name) {- final loaderThread t = (loaderThread) threads.get(name);+ final loaderThread t = (loaderThread) this.threads.get(name);if (t == null) throw new RuntimeException("no such thread: " + name);t.terminate();}-+public int threadCompleted(final String name) {- final loaderThread t = (loaderThread) threads.get(name);+ final loaderThread t = (loaderThread) this.threads.get(name);if (t == null) throw new RuntimeException("no such thread: " + name);return t.completed();}-+public int threadStatus(final String name) {- final loaderThread t = (loaderThread) threads.get(name);+ final loaderThread t = (loaderThread) this.threads.get(name);if (t == null) throw new RuntimeException("no such thread: " + name);return t.status();}-+public int completed() {- return completed;+ return this.completed;}-+public int failed() {- return failed;+ return this.failed;}-+public int count() {- return threads.size();+ return this.threads.size();}-+public Exception threadError(final String name) {- final loaderThread t = (loaderThread) threads.get(name);+ final loaderThread t = (loaderThread) this.threads.get(name);if (t == null) throw new RuntimeException("no such thread: " + name);return t.error();}@@ -109,7 +108,7 @@ public class loaderThreads {private final loaderProcess process;private byte[] page;private boolean loaded;-+public loaderThread(final DigestURI url, final loaderProcess process) {this.url = url;this.process = process;@@ -118,47 +117,48 @@ public class loaderThreads {this.loaded = false;}+ @Overridepublic void run() {try {- page = url.get(ClientIdentification.getUserAgent(), timeout);- loaded = true;- process.feed(page);- if (process.status() == loaderCore.STATUS_FAILED) {- error = process.error();+ this.page = this.url.get(ClientIdentification.getUserAgent(), loaderThreads.this.timeout);+ this.loaded = true;+ this.process.feed(this.page);+ if (this.process.status() == loaderCore.STATUS_FAILED) {+ this.error = this.process.error();}- if ((process.status() == loaderCore.STATUS_COMPLETED) ||- (process.status() == loaderCore.STATUS_FINALIZED)) completed++;- if ((process.status() == loaderCore.STATUS_ABORTED) ||- (process.status() == loaderCore.STATUS_FAILED)) failed++;+ if ((this.process.status() == loaderCore.STATUS_COMPLETED) ||+ (this.process.status() == loaderCore.STATUS_FINALIZED)) loaderThreads.this.completed++;+ if ((this.process.status() == loaderCore.STATUS_ABORTED) ||+ (this.process.status() == loaderCore.STATUS_FAILED)) loaderThreads.this.failed++;} catch (final Exception e) {- error = e;- failed++;+ this.error = e;+ loaderThreads.this.failed++;}}-+public void terminate() {- process.terminate();+ this.process.terminate();}-+public boolean loaded() {- return loaded;+ return this.loaded;}-+public int completed() {- if (process.status() == loaderCore.STATUS_READY) return 1;- if (process.status() == loaderCore.STATUS_RUNNING) return 9 + ((process.completed() * 9) / 10);- if (process.status() == loaderCore.STATUS_COMPLETED) return 100;+ if (this.process.status() == loaderCore.STATUS_READY) return 1;+ if (this.process.status() == loaderCore.STATUS_RUNNING) return 9 + ((this.process.completed() * 9) / 10);+ if (this.process.status() == loaderCore.STATUS_COMPLETED) return 100;return 0;}public int status() {- return process.status(); // see constants in loaderCore+ return this.process.status(); // see constants in loaderCore}-+public Exception error() {- return error;+ return this.error;}-+}}diff --git a/source/net/yacy/cora/storage/ConfigurationSet.java b/source/net/yacy/cora/storage/ConfigurationSet.javaindex 99fe6de16..3277b6328 100644--- a/source/net/yacy/cora/storage/ConfigurationSet.java+++ b/source/net/yacy/cora/storage/ConfigurationSet.java@@ -32,6 +32,7 @@ import java.io.FileWriter;import java.io.IOException;import java.io.Serializable;import java.util.Iterator;+import java.util.Map;import java.util.TreeMap;import java.util.logging.Level;import java.util.logging.Logger;@@ -200,7 +201,8 @@ public class ConfigurationSet extends TreeMap<String,Entry> implements SerializaFile bakfile = new File (this.file.getAbsolutePath() + ".bak");FileUtils.copy (this.file, bakfile);- TreeMap tclone = (TreeMap) this.clone(); // clone to write appended entries+ @SuppressWarnings("unchecked")+ TreeMap<String,Entry> tclone = (TreeMap<String,Entry>) this.clone(); // clone to write appended entriesfinal BufferedWriter writer = new BufferedWriter(new FileWriter(this.file));try {@@ -248,7 +250,7 @@ public class ConfigurationSet extends TreeMap<String,Entry> implements Serializa} catch (final IOException e) {}// write remainig entries (not already written)- Iterator ie = tclone.entrySet().iterator();+ Iterator<Map.Entry<String,Entry>> ie = tclone.entrySet().iterator();while (ie.hasNext()) {Object e = ie.next();writer.write (e.toString() + "\n");diff --git a/source/net/yacy/document/parser/dwgParser.java b/source/net/yacy/document/parser/dwgParser.javaindex f5d58ce42..c35ffa468 100644--- a/source/net/yacy/document/parser/dwgParser.java+++ b/source/net/yacy/document/parser/dwgParser.java@@ -50,7 +50,7 @@ public class dwgParser extends AbstractParser implements Parser {* How far to skip after the last standard property, before* we find any custom properties that might be there.*/- private static final int CUSTOM_PROPERTIES_SKIP = 20;+ //private static final int CUSTOM_PROPERTIES_SKIP = 20;public dwgParser() {super("DWG (CAD Drawing) parser (very basic)");diff --git a/source/net/yacy/kelondro/logging/ThreadDump.java b/source/net/yacy/kelondro/logging/ThreadDump.javaindex 74f1e53c3..6ed2571c7 100644--- a/source/net/yacy/kelondro/logging/ThreadDump.java+++ b/source/net/yacy/kelondro/logging/ThreadDump.java@@ -36,7 +36,6 @@ import java.util.ArrayList;import java.util.HashMap;import java.util.List;import java.util.Map;-import java.util.Map.Entry;import java.util.regex.Pattern;import net.yacy.document.parser.html.CharacterCoding;@@ -210,7 +209,7 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> impThread thread;// collect single dumps- for (final Entry<Thread, StackTraceElement[]> entry: stackTraces.entrySet()) {+ for (final Map.Entry<Thread, StackTraceElement[]> entry: stackTraces.entrySet()) {thread = entry.getKey();final StackTraceElement[] stackTraceElements = entry.getValue();StackTraceElement ste;@@ -274,7 +273,7 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> impbufferappend(buffer, plain, "");// write dumps- for (final Entry<StackTrace, List<String>> entry: entrySet()) {+ for (final Map.Entry<StackTrace, List<String>> entry: entrySet()) {final List<String> threads = entry.getValue();for (final String t: threads) bufferappend(buffer, plain, t);bufferappend(buffer, plain, entry.getKey().text);@@ -317,7 +316,7 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> impThreadDump x;for (final Map<Thread, StackTraceElement[]> trace: stackTraces) {x = new ThreadDump(rootPath, trace, plain, Thread.State.RUNNABLE);- for (final Entry<StackTrace, List<String>> e: x.entrySet()) {+ for (final Map.Entry<StackTrace, List<String>> e: x.entrySet()) {if (multiDumpFilterPattern.matcher(e.getKey().text).matches()) continue;Integer c = dumps.get(e.getKey().text);if (c == null) dumps.put(e.getKey().text, Integer.valueOf(1));@@ -330,16 +329,16 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp// write dumpswhile (!dumps.isEmpty()) {- final Entry<String, Integer> e = removeMax(dumps);+ final Map.Entry<String, Integer> e = removeMax(dumps);bufferappend(buffer, plain, "Occurrences: " + e.getValue());bufferappend(buffer, plain, e.getKey());}bufferappend(buffer, plain, "");}- private static Entry<String, Integer> removeMax(final Map<String, Integer> result) {- Entry<String, Integer> max = null;- for (final Entry<String, Integer> e: result.entrySet()) {+ private static Map.Entry<String, Integer> removeMax(final Map<String, Integer> result) {+ Map.Entry<String, Integer> max = null;+ for (final Map.Entry<String, Integer> e: result.entrySet()) {if (max == null || e.getValue().intValue() > max.getValue().intValue()) {max = e;}diff --git a/source/net/yacy/peers/graphics/NetworkGraph.java b/source/net/yacy/peers/graphics/NetworkGraph.javaindex bbb091fad..716c266a7 100644--- a/source/net/yacy/peers/graphics/NetworkGraph.java+++ b/source/net/yacy/peers/graphics/NetworkGraph.java@@ -324,12 +324,12 @@ public class NetworkGraph {private static class drawNetworkPicturePeerJob {- private RasterPlotter img;- private int centerX, centerY, innerradius, outerradius, coronaangle;- private Seed seed;- private String colorDot, colorLine, colorText;- private double cyc;- public drawNetworkPicturePeerJob() {} // used to produce a poison pill+ private final RasterPlotter img;+ private final int centerX, centerY, innerradius, outerradius, coronaangle;+ private final Seed seed;+ private final String colorDot, colorLine, colorText;+ private final double cyc;+ //public drawNetworkPicturePeerJob() {} // used to produce a poison pillpublic drawNetworkPicturePeerJob(final RasterPlotter img, final int centerX, final int centerY,final int innerradius, final int outerradius,diff --git a/source/net/yacy/search/query/RWIProcess.java b/source/net/yacy/search/query/RWIProcess.javaindex 145678cca..324e9c47a 100644--- a/source/net/yacy/search/query/RWIProcess.java+++ b/source/net/yacy/search/query/RWIProcess.java@@ -95,7 +95,6 @@ public final class RWIProcess extends Threadprivate final ScoreMap<String> ref; // reference score computation for the commonSense heuristicprivate final Map<String, byte[]> hostResolver; // a mapping from a host hash (6 bytes) to the full url hash of one of these urls that have the host hashprivate final ReferenceOrder order;- private final long startTime;private boolean addRunning;private final boolean remote;@@ -141,7 +140,6 @@ public final class RWIProcess extends Threadthis.ref = new ConcurrentScoreMap<String>();this.feedersAlive = new AtomicInteger(0);this.feedersTerminated = new AtomicInteger(0);- this.startTime = System.currentTimeMillis();this.maxExpectedRemoteReferences = new AtomicInteger(0);this.expectedRemoteReferences = new AtomicInteger(0);this.receivedRemoteReferences = new AtomicInteger(0);diff --git a/source/net/yacy/search/query/SearchEvent.java b/source/net/yacy/search/query/SearchEvent.javaindex c335798d9..243d63132 100644--- a/source/net/yacy/search/query/SearchEvent.java+++ b/source/net/yacy/search/query/SearchEvent.java@@ -505,16 +505,21 @@ public final class SearchEventthis.urlhash = urlhash;this.heuristicName = heuristicName;this.redundant = redundant;- }/*- public int compareTo(HeuristicResult o) {+ }++ public int compareTo(HeuristicResult o) {return Base64Order.enhancedCoder.compare(this.urlhash, o.urlhash);}- public int hashCode() {++ @Override+ public int hashCode() {return (int) Base64Order.enhancedCoder.cardinal(this.urlhash);- }- public boolean equals(Object o) {+ }++ @Override+ public boolean equals(Object o) {return Base64Order.enhancedCoder.equal(this.urlhash, ((HeuristicResult) o).urlhash);- }*/+ }}public class SecondarySearchSuperviser extends Threaddiff --git a/source/net/yacy/yacy.java b/source/net/yacy/yacy.javaindex 85ef9bc8b..8f271a0d8 100644--- a/source/net/yacy/yacy.java+++ b/source/net/yacy/yacy.java@@ -57,7 +57,6 @@ import net.yacy.cora.protocol.http.HTTPClient;import net.yacy.cora.sorting.Array;import net.yacy.cora.sorting.OrderedScoreMap;import net.yacy.cora.sorting.ScoreMap;-import net.yacy.gui.Tray;import net.yacy.gui.YaCyApp;import net.yacy.gui.framework.Browser;import net.yacy.kelondro.blob.MapDataMining;