Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
fixed div by zero, set default delays, fixed release number format and display
orbiter3470a72d48be
diff --git a/doc/News.html b/doc/News.htmlindex a402e91da..9590dd3f3 100644--- a/doc/News.html+++ b/doc/News.html@@ -43,6 +43,22 @@ globalheader();</ul>-->+<!--+<br><p>v0.391_20050726_424 (bugfix release)+<ul>+<li>Fixed division by zero on IndexCreate-page</li>+<li>Forcing delays of at least 100 milliseconds on Performance-page to prevent DoS behavior</li>+<li>Fixed release number display</li>+<li>Fixed name-entry bug on Settings-page</li>+<li></li>+<li></li>+<li></li>+<li></li>+<li></li>+<li></li>+</ul>+-->+<br><p>v0.39_20050722_424<ul><li>New Features:</li>diff --git a/htroot/IndexCreate_p.java b/htroot/IndexCreate_p.javaindex 59c9dce87..d1ad75568 100644--- a/htroot/IndexCreate_p.java+++ b/htroot/IndexCreate_p.java@@ -269,6 +269,10 @@ public class IndexCreate_p {prop.put("localIndexingChecked", env.getConfig("localIndexing", "").equals("true") ? 1 : 0);prop.put("crawlOrderChecked", env.getConfig("crawlOrder", "").equals("true") ? 1 : 0);long busySleep = Integer.parseInt(env.getConfig("62_remotetriggeredcrawl_busysleep", "100"));+ if (busySleep < 100) {+ busySleep = 100;+ env.setConfig("62_remotetriggeredcrawl_busysleep", "" + busySleep);+ }if (env.getConfig("crawlResponse", "").equals("true")) {if (busySleep <= 100) {prop.put("acceptCrawlMaxChecked", 1);diff --git a/htroot/Network.html b/htroot/Network.htmlindex 601240b28..6393dcae9 100644--- a/htroot/Network.html+++ b/htroot/Network.html@@ -46,9 +46,9 @@<td class="small">Hash<br> </td>#(/complete)#<td class="small">Type<br> </td>-<td class="small">Version<br> </td>+<td class="small">Version<br>Rel/SVN<br> </td><td class="small">Contact<br> </td>-<td class="small">Last Seen<br>#min ago<br> <br> <a href="/Network.html?page=#[page]#&sort=LastSeen&order=up"><</a> <a href="/Network.html?page=#[page]#&sort=LastSeen&order=down">></a></td>+<td class="small">Last Seen<br> <a href="/Network.html?page=#[page]#&sort=LastSeen&order=up"><</a> <a href="/Network.html?page=#[page]#&sort=LastSeen&order=down">></a></td><td class="small">Uptime<br> <a href="/Network.html?page=#[page]#&sort=Uptime&order=up"><</a> <a href="/Network.html?page=#[page]#&sort=Uptime&order=down">></a></td><td class="small">#Links<br> <a href="/Network.html?page=#[page]#&sort=LCount&order=up"><</a> <a href="/Network.html?page=#[page]#&sort=LCount&order=down">></a></td><td class="small">#RWIs<br> <a href="/Network.html?page=#[page]#&sort=ICount&order=up"><</a> <a href="/Network.html?page=#[page]#&sort=ICount&order=down">></a></td>diff --git a/htroot/Network.java b/htroot/Network.javaindex d5afeff1e..542ace43b 100644--- a/htroot/Network.java+++ b/htroot/Network.java@@ -193,7 +193,7 @@ public class Network {// generate tableint page = Integer.parseInt(post.get("page", "1"));int conCount = 0;- int maxCount = 100;+ int maxCount = 500;if (yacyCore.seedDB == null) {prop.put("table", 0);//no remote senior/principal proxies known"} else {@@ -256,7 +256,7 @@ public class Network {prop.put("table_list_"+conCount+"_type", 2);prop.put("table_list_"+conCount+"_type_url", seed.get("seedURL", "http://nowhere/") );}- prop.put("table_list_"+conCount+"_version", seed.get("Version", "-"));+ prop.put("table_list_"+conCount+"_version", yacy.combinedVersionString2PrettyString(seed.get("Version", "0.1")));prop.put("table_list_"+conCount+"_contact", (seed.getFlagDirectConnect() ? 1 : 0) );prop.put("table_list_"+conCount+"_lastSeen", lastSeen(seed.get("LastSeen", "-")) );prop.put("table_list_"+conCount+"_uptime", serverDate.intervalToString(60000 * Long.parseLong(seed.get("Uptime", "0"))));diff --git a/htroot/Performance_p.java b/htroot/Performance_p.javaindex 67e434b98..67b01fcc4 100644--- a/htroot/Performance_p.java+++ b/htroot/Performance_p.java@@ -145,7 +145,11 @@ public class Performance_p {// check values to prevent short-cut loopsif (idlesleep < 1000) idlesleep = 1000;if (threadName.equals("10_httpd")) { idlesleep = 0; busysleep = 0; memprereq = 0; }-+ if ((threadName.equals("50_localcrawl")) && (busysleep < 100)) busysleep = 100;+ if ((threadName.equals("61_globalcrawltrigger")) && (busysleep < 100)) busysleep = 100;+ if ((threadName.equals("62_remotetriggeredcrawl")) && (busysleep < 100)) busysleep = 100;++// on-the-fly re-configurationswitchboard.setThreadPerformance(threadName, idlesleep, busysleep, memprereq);switchboard.setConfig(threadName + "_idlesleep", idlesleep);diff --git a/htroot/SettingsAck_p.java b/htroot/SettingsAck_p.javaindex f1a02ccd5..cc446a28c 100644--- a/htroot/SettingsAck_p.java+++ b/htroot/SettingsAck_p.java@@ -297,8 +297,9 @@ public class SettingsAck_p {// check if peer name already existsString peerName = (String) post.get("peername");- String staticIP = (String)post.get("staticIP");- env.setConfig("staticIP", staticIP);+ String staticIP = (String)post.get("staticIP");+ env.setConfig("staticIP", staticIP);+ if (staticIP.length() > 0) yacyCore.seedDB.mySeed.put("IP", staticIP);yacySeed oldSeed = yacyCore.seedDB.lookupByName(peerName);if ((oldSeed == null) || (env.getConfig("peerName","").equals(peerName))) {diff --git a/htroot/Settings_p.html b/htroot/Settings_p.htmlindex 1f9578d44..7d12c2698 100644--- a/htroot/Settings_p.html+++ b/htroot/Settings_p.html@@ -70,14 +70,20 @@ delete the file 'DATA/SETTINGS/httpProxy.conf' in the YaCy application root fold<tr valign="top"><td>Peer Name:</td><td><input name="peername" type="text" size="32" maxlength="80" value="#[peerName]#"></td>- <td><b>Your peer name defines also a new '.yacy' - domain, which can be accessed from every peer running this proxy.- Using your 'Home Page' and 'File Share' - zones you also have a platform to provide content to your new domain.</b><br>+ <td><b>Your peer name defines also a new '.yacy' - domain, which can be accessed from every peer running this proxy.</b>+ Using your 'Home Page' and 'File Share' - zones you also have a platform to provide content to your new domain.<br><i>(hint: Choose a name that appears on a web page that tells something about you, visit the page, get the 'senior' status, and you can be found...)</i></td></tr><tr valign="top">- <td>staticIP(optional):</td>+ <td>staticIP (optional):</td><td><input name="staticIP" type="text" size="32" maxlength="80" value="#[staticIP]#"></td>- <td><b>If you have a static IP or a dyndns Account, enter it here to shorten the bootstrapping.</b><br>+ <td><b>The staticIP can help that your peer can be reached by other peers in case that your+ peer is behind a firewall or proxy.</b> You can create a tunnel through the firewall/proxy+ (look out for 'tunneling through https proxy with connect command') and create+ an access point for incoming connections.+ This access address can be set here (either as IP number or domain name).+ If the address of outgoing connections is equal to the address of incoming connections,+ you don't need to set anything here, please leave it blank.<br></tr><tr><td colspan="3"><input type="submit" name="generalsettings" value="submit"></td>diff --git a/htroot/Status.html b/htroot/Status.htmlindex 32bd2aaf7..2048a6056 100644--- a/htroot/Status.html+++ b/htroot/Status.html@@ -34,7 +34,7 @@ Your settings are protected by a password.#(/protection)#</td></tr><tr class="TableCellLight"><td>System version</td><td>-#[version]# (SVN #[svnRevision]#)#(versioncomment)#:: - the latest public version is #[latestVersion]#. Click here to <a href="http://www.yacy.net/yacy/Download.html">download</a> it.#(/versioncomment)#+#[versionpp]# #(versioncomment)#:: - the latest public version is #[latestVersion]#. Click here to <a href="http://www.yacy.net/yacy/Download.html">download</a> it.#(/versioncomment)#</td></tr><tr class="TableCellDark"><td>Proxy host</td><td>#[host]#:#[port]#</td></tr><tr class="TableCellLight"><td>Port forwarding host</td><td>#(portForwarding)#not used::#[host]#:#[port]# (#(status)#broken::connected#(/status)#)#(/portForwarding)#</td></tr>diff --git a/htroot/Status.java b/htroot/Status.javaindex 3800db9cf..686a0af0d 100644--- a/htroot/Status.java+++ b/htroot/Status.java@@ -80,11 +80,10 @@ public class Status {prop.put("protection", 1);//protected// version information- prop.put("svnRevision", env.getConfig("svnRevision", ""));- double thisVersion = Float.parseFloat(env.getConfig("version","0.1"));+ prop.put("versionpp", yacy.combinedVersionString2PrettyString(env.getConfig("version","0.1")));+ double thisVersion = Double.parseDouble(env.getConfig("version","0.1"));//cut off the SVN Rev in the Version- try {thisVersion = Math.round(thisVersion*100.0)/100.0;} catch (NumberFormatException e) {}- prop.put("version", thisVersion.toString()); //???+ try {thisVersion = Math.round(thisVersion*1000.0)/1000.0;} catch (NumberFormatException e) {}//System.out.println("TEST: "+thisVersion);if (yacyCore.latestVersion >= (thisVersion+0.01)) //only new Versions(not new SVN)prop.put("versioncomment", 1);//new versiondiff --git a/source/de/anomic/data/translator.java b/source/de/anomic/data/translator.javaindex 866c810d7..5952b1593 100644--- a/source/de/anomic/data/translator.java+++ b/source/de/anomic/data/translator.java@@ -71,7 +71,7 @@ public class translator {while(keys.hasMoreElements()){key = (String)keys.nextElement();result = result.replaceAll(key, (String)translationList.get(key));- //yacyCore.log.logDebug("Replaced \""+key+"\" by \""+translationList.getProperty(key)+"\""); //DEBUG+ //System.out.println("Replaced \""+key+"\" by \""+translationList.getProperty(key)+"\""); //DEBUG}return result;}diff --git a/source/de/anomic/data/wikiBoard.java b/source/de/anomic/data/wikiBoard.javaindex 6162b38d2..19d08b605 100644--- a/source/de/anomic/data/wikiBoard.java+++ b/source/de/anomic/data/wikiBoard.java@@ -146,7 +146,7 @@ public class wikiBoard {elserecord.put("page", serverCodings.enhancedCoder.encodeBase64(page));authors.put(ip, author);- //yacyCore.log.logDebug("DEBUG: setting author " + author + " for ip = " + ip + ", authors = " + authors.toString());+ //System.out.println("DEBUG: setting author " + author + " for ip = " + ip + ", authors = " + authors.toString());}private entry(String key, Map record) {@@ -259,9 +259,9 @@ public class wikiBoard {page.setAncestorDate(oldDate);oldEntry.setChild(page.subject());// write the backup- //yacyCore.log.logDebug("key = " + page.key);- //yacyCore.log.logDebug("oldDate = " + oldDate);- //yacyCore.log.logDebug("record = " + oldEntry.record.toString());+ //System.out.println("key = " + page.key);+ //System.out.println("oldDate = " + oldDate);+ //System.out.println("record = " + oldEntry.record.toString());bkpbase.set(page.key + dateString(oldDate), oldEntry.record);// write the new pagedatbase.set(page.key, page.record);diff --git a/source/de/anomic/htmlFilter/htmlFilterContentScraper.java b/source/de/anomic/htmlFilter/htmlFilterContentScraper.javaindex dc913b36a..263645a84 100644--- a/source/de/anomic/htmlFilter/htmlFilterContentScraper.java+++ b/source/de/anomic/htmlFilter/htmlFilterContentScraper.java@@ -96,7 +96,7 @@ public class htmlFilterContentScraper extends htmlFilterAbstractScraper implemen}public void scrapeText(byte[] newtext) {- //yacyCore.log.logDebug("SCRAPE: " + new String(newtext));+ //System.out.println("SCRAPE: " + new String(newtext));if ((text.length() != 0) && (text.byteAt(text.length() - 1) != 32)) text.append(32);text.append(super.stripAll(new serverByteBuffer(newtext, newtext.length + 1)).trim()).append(32);}@@ -130,7 +130,7 @@ public class htmlFilterContentScraper extends htmlFilterAbstractScraper implemen}public void scrapeTag1(String tagname, Properties tagopts, byte[] text) {- //yacyCore.log.logDebug("ScrapeTag1: tagname=" + tagname + ", opts=" + tagopts.toString() + ", text=" + new String(text));+ //System.out.println("ScrapeTag1: tagname=" + tagname + ", opts=" + tagopts.toString() + ", text=" + new String(text));if ((tagname.equalsIgnoreCase("a")) && (text.length < 2048)) anchors.put(absolutePath(tagopts.getProperty("href", "")), super.stripAll(new serverByteBuffer(text)).trim().toString());if ((tagname.equalsIgnoreCase("h1")) && (text.length < 1024)) headline = super.stripAll(new serverByteBuffer(text)).toString();if ((tagname.equalsIgnoreCase("title")) && (text.length < 1024)) title = super.stripAll(new serverByteBuffer(text)).toString();@@ -181,11 +181,11 @@ public class htmlFilterContentScraper extends htmlFilterAbstractScraper implemen}public void print() {- yacyCore.log.logInfo("TITLE :" + title);- yacyCore.log.logInfo("HEADLINE:" + headline);- yacyCore.log.logInfo("ANCHORS :" + anchors.toString());- yacyCore.log.logInfo("IMAGES :" + images.toString());- yacyCore.log.logInfo("TEXT :" + new String(text.getBytes()));+ System.out.println("TITLE :" + title);+ System.out.println("HEADLINE:" + headline);+ System.out.println("ANCHORS :" + anchors.toString());+ System.out.println("IMAGES :" + images.toString());+ System.out.println("TEXT :" + new String(text.getBytes()));}@@ -194,7 +194,7 @@ public class htmlFilterContentScraper extends htmlFilterAbstractScraper implementry {htmlFilterContentScraper scraper = new htmlFilterContentScraper(new URL("http://localhost"));scraper.scrapeText(test.getBytes());- yacyCore.log.logInfo(new String(scraper.getText()));+ System.out.println(new String(scraper.getText()));} catch (MalformedURLException e) {}}diff --git a/source/de/anomic/htmlFilter/htmlFilterContentTransformer.java b/source/de/anomic/htmlFilter/htmlFilterContentTransformer.javaindex 5c5ee845a..2cc646ee0 100644--- a/source/de/anomic/htmlFilter/htmlFilterContentTransformer.java+++ b/source/de/anomic/htmlFilter/htmlFilterContentTransformer.java@@ -77,7 +77,7 @@ public class htmlFilterContentTransformer extends htmlFilterAbstractTransformer}public void init(String initarg) {- //yacyCore.log.logDebug("Transformer init: " + initarg);+ //System.out.println("Transformer init: " + initarg);if (bluelist == null) {// here, the initarg is used to load a list of bluelisted wordsbluelist = new Vector();@@ -91,7 +91,7 @@ public class htmlFilterContentTransformer extends htmlFilterAbstractTransformerr.close();} catch (Exception e) {}- //if (bluelist.size() == 0) yacyCore.log.logInfo("BLUELIST is empty");+ //if (bluelist.size() == 0) System.out.println("BLUELIST is empty");}}@@ -117,7 +117,7 @@ public class htmlFilterContentTransformer extends htmlFilterAbstractTransformerpublic byte[] transformText(byte[] text) {if (hit(text)) {- yacyCore.log.logInfo("FILTERHIT: " + text);+ //System.out.println("FILTERHIT: " + text);return genBlueLetters(text.length);} elsereturn text;diff --git a/source/de/anomic/htmlFilter/htmlFilterOutputStream.java b/source/de/anomic/htmlFilter/htmlFilterOutputStream.javaindex d8881a412..c8dede24e 100644--- a/source/de/anomic/htmlFilter/htmlFilterOutputStream.java+++ b/source/de/anomic/htmlFilter/htmlFilterOutputStream.java@@ -159,7 +159,7 @@ public final class htmlFilterOutputStream extends OutputStream {}private byte[] filterTag(String tag, boolean opening, byte[] content, byte quotechar) {- //yacyCore.log.logDebug("FILTER1: filterTag=" + ((filterTag == null) ? "null" : filterTag) + ", tag=" + tag + ", opening=" + ((opening) ? "true" : "false") + ", content=" + new String(content)); // debug+ //System.out.println("FILTER1: filterTag=" + ((filterTag == null) ? "null" : filterTag) + ", tag=" + tag + ", opening=" + ((opening) ? "true" : "false") + ", content=" + new String(content)); // debugif (filterTag == null) {// we are not collection tag textif (tag == null) {@@ -245,7 +245,7 @@ public final class htmlFilterOutputStream extends OutputStream {private byte[] filterSentence(byte[] in, byte quotechar) {if (in.length == 0) return in;- //yacyCore.log.logDebug("FILTER0: " + new String(in)); // debug+ //System.out.println("FILTER0: " + new String(in)); // debug// scan the string and parse structureif ((in.length > 2) && (in[0] == lb)) {// a tag@@ -290,7 +290,7 @@ public final class htmlFilterOutputStream extends OutputStream {}private void write(byte b) throws IOException {- //yacyCore.log.logDebug((char) b);+ //System.out.println((char) b);if ((binaryUnsuspect) && (binaryHint(b))) {binaryUnsuspect = false;if (passbyIfBinarySuspect) finalize();@@ -423,7 +423,7 @@ public final class htmlFilterOutputStream extends OutputStream {}public void write(byte b[], int off, int len) throws IOException {- //yacyCore.log.logDebug(new String(b, off, len));+ //System.out.println(new String(b, off, len));if ((off | len | (b.length - (len + off)) | (off + len)) < 0) throw new IndexOutOfBoundsException();for (int i = off ; i < (len - off) ; i++) this.write(b[i]);}@@ -469,7 +469,7 @@ public final class htmlFilterOutputStream extends OutputStream {if (b > 31) return false;if ((b == 8) || (b == 9) || (b == 10) || (b == 13)) return false;//return false;- yacyCore.log.logInfo("BINARY HINT: " + (int) b);+ //System.out.println("BINARY HINT: " + (int) b);return true;}diff --git a/source/de/anomic/kelondro/kelondroRecords.java b/source/de/anomic/kelondro/kelondroRecords.javaindex 7f4719737..9b956cd85 100644--- a/source/de/anomic/kelondro/kelondroRecords.java+++ b/source/de/anomic/kelondro/kelondroRecords.java@@ -105,7 +105,7 @@ public class kelondroRecords {// POS_NODES : (USEDC + FREEC) * (overhead + sum(all: COLWIDTHS)) : Node Objects// values that are only present at run-time- protected String filename; // the database's file name+ protected String filename; // the database's file nameprotected kelondroRA entryFile; // the database fileprivate int overhead; // OHBYTEC + 4 * OHHANDLEC = size of additional control bytesprivate int recordsize; // (overhead + sum(all: COLWIDTHS)) = the overall size of a recorddiff --git a/source/de/anomic/plasma/plasmaHTCache.java b/source/de/anomic/plasma/plasmaHTCache.javaindex 35546cc60..49fa12efe 100644--- a/source/de/anomic/plasma/plasmaHTCache.java+++ b/source/de/anomic/plasma/plasmaHTCache.java@@ -181,17 +181,19 @@ public final class plasmaHTCache {}public void writeFileAnnouncement(File file) {- if (file.exists()) {- currCacheSize += file.length();- cacheAge.put(ageString(file.lastModified(), file), file);- cleanup();+ synchronized (cacheAge) {+ if (file.exists()) {+ currCacheSize += file.length();+ cacheAge.put(ageString(file.lastModified(), file), file);+ cleanup();+ }}}private void cleanup() {// clean up cache to have enough space for next entriesFile f;- while (currCacheSize > maxCacheSize) {+ while ((currCacheSize > maxCacheSize) && (cacheAge.size() > 0)) {f = (File) cacheAge.remove(cacheAge.firstKey());if ((f != null) && (f.exists())) {currCacheSize -= f.length();diff --git a/source/yacy.java b/source/yacy.javaindex 5b78ec859..79fc3e302 100644--- a/source/yacy.java+++ b/source/yacy.java@@ -112,15 +112,27 @@ public final class yacy {// static objectsprivate static String vString = "@REPL_VERSION@";- private static float version = (float) 0.1;+ private static double version = (double) 0.1;private static final String vDATE = "@REPL_DATE@";private static final String copyright = "[ YACY Proxy v" + vString + ", build " + vDATE + " by Michael Christen / www.yacy.net ]";private static final String hline = "-------------------------------------------------------------------------------";+ public static String combinedVersionString2PrettyString(String s) {+ long svn;+ try {svn = (long) ((double) 10000000 * Double.parseDouble(s));} catch (NumberFormatException ee) {svn = 1000000;}+ double version = (Math.floor((double) svn / (double) 10000) / (double) 1000);+ svn = svn % 10000;+ return ((version < 0.11) ? "dev" : "" + version) + "/" + ((svn == 0) ? "000" : ("" + svn));+ }++ public static double versvn2combinedVersionString(double version, int svn) {+ return version + (((double) svn) / 10000000.0);+ }+private static void startup(String homePath) {long startup = yacyCore.universalTime();- try {version = Float.parseFloat(vString);} catch (NumberFormatException e) {}+ try {version = Double.parseDouble(vString);} catch (NumberFormatException e) {version = (double) 0.1;}try {// start upSystem.out.println(copyright);@@ -177,7 +189,7 @@ public final class yacy {if (matcher.find()) {String svrReleaseNr = matcher.group(1);try {- version = version + (Float.parseFloat(svrReleaseNr) / (float) 10000000.0);+ version = versvn2combinedVersionString(version, Integer.parseInt(svrReleaseNr));} catch (NumberFormatException e) {}sb.setConfig("svnRevision", svrReleaseNr);}@@ -191,7 +203,7 @@ public final class yacy {sb.setConfig("applicationRoot", homePath);sb.setConfig("startupTime", "" + startup);serverLog.logSystem("STARTUP", "YACY Version: " + version + ", Built " + vDATE);- yacyCore.latestVersion = version;+ yacyCore.latestVersion = (float) version;// read environment//new