Skip to content

Commit

Permalink
*) fix for r5832
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5835 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
low012 committed Apr 19, 2009
1 parent ab0030d commit 31c6934
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions htroot/Blacklist_p.java
Expand Up @@ -36,6 +36,7 @@
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;

import de.anomic.data.AbstractBlacklist;
Expand Down Expand Up @@ -529,8 +530,7 @@ private static String addBlacklistEntry(final String blacklistToUse, String newE
newEntry = newEntry + "/.*";
}

if (supportedBlacklistTypes.length > 0 &&
!plasmaSwitchboard.urlBlacklist.contains(supportedBlacklistTypes[0], newEntry.substring(0, pos), newEntry.substring(pos + 1))) {
if (!blacklistFileContains(blacklistToUse, newEntry)) {
// append the line to the file
PrintWriter pw = null;
try {
Expand Down Expand Up @@ -610,4 +610,19 @@ private static String deleteBlacklistEntry(final String blacklistToUse, String o
return null;
}

/**
* Checks if a blacklist file contains a certain entry.
* @param blacklistToUse The blacklist.
* @param newEntry The Entry.
* @return True if file contains entry, else false.
*/
private static boolean blacklistFileContains(final String blacklistToUse, String newEntry) {
boolean ret = false;
final HashSet<String> Blacklist = new HashSet<String>(listManager.getListArray(new File(listManager.listsPath, blacklistToUse)));
if (Blacklist != null) {
ret = Blacklist.contains(newEntry);
}
return ret;
}

}

0 comments on commit 31c6934

Please sign in to comment.