Commit b756eee6 authored by Karsten Loesing's avatar Karsten Loesing
Browse files

Avoid double-initialization of a local variable.

Note that the previous code was not wrong. It declared a local
variable and it read a line (containing headers). But these are two
distinct things, and doing them on one line confused the code
analyzer. Splitting them is just fine.
parent 91588c98
......@@ -129,7 +129,8 @@ public class LookupService {
this.geoLite2CityBlocksIPv4CsvFile)) {
SortedSet<Long> sortedAddressNumbers = new TreeSet<>(
addressStringNumbers.values());
String line = br.readLine();
String line;
br.readLine();
while ((line = br.readLine()) != null) {
String[] parts = line.split(",", -1);
if (parts.length < 9) {
......@@ -187,7 +188,8 @@ public class LookupService {
try (BufferedReader br = this.createBufferedReaderFromUtf8File(
this.geoLite2CityLocationsEnCsvFile)) {
Set<Long> blockNumbers = new HashSet<>(addressNumberBlocks.values());
String line = br.readLine();
String line;
br.readLine();
while ((line = br.readLine()) != null) {
String[] parts = line.replaceAll("\"", "").split(",", 13);
if (parts.length != 13) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment