Skip to content

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

*) BlacklistCleaner_p.java reports exception to log instead of System.err *) changes in formatting for better readability in BlacklistCleaner_p.java *) replaced test for necessary Java version (was 1.4.2, is 1.5 now)

low0128d83febb953e
diff --git a/htroot/BlacklistCleaner_p.java b/htroot/BlacklistCleaner_p.java
index 68ff6c2d5..68924f4fa 100644
--- a/htroot/BlacklistCleaner_p.java
+++ b/htroot/BlacklistCleaner_p.java
@@ -150,8 +150,9 @@ public class BlacklistCleaner_p {
private static void putBlacklists(serverObjects prop, String[] lists, String selected) {
boolean supported = false;
- for (int i=0; i<supportedBLEngines.length && !supported; i++)
+ for (int i=0; i<supportedBLEngines.length && !supported; i++) {
supported |= (plasmaSwitchboard.urlBlacklist.getClass() == supportedBLEngines[i]);
+ }
if (supported) {
if (lists.length > 0) {
@@ -166,8 +167,9 @@ public class BlacklistCleaner_p {
}
} else {
prop.put("disabled", "1");
- for (int i=0; i<supportedBLEngines.length; i++)
+ for (int i=0; i<supportedBLEngines.length; i++) {
prop.putHTML(DISABLED + "engines_" + i + "_name", supportedBLEngines[i].getName());
+ }
prop.put(DISABLED + "engines", supportedBLEngines.length);
}
}
@@ -183,15 +185,19 @@ public class BlacklistCleaner_p {
String s;
if (useKeys) {
Iterator<String> it = post.keySet().iterator();
- while (it.hasNext())
- if ((s = (String)it.next()).indexOf(prefix) == 0)
+ while (it.hasNext()) {
+ if ((s = (String)it.next()).indexOf(prefix) == 0) {
r.add(s.substring(prefix.length()));
+ }
+ }
} else {
Iterator<Map.Entry<String, String>> it = post.entrySet().iterator();
Map.Entry<String, String> entry;
while (it.hasNext()) {
entry = it.next();
- if (entry.getKey().indexOf(prefix) == 0) r.add((String) entry.getValue());
+ if (entry.getKey().indexOf(prefix) == 0) {
+ r.add((String) entry.getValue());
+ }
}
}
@@ -278,7 +284,11 @@ public class BlacklistCleaner_p {
String s;
for (int i=0; i<entries.length; i++) {
s = entries[i];
- if (list != null) while (list.contains(s)) list.remove(s);
+ if (list != null){
+ while (list.contains(s)) {
+ list.remove(s);
+ }
+ }
// remove the entry from the running blacklist engine
for (int blTypes=0; blTypes < supportedBlacklistTypes.length; blTypes++) {
@@ -288,11 +298,16 @@ public class BlacklistCleaner_p {
try {
plasmaSwitchboard.urlBlacklist.remove(supportedBlacklistTypes[blTypes],
host,path);
- } catch (RuntimeException e) { System.err.println(e.getMessage() + ": " + host + "/" + path); }
+ } catch (RuntimeException e) {
+ //System.err.println(e.getMessage() + ": " + host + "/" + path);
+ serverLog.logSevere("BLACKLIST-CLEANER", e.getMessage() + ": " + host + "/" + path);
+ }
}
}
}
- if (list != null) listManager.writeList(new File(listManager.listsPath, blacklistToUse), (String[])list.toArray(new String[list.size()]));
+ if (list != null){
+ listManager.writeList(new File(listManager.listsPath, blacklistToUse), (String[])list.toArray(new String[list.size()]));
+ }
return entries.length;
}
diff --git a/source/yacy.java b/source/yacy.java
index 773a65b10..40e14fa80 100644
--- a/source/yacy.java
+++ b/source/yacy.java
@@ -182,9 +182,9 @@ public final class yacy {
// check java version
try {
- /*String[] check =*/ "a,b".split(","); // split needs java 1.4
+ "a".codePointAt(0); // needs at least Java 1.5
} catch (NoSuchMethodError e) {
- System.err.println("STARTUP: Java Version too low. You need at least Java 1.4.2 to run YaCy");
+ System.err.println("STARTUP: Java Version too low. You need at least Java 1.5 to run YaCy");
Thread.sleep(3000);
System.exit(-1);
}