Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
code cleanup
orbiter7920e1547d9a
diff --git a/htroot/profile.html b/htroot/profile.htmldeleted file mode 100644index 2dbf84277..000000000--- a/htroot/profile.html+++ /dev/null@@ -1,2 +0,0 @@-#{list}##[key]#=#[value]#-#{/list}#diff --git a/htroot/yacy/search.java b/htroot/yacy/search.javaindex 6877974b7..de1ba5f5e 100644--- a/htroot/yacy/search.java+++ b/htroot/yacy/search.java@@ -77,7 +77,7 @@ public final class search {// final String fwden = (String) post.get("fwden", ""); // forward deny, a list of seed hashes. They may NOT be target of forward hoppingfinal long duetime= Long.parseLong((String) post.get("duetime", "3000"));final int count = Integer.parseInt((String) post.get("count", "10")); // maximum number of wanted results- final boolean global = ((String) post.get("resource", "global")).equals("global"); // if true, then result may consist of answers from other peers+// final boolean global = ((String) post.get("resource", "global")).equals("global"); // if true, then result may consist of answers from other peers// Date remoteTime = yacyCore.parseUniversalDate((String) post.get(yacySeed.MYTIME)); // read remote timeif (yacyCore.seedDB == null) {yacyCore.log.logSevere("yacy.search: seed cache not initialized");diff --git a/htroot/yacy/transfer.java b/htroot/yacy/transfer.javaindex 792231d77..0bc428fae 100644--- a/htroot/yacy/transfer.java+++ b/htroot/yacy/transfer.java@@ -65,11 +65,11 @@ public final class transfer {String process = (String) post.get("process", ""); // permission or store- String key = (String) post.get("key", ""); // a transmission key from the client+ //String key = (String) post.get("key", ""); // a transmission key from the clientString otherpeer = (String) post.get("iam", ""); // identification of the client (a peer-hash)String purpose = (String) post.get("purpose", ""); // declares how the file shall be treatedString filename = (String) post.get("filename", ""); // a name of a file without path- long filesize = Long.parseLong((String) post.get("filesize", "")); // the size of the file+ //long filesize = Long.parseLong((String) post.get("filesize", "")); // the size of the fileyacySeed otherseed = yacyCore.seedDB.get(otherpeer);if (otherseed == null) {@@ -93,7 +93,7 @@ public final class transfer {if (purpose.equals("crcon")) {// consolidation of cr files//System.out.println("yacy/transfer:post=" + post.toString());- String cansendprotocol = (String) post.get("can-send-protocol", "http");+ //String cansendprotocol = (String) post.get("can-send-protocol", "http");String access = serverCodings.encodeMD5B64(otherpeer + ":" + filename, true) + ":" + serverCodings.encodeMD5B64("" + System.currentTimeMillis(), true);prop.put("response", "ok");prop.put("process_access", access);diff --git a/source/de/anomic/data/robotsParser.java b/source/de/anomic/data/robotsParser.javaindex e1cf2486b..f63122503 100644--- a/source/de/anomic/data/robotsParser.java+++ b/source/de/anomic/data/robotsParser.java@@ -353,19 +353,19 @@ public final class robotsParser{public static void main(String[] args) {try {- robotsParser parser = new robotsParser();+ //robotsParser parser = new robotsParser();URL robotsURL = new URL("http://www.bigfoot2002.de.vu/robots.txt");- Object[] result = parser.downloadRobotsTxt(robotsURL,5,null);+ Object[] result = downloadRobotsTxt(robotsURL,5,null);if (result != null) {boolean accessCompletelyRestricted = ((Boolean)result[0]).booleanValue();byte[] robotsTxt = (byte[])result[1];- String eTag = (String) result[2];- Date modDate = (Date) result[3];+ //String eTag = (String) result[2];+ //Date modDate = (Date) result[3];if (!accessCompletelyRestricted) {- ArrayList denyPath = robotsParser.parse(robotsTxt);+ /*ArrayList denyPath =*/ robotsParser.parse(robotsTxt);}}diff --git a/source/de/anomic/data/translator.java b/source/de/anomic/data/translator.javaindex ce7563e0f..905a755f6 100644--- a/source/de/anomic/data/translator.java+++ b/source/de/anomic/data/translator.java@@ -80,8 +80,7 @@ public class translator {public static Hashtable loadTranslationsLists(File translationFile){Hashtable lists = new Hashtable(); //list of translationLists for different files.Hashtable translationList = new Hashtable(); //current Translation Table- FileInputStream fileIn = null;-+ArrayList list = listManager.getListArray(translationFile);Iterator it = list.iterator();String line = "";diff --git a/source/de/anomic/http/httpHeader.java b/source/de/anomic/http/httpHeader.javaindex 30c6359cb..bec9bfa69 100644--- a/source/de/anomic/http/httpHeader.java+++ b/source/de/anomic/http/httpHeader.java@@ -350,7 +350,7 @@ public final class httpHeader extends TreeMap implements Map {Server=Apache/1.3.26*/- private static SimpleDateFormat HTTPGMTFormatter = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'");+ //private static SimpleDateFormat HTTPGMTFormatter = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'");private static SimpleDateFormat EMLFormatter = new SimpleDateFormat("dd MMM yyyy HH:mm:ss", Locale.US);public static Date parseHTTPDate(String s) {@@ -687,7 +687,7 @@ public final class httpHeader extends TreeMap implements Map {String host = conProp.getProperty(httpHeader.CONNECTION_PROP_HOST);String path = conProp.getProperty(httpHeader.CONNECTION_PROP_PATH); // always starts with leading '/'String args = conProp.getProperty(httpHeader.CONNECTION_PROP_ARGS); // may be null if no args were given- String ip = conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP); // the ip from the connecting peer+ //String ip = conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP); // the ip from the connecting peerint port, pos;if ((pos = host.indexOf(":")) < 0) {diff --git a/source/de/anomic/http/httpTemplate.java b/source/de/anomic/http/httpTemplate.javaindex b827a82dd..1facafc4d 100644--- a/source/de/anomic/http/httpTemplate.java+++ b/source/de/anomic/http/httpTemplate.java@@ -120,7 +120,7 @@ public final class httpTemplate {private static final byte lbr = (byte)'[';private static final byte rbr = (byte)']';- private static final byte[] pOpen = {hash, lbr};+ //private static final byte[] pOpen = {hash, lbr};private static final byte[] pClose = {rbr, hash};private static final byte lcbr = (byte)'{';@@ -130,11 +130,11 @@ public final class httpTemplate {private static final byte lrbr = (byte)'(';private static final byte rrbr = (byte)')';- private static final byte[] aOpen = {hash, lrbr};+ //private static final byte[] aOpen = {hash, lrbr};private static final byte[] aClose = {rrbr, hash};private static final byte ps = (byte)'%';- private static final byte[] iOpen = {hash, ps};+ //private static final byte[] iOpen = {hash, ps};private static final byte[] iClose = {ps, hash};/**@@ -142,7 +142,6 @@ public final class httpTemplate {* the function returns true, if the pattern is found*/private static boolean transferUntil(PushbackInputStream i, OutputStream o, byte[] pattern) throws IOException {- int ppos = 0;int b, bb;boolean equal;while ((b = i.read()) > 0) {@@ -176,8 +175,7 @@ public final class httpTemplate {PushbackInputStream pis = new PushbackInputStream(in, 100);ByteArrayOutputStream keyStream;String key;- String multi_key;- boolean consistent;+ String multi_key;byte[] replacement;int bb;@@ -436,7 +434,6 @@ public final class httpTemplate {if (!(path.isDirectory())) path = path.getParentFile();if ((path == null) || (!(path.isDirectory()))) return result;String[] templates = path.list();- int c;for (int i = 0; i < templates.length; i++) {if (templates[i].endsWith(".template"))try {diff --git a/source/de/anomic/icap/icapHeader.java b/source/de/anomic/icap/icapHeader.javaindex 3e21f8e57..410b6d3ea 100644--- a/source/de/anomic/icap/icapHeader.java+++ b/source/de/anomic/icap/icapHeader.java@@ -57,7 +57,9 @@ import de.anomic.server.serverCore;public class icapHeader extends TreeMap implements Map {- /* =============================================================+ private static final long serialVersionUID = 1L;++ /* =============================================================* Constants defining icap methods* ============================================================= */public static final String METHOD_REQMOD = "REQMOD";@@ -184,7 +186,7 @@ public class icapHeader extends TreeMap implements Map {// write headerIterator i = keySet().iterator();- String key, value;+ String key;char tag;int count;while (i.hasNext()) {diff --git a/source/de/anomic/icap/icapd.java b/source/de/anomic/icap/icapd.javaindex c6af96b4e..f4e7330dc 100644--- a/source/de/anomic/icap/icapd.java+++ b/source/de/anomic/icap/icapd.java@@ -44,7 +44,6 @@package de.anomic.icap;-import java.io.BufferedInputStream;import java.io.BufferedOutputStream;import java.io.BufferedReader;import java.io.ByteArrayInputStream;@@ -154,7 +153,6 @@ public class icapd implements serverHandler {public Boolean OPTIONS(String arg) throws IOException {- BufferedInputStream in = new BufferedInputStream(this.session.in);BufferedOutputStream out = new BufferedOutputStream(this.session.out);// parsing the http request line@@ -243,6 +241,7 @@ public class icapd implements serverHandler {return this.prop.getProperty(icapHeader.CONNECTION_PROP_PERSISTENT).equals("keep-alive") ? serverCore.RESUME_CONNECTION : serverCore.TERMINATE_CONNECTION;}+ /*private void blacklistService(icapHeader reqHeader, InputStream in, OutputStream out) {try {@@ -250,6 +249,7 @@ public class icapd implements serverHandler {e.printStackTrace();}}+ */private void indexingService(icapHeader reqHeader, InputStream in, OutputStream out) {try {diff --git a/source/de/anomic/kelondro/kelondroAbstractRA.java b/source/de/anomic/kelondro/kelondroAbstractRA.javaindex 5d42192a4..23a070c35 100644--- a/source/de/anomic/kelondro/kelondroAbstractRA.java+++ b/source/de/anomic/kelondro/kelondroAbstractRA.java@@ -128,8 +128,7 @@ abstract class kelondroAbstractRA implements kelondroRA {private static final byte cr = 13;private static final byte lf = 10;- private static final String crlf = new String(new byte[] {cr, lf});-+public void writeLine(final String line) throws IOException {this.write(line.getBytes());this.write(cr);diff --git a/source/de/anomic/kelondro/kelondroDyn.java b/source/de/anomic/kelondro/kelondroDyn.javaindex b90912954..5580f2cf7 100644--- a/source/de/anomic/kelondro/kelondroDyn.java+++ b/source/de/anomic/kelondro/kelondroDyn.java@@ -103,6 +103,7 @@ public class kelondroDyn extends kelondroTree {}}+ /*private void readSegmentCount() {try {segmentCount = (int) serverCodings.enhancedCoder.decodeBase64Long(new String(getText(0)));@@ -111,6 +112,7 @@ public class kelondroDyn extends kelondroTree {writeSegmentCount();}}+ */public synchronized int sizeDyn() {//this.segmentCount = 0;diff --git a/source/de/anomic/kelondro/kelondroDynTree.java b/source/de/anomic/kelondro/kelondroDynTree.javaindex e7d822b84..e29258dc9 100644--- a/source/de/anomic/kelondro/kelondroDynTree.java+++ b/source/de/anomic/kelondro/kelondroDynTree.java@@ -59,15 +59,15 @@ public class kelondroDynTree {private File file;// some properties to control caching and buffering- private int maxcountCache = 1000, maxsizeCache = 100;+ //private int maxcountCache = 1000, maxsizeCache = 100;private int maxcountBuffer = 1000, maxsizeBuffer = 100;- private long maxageCache = 60000, cycletimeCache = 10000;+ //private long maxageCache = 60000, cycletimeCache = 10000;private long maxageBuffer = 60000, cycletimeBuffer = 10000;private long buffersize = 0;// data structures for the cache and bufferprivate Hashtable buffer, cache;- private long cycleCache, cycleBuffer;+ private long cycleBuffer;public kelondroDynTree(File file, long buffersize, int keylength, int nodesize, int[] columns) throws IOException {// creates a new DynTree@@ -75,7 +75,7 @@ public class kelondroDynTree {this.columns = columns;this.buffer = new Hashtable();this.cache = new Hashtable();- this.cycleCache = Long.MIN_VALUE;+ //this.cycleCache = Long.MIN_VALUE;this.cycleBuffer = Long.MIN_VALUE;if (file.exists()) throw new IOException("DynTree " + file.toString() + " already exists");this.table = new kelondroDyn(file, buffersize, keylength, nodesize);@@ -87,7 +87,7 @@ public class kelondroDynTree {this.file = file;this.buffer = new Hashtable();this.cache = new Hashtable();- this.cycleCache = Long.MIN_VALUE;+ //this.cycleCache = Long.MIN_VALUE;this.cycleBuffer = Long.MIN_VALUE;if (!(file.exists())) throw new IOException("DynTree " + file.toString() + " does not exist");this.table = new kelondroDyn(file, buffersize);@@ -110,13 +110,14 @@ public class kelondroDynTree {if (size == 0) this.file.delete();}-+ /*public void setReadCacheAttr(int maxcount, int maxsize, long maxage, long cycletime) {maxcountCache = maxcount;maxsizeCache = maxsize;maxageCache = maxage;cycletimeCache = cycletime;}+ */public void setWriteBufferAttr(int maxcount, int maxsize, long maxage, long cycletime) {maxcountBuffer = maxcount;@@ -252,7 +253,7 @@ public class kelondroDynTree {return tc.get(key);}-+ /*// clean-up method for cache:private void flushCache() {if ((System.currentTimeMillis() - this.cycleCache < this.cycletimeCache) &&@@ -272,6 +273,7 @@ public class kelondroDynTree {}}}+ */// write bufferedpublic synchronized void put(String tablename, byte[][] newrow) {diff --git a/source/de/anomic/kelondro/kelondroException.java b/source/de/anomic/kelondro/kelondroException.javaindex 7a11df80e..48f2cab2b 100644--- a/source/de/anomic/kelondro/kelondroException.java+++ b/source/de/anomic/kelondro/kelondroException.java@@ -44,7 +44,9 @@ package de.anomic.kelondro;public class kelondroException extends java.lang.RuntimeException {- public kelondroException() {+ private static final long serialVersionUID = 1L;++ public kelondroException() {super("unspecific-error");}diff --git a/source/yacy.java b/source/yacy.javaindex f2d486878..206f8f913 100644--- a/source/yacy.java+++ b/source/yacy.java@@ -182,7 +182,7 @@ public final class yacy {// check java versiontry {- String[] check = "a,b".split(","); // split needs java 1.4+ /*String[] check =*/ "a,b".split(","); // split needs java 1.4} catch (NoSuchMethodError e) {System.err.println("STARTUP: Java Version too low. You need at least Java 1.4.2 to run YACY");Thread.sleep(3000);@@ -275,7 +275,7 @@ public final class yacy {// create some directoriesfinal File htRootPath = new File(homePath, sb.getConfig("htRootPath", "htroot"));final File htDocsPath = new File(homePath, sb.getConfig("htDocsPath", "DATA/HTDOCS"));- File htTemplatePath = new File(homePath, sb.getConfig("htTemplatePath","htdocs"));+ //final File htTemplatePath = new File(homePath, sb.getConfig("htTemplatePath","htdocs"));// create default notifier pictureif (!((new File(htRootPath, "env/grafics/notifier.gif")).exists())) try {@@ -430,7 +430,7 @@ public final class yacy {// idle until the processes are downwhile (server.isAlive()) {- Thread.currentThread().sleep(2000); // wait a while+ Thread.sleep(2000); // wait a while}serverLog.logConfig("SHUTDOWN", "server has terminated");sb.close();@@ -451,12 +451,12 @@ public final class yacy {serverLog.logConfig("SHUTDOWN", "Wait maximally 5 minutes for " + (Thread.activeCount() - 1) + " running threads to restart YaCy");while (Thread.activeCount() > 1 && count <= 60) { // wait 5 minutescount++;- try { Thread.currentThread().sleep(5000); } catch (InterruptedException e) {}+ try { Thread.sleep(5000); } catch (InterruptedException e) {}}}if (count < 60) {System.gc();- try { Thread.currentThread().sleep(5000); } catch (InterruptedException e) {}+ try { Thread.sleep(5000); } catch (InterruptedException e) {}startupMemFree = Runtime.getRuntime().freeMemory(); // the amount of free memory in the Java Virtual MachinestartupMemTotal = Runtime.getRuntime().totalMemory(); // the total amount of memory in the Java virtual machine; may vary over timestartup(homePath, startupMemFree, startupMemTotal);@@ -861,7 +861,7 @@ public final class yacy {if ((currentUrlDB.exists(urlHash)) && (!minimizedUrlDB.exists(urlHash))) {urlCounter++;plasmaCrawlLURL.Entry urlEntry = currentUrlDB.getEntry(urlHash);- plasmaCrawlLURL.Entry newEntry = minimizedUrlDB.newEntry(urlEntry);+ /*plasmaCrawlLURL.Entry newEntry =*/ minimizedUrlDB.newEntry(urlEntry);if (urlCounter % 500 == 0) {log.logInfo(urlCounter + " URLs found so far.");}@@ -1062,7 +1062,6 @@ public final class yacy {Iterator eiter = pool.loadedURL.entries(true, false);HashSet doms = new HashSet();plasmaCrawlLURL.Entry entry;- URL url;while (eiter.hasNext()) {entry = (plasmaCrawlLURL.Entry) eiter.next();if ((entry != null) && (entry.url() != null)) doms.add(entry.url().getHost());