Skip to content

Commit 2f1edaf

Browse files
authored
Merge pull request #261 from maxmind/greg/module
Make a Java Module and prepare for 3.0.0 release
2 parents c9cf7b5 + 1894c5b commit 2f1edaf

69 files changed

Lines changed: 1119 additions & 1109 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,7 @@ jobs:
1717
with:
1818
distribution: ${{ matrix.distribution }}
1919
java-version: ${{ matrix.version }}
20-
- run: mvn javadoc:javadoc
2120
- run: mvn test -B
21+
# This is after the test run to work around
22+
# https://issues.apache.org/jira/projects/MJAVADOC/issues/MJAVADOC-736
23+
- run: mvn javadoc:javadoc

CHANGELOG.md

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
CHANGELOG
22
=========
33

4+
3.0.0
5+
------------------
6+
7+
* This library is now a Java module.
8+
* Removed deprecated `last4Digits` method on `CreditCard.Builder` and
9+
`getLast4Digits` method on `CreditCard`. Use `lastDigits` and
10+
`getLastDigits` instead.
11+
* Removed deprecated `connectTimeout(int)`, `readTimeout(int)`, and
12+
`proxy(Proxy)` on `WebServiceClient.Builder`. Use
13+
`connectTimeout(Duration)`, `requestTimeout(Duration)`, and
14+
`proxy(ProxySelector)` instead.
15+
* `WebServiceClient` no longer implements `Closeable` and the `Close`
16+
method has been removed. This method was deprecated when the library
17+
switched to using `java.net.http.HttpClient`.
18+
419
2.2.0 (2022-10-31)
520
------------------
621

@@ -62,9 +77,9 @@ CHANGELOG
6277
* `TRUSTLY`
6378
* `WINDCAVE`
6479
* `com.maxmind.minfraud.request.CreditCard.last4Digits` has been deprecated in
65-
favor of `lastDigits` and will be removed in a future release. `lastDigits`
66-
/ `last4Digits` also now supports two digit values in addition to the
67-
previous four digit values.
80+
favor of `lastDigits` and will be removed in a future release. `lastDigits`
81+
/ `last4Digits` also now supports two digit values in addition to the
82+
previous four digit values.
6883
* Eight digit `com.maxmind.minfraud.request.CreditCard.issuerIdNumber` inputs are
6984
now supported in addition to the previously accepted six digit `issuerIdNumber`.
7085
In most cases, you should send the last four digits for
@@ -281,24 +296,24 @@ CHANGELOG
281296

282297
* Added support for custom inputs. These can be set up from your account portal.
283298
* Added support for new Device inputs. These are:
284-
* `/device/session_age`
285-
* `/device/session_id`
299+
* `/device/session_age`
300+
* `/device/session_id`
286301
* Added support for new Email outputs. These are:
287-
* `/email/first_seen`
302+
* `/email/first_seen`
288303
* The following payment processors were added to the `Payment.Processor` enum:
289-
* `AMERICAN_EXPRESS_PAYMENT_GATEWAY`
290-
* `BLUESNAP`
291-
* `COMMDOO`
292-
* `CUROPAYMENTS`
293-
* `EXACT`
294-
* `OCEANPAYMENT`
295-
* `PAYMENTWALL`
296-
* `PAYZA`
297-
* `SECURETRADING`
298-
* `SOLIDTRUST_PAY`
299-
* `VANTIV`
300-
* `VERICHECK`
301-
* `VPOS`
304+
* `AMERICAN_EXPRESS_PAYMENT_GATEWAY`
305+
* `BLUESNAP`
306+
* `COMMDOO`
307+
* `CUROPAYMENTS`
308+
* `EXACT`
309+
* `OCEANPAYMENT`
310+
* `PAYMENTWALL`
311+
* `PAYZA`
312+
* `SECURETRADING`
313+
* `SOLIDTRUST_PAY`
314+
* `VANTIV`
315+
* `VERICHECK`
316+
* `VPOS`
302317

303318
1.4.0 (2017-02-22)
304319
------------------
@@ -377,11 +392,11 @@ CHANGELOG
377392
------------------
378393

379394
* Added support for new minFraud Insights outputs. These are:
380-
* `/credit_card/brand`
381-
* `/credit_card/type`
382-
* `/device/id`
383-
* `/email/is_free`
384-
* `/email/is_high_risk`
395+
* `/credit_card/brand`
396+
* `/credit_card/type`
397+
* `/device/id`
398+
* `/email/is_free`
399+
* `/email/is_high_risk`
385400
* The `Warning.getInput()` method has been replaced by
386401
`Warning.getInputPointer()`, which returns a JSON Pointer rather than array.
387402
* The `ScoreResponse.getId()` and `InsightsResponse.getId()` methods now

README.dev.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Preparing your environment for a release
2+
23
- Ensure you have access to publish to the repository on
34
[Sonatype](https://oss.sonatype.org).
45
- See the section about Sonatype access.
@@ -14,8 +15,8 @@
1415
`PATH`.
1516
- An easy way to do this is get a release tarball and run `./install`.
1617

17-
1818
## Setting up Sonatype access
19+
1920
To get this access, make an account on the [Sonatype JIRA issue
2021
tracker](https://issues.sonatype.org/) and make an issue asking for access
2122
[like so](https://issues.sonatype.org/browse/OSSRH-34414).
@@ -66,14 +67,14 @@ Some links about Sonatype:
6667
* http://central.sonatype.org/pages/releasing-the-deployment.html
6768
* http://central.sonatype.org/pages/apache-maven.html
6869

69-
7070
See the following documentation for details on specifying which gpg to use for
7171
publishing in your local settings.xml:
7272

7373
* https://central.sonatype.org/publish/requirements/gpg/
7474
* https://maven.apache.org/plugins/maven-gpg-plugin/usage.html
7575

7676
## Setting up GPG
77+
7778
You need a key. It is fine to create/use your own, but you'll probably want
7879
one with your MaxMind email address.
7980

@@ -93,8 +94,8 @@ Make sure you publish it to a keyserver. See
9394
[here](http://central.sonatype.org/pages/working-with-pgp-signatures.html)
9495
for more info about that and the process in general.
9596

96-
9797
### gpg "inappropriate ioctl" errors
98+
9899
You only really need to do this if you see "inappropriate ioctl" errors,
99100
but it shouldn't hurt to proactively do this.
100101

@@ -107,10 +108,10 @@ Add this to ~/.gnupg/gpg-agent.conf:
107108

108109
allow-loopback-pinentry
109110

110-
111111
# Releasing
112112

113113
## Steps
114+
114115
- Ensure you can run `mvn test` and `mvn package` successfully. Run
115116
`mvn clean` after.
116117
- Create a release branch off `main`. Ensure you have a clean checkout and that
@@ -164,8 +165,8 @@ Add this to ~/.gnupg/gpg-agent.conf:
164165
search on [Sonatype](https://oss.sonatype.org) to see the version is as
165166
you expect.
166167

167-
168168
## Updating dependencies
169+
169170
Review the versions and look at what changed in their changelogs. If you
170171
think it is appropriate to update the dependencies, stop the release
171172
process (say `n` or ctrl-c out).

checkstyle-suppressions.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0"?>
2+
3+
<!DOCTYPE suppressions PUBLIC
4+
"-//Checkstyle//DTD SuppressionFilter Configuration 1.0//EN"
5+
"https://checkstyle.org/dtds/suppressions_1_0.dtd">
6+
7+
<suppressions>
8+
<suppress checks="Indentation" files="Email.java" lines="28-38"/>
9+
<suppress checks="LineLength" files="AbstractAddress.java" lines="13"/>
10+
<suppress checks="LineLength" files="AbstractLocation.java" lines="131"/>
11+
<suppress checks="LineLength" files="CreditCard.java" lines="33,43,44,67,93,95,140,142"/>
12+
<suppress checks="LineLength" files="Email.java" lines="93"/>
13+
<suppress checks="LineLength" files="GeoIp2Location.java" lines="25"/>
14+
<suppress checks="LineLength" files="IpAddress.java" lines="33,53,56"/>
15+
<suppress checks="LineLength" files="ScoreResponse.java" lines="37"/>
16+
<suppress checks="LineLength" files="ShoppingCartItem.java" lines="58"/>
17+
<suppress checks="LineLength" files="Subscores.java" lines="32,41,46,52,66"/>
18+
<suppress checks="LineLength" files="TransactionReport.java" lines="75,76,82"/>
19+
<suppress checks="LineLength" files="WebServiceClient.java" lines="143,393,504"/>
20+
21+
</suppressions>

checkstyle.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<!-- https://checkstyle.org/config_filters.html#SuppressionFilter -->
3333
<module name="SuppressionFilter">
3434
<property name="file" value="${org.checkstyle.google.suppressionfilter.config}"
35-
default="checkstyle-suppressions.xml" />
35+
default="checkstyle-suppressions.xml"/>
3636
<property name="optional" value="true"/>
3737
</module>
3838

@@ -362,14 +362,14 @@
362362
<!-- https://checkstyle.org/config_filters.html#SuppressionXpathFilter -->
363363
<module name="SuppressionXpathFilter">
364364
<property name="file" value="${org.checkstyle.google.suppressionxpathfilter.config}"
365-
default="checkstyle-xpath-suppressions.xml" />
365+
default="checkstyle-xpath-suppressions.xml"/>
366366
<property name="optional" value="true"/>
367367
</module>
368-
<module name="SuppressWarningsHolder" />
368+
<module name="SuppressWarningsHolder"/>
369369
<module name="SuppressionCommentFilter">
370-
<property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)" />
371-
<property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)" />
372-
<property name="checkFormat" value="$1" />
370+
<property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/>
371+
<property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/>
372+
<property name="checkFormat" value="$1"/>
373373
</module>
374374
<module name="SuppressWithNearbyCommentFilter">
375375
<property name="commentFormat" value="CHECKSTYLE.SUPPRESS\: ([\w\|]+)"/>

pom.xml

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
34
<modelVersion>4.0.0</modelVersion>
45

56
<groupId>com.maxmind.minfraud</groupId>
@@ -35,13 +36,6 @@
3536
<email>goschwald@maxmind.com</email>
3637
</developer>
3738
</developers>
38-
<properties>
39-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
40-
<checkstyle-maven-plugin.version>3.2.0</checkstyle-maven-plugin.version>
41-
<checkstyle.version>10.3</checkstyle.version>
42-
<checkstyle.config.location>checkstyle.xml</checkstyle.config.location>
43-
<checkstyle.suppressions.location>suppressions.xml</checkstyle.suppressions.location>
44-
</properties>
4539
<dependencies>
4640
<dependency>
4741
<groupId>com.fasterxml.jackson.core</groupId>
@@ -113,34 +107,26 @@
113107
<build>
114108
<plugins>
115109
<plugin>
116-
<groupId>org.openrewrite.maven</groupId>
117-
<artifactId>rewrite-maven-plugin</artifactId>
118-
<version>4.37.0</version>
119-
<configuration>
120-
<activeRecipes>
121-
<recipe>org.openrewrite.java.cleanup.Cleanup</recipe>
122-
</activeRecipes>
123-
</configuration>
124-
</plugin>
125-
<plugin>
126-
127110
<groupId>org.apache.maven.plugins</groupId>
128111
<artifactId>maven-checkstyle-plugin</artifactId>
129-
<version>${checkstyle-maven-plugin.version}</version>
112+
<version>3.2.0</version>
130113
<configuration>
131114
<consoleOutput>true</consoleOutput>
115+
<configLocation>checkstyle.xml</configLocation>
116+
<suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
117+
<violationSeverity>warning</violationSeverity>
132118
</configuration>
133119
<dependencies>
134120
<dependency>
135121
<groupId>com.puppycrawl.tools</groupId>
136122
<artifactId>checkstyle</artifactId>
137-
<version>${checkstyle.version}</version>
123+
<version>10.5.0</version>
138124
</dependency>
139125
</dependencies>
140126
<executions>
141127
<execution>
142-
<id>validate</id>
143-
<phase>validate</phase>
128+
<id>test</id>
129+
<phase>test</phase>
144130
<goals>
145131
<goal>check</goal>
146132
</goals>
@@ -249,7 +235,7 @@
249235
<configuration>
250236
<format>xml</format>
251237
<maxmem>256m</maxmem>
252-
<check />
238+
<check/>
253239
</configuration>
254240
</plugin>
255241
<plugin>
@@ -270,7 +256,7 @@
270256
<plugin>
271257
<groupId>org.apache.maven.plugins</groupId>
272258
<artifactId>maven-checkstyle-plugin</artifactId>
273-
<version>${checkstyle-maven-plugin.version}</version>
259+
<version>3.2.0</version>
274260
<reportSets>
275261
<reportSet>
276262
<reports>

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
1111

1212
class Mapper {
13-
private static final ObjectMapper mapper = JsonMapper.builder()
14-
.addModule(new JavaTimeModule())
15-
.defaultDateFormat(new StdDateFormat().withColonInTimeZone(true))
16-
.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)
17-
.disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS)
18-
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
19-
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
20-
.serializationInclusion(JsonInclude.Include.NON_NULL)
21-
.serializationInclusion(JsonInclude.Include.NON_EMPTY)
22-
.build();
13+
private static final ObjectMapper mapper = JsonMapper.builder()
14+
.addModule(new JavaTimeModule())
15+
.defaultDateFormat(new StdDateFormat().withColonInTimeZone(true))
16+
.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)
17+
.disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS)
18+
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
19+
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
20+
.serializationInclusion(JsonInclude.Include.NON_NULL)
21+
.serializationInclusion(JsonInclude.Include.NON_EMPTY)
22+
.build();
2323

2424
public static ObjectMapper get() {
2525
return mapper;

0 commit comments

Comments
 (0)