Skip to content

Commit 966f559

Browse files
committed
Manual Checkstyle fixes
1 parent 64cbdfc commit 966f559

File tree

3 files changed

+32
-33
lines changed

3 files changed

+32
-33
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public interface DatabaseProvider extends GeoIp2Provider {
1818

1919
/**
2020
* @param ipAddress IPv4 or IPv6 address to lookup.
21-
* @return A Country model for the requested IP address or empty if the IP address is not in the DB.
21+
* @return A Country model for the requested IP address or empty if it is not in the DB.
2222
* @throws GeoIp2Exception if there is an error looking up the IP
2323
* @throws IOException if there is an IO error
2424
*/
@@ -27,7 +27,7 @@ Optional<CountryResponse> tryCountry(InetAddress ipAddress) throws IOException,
2727

2828
/**
2929
* @param ipAddress IPv4 or IPv6 address to lookup.
30-
* @return A City model for the requested IP address or empty if the IP address is not in the DB.
30+
* @return A City model for the requested IP address or empty if it is not in the DB.
3131
* @throws GeoIp2Exception if there is an error looking up the IP
3232
* @throws IOException if there is an IO error
3333
*/
@@ -49,7 +49,7 @@ AnonymousIpResponse anonymousIp(InetAddress ipAddress) throws IOException,
4949
* Look up an IP address in a GeoIP2 Anonymous IP.
5050
*
5151
* @param ipAddress IPv4 or IPv6 address to lookup.
52-
* @return a AnonymousIpResponse for the requested IP address or empty if the IP address is not in the DB.
52+
* @return a AnonymousIpResponse for the requested IP address or empty if it is not in the DB.
5353
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
5454
* @throws java.io.IOException if there is an IO error
5555
*/
@@ -72,7 +72,7 @@ IpRiskResponse ipRisk(InetAddress ipAddress) throws IOException,
7272
* Look up an IP address in a GeoIP2 IP Risk database.
7373
*
7474
* @param ipAddress IPv4 or IPv6 address to lookup.
75-
* @return an IPRiskResponse for the requested IP address or empty if the IP address is not in the DB.
75+
* @return an IPRiskResponse for the requested IP address or empty if it is not in the DB.
7676
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
7777
* @throws java.io.IOException if there is an IO error
7878
*/
@@ -94,7 +94,7 @@ AsnResponse asn(InetAddress ipAddress) throws IOException,
9494
* Look up an IP address in a GeoLite2 ASN database.
9595
*
9696
* @param ipAddress IPv4 or IPv6 address to lookup.
97-
* @return an IspResponse for the requested IP address or empty if the IP address is not in the DB.
97+
* @return an IspResponse for the requested IP address or empty if it is not in the DB.
9898
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
9999
* @throws java.io.IOException if there is an IO error
100100
*/
@@ -116,7 +116,7 @@ ConnectionTypeResponse connectionType(InetAddress ipAddress)
116116
* Look up an IP address in a GeoIP2 Connection Type database.
117117
*
118118
* @param ipAddress IPv4 or IPv6 address to lookup.
119-
* @return a ConnectTypeResponse for the requested IP address or empty if the IP address is not in the DB.
119+
* @return a ConnectTypeResponse for the requested IP address or empty if it is not in the DB.
120120
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
121121
* @throws java.io.IOException if there is an IO error
122122
*/
@@ -138,7 +138,7 @@ DomainResponse domain(InetAddress ipAddress) throws IOException,
138138
* Look up an IP address in a GeoIP2 Domain database.
139139
*
140140
* @param ipAddress IPv4 or IPv6 address to lookup.
141-
* @return a DomainResponse for the requested IP address or empty if the IP address is not in the DB.
141+
* @return a DomainResponse for the requested IP address or empty if it is not in the DB.
142142
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
143143
* @throws java.io.IOException if there is an IO error
144144
*/
@@ -160,7 +160,7 @@ EnterpriseResponse enterprise(InetAddress ipAddress) throws IOException,
160160
* Look up an IP address in a GeoIP2 Enterprise database.
161161
*
162162
* @param ipAddress IPv4 or IPv6 address to lookup.
163-
* @return an EnterpriseResponse for the requested IP address or empty if the IP address is not in the DB.
163+
* @return an EnterpriseResponse for the requested IP address or empty if it is not in the DB.
164164
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
165165
* @throws java.io.IOException if there is an IO error
166166
*/
@@ -181,7 +181,7 @@ IspResponse isp(InetAddress ipAddress) throws IOException,
181181
/**
182182
* Look up an IP address in a GeoIP2 ISP database.
183183
*
184-
* @param ipAddress IPv4 or IPv6 address to look up or empty if the IP address is not in the DB.
184+
* @param ipAddress IPv4 or IPv6 address to look up or empty if it is not in the DB.
185185
* @return an IspResponse for the requested IP address.
186186
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
187187
* @throws java.io.IOException if there is an IO error

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,9 @@ public Builder withCache(NodeCache cache) {
211211
/**
212212
* @param val The file mode used to open the GeoIP2 database
213213
* @return Builder object
214-
* @throws java.lang.IllegalArgumentException if you initialized the Builder with a URL, which uses
215-
* {@link FileMode#MEMORY}, but you provided a different
216-
* FileMode to this method.
214+
* @throws java.lang.IllegalArgumentException if you initialized the Builder with a URL,
215+
* which uses {@link FileMode#MEMORY}, but you
216+
* provided a different FileMode to this method.
217217
*/
218218
public Builder fileMode(FileMode val) {
219219
if (this.stream != null && FileMode.MEMORY != val) {
@@ -262,7 +262,7 @@ Network getNetwork() {
262262
* @param ipAddress IPv4 or IPv6 address to lookup.
263263
* @param cls The class to deserialize to.
264264
* @param expectedType The expected database type.
265-
* @return A LookupResult<T> object with the data for the IP address
265+
* @return A {@code LookupResult<T>} object with the data for the IP address
266266
* @throws IOException if there is an error opening or reading from the file.
267267
*/
268268
private <T> LookupResult<T> get(InetAddress ipAddress, Class<T> cls,

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

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,8 @@ private WebServiceClient(Builder builder) {
129129
// HttpClient supports basic auth, but it will only send it after the
130130
// server responds with an unauthorized. As such, we just make the
131131
// Authorization header ourselves.
132-
this.authHeader = "Basic " +
133-
Base64.getEncoder()
134-
.encodeToString((builder.accountId + ":" + builder.licenseKey)
135-
.getBytes(StandardCharsets.UTF_8));
132+
this.authHeader = "Basic " + Base64.getEncoder().encodeToString(
133+
(builder.accountId + ":" + builder.licenseKey).getBytes(StandardCharsets.UTF_8));
136134

137135
mapper = JsonMapper.builder()
138136
.disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS)
@@ -156,7 +154,8 @@ private WebServiceClient(Builder builder) {
156154
* with the {@code Builder}:
157155
* </p>
158156
* <p>
159-
* {@code WebServiceClient client = new WebServiceClient.Builder(12,"licensekey").host("geoip.maxmind.com").build();}
157+
* {@code WebServiceClient client = new WebServiceClient.Builder(12,"licensekey")
158+
* .host("geoip.maxmind.com").build();}
160159
* </p>
161160
* <p>
162161
* Only the values set in the {@code Builder} constructor are required.
@@ -208,8 +207,8 @@ public Builder connectTimeout(Duration val) {
208207
}
209208

210209
/**
211-
* Disables HTTPS to connect to a test server or proxy. The minFraud ScoreResponse and InsightsResponse web services require
212-
* HTTPS.
210+
* Disables HTTPS to connect to a test server or proxy. The minFraud ScoreResponse and
211+
* InsightsResponse web services require HTTPS.
213212
*
214213
* @return Builder object
215214
*/
@@ -456,10 +455,10 @@ private static void handleErrorWithJsonBody(Map<String, String> content,
456455
throw new OutOfQueriesException(error);
457456
case "PERMISSION_REQUIRED":
458457
throw new PermissionRequiredException(error);
458+
default:
459+
// These should be fairly rare
460+
throw new InvalidRequestException(error, code, uri);
459461
}
460-
461-
// These should be fairly rare
462-
throw new InvalidRequestException(error, code, uri);
463462
}
464463

465464
private URI createUri(String service, InetAddress ipAddress) throws GeoIp2Exception {
@@ -504,15 +503,15 @@ public void close() throws IOException {
504503

505504
@Override
506505
public String toString() {
507-
return "WebServiceClient{" +
508-
"host='" + host + '\'' +
509-
", locales=" + locales +
510-
", useHttps=" + useHttps +
511-
", port=" + port +
512-
", requestTimeout=" + requestTimeout +
513-
", userAgent='" + userAgent + '\'' +
514-
", mapper=" + mapper +
515-
", httpClient=" + httpClient +
516-
'}';
506+
return "WebServiceClient{"
507+
+ "host='" + host + '\''
508+
+ ", locales=" + locales
509+
+ ", useHttps=" + useHttps
510+
+ ", port=" + port
511+
+ ", requestTimeout=" + requestTimeout
512+
+ ", userAgent='" + userAgent + '\''
513+
+ ", mapper=" + mapper
514+
+ ", httpClient=" + httpClient
515+
+ '}';
517516
}
518517
}

0 commit comments

Comments
 (0)