Skip to content

Commit 774a2b9

Browse files
committed
Address some formatting issues
1 parent 025395e commit 774a2b9

File tree

4 files changed

+47
-45
lines changed

4 files changed

+47
-45
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
CHANGELOG
22
=========
3+
34
4.0.0
45
------------------
56

src/main/java/com/maxmind/geoip2/DatabaseProvider.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Optional<AnonymousIpResponse> tryAnonymousIp(InetAddress ipAddress) throws IOExc
5050
GeoIp2Exception;
5151

5252

53-
/**
53+
/**
5454
* Look up an IP address in a GeoIP2 IP Risk database.
5555
*
5656
* @param ipAddress IPv4 or IPv6 address to lookup.
@@ -69,8 +69,8 @@ IpRiskResponse ipRisk(InetAddress ipAddress) throws IOException,
6969
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
7070
* @throws java.io.IOException if there is an IO error
7171
*/
72-
Optional<IpRiskResponse> tryIpRisk(InetAddress ipAddress) throws IOException,
73-
GeoIp2Exception;
72+
Optional<IpRiskResponse> tryIpRisk(InetAddress ipAddress) throws IOException,
73+
GeoIp2Exception;
7474

7575
/**
7676
* Look up an IP address in a GeoLite2 ASN database.

src/main/java/com/maxmind/geoip2/DatabaseReader.java

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -413,51 +413,51 @@ private Optional<AnonymousIpResponse> getAnonymousIp(
413413
)
414414
);
415415
}
416+
416417
/**
417-
* Look up an IP address in a GeoIP2 IP Risk.
418-
*
419-
* @param ipAddress IPv4 or IPv6 address to lookup.
420-
* @return a IPRiskResponse for the requested IP address.
421-
* @throws GeoIp2Exception if there is an error looking up the IP
422-
* @throws IOException if there is an IO error
423-
*/
424-
@Override
425-
public IpRiskResponse ipRisk(InetAddress ipAddress) throws IOException,
426-
GeoIp2Exception {
427-
Optional<IpRiskResponse> r = getIpRisk(ipAddress);
428-
if (r.isEmpty()) {
429-
throw new AddressNotFoundException("The address "
430-
+ ipAddress.getHostAddress() + " is not in the database.");
431-
}
432-
return r.get();
433-
}
418+
* Look up an IP address in a GeoIP2 IP Risk database.
419+
*
420+
* @param ipAddress IPv4 or IPv6 address to lookup.
421+
* @return a IPRiskResponse for the requested IP address.
422+
* @throws GeoIp2Exception if there is an error looking up the IP
423+
* @throws IOException if there is an IO error
424+
*/
425+
@Override
426+
public IpRiskResponse ipRisk(InetAddress ipAddress) throws IOException,
427+
GeoIp2Exception {
428+
Optional<IpRiskResponse> r = getIpRisk(ipAddress);
429+
if (r.isEmpty()) {
430+
throw new AddressNotFoundException("The address "
431+
+ ipAddress.getHostAddress() + " is not in the database.");
432+
}
433+
return r.get();
434+
}
434435

435-
@Override
436-
public Optional<IpRiskResponse> tryIpRisk(InetAddress ipAddress) throws IOException,
437-
GeoIp2Exception {
438-
return getIpRisk(ipAddress);
439-
}
436+
@Override
437+
public Optional<IpRiskResponse> tryIpRisk(InetAddress ipAddress) throws IOException,
438+
GeoIp2Exception {
439+
return getIpRisk(ipAddress);
440+
}
440441

441-
private Optional<IpRiskResponse> getIpRisk(
442-
InetAddress ipAddress
443-
) throws IOException, GeoIp2Exception {
444-
LookupResult<IpRiskResponse> result = this.get(
445-
ipAddress,
446-
IpRiskResponse.class,
447-
DatabaseType.IP_RISK
448-
);
449-
IpRiskResponse response = result.getModel();
450-
if (response == null) {
451-
return Optional.empty();
452-
}
453-
return Optional.of(
454-
new IpRiskResponse(
455-
response,
456-
result.getIpAddress(),
457-
result.getNetwork()
458-
)
459-
);
460-
}
442+
private Optional<IpRiskResponse> getIpRisk( InetAddress ipAddress) throws IOException,
443+
GeoIp2Exception {
444+
LookupResult<IpRiskResponse> result = this.get(
445+
ipAddress,
446+
IpRiskResponse.class,
447+
DatabaseType.IP_RISK
448+
);
449+
IpRiskResponse response = result.getModel();
450+
if (response == null) {
451+
return Optional.empty();
452+
}
453+
return Optional.of(
454+
new IpRiskResponse(
455+
response,
456+
result.getIpAddress(),
457+
result.getNetwork()
458+
)
459+
);
460+
}
461461

462462
/**
463463
* Look up an IP address in a GeoLite2 ASN database.

src/test/java/com/maxmind/geoip2/DatabaseReaderTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ public void testAnonymousIp() throws Exception {
215215
assertEquals(response.toJson(), tryResponse.toJson());
216216
}
217217
}
218+
218219
@Test
219220
public void testIPRisk() throws Exception {
220221
try (DatabaseReader reader = new DatabaseReader.Builder(

0 commit comments

Comments
 (0)