commit e01e8ba9eb1f1a5f4f433c98bb3c4b78aeac3d15 Author: Karsten Loesing karsten.loesing@gmx.net Date: Tue Nov 20 16:51:10 2018 +0100
Accept empty AS names.
Partially takes back b45c630. --- .../java/org/torproject/metrics/onionoo/updater/LookupService.java | 5 ----- .../org/torproject/metrics/onionoo/updater/LookupServiceTest.java | 5 +++-- 2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/src/main/java/org/torproject/metrics/onionoo/updater/LookupService.java b/src/main/java/org/torproject/metrics/onionoo/updater/LookupService.java index 3664186..947c78c 100644 --- a/src/main/java/org/torproject/metrics/onionoo/updater/LookupService.java +++ b/src/main/java/org/torproject/metrics/onionoo/updater/LookupService.java @@ -250,11 +250,6 @@ public class LookupService { } String asNumber = "AS" + String.valueOf(Integer.parseInt(parts[1])); String asName = parts[2]; - if (asName.isEmpty()) { - log.error("Illegal AS name in '{}' in {}.", line, - this.geoLite2AsnBlocksIpv4CsvFile.getAbsolutePath()); - return lookupResults; - } while (firstAddressNumber < startIpNum && firstAddressNumber != -1L) { sortedAddressNumbers.remove(firstAddressNumber); diff --git a/src/test/java/org/torproject/metrics/onionoo/updater/LookupServiceTest.java b/src/test/java/org/torproject/metrics/onionoo/updater/LookupServiceTest.java index f521dfc..515280e 100644 --- a/src/test/java/org/torproject/metrics/onionoo/updater/LookupServiceTest.java +++ b/src/test/java/org/torproject/metrics/onionoo/updater/LookupServiceTest.java @@ -440,13 +440,14 @@ public class LookupServiceTest { }
@Test() - public void testLookupGeoLite2AsnBlocksIpv4TooFewFieldsNoAsName() { + public void testLookupGeoLite2AsnBlocksIpv4AsNameEmpty() { List<String> geoLite2AsnBlocksIpv4Lines = new ArrayList<>(); geoLite2AsnBlocksIpv4Lines.add("network,autonomous_system_number," + "autonomous_system_organization"); geoLite2AsnBlocksIpv4Lines.add("8.8.8.0/24,15169,"); this.assertLookupResult(null, null, geoLite2AsnBlocksIpv4Lines, "8.8.8.8", - null, null, null, null, null, null, null, null); + "us", "United States", "California", "Mountain View", 37.3860f, + -122.0838f, "AS15169", ""); }
@Test()