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.
pull/60/head
reger 9 years ago
parent 5523998fdf
commit 5aaa057c65

@ -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 '#'.

Loading…
Cancel
Save