Skip to content

Commit 294d150

Browse files
authored
Merge pull request #528 from maxmind/greg/eng-2665
Require Java 17+
2 parents dea1194 + af59716 commit 294d150

26 files changed

Lines changed: 44 additions & 637 deletions

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
matrix:
1010
distribution: ['zulu']
1111
os: [ubuntu-latest, windows-latest, macos-latest]
12-
version: [ 11, 17, 21, 22 ]
12+
version: [ 17, 21, 24 ]
1313
steps:
1414
- uses: actions/checkout@v5
1515
with:

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
CHANGELOG
22
=========
33

4+
4.0.0
5+
------------------
6+
7+
* BREAKING: Removed deprecated `TransactionReport.Builder(InetAddress, Tag)`
8+
constructor. Use `Builder(Tag)` and `ipAddress(InetAddress)` instead.
9+
* BREAKING: Removed deprecated `getUrl()` methods from `HttpException` and
10+
`InvalidRequestException`. Use `getUri()` instead.
11+
* BREAKING: Removed deprecated constructors from `FactorsResponse`,
12+
`InsightsResponse`, and `Phone` classes.
13+
* BREAKING: Removed deprecated `Subscores` class and
14+
`FactorsResponse.getSubscores()` method. Use `getRiskScoreReasons()`
15+
instead.
16+
* BREAKING: Java 17 is now required (previously Java 11).
17+
418
3.9.0
519
------------------
620

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ To do this, add the dependency to your pom.xml:
1616
<dependency>
1717
<groupId>com.maxmind.minfraud</groupId>
1818
<artifactId>minfraud</artifactId>
19-
<version>3.8.0</version>
19+
<version>4.0.0</version>
2020
</dependency>
2121
```
2222

@@ -29,7 +29,7 @@ repositories {
2929
mavenCentral()
3030
}
3131
dependencies {
32-
compile 'com.maxmind.minfraud:minfraud:3.8.0'
32+
compile 'com.maxmind.minfraud:minfraud:4.0.0'
3333
}
3434
```
3535

@@ -281,7 +281,7 @@ to the client API, please see
281281

282282
## Requirements ##
283283

284-
This code requires Java 11+.
284+
This code requires Java 17+.
285285

286286
## Contributing ##
287287

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.maxmind.minfraud</groupId>
66
<artifactId>minfraud</artifactId>
7-
<version>3.8.0</version>
7+
<version>4.0.0</version>
88
<name>MaxMind minFraud API</name>
99
<description>MaxMind minFraud Score, Insights, Factors and Report Transaction API</description>
1010
<url>http://dev.maxmind.com/minfraud</url>
@@ -170,7 +170,7 @@
170170
<version>3.11.3</version>
171171
<configuration>
172172
<show>public</show>
173-
<source>11</source>
173+
<source>17</source>
174174
<doclint>-missing</doclint>
175175
</configuration>
176176
<executions>
@@ -206,9 +206,9 @@
206206
<artifactId>maven-compiler-plugin</artifactId>
207207
<version>3.14.0</version>
208208
<configuration>
209-
<release>11</release>
210-
<source>1.11</source>
211-
<target>1.11</target>
209+
<release>17</release>
210+
<source>17</source>
211+
<target>17</target>
212212
</configuration>
213213
</plugin>
214214
<plugin>

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

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import java.net.http.HttpResponse;
2525
import java.nio.charset.StandardCharsets;
2626
import java.time.Duration;
27-
import java.util.ArrayList;
2827
import java.util.Base64;
2928
import java.util.Collections;
3029
import java.util.HashMap;
@@ -168,7 +167,7 @@ public WebServiceClient.Builder locales(List<String> val) {
168167
if (locales == null) {
169168
throw new IllegalArgumentException("locales must not be null");
170169
}
171-
locales = new ArrayList<>(val);
170+
locales = List.copyOf(val);
172171
return this;
173172
}
174173

@@ -436,17 +435,11 @@ private void handleErrorWithJsonBody(Map<String, String> content,
436435
}
437436

438437
switch (code) {
439-
case "ACCOUNT_ID_REQUIRED":
440-
case "AUTHORIZATION_INVALID":
441-
case "LICENSE_KEY_REQUIRED":
442-
case "USER_ID_REQUIRED":
443-
throw new AuthenticationException(error);
444-
case "INSUFFICIENT_FUNDS":
445-
throw new InsufficientFundsException(error);
446-
case "PERMISSION_REQUIRED":
447-
throw new PermissionRequiredException(error);
448-
default:
449-
throw new InvalidRequestException(error, code, status, uri, null);
438+
case "ACCOUNT_ID_REQUIRED", "AUTHORIZATION_INVALID", "LICENSE_KEY_REQUIRED",
439+
"USER_ID_REQUIRED" -> throw new AuthenticationException(error);
440+
case "INSUFFICIENT_FUNDS" -> throw new InsufficientFundsException(error);
441+
case "PERMISSION_REQUIRED" -> throw new PermissionRequiredException(error);
442+
default -> throw new InvalidRequestException(error, code, status, uri, null);
450443
}
451444
}
452445

src/main/java/com/maxmind/minfraud/exception/HttpException.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package com.maxmind.minfraud.exception;
22

33
import java.io.IOException;
4-
import java.net.MalformedURLException;
54
import java.net.URI;
6-
import java.net.URL;
75

86
/**
97
* This class represents an HTTP transport error. This is not an error returned by the web service
@@ -51,16 +49,4 @@ public URI getUri() {
5149
return this.uri;
5250
}
5351

54-
/**
55-
* @return the URL queried.
56-
* @deprecated Use getUri() instead
57-
*/
58-
@Deprecated
59-
public URL getUrl() {
60-
try {
61-
return this.uri.toURL();
62-
} catch (MalformedURLException e) {
63-
return null;
64-
}
65-
}
6652
}

src/main/java/com/maxmind/minfraud/exception/InsufficientFundsException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This exception is thrown when your account does not have sufficient funds to complete the
55
* request.
66
*/
7-
public class InsufficientFundsException extends MinFraudException {
7+
public final class InsufficientFundsException extends MinFraudException {
88

99
/**
1010
* @param message A message explaining the cause of the error.

src/main/java/com/maxmind/minfraud/exception/InvalidRequestException.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
package com.maxmind.minfraud.exception;
22

3-
import java.net.MalformedURLException;
43
import java.net.URI;
5-
import java.net.URL;
64

75
/**
86
* This class represents a non-specific error returned by MaxMind's minFraud web service. This
97
* occurs when the web service is up and responding to requests, but the request sent was invalid in
108
* some way.
119
*/
12-
public class InvalidRequestException extends MinFraudException {
10+
public final class InvalidRequestException extends MinFraudException {
1311
private final String code;
1412
private final int httpStatus;
1513
private final URI uri;
@@ -63,16 +61,4 @@ public URI getUri() {
6361
return this.uri;
6462
}
6563

66-
/**
67-
* @return the URL queried.
68-
* @deprecated Use getUri() instead
69-
*/
70-
@Deprecated
71-
public URL getUrl() {
72-
try {
73-
return this.uri.toURL();
74-
} catch (MalformedURLException e) {
75-
return null;
76-
}
77-
}
7864
}

src/main/java/com/maxmind/minfraud/exception/MinFraudException.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
* It also serves as the base class for {@code AuthenticationException},
88
* {@code InsufficientFundsException}, and {@code InvalidRequestException}.
99
*/
10-
public class MinFraudException extends Exception {
10+
public sealed class MinFraudException extends Exception
11+
permits AuthenticationException, InsufficientFundsException, InvalidRequestException,
12+
PermissionRequiredException {
1113

1214
/**
1315
* @param message A message explaining the cause of the error.

src/main/java/com/maxmind/minfraud/request/AbstractLocation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected AbstractLocation(AbstractLocation.Builder builder) {
4141
* @param <T> the builder class
4242
*/
4343
@SuppressWarnings("unchecked")
44-
abstract static class Builder<T extends AbstractLocation.Builder> {
44+
abstract static class Builder<T extends AbstractLocation.Builder<T>> {
4545
private static final Pattern COUNTRY_CODE_PATTERN = Pattern.compile("^[A-Z]{2}$");
4646

4747
String firstName;

0 commit comments

Comments
 (0)