Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

code-enhancements after analysis with AppPerfect

orbitera19541e563e6
diff --git a/source/de/anomic/kelondro/kelondroAbstractRA.java b/source/de/anomic/kelondro/kelondroAbstractRA.java
index d4a20044e..180e14dce 100644
--- a/source/de/anomic/kelondro/kelondroAbstractRA.java
+++ b/source/de/anomic/kelondro/kelondroAbstractRA.java
@@ -94,7 +94,7 @@ abstract class kelondroAbstractRA implements kelondroRA {
int ch3 = this.read();
int ch4 = this.read();
if ((ch1 | ch2 | ch3 | ch4) < 0) throw new IOException("kelondroAbstractRA.readInt: wrong values; ch1=" + ch1 + ", ch2=" + ch2 + ", ch3=" + ch3 + ", ch4=" + ch4);
- return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0));
+ return ((ch1 << 24) | (ch2 << 16) | (ch3 << 8) | ch4);
}
public void writeInt(int v) throws IOException {
@@ -122,7 +122,9 @@ abstract class kelondroAbstractRA implements kelondroRA {
private static final String crlf = new String(new byte[] {cr, lf});
public void writeLine(String line) throws IOException {
- this.write((line + crlf).getBytes());
+ this.write(line.getBytes());
+ this.write(cr);
+ this.write(lf);
}
public String readLine() throws IOException {
@@ -158,7 +160,9 @@ abstract class kelondroAbstractRA implements kelondroRA {
while (e.hasMoreElements()) {
key = (String) e.nextElement();
value = props.getProperty(key, "");
- writeLine(key + "=" + value);
+ write(key.getBytes());
+ write((byte) '0');
+ writeLine(value);
}
writeLine("# EOF");
}
@@ -171,7 +175,7 @@ abstract class kelondroAbstractRA implements kelondroRA {
while ((line = readLine()) != null) {
line = line.trim();
if (line.equals("# EOF")) return props;
- if ((line.length() == 0) || (line.startsWith("#"))) continue;
+ if ((line.length() == 0) || (line.charAt(0) == '#')) continue;
pos = line.indexOf("=");
if (pos < 0) continue;
props.setProperty(line.substring(0, pos).trim(), line.substring(pos + 1).trim());
@@ -200,7 +204,7 @@ abstract class kelondroAbstractRA implements kelondroRA {
while ((line = readLine()) != null) { // very slow readLine????
line = line.trim();
if (line.equals("# EOF")) return map;
- if ((line.length() == 0) || (line.startsWith("#"))) continue;
+ if ((line.length() == 0) || (line.charAt(0) == '#')) continue;
pos = line.indexOf("=");
if (pos < 0) continue;
map.put(line.substring(0, pos), line.substring(pos + 1));
diff --git a/source/de/anomic/plasma/plasmaHTCache.java b/source/de/anomic/plasma/plasmaHTCache.java
index 7e230983c..3326d2dd1 100644
--- a/source/de/anomic/plasma/plasmaHTCache.java
+++ b/source/de/anomic/plasma/plasmaHTCache.java
@@ -145,10 +145,13 @@ public final class plasmaHTCache {
private String ageString(long date, File f) {
String s = Integer.toHexString(f.hashCode());
- while (s.length() < 8) s = "0" + s;
- s = Long.toHexString(date) + s;
- while (s.length() < 24) s = "0" + s;
- return s;
+ StringBuffer sb = new StringBuffer(32);
+ for (int i = s.length(); i < 8; i++) sb.append('0');
+ sb.append(s);
+ s = Long.toHexString(date);
+ for (int i = s.length(); i < 16; i++) sb.append('0');
+ sb.append(s);
+ return sb.toString();
}
public void cacheScan() {
diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java
index d12c3d781..177824307 100644
--- a/source/de/anomic/plasma/plasmaSwitchboard.java
+++ b/source/de/anomic/plasma/plasmaSwitchboard.java
@@ -304,8 +304,11 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
File facilityDBpath = new File(getRootPath(), "DATA/SETTINGS/");
facilityDB = new kelondroTables(facilityDBpath);
facilityDB.declareMaps("backlinks", 250, 500, new String[] {"date"}, null);
+ log.logSystem("..opened backlinks");
facilityDB.declareMaps("zeitgeist", 40, 500);
+ log.logSystem("..opened zeitgeist");
facilityDB.declareTree("statistik", new int[]{11, 8, 8, 8, 8, 8, 8}, 0x400);
+ log.logSystem("..opened statistik");
facilityDB.update("statistik", (new serverDate()).toShortString(false).substring(0, 11), new long[]{1,2,3,4,5,6});
long[] testresult = facilityDB.selectLong("statistik", "yyyyMMddHHm");
testresult = facilityDB.selectLong("statistik", (new serverDate()).toShortString(false).substring(0, 11));