*) 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)

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4756 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
low012 17 years ago
parent d4bce6affd
commit 8d83febb95

@ -150,8 +150,9 @@ public class BlacklistCleaner_p {
private static void putBlacklists(serverObjects prop, String[] lists, String selected) { private static void putBlacklists(serverObjects prop, String[] lists, String selected) {
boolean supported = false; 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]); supported |= (plasmaSwitchboard.urlBlacklist.getClass() == supportedBLEngines[i]);
}
if (supported) { if (supported) {
if (lists.length > 0) { if (lists.length > 0) {
@ -166,8 +167,9 @@ public class BlacklistCleaner_p {
} }
} else { } else {
prop.put("disabled", "1"); 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.putHTML(DISABLED + "engines_" + i + "_name", supportedBLEngines[i].getName());
}
prop.put(DISABLED + "engines", supportedBLEngines.length); prop.put(DISABLED + "engines", supportedBLEngines.length);
} }
} }
@ -183,15 +185,19 @@ public class BlacklistCleaner_p {
String s; String s;
if (useKeys) { if (useKeys) {
Iterator<String> it = post.keySet().iterator(); Iterator<String> it = post.keySet().iterator();
while (it.hasNext()) while (it.hasNext()) {
if ((s = (String)it.next()).indexOf(prefix) == 0) if ((s = (String)it.next()).indexOf(prefix) == 0) {
r.add(s.substring(prefix.length())); r.add(s.substring(prefix.length()));
}
}
} else { } else {
Iterator<Map.Entry<String, String>> it = post.entrySet().iterator(); Iterator<Map.Entry<String, String>> it = post.entrySet().iterator();
Map.Entry<String, String> entry; Map.Entry<String, String> entry;
while (it.hasNext()) { while (it.hasNext()) {
entry = it.next(); 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; String s;
for (int i=0; i<entries.length; i++) { for (int i=0; i<entries.length; i++) {
s = entries[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 // remove the entry from the running blacklist engine
for (int blTypes=0; blTypes < supportedBlacklistTypes.length; blTypes++) { for (int blTypes=0; blTypes < supportedBlacklistTypes.length; blTypes++) {
@ -288,11 +298,16 @@ public class BlacklistCleaner_p {
try { try {
plasmaSwitchboard.urlBlacklist.remove(supportedBlacklistTypes[blTypes], plasmaSwitchboard.urlBlacklist.remove(supportedBlacklistTypes[blTypes],
host,path); 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; return entries.length;
} }

@ -182,9 +182,9 @@ public final class yacy {
// check java version // check java version
try { try {
/*String[] check =*/ "a,b".split(","); // split needs java 1.4 "a".codePointAt(0); // needs at least Java 1.5
} catch (NoSuchMethodError e) { } 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); Thread.sleep(3000);
System.exit(-1); System.exit(-1);
} }

Loading…
Cancel
Save