Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
code cleanup
orbiter1d6a6d1f85c7
diff --git a/htroot/yacy/transfer.java b/htroot/yacy/transfer.javaindex f4d2d3eb9..792231d77 100644--- a/htroot/yacy/transfer.java+++ b/htroot/yacy/transfer.java@@ -94,7 +94,7 @@ public final class transfer {// consolidation of cr files//System.out.println("yacy/transfer:post=" + post.toString());String cansendprotocol = (String) post.get("can-send-protocol", "http");- String access = serverCodings.enhancedCoder.encodeMD5B64(otherpeer + ":" + filename, true) + ":" + serverCodings.enhancedCoder.encodeMD5B64("" + System.currentTimeMillis(), true);+ String access = serverCodings.encodeMD5B64(otherpeer + ":" + filename, true) + ":" + serverCodings.encodeMD5B64("" + System.currentTimeMillis(), true);prop.put("response", "ok");prop.put("process_access", access);prop.put("process_address", yacyCore.seedDB.mySeed.getAddress());@@ -113,7 +113,7 @@ public final class transfer {byte[] filebytes = (byte[]) post.get("filename$file");String accesscode = (String) post.get("access", ""); // one-time authenticationString md5 = (String) post.get("md5", ""); // one-time authentication- java.util.HashMap perm = sb.rankingPermissions;+ //java.util.HashMap perm = sb.rankingPermissions;//System.out.println("PERMISSIONDEBUG: accesscode=" + accesscode + ", permissions=" + perm.toString());String grantedFile = (String) sb.rankingPermissions.get(accesscode);prop.put("process_tt", "");diff --git a/source/de/anomic/data/wikiBoard.java b/source/de/anomic/data/wikiBoard.javaindex ea47041c6..2cf533dd5 100644--- a/source/de/anomic/data/wikiBoard.java+++ b/source/de/anomic/data/wikiBoard.java@@ -68,24 +68,22 @@ public class wikiBoard {private kelondroMap datbase = null;private kelondroMap bkpbase = null;private HashMap authors = new HashMap();- private int sn = 0;-+public wikiBoard(File actpath, File bkppath, int bufferkb) throws IOException {- new File(actpath.getParent()).mkdir();- if (datbase == null) {- if (actpath.exists())- datbase = new kelondroMap(new kelondroDyn(actpath, bufferkb/2 * 0x40));- else- datbase = new kelondroMap(new kelondroDyn(actpath, bufferkb/2 * 0x400, keyLength, recordSize));- }- new File(bkppath.getParent()).mkdir();- if (bkpbase == null) {- if (bkppath.exists())- bkpbase = new kelondroMap(new kelondroDyn(bkppath, bufferkb/2 * 0x400));- else- bkpbase = new kelondroMap(new kelondroDyn(bkppath, bufferkb/2 * 0x400, keyLength + dateFormat.length(), recordSize));- }- sn = 0;+ new File(actpath.getParent()).mkdir();+ if (datbase == null) {+ if (actpath.exists())+ datbase = new kelondroMap(new kelondroDyn(actpath, bufferkb/2 * 0x40));+ else+ datbase = new kelondroMap(new kelondroDyn(actpath, bufferkb/2 * 0x400, keyLength, recordSize));+ }+ new File(bkppath.getParent()).mkdir();+ if (bkpbase == null) {+ if (bkppath.exists())+ bkpbase = new kelondroMap(new kelondroDyn(bkppath, bufferkb/2 * 0x400));+ else+ bkpbase = new kelondroMap(new kelondroDyn(bkppath, bufferkb/2 * 0x400, keyLength + dateFormat.length(), recordSize));+ }}public int sizeOfTwo() {diff --git a/source/de/anomic/http/httpChunkedInputStream.java b/source/de/anomic/http/httpChunkedInputStream.javaindex 87211ed22..b669aa37f 100644--- a/source/de/anomic/http/httpChunkedInputStream.java+++ b/source/de/anomic/http/httpChunkedInputStream.java@@ -57,7 +57,7 @@ import de.anomic.server.serverByteBuffer;*/public final class httpChunkedInputStream extends InputStream {- private static final int READ_CHUNK_STATE_NORMAL = 0;+ //private static final int READ_CHUNK_STATE_NORMAL = 0;private static final int READ_CHUNK_STATE_CR_READ = 1;private static final int READ_CHUNK_STATE_IN_EXT_CHUNK = 2;private static final int READ_CHUNK_STATE_FINISHED = -1;diff --git a/source/de/anomic/http/httpHeader.java b/source/de/anomic/http/httpHeader.javaindex b7e0f8acf..30c6359cb 100644--- a/source/de/anomic/http/httpHeader.java+++ b/source/de/anomic/http/httpHeader.java@@ -77,7 +77,9 @@ import de.anomic.server.logging.serverLog;public final class httpHeader extends TreeMap implements Map {- /* =============================================================+ private static final long serialVersionUID = 17L;++ /* =============================================================* Constants defining http versions* ============================================================= */public static final String HTTP_VERSION_0_9 = "HTTP/0.9";@@ -664,7 +666,7 @@ public final class httpHeader 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/http/httpc.java b/source/de/anomic/http/httpc.javaindex 75cdf2532..789b23b72 100644--- a/source/de/anomic/http/httpc.java+++ b/source/de/anomic/http/httpc.java@@ -79,7 +79,6 @@ import de.anomic.server.serverCodings;import de.anomic.server.serverCore;import de.anomic.server.serverObjects;import de.anomic.server.logging.serverLog;-import de.anomic.server.serverCore.Session;import org.apache.commons.pool.impl.GenericObjectPool;@@ -113,9 +112,6 @@ public final class httpc {// --- The GMT standard date format used in the HTTP protocolprivate static final SimpleDateFormat HTTPGMTFormatter = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.US);- private static final SimpleDateFormat EMLFormatter = new SimpleDateFormat("dd MMM yyyy HH:mm:ss", Locale.US);- private static final SimpleDateFormat ShortFormatter = new SimpleDateFormat("yyyyMMddHHmmss");- //Mo 06 Sep 2004 23:32static final HashMap reverseMappingCache = new HashMap();// the dns cache@@ -134,9 +130,8 @@ public final class httpc {private Socket socket = null; // client socket for commandsprivate Thread socketOwner = null;String host = null;- private long timeout;- private long handle;-+ //private long timeout;+// output and input streams for client control connectionPushbackInputStream clientInput = null;private OutputStream clientOutput = null;@@ -537,13 +532,10 @@ public final class httpc {String incomingByteCountAccounting,String outgoingByteCountAccounting) throws IOException {- this.handle = System.currentTimeMillis();//serverLog.logDebug("HTTPC", handle + " initialized");this.remoteProxyUse = false;- this.timeout = timeout;- if(yacyDebugMode){- this.timeout=60000;- }+ //this.timeout = timeout;+ //if(yacyDebugMode){ this.timeout=60000; }this.savedRemoteHost = server;try {@@ -642,8 +634,7 @@ public final class httpc {}this.host = null;- this.timeout = 0;- this.handle = 0;+ //this.timeout = 0;this.remoteProxyUse = false;this.remoteProxyConfig = null;@@ -1525,8 +1516,7 @@ do uploadpublic int statusCode = 503;public String statusText = "internal error";private boolean gzip; // for gunzipping on-the-fly- private String encoding;-+/*** Constructor for this class. Reads in the content for the given outer* instance and parses it.@@ -1893,10 +1883,12 @@ final class httpcFactory implements org.apache.commons.pool.PoolableObjectFactor* @see org.apache.commons.pool.PoolableObjectFactory#validateObject(java.lang.Object)*/public boolean validateObject(Object obj) {+ /*if (obj instanceof httpc) {httpc theHttpc = (httpc) obj;return true;}+ */return true;}@@ -1914,9 +1906,11 @@ final class httpcFactory implements org.apache.commons.pool.PoolableObjectFactor*/public void passivateObject(Object obj) {//log.debug(" passivateObject..." + obj);+ /*if (obj instanceof Session) {httpc theHttpc = (httpc) obj;}+ */}}diff --git a/source/de/anomic/http/httpd.java b/source/de/anomic/http/httpd.javaindex 801e70f9f..6762b2875 100644--- a/source/de/anomic/http/httpd.java+++ b/source/de/anomic/http/httpd.java@@ -127,8 +127,6 @@ public final class httpd implements serverHandler {// needed for loggingprivate final serverLog log = new serverLog("HTTPD");- private final serverCodings codings = new serverCodings(true);-// class methodspublic httpd(serverSwitch s, httpdHandler fileHandler, httpdHandler proxyHandler) {// handler info@@ -203,7 +201,6 @@ public final class httpd implements serverHandler {// each pattern may contain one wildcard-character '*' which matches anythingStringTokenizer st = new StringTokenizer(latch,",");String pattern;- int pos;while (st.hasMoreTokens()) {pattern = st.nextToken();if (key.matches(pattern)) return true;@@ -356,7 +353,7 @@ public final class httpd implements serverHandler {}parseRequestLine(unknownCommand, args);- String httpVersion = this.prop.getProperty(httpHeader.CONNECTION_PROP_HTTP_VER,"HTTP/0.9");+ //String httpVersion = this.prop.getProperty(httpHeader.CONNECTION_PROP_HTTP_VER,"HTTP/0.9");sendRespondError(this.prop,this.session.out,0,501,null,unknownCommand + " method not implemented",null);return serverCore.TERMINATE_CONNECTION;@@ -491,7 +488,7 @@ public final class httpd implements serverHandler {httpHeader.handleTransparentProxySupport(header, this.prop, virtualHost, httpdProxyHandler.isTransparentProxy);// determines if the connection should be kept alive- boolean persistent = handlePersistentConnection(header);+ //boolean persistent = handlePersistentConnection(header);// return multi-line messageif (this.prop.getProperty("HOST").equals(virtualHost)) {@@ -544,7 +541,7 @@ public final class httpd implements serverHandler {httpHeader.handleTransparentProxySupport(header, this.prop, virtualHost, httpdProxyHandler.isTransparentProxy);// determines if the connection should be kept alive- boolean persistent = handlePersistentConnection(header);+ //boolean persistent = handlePersistentConnection(header);// return multi-line messageif (prop.getProperty("HOST").equals(virtualHost)) {@@ -817,7 +814,7 @@ public final class httpd implements serverHandler {// we need some constantsbyte[] namec = (new String("name=")).getBytes();byte[] filenamec = (new String("filename=")).getBytes();- byte[] semicolonc = (new String(";")).getBytes();+ //byte[] semicolonc = (new String(";")).getBytes();byte[] quotec = new byte[] {(byte) '"'};// now loop over boundaries@@ -935,7 +932,6 @@ public final class httpd implements serverHandler {// return a position of a pattern in an arrayif (start > array.length - pattern.length) return -1;if (pattern.length == 0) return start;- int i;for (int pos = start; pos <= array.length - pattern.length; pos++)if ((array[pos] == pattern[0]) && (equals(array, pos, pattern, 0, pattern.length)))return pos;@@ -1259,7 +1255,7 @@ public final class httpd implements serverHandler {// write headerIterator i = header.keySet().iterator();- String key, value;+ String key;char tag;int count;//System.out.println("vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv");diff --git a/source/de/anomic/http/httpdFileHandler.java b/source/de/anomic/http/httpdFileHandler.javaindex 3eeb80df4..67662df57 100644--- a/source/de/anomic/http/httpdFileHandler.java+++ b/source/de/anomic/http/httpdFileHandler.java@@ -484,7 +484,7 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http// write the array to the clienthttpd.sendRespondHeader(this.connectionProperties, out, "HTTP/1.1", 200, null, mimeType, result.length, targetDate, null, null, null, null);- Thread.currentThread().sleep(200); // see below+ Thread.sleep(200); // see belowserverFileUtils.write(result, out);}} else if ((targetClass != null) && (path.endsWith(".stream"))) {@@ -497,7 +497,7 @@ public final class httpdFileHandler extends httpdAbstractHandler implements httphttpd.sendRespondHeader(this.connectionProperties, out, httpVersion, 200, null);// in case that there are no args given, args = null or empty hashmap- serverObjects tp = (serverObjects) rewriteMethod(targetClass).invoke(null, new Object[] {requestHeader, args, switchboard});+ /*serverObjects tp = (serverObjects)*/ rewriteMethod(targetClass).invoke(null, new Object[] {requestHeader, args, switchboard});this.forceConnectionClose();return;@@ -508,7 +508,6 @@ public final class httpdFileHandler extends httpdAbstractHandler implements httpString mimeType = mimeTable.getProperty(targetExt,"text/html");byte[] result;boolean zipContent = requestHeader.acceptGzip() && httpd.shallTransportZipped("." + conProp.getProperty("EXT",""));- String md5String = null;if (path.endsWith("html") ||path.endsWith("xml") ||path.endsWith("rss") ||@@ -645,7 +644,6 @@ public final class httpdFileHandler extends httpdAbstractHandler implements httpfor ( int i = 0; i < digest.length; i++ )digestString.append(Integer.toHexString( digest[i]&0xff));- md5String = digestString.toString();}} finally {if (zippedOut != null) try {zippedOut.close();} catch(Exception e) {}@@ -667,7 +665,7 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http// write the array to the clienthttpd.sendRespondHeader(this.connectionProperties, out, httpVersion, 200, null, mimeType, result.length, targetDate, null, null, (zipContent)?"gzip":null, null);- Thread.currentThread().sleep(200); // this solved the message problem (!!)+ Thread.sleep(200); // this solved the message problem (!!)serverFileUtils.write(result, out);} else {httpd.sendRespondError(conProp,out,3,404,"File not Found",null,null);@@ -761,7 +759,6 @@ public final class httpdFileHandler extends httpdAbstractHandler implements httpprivate final Method rewriteMethod(File classFile) {Method m = null;- long start = System.currentTimeMillis();// now make a class out of the streamtry {if (useTemplateCache) {diff --git a/source/de/anomic/http/httpdProxyHandler.java b/source/de/anomic/http/httpdProxyHandler.javaindex 7982f61c5..28ceeac98 100644--- a/source/de/anomic/http/httpdProxyHandler.java+++ b/source/de/anomic/http/httpdProxyHandler.java@@ -1141,7 +1141,7 @@ public final class httpdProxyHandler extends httpdAbstractHandler implements htt(sslSocket.isConnected()) &&((cs.isAlive()) || (sc.isAlive()))) {// idle- try {Thread.currentThread().sleep(1000);} catch (InterruptedException e) {} // wait a while+ try {Thread.sleep(1000);} catch (InterruptedException e) {} // wait a while}// set stop modecs.pleaseTerminate();@@ -1260,7 +1260,7 @@ public final class httpdProxyHandler extends httpdAbstractHandler implements htt// normal creation of httpc objectreturn newhttpc(server, port, timeout);}-+ /*private void textMessage(OutputStream out, String body) throws IOException {out.write(("HTTP/1.1 200 OK\r\n").getBytes());out.write((httpHeader.SERVER + ": AnomicHTTPD (www.anomic.de)\r\n").getBytes());@@ -1272,7 +1272,7 @@ public final class httpdProxyHandler extends httpdAbstractHandler implements httout.write(body.getBytes());out.flush();}-+ */private void handleProxyException(Exception e, httpc remote, Properties conProp, OutputStream respond, URL url) {// this may happen if// - the targeted host does not existdiff --git a/source/de/anomic/net/ftpc.java b/source/de/anomic/net/ftpc.javaindex 6e5d92c8b..1f65513d0 100644--- a/source/de/anomic/net/ftpc.java+++ b/source/de/anomic/net/ftpc.java@@ -833,7 +833,7 @@ cd ..for (int i = 1; i< cmd.length; i++) s = s + " " + cmd[i];try {send(s);- String reply = receive();+ /*String reply =*/ receive();} catch (IOException e) {}return true;}@@ -1038,7 +1038,6 @@ cd ..// read file system dataString line;- int i = 0;Vector files = new Vector();while ((line = ClientStream.readLine()) != null)if (!line.startsWith("total ")) files.addElement(line);@@ -1100,7 +1099,7 @@ cd ..Enumeration x = l.elements();String remote;File local;- int idx; // the search for " " is only for improper lists from the server. this fails if the file name has a " " in it+ //int idx; // the search for " " is only for improper lists from the server. this fails if the file name has a " " in itwhile (x.hasMoreElements()) {remote = (String) x.nextElement();//idx = remote.lastIndexOf(" ");@@ -1764,7 +1763,7 @@ cd ..}- private String login() throws IOException {+ public String login() throws IOException {// force anonymous login if not already connectedif (this.account == null) {login("anonymous", "bob@");@@ -1773,7 +1772,7 @@ cd ..return this.account;}- private String sys() throws IOException {+ public String sys() throws IOException {// send system commandsend("SYST");@@ -1797,7 +1796,9 @@ cd ..}class ee extends SecurityException {- private int value = 0;++ private static final long serialVersionUID = 1L;+ private int value = 0;public ee() {}public ee(int value) {super();diff --git a/source/de/anomic/server/logging/serverLog.java b/source/de/anomic/server/logging/serverLog.javaindex e34443455..e1910c5fc 100644--- a/source/de/anomic/server/logging/serverLog.java+++ b/source/de/anomic/server/logging/serverLog.java@@ -209,7 +209,7 @@ public final class serverLog {if(!log.canRead()) log.mkdir();// generating the root logger- Logger logger = Logger.getLogger("");+ /*Logger logger =*/ Logger.getLogger("");// System.setOut(new PrintStream(new LoggerOutputStream(Logger.getLogger("STDOUT"),Level.FINEST)));// System.setErr(new PrintStream(new LoggerOutputStream(Logger.getLogger("STDERR"),Level.SEVERE)));diff --git a/source/de/anomic/soap/httpdSoapHandler.java b/source/de/anomic/soap/httpdSoapHandler.javaindex 4f4307e9d..42aeb55bc 100644--- a/source/de/anomic/soap/httpdSoapHandler.java+++ b/source/de/anomic/soap/httpdSoapHandler.java@@ -464,7 +464,6 @@ public final class httpdSoapHandler extends httpdAbstractHandler implements httpif (!(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 {//System.out.println("TEMPLATE " + templates[i].substring(0, templates[i].length() - 9) + ": " + new String(buf, 0, c));diff --git a/source/de/anomic/tools/cryptbig.java b/source/de/anomic/tools/cryptbig.javaindex 39337d862..aa1a6448f 100644--- a/source/de/anomic/tools/cryptbig.java+++ b/source/de/anomic/tools/cryptbig.java@@ -154,7 +154,6 @@ public class cryptbig {if (enc == null) return null;return serverCodings.standardCoder.encodeBase64(enc);} catch (UnsupportedEncodingException e) {- } catch (java.io.IOException e) {}return null;}@@ -168,7 +167,6 @@ public class cryptbig {if (dec == null) return null;return new String(dec, "UTF8");} catch (UnsupportedEncodingException e) {- } catch (java.io.IOException e) {}return null;}diff --git a/source/de/anomic/tools/disorderSet.java b/source/de/anomic/tools/disorderSet.javaindex e53280bf0..a14602038 100644--- a/source/de/anomic/tools/disorderSet.java+++ b/source/de/anomic/tools/disorderSet.java@@ -47,7 +47,8 @@ import java.util.Set;public class disorderSet extends HashSet implements Set {- disorderHeap dh;+ private static final long serialVersionUID = 1L;+ disorderHeap dh;public disorderSet() {super();diff --git a/source/yacy.java b/source/yacy.javaindex 8ef6b98a0..f2d486878 100644--- a/source/yacy.java+++ b/source/yacy.java@@ -185,7 +185,7 @@ public final class yacy {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.currentThread().sleep(3000);+ Thread.sleep(3000);System.exit(-1);}