fixed div by zero, set default delays, fixed release number format and display

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@435 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 20 years ago
parent 12da0c2758
commit 3470a72d48

@ -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>

@ -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);

@ -46,9 +46,9 @@
<td class="small">Hash<br>&nbsp;</td>
#(/complete)#
<td class="small">Type<br>&nbsp;</td>
<td class="small">Version<br>&nbsp;</td>
<td class="small">Version<br>Rel/SVN<br>&nbsp;</td>
<td class="small">Contact<br>&nbsp;</td>
<td class="small">Last Seen<br>#min ago<br>&nbsp;<br>&nbsp;&nbsp;<a href="/Network.html?page=#[page]#&sort=LastSeen&order=up">&lt;</a>&nbsp;<a href="/Network.html?page=#[page]#&sort=LastSeen&order=down">&gt;</a></td>
<td class="small">Last Seen<br>&nbsp;&nbsp;<a href="/Network.html?page=#[page]#&sort=LastSeen&order=up">&lt;</a>&nbsp;<a href="/Network.html?page=#[page]#&sort=LastSeen&order=down">&gt;</a></td>
<td class="small">Uptime<br>&nbsp;&nbsp;<a href="/Network.html?page=#[page]#&sort=Uptime&order=up">&lt;</a>&nbsp;<a href="/Network.html?page=#[page]#&sort=Uptime&order=down">&gt;</a></td>
<td class="small">#Links<br>&nbsp;&nbsp;<a href="/Network.html?page=#[page]#&sort=LCount&order=up">&lt;</a>&nbsp;<a href="/Network.html?page=#[page]#&sort=LCount&order=down">&gt;</a></td>
<td class="small">#RWIs<br>&nbsp;&nbsp;<a href="/Network.html?page=#[page]#&sort=ICount&order=up">&lt;</a>&nbsp;<a href="/Network.html?page=#[page]#&sort=ICount&order=down">&gt;</a></td>

@ -193,7 +193,7 @@ public class Network {
// generate table
int 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"))));

@ -145,7 +145,11 @@ public class Performance_p {
// check values to prevent short-cut loops
if (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-configuration
switchboard.setThreadPerformance(threadName, idlesleep, busysleep, memprereq);
switchboard.setConfig(threadName + "_idlesleep", idlesleep);

@ -297,8 +297,9 @@ public class SettingsAck_p {
// check if peer name already exists
String 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))) {

@ -70,14 +70,20 @@ delete the file 'DATA/SETTINGS/httpProxy.conf' in the YaCy application root fold
<tr valign="top">
<td>Peer&nbsp;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>

@ -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>

@ -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 version

@ -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;
}

@ -146,7 +146,7 @@ public class wikiBoard {
else
record.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 page
datbase.set(page.key, page.record);

@ -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 implemen
try {
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) {}
}

@ -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 words
bluelist = new Vector();
@ -91,7 +91,7 @@ public class htmlFilterContentTransformer extends htmlFilterAbstractTransformer
r.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 htmlFilterAbstractTransformer
public byte[] transformText(byte[] text) {
if (hit(text)) {
yacyCore.log.logInfo("FILTERHIT: " + text);
//System.out.println("FILTERHIT: " + text);
return genBlueLetters(text.length);
} else
return text;

@ -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)); // debug
if (filterTag == null) {
// we are not collection tag text
if (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 structure
if ((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;
}

@ -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 name
protected kelondroRA entryFile; // the database file
private int overhead; // OHBYTEC + 4 * OHHANDLEC = size of additional control bytes
private int recordsize; // (overhead + sum(all: COLWIDTHS)) = the overall size of a record

@ -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 entries
File f;
while (currCacheSize > maxCacheSize) {
while ((currCacheSize > maxCacheSize) && (cacheAge.size() > 0)) {
f = (File) cacheAge.remove(cacheAge.firstKey());
if ((f != null) && (f.exists())) {
currCacheSize -= f.length();

@ -112,15 +112,27 @@ public final class yacy {
// static objects
private 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 up
System.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

Loading…
Cancel
Save