From 1faa045dc1e63852562f335600f565b22e1d22f8 Mon Sep 17 00:00:00 2001 From: reger Date: Sat, 1 Dec 2012 22:41:21 +0100 Subject: [PATCH] fix: prevent regex pattern compile error for blacklist import for path '*' (extend it to '.*') --- source/net/yacy/repository/Blacklist.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/net/yacy/repository/Blacklist.java b/source/net/yacy/repository/Blacklist.java index 19652e757..9ca6fae13 100644 --- a/source/net/yacy/repository/Blacklist.java +++ b/source/net/yacy/repository/Blacklist.java @@ -283,12 +283,13 @@ public class Blacklist { throw new IllegalArgumentException("path may not be null"); } - final String p = (!path.isEmpty() && path.charAt(0) == '/') ? path.substring(1) : path; + String p = (!path.isEmpty() && path.charAt(0) == '/') ? path.substring(1) : path; final Map> blacklistMap = getBlacklistMap(blacklistType, isMatchable(host)); // avoid PatternSyntaxException e final String h = ((!isMatchable(host) && !host.isEmpty() && host.charAt(0) == '*') ? "." + host : host).toLowerCase(); - + if (!p.isEmpty() && p.charAt(0) == '*') p = "." + p; + List hostList; if (!(blacklistMap.containsKey(h) && ((hostList = blacklistMap.get(h)) != null))) { blacklistMap.put(h, (hostList = new ArrayList()));