Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
*) fixed bug which affected blacklist entries which consisted of domain _and_ path parts *) minor cleanup
low01274b22dfa2495
diff --git a/source/net/yacy/repository/Blacklist.java b/source/net/yacy/repository/Blacklist.javaindex 7de638b2f..7c0945774 100644--- a/source/net/yacy/repository/Blacklist.java+++ b/source/net/yacy/repository/Blacklist.java@@ -188,7 +188,7 @@ public class Blacklist {List<String> paths;List<String> loadedPaths;- final String[] fileNames = blFile.getFileNamesUnified();+ final Set<String> fileNames = blFile.getFileNamesUnified();for (final String fileName : fileNames) {// make sure all requested blacklist files existfinal File file = new File(this.blacklistRootPath, fileName);@@ -262,7 +262,7 @@ public class Blacklist {final String p = (path.length() > 0 && path.charAt(0) == '/') ? path.substring(1) : path;- final Map<String, List<String>> blacklistMap = getBlacklistMap(blacklistType, (isMatchable(host)) ? true : false);+ final Map<String, List<String>> blacklistMap = getBlacklistMap(blacklistType, isMatchable(host));// avoid PatternSyntaxException efinal String h =@@ -294,7 +294,7 @@ public class Blacklist {if (blacklistType != null && host != null && path != null) {final Map<String, List<String>> blacklistMap =- getBlacklistMap(blacklistType, (isMatchable(host)) ? true : false);+ getBlacklistMap(blacklistType, isMatchable(host));// avoid PatternSyntaxException efinal String h =@@ -380,13 +380,13 @@ public class Blacklist {if ((app = blacklistMapMatched.get(hostlow.substring(0, index + 1) + "*")) != null) {for (int i = app.size() - 1; !matched && i > -1; i--) {pp = app.get(i);- matched |= (("*".equals(pp)) || (path.matches(pp)));+ matched |= (("*".equals(pp)) || (p.matches(pp)));}}if ((app = blacklistMapMatched.get(hostlow.substring(0, index))) != null) {for (int i = app.size() - 1; !matched && i > -1; i--) {pp = app.get(i);- matched |= (("*".equals(pp)) || (path.matches(pp)));+ matched |= (("*".equals(pp)) || (p.matches(pp)));}}}@@ -395,13 +395,13 @@ public class Blacklist {if ((app = blacklistMapMatched.get("*" + hostlow.substring(index, hostlow.length()))) != null) {for (int i = app.size() - 1; !matched && i > -1; i--) {pp = app.get(i);- matched |= (("*".equals(pp)) || (path.matches(pp)));+ matched |= (("*".equals(pp)) || (p.matches(pp)));}}if ((app = blacklistMapMatched.get(hostlow.substring(index + 1, hostlow.length()))) != null) {for (int i = app.size() - 1; !matched && i > -1; i--) {pp = app.get(i);- matched |= (("*".equals(pp)) || (path.matches(pp)));+ matched |= (("*".equals(pp)) || (p.matches(pp)));}}}@@ -417,7 +417,7 @@ public class Blacklist {if (Pattern.matches(key, hostlow)) {app = entry.getValue();for (int i = 0; i < app.size(); i++) {- if (Pattern.matches(app.get(i), path)) {+ if (Pattern.matches(app.get(i), p)) {return true;}}@@ -432,14 +432,10 @@ public class Blacklist {public BlacklistError checkError(final String element, final Map<String, String> properties) {- boolean allowRegex = true;+ final boolean allowRegex = (properties != null) && properties.get("allowRegex").equalsIgnoreCase("true");int slashPos;final String host, path;- if (properties != null) {- allowRegex = properties.get("allowRegex").equalsIgnoreCase("true") ? true : false;- }-if ((slashPos = element.indexOf('/')) == -1) {host = element;path = ".*";diff --git a/source/net/yacy/repository/BlacklistFile.java b/source/net/yacy/repository/BlacklistFile.javaindex 147de41ed..9895cae6a 100644--- a/source/net/yacy/repository/BlacklistFile.java+++ b/source/net/yacy/repository/BlacklistFile.java@@ -28,6 +28,7 @@ package net.yacy.repository;import java.util.Arrays;import java.util.HashSet;+import java.util.Set;public class BlacklistFile {@@ -48,10 +49,8 @@ public class BlacklistFile {** @return unified String array of file names*/- public String[] getFileNamesUnified() {- final HashSet<String> hs = new HashSet<String>(Arrays.asList(this.filename.split(",")));-- return hs.toArray(new String[hs.size()]);+ public Set<String> getFileNamesUnified() {+ return new HashSet<String>(Arrays.asList(this.filename.split(",")));}public String getType() { return this.type; }diff --git a/source/net/yacy/repository/FilterEngine.java b/source/net/yacy/repository/FilterEngine.javaindex b1758f171..7cf63465d 100644--- a/source/net/yacy/repository/FilterEngine.java+++ b/source/net/yacy/repository/FilterEngine.java@@ -217,14 +217,10 @@ public class FilterEngine {public int checkError(String element, Map<String, String> properties) {- boolean allowRegex = true;+ final boolean allowRegex = (properties != null) && properties.get("allowRegex").equalsIgnoreCase("true");int slashPos;String host, path;- if (properties != null) {- allowRegex = properties.get("allowRegex").equalsIgnoreCase("true") ? true : false;- }-if ((slashPos = element.indexOf('/')) == -1) {host = element;path = ".*";