Skip to content

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

ignore empty input lines in FileUtils.getListArray() to poka joke blacklist read. equalizes behavior with getListString() improves: case were blacklist file contained a undesired empty line, not fixed by blacklist-cleaner.

reger5aaa057c65da
diff --git a/source/net/yacy/kelondro/util/FileUtils.java b/source/net/yacy/kelondro/util/FileUtils.java
index e3f748c65..c9e8564fb 100644
--- a/source/net/yacy/kelondro/util/FileUtils.java
+++ b/source/net/yacy/kelondro/util/FileUtils.java
@@ -517,6 +517,7 @@ public final class FileUtils {
/**
* Read lines of a file into an ArrayList.
+ * Empty lines in the file are ignored.
*
* @param listFile the file
* @return the resulting array as an ArrayList
@@ -529,7 +530,7 @@ public final class FileUtils {
br = new BufferedReader(new InputStreamReader(new FileInputStream(listFile), StandardCharsets.UTF_8));
while ( (line = br.readLine()) != null ) {
- list.add(line);
+ if (!line.isEmpty()) list.add(line);
}
br.close();
} catch (final IOException e ) {
@@ -576,6 +577,7 @@ public final class FileUtils {
/**
* Read lines of a text file into a String, optionally ignoring comments.
+ * Empty lines are always ignored.
*
* @param listFile the File to read from.
* @param withcomments If <code>false</code> ignore lines starting with '#'.