result = this.get(ipAddress, cls, expectedType, caller);
+ T response = result.model();
+ if (response == null) {
+ return Optional.empty();
+ }
+ return Optional.of(response);
+ }
+
/**
*
* Closes the database.
@@ -288,7 +311,7 @@ public void close() throws IOException {
@Override
public CountryResponse country(InetAddress ipAddress) throws IOException,
GeoIp2Exception {
- Optional r = getCountry(ipAddress);
+ Optional r = tryCountry(ipAddress);
if (r.isEmpty()) {
throw new AddressNotFoundException("The address "
+ ipAddress.getHostAddress() + " is not in the database.");
@@ -299,33 +322,19 @@ public CountryResponse country(InetAddress ipAddress) throws IOException,
@Override
public Optional tryCountry(InetAddress ipAddress) throws IOException,
GeoIp2Exception {
- return getCountry(ipAddress);
- }
-
- private Optional getCountry(
- InetAddress ipAddress
- ) throws IOException, GeoIp2Exception {
- LookupResult result = this.get(
+ Optional response = getResponse(
ipAddress,
CountryResponse.class,
- DatabaseType.COUNTRY
- );
- CountryResponse response = result.model();
- if (response == null) {
- return Optional.empty();
- }
- return Optional.of(
- new CountryResponse(
- response,
- locales
- )
+ DatabaseType.COUNTRY,
+ "country"
);
+ return response.map(r -> new CountryResponse(r, locales));
}
@Override
public CityResponse city(InetAddress ipAddress) throws IOException,
GeoIp2Exception {
- Optional r = getCity(ipAddress);
+ Optional r = tryCity(ipAddress);
if (r.isEmpty()) {
throw new AddressNotFoundException("The address "
+ ipAddress.getHostAddress() + " is not in the database.");
@@ -336,24 +345,13 @@ public CityResponse city(InetAddress ipAddress) throws IOException,
@Override
public Optional tryCity(InetAddress ipAddress) throws IOException,
GeoIp2Exception {
- return getCity(ipAddress);
- }
-
- private Optional getCity(
- InetAddress ipAddress
- ) throws IOException, GeoIp2Exception {
- LookupResult result = this.get(
+ Optional response = getResponse(
ipAddress,
CityResponse.class,
- DatabaseType.CITY
- );
- CityResponse response = result.model();
- if (response == null) {
- return Optional.empty();
- }
- return Optional.of(
- new CityResponse(response, locales)
+ DatabaseType.CITY,
+ "city"
);
+ return response.map(r -> new CityResponse(r, locales));
}
/**
@@ -367,7 +365,7 @@ private Optional getCity(
@Override
public AnonymousIpResponse anonymousIp(InetAddress ipAddress) throws IOException,
GeoIp2Exception {
- Optional r = getAnonymousIp(ipAddress);
+ Optional r = tryAnonymousIp(ipAddress);
if (r.isEmpty()) {
throw new AddressNotFoundException("The address "
+ ipAddress.getHostAddress() + " is not in the database.");
@@ -378,22 +376,12 @@ public AnonymousIpResponse anonymousIp(InetAddress ipAddress) throws IOException
@Override
public Optional tryAnonymousIp(InetAddress ipAddress) throws IOException,
GeoIp2Exception {
- return getAnonymousIp(ipAddress);
- }
-
- private Optional getAnonymousIp(
- InetAddress ipAddress
- ) throws IOException, GeoIp2Exception {
- LookupResult result = this.get(
+ return getResponse(
ipAddress,
AnonymousIpResponse.class,
- DatabaseType.ANONYMOUS_IP
+ DatabaseType.ANONYMOUS_IP,
+ "anonymousIp"
);
- AnonymousIpResponse response = result.model();
- if (response == null) {
- return Optional.empty();
- }
- return Optional.of(response);
}
/**
@@ -407,7 +395,7 @@ private Optional getAnonymousIp(
@Override
public AnonymousPlusResponse anonymousPlus(InetAddress ipAddress) throws IOException,
GeoIp2Exception {
- Optional r = getAnonymousPlus(ipAddress);
+ Optional r = tryAnonymousPlus(ipAddress);
if (r.isEmpty()) {
throw new AddressNotFoundException("The address "
+ ipAddress.getHostAddress() + " is not in the database.");
@@ -419,22 +407,12 @@ public AnonymousPlusResponse anonymousPlus(InetAddress ipAddress) throws IOExcep
public Optional tryAnonymousPlus(InetAddress ipAddress)
throws IOException,
GeoIp2Exception {
- return getAnonymousPlus(ipAddress);
- }
-
- private Optional getAnonymousPlus(
- InetAddress ipAddress
- ) throws IOException, GeoIp2Exception {
- LookupResult result = this.get(
+ return getResponse(
ipAddress,
AnonymousPlusResponse.class,
- DatabaseType.ANONYMOUS_PLUS
+ DatabaseType.ANONYMOUS_PLUS,
+ "anonymousPlus"
);
- AnonymousPlusResponse response = result.model();
- if (response == null) {
- return Optional.empty();
- }
- return Optional.of(response);
}
@@ -449,7 +427,7 @@ private Optional getAnonymousPlus(
@Override
public IpRiskResponse ipRisk(InetAddress ipAddress) throws IOException,
GeoIp2Exception {
- Optional r = getIpRisk(ipAddress);
+ Optional r = tryIpRisk(ipAddress);
if (r.isEmpty()) {
throw new AddressNotFoundException("The address "
+ ipAddress.getHostAddress() + " is not in the database.");
@@ -460,21 +438,7 @@ public IpRiskResponse ipRisk(InetAddress ipAddress) throws IOException,
@Override
public Optional tryIpRisk(InetAddress ipAddress) throws IOException,
GeoIp2Exception {
- return getIpRisk(ipAddress);
- }
-
- private Optional getIpRisk(InetAddress ipAddress) throws IOException,
- GeoIp2Exception {
- LookupResult result = this.get(
- ipAddress,
- IpRiskResponse.class,
- DatabaseType.IP_RISK
- );
- IpRiskResponse response = result.model();
- if (response == null) {
- return Optional.empty();
- }
- return Optional.of(response);
+ return getResponse(ipAddress, IpRiskResponse.class, DatabaseType.IP_RISK, "ipRisk");
}
/**
@@ -488,7 +452,7 @@ private Optional getIpRisk(InetAddress ipAddress) throws IOExcep
@Override
public AsnResponse asn(InetAddress ipAddress) throws IOException,
GeoIp2Exception {
- Optional r = getAsn(ipAddress);
+ Optional r = tryAsn(ipAddress);
if (r.isEmpty()) {
throw new AddressNotFoundException("The address "
+ ipAddress.getHostAddress() + " is not in the database.");
@@ -499,21 +463,7 @@ public AsnResponse asn(InetAddress ipAddress) throws IOException,
@Override
public Optional tryAsn(InetAddress ipAddress) throws IOException,
GeoIp2Exception {
- return getAsn(ipAddress);
- }
-
- private Optional getAsn(InetAddress ipAddress)
- throws IOException, GeoIp2Exception {
- LookupResult result = this.get(
- ipAddress,
- AsnResponse.class,
- DatabaseType.ASN
- );
- AsnResponse response = result.model();
- if (response == null) {
- return Optional.empty();
- }
- return Optional.of(response);
+ return getResponse(ipAddress, AsnResponse.class, DatabaseType.ASN, "asn");
}
/**
@@ -527,7 +477,7 @@ private Optional getAsn(InetAddress ipAddress)
@Override
public ConnectionTypeResponse connectionType(InetAddress ipAddress)
throws IOException, GeoIp2Exception {
- Optional r = getConnectionType(ipAddress);
+ Optional r = tryConnectionType(ipAddress);
if (r.isEmpty()) {
throw new AddressNotFoundException("The address "
+ ipAddress.getHostAddress() + " is not in the database.");
@@ -538,22 +488,12 @@ public ConnectionTypeResponse connectionType(InetAddress ipAddress)
@Override
public Optional tryConnectionType(InetAddress ipAddress)
throws IOException, GeoIp2Exception {
- return getConnectionType(ipAddress);
- }
-
- private Optional getConnectionType(
- InetAddress ipAddress
- ) throws IOException, GeoIp2Exception {
- LookupResult result = this.get(
+ return getResponse(
ipAddress,
ConnectionTypeResponse.class,
- DatabaseType.CONNECTION_TYPE
+ DatabaseType.CONNECTION_TYPE,
+ "connectionType"
);
- ConnectionTypeResponse response = result.model();
- if (response == null) {
- return Optional.empty();
- }
- return Optional.of(response);
}
/**
@@ -567,7 +507,7 @@ private Optional getConnectionType(
@Override
public DomainResponse domain(InetAddress ipAddress) throws IOException,
GeoIp2Exception {
- Optional r = getDomain(ipAddress);
+ Optional r = tryDomain(ipAddress);
if (r.isEmpty()) {
throw new AddressNotFoundException("The address "
+ ipAddress.getHostAddress() + " is not in the database.");
@@ -578,22 +518,7 @@ public DomainResponse domain(InetAddress ipAddress) throws IOException,
@Override
public Optional tryDomain(InetAddress ipAddress) throws IOException,
GeoIp2Exception {
- return getDomain(ipAddress);
- }
-
- private Optional getDomain(
- InetAddress ipAddress
- ) throws IOException, GeoIp2Exception {
- LookupResult result = this.get(
- ipAddress,
- DomainResponse.class,
- DatabaseType.DOMAIN
- );
- DomainResponse response = result.model();
- if (response == null) {
- return Optional.empty();
- }
- return Optional.of(response);
+ return getResponse(ipAddress, DomainResponse.class, DatabaseType.DOMAIN, "domain");
}
/**
@@ -607,7 +532,7 @@ private Optional getDomain(
@Override
public EnterpriseResponse enterprise(InetAddress ipAddress) throws IOException,
GeoIp2Exception {
- Optional r = getEnterprise(ipAddress);
+ Optional r = tryEnterprise(ipAddress);
if (r.isEmpty()) {
throw new AddressNotFoundException("The address "
+ ipAddress.getHostAddress() + " is not in the database.");
@@ -618,24 +543,13 @@ public EnterpriseResponse enterprise(InetAddress ipAddress) throws IOException,
@Override
public Optional tryEnterprise(InetAddress ipAddress) throws IOException,
GeoIp2Exception {
- return getEnterprise(ipAddress);
- }
-
- private Optional getEnterprise(
- InetAddress ipAddress
- ) throws IOException, GeoIp2Exception {
- LookupResult result = this.get(
+ Optional response = getResponse(
ipAddress,
EnterpriseResponse.class,
- DatabaseType.ENTERPRISE
- );
- EnterpriseResponse response = result.model();
- if (response == null) {
- return Optional.empty();
- }
- return Optional.of(
- new EnterpriseResponse(response, locales)
+ DatabaseType.ENTERPRISE,
+ "enterprise"
);
+ return response.map(r -> new EnterpriseResponse(r, locales));
}
/**
@@ -649,7 +563,7 @@ private Optional getEnterprise(
@Override
public IspResponse isp(InetAddress ipAddress) throws IOException,
GeoIp2Exception {
- Optional r = getIsp(ipAddress);
+ Optional r = tryIsp(ipAddress);
if (r.isEmpty()) {
throw new AddressNotFoundException("The address "
+ ipAddress.getHostAddress() + " is not in the database.");
@@ -660,22 +574,7 @@ public IspResponse isp(InetAddress ipAddress) throws IOException,
@Override
public Optional tryIsp(InetAddress ipAddress) throws IOException,
GeoIp2Exception {
- return getIsp(ipAddress);
- }
-
- private Optional getIsp(
- InetAddress ipAddress
- ) throws IOException, GeoIp2Exception {
- LookupResult result = this.get(
- ipAddress,
- IspResponse.class,
- DatabaseType.ISP
- );
- IspResponse response = result.model();
- if (response == null) {
- return Optional.empty();
- }
- return Optional.of(response);
+ return getResponse(ipAddress, IspResponse.class, DatabaseType.ISP, "isp");
}
/**
From 9429631d2a39c05a3069d1c38a54f490dcf51321 Mon Sep 17 00:00:00 2001
From: Gregory Oschwald
Date: Thu, 23 Oct 2025 11:00:17 -0700
Subject: [PATCH 07/17] Change ipAddress from String to InetAddress in all
models
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Changed the ipAddress field type from String to InetAddress across all
model and record classes. This provides better type safety and makes it
clear that these fields contain IP addresses.
Key changes:
- Updated ipAddress field type to InetAddress in all response/record classes
- Deprecated getIpAddress() methods now call ipAddress().getHostAddress()
to maintain backward compatibility (still return String)
- Created InetAddressSerializer to serialize InetAddress to String in JSON
- Created InetAddressDeserializer to deserialize JSON strings to InetAddress
- Created InetAddressModule and registered it globally in JsonSerializable
- Updated all tests to call .getHostAddress() when comparing IP addresses
The new ipAddress() accessor returns InetAddress, while the deprecated
getIpAddress() continues to return String for backward compatibility.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude
---
.../geoip2/InetAddressDeserializer.java | 34 +++++++++++++++++++
.../com/maxmind/geoip2/InetAddressModule.java | 18 ++++++++++
.../maxmind/geoip2/InetAddressSerializer.java | 29 ++++++++++++++++
.../com/maxmind/geoip2/JsonSerializable.java | 1 +
.../geoip2/model/AnonymousIpResponse.java | 5 +--
.../geoip2/model/AnonymousPlusResponse.java | 7 ++--
.../com/maxmind/geoip2/model/AsnResponse.java | 5 +--
.../geoip2/model/ConnectionTypeResponse.java | 5 +--
.../maxmind/geoip2/model/DomainResponse.java | 5 +--
.../maxmind/geoip2/model/IpRiskResponse.java | 5 +--
.../com/maxmind/geoip2/model/IspResponse.java | 5 +--
.../com/maxmind/geoip2/record/Traits.java | 5 +--
.../maxmind/geoip2/DatabaseReaderTest.java | 20 +++++------
.../maxmind/geoip2/WebServiceClientTest.java | 8 ++---
.../geoip2/model/CountryResponseTest.java | 2 +-
.../geoip2/model/InsightsResponseTest.java | 2 +-
.../com/maxmind/geoip2/model/JsonTest.java | 1 +
17 files changed, 124 insertions(+), 33 deletions(-)
create mode 100644 src/main/java/com/maxmind/geoip2/InetAddressDeserializer.java
create mode 100644 src/main/java/com/maxmind/geoip2/InetAddressModule.java
create mode 100644 src/main/java/com/maxmind/geoip2/InetAddressSerializer.java
diff --git a/src/main/java/com/maxmind/geoip2/InetAddressDeserializer.java b/src/main/java/com/maxmind/geoip2/InetAddressDeserializer.java
new file mode 100644
index 000000000..7bc007a3d
--- /dev/null
+++ b/src/main/java/com/maxmind/geoip2/InetAddressDeserializer.java
@@ -0,0 +1,34 @@
+package com.maxmind.geoip2;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+/**
+ * Deserializes a string to an InetAddress.
+ */
+public class InetAddressDeserializer extends StdDeserializer {
+ /**
+ * Constructs an instance of {@code InetAddressDeserializer}.
+ */
+ public InetAddressDeserializer() {
+ super(InetAddress.class);
+ }
+
+ @Override
+ public InetAddress deserialize(JsonParser p, DeserializationContext ctxt)
+ throws IOException {
+ String value = p.getValueAsString();
+ if (value == null || value.isEmpty()) {
+ return null;
+ }
+ try {
+ return InetAddress.getByName(value);
+ } catch (UnknownHostException e) {
+ throw new IOException("Invalid IP address: " + value, e);
+ }
+ }
+}
diff --git a/src/main/java/com/maxmind/geoip2/InetAddressModule.java b/src/main/java/com/maxmind/geoip2/InetAddressModule.java
new file mode 100644
index 000000000..6b989a4a4
--- /dev/null
+++ b/src/main/java/com/maxmind/geoip2/InetAddressModule.java
@@ -0,0 +1,18 @@
+package com.maxmind.geoip2;
+
+import com.fasterxml.jackson.databind.module.SimpleModule;
+import java.net.InetAddress;
+
+/**
+ * Jackson module for InetAddress serialization and deserialization.
+ */
+public class InetAddressModule extends SimpleModule {
+ /**
+ * Constructs an instance of {@code InetAddressModule}.
+ */
+ public InetAddressModule() {
+ super("InetAddressModule");
+ addSerializer(InetAddress.class, new InetAddressSerializer());
+ addDeserializer(InetAddress.class, new InetAddressDeserializer());
+ }
+}
diff --git a/src/main/java/com/maxmind/geoip2/InetAddressSerializer.java b/src/main/java/com/maxmind/geoip2/InetAddressSerializer.java
new file mode 100644
index 000000000..38319841c
--- /dev/null
+++ b/src/main/java/com/maxmind/geoip2/InetAddressSerializer.java
@@ -0,0 +1,29 @@
+package com.maxmind.geoip2;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import java.io.IOException;
+import java.net.InetAddress;
+
+/**
+ * Serializes InetAddress to its host address string representation.
+ */
+public class InetAddressSerializer extends StdSerializer {
+ /**
+ * Constructs an instance of {@code InetAddressSerializer}.
+ */
+ public InetAddressSerializer() {
+ super(InetAddress.class);
+ }
+
+ @Override
+ public void serialize(InetAddress value, JsonGenerator gen, SerializerProvider provider)
+ throws IOException {
+ if (value == null) {
+ gen.writeNull();
+ } else {
+ gen.writeString(value.getHostAddress());
+ }
+ }
+}
diff --git a/src/main/java/com/maxmind/geoip2/JsonSerializable.java b/src/main/java/com/maxmind/geoip2/JsonSerializable.java
index 46dd37ac9..190553cda 100644
--- a/src/main/java/com/maxmind/geoip2/JsonSerializable.java
+++ b/src/main/java/com/maxmind/geoip2/JsonSerializable.java
@@ -21,6 +21,7 @@ default String toJson() throws IOException {
JsonMapper mapper = JsonMapper.builder()
.disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS)
.addModule(new JavaTimeModule())
+ .addModule(new InetAddressModule())
.serializationInclusion(JsonInclude.Include.NON_NULL)
.serializationInclusion(JsonInclude.Include.NON_EMPTY)
.build();
diff --git a/src/main/java/com/maxmind/geoip2/model/AnonymousIpResponse.java b/src/main/java/com/maxmind/geoip2/model/AnonymousIpResponse.java
index eb6104018..c17fee07b 100644
--- a/src/main/java/com/maxmind/geoip2/model/AnonymousIpResponse.java
+++ b/src/main/java/com/maxmind/geoip2/model/AnonymousIpResponse.java
@@ -11,6 +11,7 @@
import com.maxmind.db.Network;
import com.maxmind.geoip2.JsonSerializable;
import com.maxmind.geoip2.NetworkDeserializer;
+import java.net.InetAddress;
/**
* This class provides the GeoIP2 Anonymous IP model.
@@ -32,7 +33,7 @@
public record AnonymousIpResponse(
@JsonProperty("ip_address")
@MaxMindDbIpAddress
- String ipAddress,
+ InetAddress ipAddress,
@JsonProperty("is_anonymous")
@MaxMindDbParameter(name = "is_anonymous", useDefault = true)
@@ -71,7 +72,7 @@ public record AnonymousIpResponse(
@Deprecated(since = "5.0.0", forRemoval = true)
@JsonProperty("ip_address")
public String getIpAddress() {
- return ipAddress();
+ return ipAddress().getHostAddress();
}
/**
diff --git a/src/main/java/com/maxmind/geoip2/model/AnonymousPlusResponse.java b/src/main/java/com/maxmind/geoip2/model/AnonymousPlusResponse.java
index 4a637eee3..e6be23a9e 100644
--- a/src/main/java/com/maxmind/geoip2/model/AnonymousPlusResponse.java
+++ b/src/main/java/com/maxmind/geoip2/model/AnonymousPlusResponse.java
@@ -12,6 +12,7 @@
import com.maxmind.db.Network;
import com.maxmind.geoip2.JsonSerializable;
import com.maxmind.geoip2.NetworkDeserializer;
+import java.net.InetAddress;
import java.time.LocalDate;
/**
@@ -40,7 +41,7 @@
public record AnonymousPlusResponse(
@JsonProperty("ip_address")
@MaxMindDbIpAddress
- String ipAddress,
+ InetAddress ipAddress,
@JsonProperty("is_anonymous")
@MaxMindDbParameter(name = "is_anonymous", useDefault = true)
@@ -102,7 +103,7 @@ public record AnonymousPlusResponse(
*/
@MaxMindDbConstructor
public AnonymousPlusResponse(
- @MaxMindDbIpAddress String ipAddress,
+ @MaxMindDbIpAddress InetAddress ipAddress,
@MaxMindDbParameter(name = "is_anonymous", useDefault = true)
boolean isAnonymous,
@MaxMindDbParameter(name = "is_anonymous_vpn", useDefault = true)
@@ -142,7 +143,7 @@ public AnonymousPlusResponse(
@Deprecated(since = "5.0.0", forRemoval = true)
@JsonProperty("ip_address")
public String getIpAddress() {
- return ipAddress();
+ return ipAddress().getHostAddress();
}
/**
diff --git a/src/main/java/com/maxmind/geoip2/model/AsnResponse.java b/src/main/java/com/maxmind/geoip2/model/AsnResponse.java
index c2bcea216..22bae1b04 100644
--- a/src/main/java/com/maxmind/geoip2/model/AsnResponse.java
+++ b/src/main/java/com/maxmind/geoip2/model/AsnResponse.java
@@ -11,6 +11,7 @@
import com.maxmind.db.Network;
import com.maxmind.geoip2.JsonSerializable;
import com.maxmind.geoip2.NetworkDeserializer;
+import java.net.InetAddress;
/**
* This class provides the GeoLite2 ASN model.
@@ -33,7 +34,7 @@ public record AsnResponse(
@JsonProperty("ip_address")
@MaxMindDbIpAddress
- String ipAddress,
+ InetAddress ipAddress,
@JsonProperty("network")
@JsonDeserialize(using = NetworkDeserializer.class)
@@ -71,7 +72,7 @@ public String getAutonomousSystemOrganization() {
@Deprecated(since = "5.0.0", forRemoval = true)
@JsonProperty("ip_address")
public String getIpAddress() {
- return ipAddress();
+ return ipAddress().getHostAddress();
}
/**
diff --git a/src/main/java/com/maxmind/geoip2/model/ConnectionTypeResponse.java b/src/main/java/com/maxmind/geoip2/model/ConnectionTypeResponse.java
index 3c7482347..30bef27cd 100644
--- a/src/main/java/com/maxmind/geoip2/model/ConnectionTypeResponse.java
+++ b/src/main/java/com/maxmind/geoip2/model/ConnectionTypeResponse.java
@@ -14,6 +14,7 @@
import com.maxmind.db.Network;
import com.maxmind.geoip2.JsonSerializable;
import com.maxmind.geoip2.NetworkDeserializer;
+import java.net.InetAddress;
/**
* This class provides the GeoIP2 Connection-Type model.
@@ -30,7 +31,7 @@ public record ConnectionTypeResponse(
@JsonProperty("ip_address")
@MaxMindDbIpAddress
- String ipAddress,
+ InetAddress ipAddress,
@JsonProperty("network")
@JsonDeserialize(using = NetworkDeserializer.class)
@@ -105,7 +106,7 @@ public ConnectionType getConnectionType() {
@Deprecated(since = "5.0.0", forRemoval = true)
@JsonProperty("ip_address")
public String getIpAddress() {
- return ipAddress();
+ return ipAddress().getHostAddress();
}
/**
diff --git a/src/main/java/com/maxmind/geoip2/model/DomainResponse.java b/src/main/java/com/maxmind/geoip2/model/DomainResponse.java
index c43a9cbaa..d721a930c 100644
--- a/src/main/java/com/maxmind/geoip2/model/DomainResponse.java
+++ b/src/main/java/com/maxmind/geoip2/model/DomainResponse.java
@@ -11,6 +11,7 @@
import com.maxmind.db.Network;
import com.maxmind.geoip2.JsonSerializable;
import com.maxmind.geoip2.NetworkDeserializer;
+import java.net.InetAddress;
/**
* This class provides the GeoIP2 Domain model.
@@ -28,7 +29,7 @@ public record DomainResponse(
@JsonProperty("ip_address")
@MaxMindDbIpAddress
- String ipAddress,
+ InetAddress ipAddress,
@JsonProperty("network")
@JsonDeserialize(using = NetworkDeserializer.class)
@@ -54,7 +55,7 @@ public String getDomain() {
@Deprecated(since = "5.0.0", forRemoval = true)
@JsonProperty("ip_address")
public String getIpAddress() {
- return ipAddress();
+ return ipAddress().getHostAddress();
}
/**
diff --git a/src/main/java/com/maxmind/geoip2/model/IpRiskResponse.java b/src/main/java/com/maxmind/geoip2/model/IpRiskResponse.java
index 8c2679468..bbab36dd3 100644
--- a/src/main/java/com/maxmind/geoip2/model/IpRiskResponse.java
+++ b/src/main/java/com/maxmind/geoip2/model/IpRiskResponse.java
@@ -11,6 +11,7 @@
import com.maxmind.db.Network;
import com.maxmind.geoip2.JsonSerializable;
import com.maxmind.geoip2.NetworkDeserializer;
+import java.net.InetAddress;
/**
* This class provides the GeoIP2 IP Risk model.
@@ -33,7 +34,7 @@
public record IpRiskResponse(
@JsonProperty("ip_address")
@MaxMindDbIpAddress
- String ipAddress,
+ InetAddress ipAddress,
@JsonProperty("is_anonymous")
@MaxMindDbParameter(name = "is_anonymous", useDefault = true)
@@ -76,7 +77,7 @@ public record IpRiskResponse(
@Deprecated(since = "5.0.0", forRemoval = true)
@JsonProperty("ip_address")
public String getIpAddress() {
- return ipAddress();
+ return ipAddress().getHostAddress();
}
/**
diff --git a/src/main/java/com/maxmind/geoip2/model/IspResponse.java b/src/main/java/com/maxmind/geoip2/model/IspResponse.java
index 73a064ca8..7056397ef 100644
--- a/src/main/java/com/maxmind/geoip2/model/IspResponse.java
+++ b/src/main/java/com/maxmind/geoip2/model/IspResponse.java
@@ -11,6 +11,7 @@
import com.maxmind.db.Network;
import com.maxmind.geoip2.JsonSerializable;
import com.maxmind.geoip2.NetworkDeserializer;
+import java.net.InetAddress;
/**
* This class provides the GeoIP2 ISP model.
@@ -43,7 +44,7 @@ public record IspResponse(
@JsonProperty("ip_address")
@MaxMindDbIpAddress
- String ipAddress,
+ InetAddress ipAddress,
@JsonProperty("isp")
@MaxMindDbParameter(name = "isp")
@@ -97,7 +98,7 @@ public String getAutonomousSystemOrganization() {
@Deprecated(since = "5.0.0", forRemoval = true)
@JsonProperty("ip_address")
public String getIpAddress() {
- return ipAddress();
+ return ipAddress().getHostAddress();
}
/**
diff --git a/src/main/java/com/maxmind/geoip2/record/Traits.java b/src/main/java/com/maxmind/geoip2/record/Traits.java
index 63263f007..2540b9d0f 100644
--- a/src/main/java/com/maxmind/geoip2/record/Traits.java
+++ b/src/main/java/com/maxmind/geoip2/record/Traits.java
@@ -11,6 +11,7 @@
import com.maxmind.geoip2.JsonSerializable;
import com.maxmind.geoip2.NetworkDeserializer;
import com.maxmind.geoip2.model.ConnectionTypeResponse.ConnectionType;
+import java.net.InetAddress;
/**
* Contains data for the traits record associated with an IP address.
@@ -91,7 +92,7 @@ public record Traits(
@JsonProperty("ip_address")
@MaxMindDbIpAddress
- String ipAddress,
+ InetAddress ipAddress,
@JsonProperty("is_anonymous")
@MaxMindDbParameter(name = "is_anonymous", useDefault = true)
@@ -261,7 +262,7 @@ public String getDomain() {
@Deprecated(since = "5.0.0", forRemoval = true)
@JsonProperty("ip_address")
public String getIpAddress() {
- return ipAddress();
+ return ipAddress().getHostAddress();
}
/**
diff --git a/src/test/java/com/maxmind/geoip2/DatabaseReaderTest.java b/src/test/java/com/maxmind/geoip2/DatabaseReaderTest.java
index 060219e4c..b92e1a1c4 100644
--- a/src/test/java/com/maxmind/geoip2/DatabaseReaderTest.java
+++ b/src/test/java/com/maxmind/geoip2/DatabaseReaderTest.java
@@ -156,7 +156,7 @@ public void hasIpAddressURL() throws Exception {
private void hasIpInfo(DatabaseReader reader) throws IOException,
GeoIp2Exception {
CityResponse cio = reader.city(InetAddress.getByName("81.2.69.160"));
- assertEquals("81.2.69.160", cio.traits().ipAddress());
+ assertEquals("81.2.69.160", cio.traits().ipAddress().getHostAddress());
assertEquals("81.2.69.160/27", cio.traits().network().toString());
}
@@ -220,7 +220,7 @@ public void testAnonymousIp() throws Exception {
assertFalse(response.isPublicProxy());
assertFalse(response.isResidentialProxy());
assertFalse(response.isTorExitNode());
- assertEquals(ipAddress.getHostAddress(), response.ipAddress());
+ assertEquals(ipAddress.getHostAddress(), response.ipAddress().getHostAddress());
assertEquals("1.2.0.0/16", response.network().toString());
AnonymousIpResponse tryResponse = reader.tryAnonymousIp(ipAddress).get();
@@ -242,7 +242,7 @@ public void testAnonymousPlus() throws Exception {
assertFalse(response.isPublicProxy());
assertFalse(response.isResidentialProxy());
assertFalse(response.isTorExitNode());
- assertEquals(ipAddress.getHostAddress(), response.ipAddress());
+ assertEquals(ipAddress.getHostAddress(), response.ipAddress().getHostAddress());
assertEquals("1.2.0.1/32", response.network().toString());
assertEquals("2025-04-14", response.networkLastSeen().toString());
assertEquals("foo", response.providerName());
@@ -273,7 +273,7 @@ public void testAsn() throws Exception {
assertEquals(1221, response.autonomousSystemNumber().intValue());
assertEquals("Telstra Pty Ltd",
response.autonomousSystemOrganization());
- assertEquals(ipAddress.getHostAddress(), response.ipAddress());
+ assertEquals(ipAddress.getHostAddress(), response.ipAddress().getHostAddress());
assertEquals("1.128.0.0/11", response.network().toString());
AsnResponse tryResponse = reader.tryAsn(ipAddress).get();
@@ -292,7 +292,7 @@ public void testCity() throws Exception {
assertEquals(2635167, response.country().geonameId().intValue());
assertEquals(100, response.location().accuracyRadius().intValue());
assertFalse(response.traits().isLegitimateProxy());
- assertEquals(ipAddress.getHostAddress(), response.traits().ipAddress());
+ assertEquals(ipAddress.getHostAddress(), response.traits().ipAddress().getHostAddress());
assertEquals("81.2.69.192/28", response.traits().network().toString());
CityResponse tryResponse = reader.tryCity(ipAddress).get();
@@ -318,7 +318,7 @@ public void testConnectionType() throws Exception {
ConnectionTypeResponse response = reader.connectionType(ipAddress);
assertEquals(ConnectionType.CELLULAR, response.connectionType());
- assertEquals(ipAddress.getHostAddress(), response.ipAddress());
+ assertEquals(ipAddress.getHostAddress(), response.ipAddress().getHostAddress());
assertEquals("1.0.1.0/24", response.network().toString());
ConnectionTypeResponse tryResponse = reader.tryConnectionType(ipAddress).get();
@@ -337,7 +337,7 @@ public void testCountry() throws Exception {
assertEquals("NA", response.continent().code());
assertEquals(6252001, response.country().geonameId().intValue());
assertEquals(6252001, response.registeredCountry().geonameId().intValue());
- assertEquals(ipAddress.getHostAddress(), response.traits().ipAddress());
+ assertEquals(ipAddress.getHostAddress(), response.traits().ipAddress().getHostAddress());
assertEquals("74.209.16.0/20", response.traits().network().toString());
CountryResponse tryResponse = reader.tryCountry(ipAddress).get();
@@ -357,7 +357,7 @@ public void testDomain() throws Exception {
InetAddress ipAddress = InetAddress.getByName("1.2.0.0");
DomainResponse response = reader.domain(ipAddress);
assertEquals("maxmind.com", response.domain());
- assertEquals(ipAddress.getHostAddress(), response.ipAddress());
+ assertEquals(ipAddress.getHostAddress(), response.ipAddress().getHostAddress());
assertEquals("1.2.0.0/16", response.network().toString());
DomainResponse tryResponse = reader.tryDomain(ipAddress).get();
@@ -379,7 +379,7 @@ public void testEnterprise() throws Exception {
assertEquals(27, response.location().accuracyRadius().intValue());
assertEquals(ConnectionType.CABLE_DSL, response.traits().connectionType());
assertTrue(response.traits().isLegitimateProxy());
- assertEquals(ipAddress.getHostAddress(), response.traits().ipAddress());
+ assertEquals(ipAddress.getHostAddress(), response.traits().ipAddress().getHostAddress());
assertEquals("74.209.16.0/20", response.traits().network().toString());
EnterpriseResponse tryResponse = reader.tryEnterprise(ipAddress).get();
@@ -414,7 +414,7 @@ public void testIsp() throws Exception {
assertEquals("Telstra Internet", response.isp());
assertEquals("Telstra Internet", response.organization());
- assertEquals(ipAddress.getHostAddress(), response.ipAddress());
+ assertEquals(ipAddress.getHostAddress(), response.ipAddress().getHostAddress());
assertEquals("1.128.0.0/11", response.network().toString());
IspResponse tryResponse = reader.tryIsp(ipAddress).get();
diff --git a/src/test/java/com/maxmind/geoip2/WebServiceClientTest.java b/src/test/java/com/maxmind/geoip2/WebServiceClientTest.java
index 4e0f49546..cd5c2af01 100644
--- a/src/test/java/com/maxmind/geoip2/WebServiceClientTest.java
+++ b/src/test/java/com/maxmind/geoip2/WebServiceClientTest.java
@@ -135,7 +135,7 @@ public void test200WithDefaultValues() throws Exception {
assertNull(traits.autonomousSystemOrganization());
assertNull(traits.connectionType());
assertNull(traits.domain());
- assertEquals("1.2.3.13", traits.ipAddress());
+ assertEquals("1.2.3.13", traits.ipAddress().getHostAddress());
assertEquals("1.2.3.0/24", traits.network().toString());
assertNull(traits.isp());
assertNull(traits.organization());
@@ -179,7 +179,7 @@ public void test200OnInsightsAsMe() throws Exception {
WebServiceClient client = createSuccessClient("insights", "me",
"{\"traits\":{\"ip_address\":\"24.24.24.24\"}}");
assertEquals("24.24.24.24",
- client.insights().traits().ipAddress());
+ client.insights().traits().ipAddress().getHostAddress());
}
@Test
@@ -187,7 +187,7 @@ public void test200OnCityAsMe() throws Exception {
WebServiceClient client = createSuccessClient("city", "me",
"{\"traits\":{\"ip_address\":\"24.24.24.24\"}}");
assertEquals("24.24.24.24",
- client.city().traits().ipAddress());
+ client.city().traits().ipAddress().getHostAddress());
}
@Test
@@ -195,7 +195,7 @@ public void test200OnCountryAsMe() throws Exception {
WebServiceClient client = createSuccessClient("country", "me",
"{\"traits\":{\"ip_address\":\"24.24.24.24\"}}");
assertEquals("24.24.24.24",
- client.country().traits().ipAddress());
+ client.country().traits().ipAddress().getHostAddress());
}
@Test
diff --git a/src/test/java/com/maxmind/geoip2/model/CountryResponseTest.java b/src/test/java/com/maxmind/geoip2/model/CountryResponseTest.java
index a60a2b0c1..d0a7c415b 100644
--- a/src/test/java/com/maxmind/geoip2/model/CountryResponseTest.java
+++ b/src/test/java/com/maxmind/geoip2/model/CountryResponseTest.java
@@ -151,7 +151,7 @@ public void testTraits() {
assertEquals(
"1.2.3.4",
- this.country.traits().ipAddress(),
+ this.country.traits().ipAddress().getHostAddress(),
"country.traits().getIpAddress does not return 1.2.3.4"
);
diff --git a/src/test/java/com/maxmind/geoip2/model/InsightsResponseTest.java b/src/test/java/com/maxmind/geoip2/model/InsightsResponseTest.java
index ccb1716ef..ae76aed2c 100644
--- a/src/test/java/com/maxmind/geoip2/model/InsightsResponseTest.java
+++ b/src/test/java/com/maxmind/geoip2/model/InsightsResponseTest.java
@@ -134,7 +134,7 @@ public void testTraits() {
);
assertEquals(
"1.2.3.4",
- traits.ipAddress(),
+ traits.ipAddress().getHostAddress(),
"traits.ipAddress() does not return 1.2.3.4"
);
assertTrue(traits.isAnonymous(), "traits.isAnonymous() returns true");
diff --git a/src/test/java/com/maxmind/geoip2/model/JsonTest.java b/src/test/java/com/maxmind/geoip2/model/JsonTest.java
index cd8109e52..73aab8da8 100644
--- a/src/test/java/com/maxmind/geoip2/model/JsonTest.java
+++ b/src/test/java/com/maxmind/geoip2/model/JsonTest.java
@@ -334,6 +334,7 @@ public void testIspSerialization() throws Exception {
throws IOException {
JsonMapper mapper = JsonMapper.builder()
.disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS)
+ .addModule(new com.maxmind.geoip2.InetAddressModule())
.build();
InjectableValues inject = new InjectableValues.Std().addValue(
"locales", Collections.singletonList("en"));
From f44dfd80ceacb9177cfdac511e88bc2078702ad4 Mon Sep 17 00:00:00 2001
From: Gregory Oschwald
Date: Thu, 23 Oct 2025 11:44:43 -0700
Subject: [PATCH 08/17] Remove unused imports
---
src/main/java/com/maxmind/geoip2/model/AnonymousIpResponse.java | 1 -
.../java/com/maxmind/geoip2/model/AnonymousPlusResponse.java | 1 -
src/main/java/com/maxmind/geoip2/model/AsnResponse.java | 1 -
src/main/java/com/maxmind/geoip2/model/CityResponse.java | 2 --
.../java/com/maxmind/geoip2/model/ConnectionTypeResponse.java | 1 -
src/main/java/com/maxmind/geoip2/model/CountryResponse.java | 2 --
src/main/java/com/maxmind/geoip2/model/DomainResponse.java | 1 -
src/main/java/com/maxmind/geoip2/model/EnterpriseResponse.java | 2 --
src/main/java/com/maxmind/geoip2/model/InsightsResponse.java | 1 -
src/main/java/com/maxmind/geoip2/model/IpRiskResponse.java | 1 -
src/main/java/com/maxmind/geoip2/model/IspResponse.java | 1 -
src/main/java/com/maxmind/geoip2/record/City.java | 2 --
12 files changed, 16 deletions(-)
diff --git a/src/main/java/com/maxmind/geoip2/model/AnonymousIpResponse.java b/src/main/java/com/maxmind/geoip2/model/AnonymousIpResponse.java
index c17fee07b..c8a222269 100644
--- a/src/main/java/com/maxmind/geoip2/model/AnonymousIpResponse.java
+++ b/src/main/java/com/maxmind/geoip2/model/AnonymousIpResponse.java
@@ -1,6 +1,5 @@
package com.maxmind.geoip2.model;
-import com.fasterxml.jackson.annotation.JacksonInject;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
diff --git a/src/main/java/com/maxmind/geoip2/model/AnonymousPlusResponse.java b/src/main/java/com/maxmind/geoip2/model/AnonymousPlusResponse.java
index e6be23a9e..22ac498bb 100644
--- a/src/main/java/com/maxmind/geoip2/model/AnonymousPlusResponse.java
+++ b/src/main/java/com/maxmind/geoip2/model/AnonymousPlusResponse.java
@@ -1,6 +1,5 @@
package com.maxmind.geoip2.model;
-import com.fasterxml.jackson.annotation.JacksonInject;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
diff --git a/src/main/java/com/maxmind/geoip2/model/AsnResponse.java b/src/main/java/com/maxmind/geoip2/model/AsnResponse.java
index 22bae1b04..0dea5f03f 100644
--- a/src/main/java/com/maxmind/geoip2/model/AsnResponse.java
+++ b/src/main/java/com/maxmind/geoip2/model/AsnResponse.java
@@ -1,6 +1,5 @@
package com.maxmind.geoip2.model;
-import com.fasterxml.jackson.annotation.JacksonInject;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
diff --git a/src/main/java/com/maxmind/geoip2/model/CityResponse.java b/src/main/java/com/maxmind/geoip2/model/CityResponse.java
index 0ba099198..65a94673d 100644
--- a/src/main/java/com/maxmind/geoip2/model/CityResponse.java
+++ b/src/main/java/com/maxmind/geoip2/model/CityResponse.java
@@ -1,10 +1,8 @@
package com.maxmind.geoip2.model;
-import com.fasterxml.jackson.annotation.JacksonInject;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.maxmind.db.MaxMindDbParameter;
-import com.maxmind.db.Network;
import com.maxmind.geoip2.JsonSerializable;
import com.maxmind.geoip2.record.City;
import com.maxmind.geoip2.record.Continent;
diff --git a/src/main/java/com/maxmind/geoip2/model/ConnectionTypeResponse.java b/src/main/java/com/maxmind/geoip2/model/ConnectionTypeResponse.java
index 30bef27cd..40b492c9c 100644
--- a/src/main/java/com/maxmind/geoip2/model/ConnectionTypeResponse.java
+++ b/src/main/java/com/maxmind/geoip2/model/ConnectionTypeResponse.java
@@ -1,6 +1,5 @@
package com.maxmind.geoip2.model;
-import com.fasterxml.jackson.annotation.JacksonInject;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
diff --git a/src/main/java/com/maxmind/geoip2/model/CountryResponse.java b/src/main/java/com/maxmind/geoip2/model/CountryResponse.java
index 45bf4186e..23c3c3f2a 100644
--- a/src/main/java/com/maxmind/geoip2/model/CountryResponse.java
+++ b/src/main/java/com/maxmind/geoip2/model/CountryResponse.java
@@ -1,9 +1,7 @@
package com.maxmind.geoip2.model;
-import com.fasterxml.jackson.annotation.JacksonInject;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.maxmind.db.MaxMindDbParameter;
-import com.maxmind.db.Network;
import com.maxmind.geoip2.JsonSerializable;
import com.maxmind.geoip2.record.Continent;
import com.maxmind.geoip2.record.Country;
diff --git a/src/main/java/com/maxmind/geoip2/model/DomainResponse.java b/src/main/java/com/maxmind/geoip2/model/DomainResponse.java
index d721a930c..347f255c0 100644
--- a/src/main/java/com/maxmind/geoip2/model/DomainResponse.java
+++ b/src/main/java/com/maxmind/geoip2/model/DomainResponse.java
@@ -1,6 +1,5 @@
package com.maxmind.geoip2.model;
-import com.fasterxml.jackson.annotation.JacksonInject;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
diff --git a/src/main/java/com/maxmind/geoip2/model/EnterpriseResponse.java b/src/main/java/com/maxmind/geoip2/model/EnterpriseResponse.java
index 8855b34a1..386ce6a6e 100644
--- a/src/main/java/com/maxmind/geoip2/model/EnterpriseResponse.java
+++ b/src/main/java/com/maxmind/geoip2/model/EnterpriseResponse.java
@@ -1,10 +1,8 @@
package com.maxmind.geoip2.model;
-import com.fasterxml.jackson.annotation.JacksonInject;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.maxmind.db.MaxMindDbParameter;
-import com.maxmind.db.Network;
import com.maxmind.geoip2.JsonSerializable;
import com.maxmind.geoip2.record.City;
import com.maxmind.geoip2.record.Continent;
diff --git a/src/main/java/com/maxmind/geoip2/model/InsightsResponse.java b/src/main/java/com/maxmind/geoip2/model/InsightsResponse.java
index 7196c5f92..2358153ed 100644
--- a/src/main/java/com/maxmind/geoip2/model/InsightsResponse.java
+++ b/src/main/java/com/maxmind/geoip2/model/InsightsResponse.java
@@ -1,6 +1,5 @@
package com.maxmind.geoip2.model;
-import com.fasterxml.jackson.annotation.JacksonInject;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.maxmind.geoip2.JsonSerializable;
diff --git a/src/main/java/com/maxmind/geoip2/model/IpRiskResponse.java b/src/main/java/com/maxmind/geoip2/model/IpRiskResponse.java
index bbab36dd3..4795ae187 100644
--- a/src/main/java/com/maxmind/geoip2/model/IpRiskResponse.java
+++ b/src/main/java/com/maxmind/geoip2/model/IpRiskResponse.java
@@ -1,6 +1,5 @@
package com.maxmind.geoip2.model;
-import com.fasterxml.jackson.annotation.JacksonInject;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
diff --git a/src/main/java/com/maxmind/geoip2/model/IspResponse.java b/src/main/java/com/maxmind/geoip2/model/IspResponse.java
index 7056397ef..612816b48 100644
--- a/src/main/java/com/maxmind/geoip2/model/IspResponse.java
+++ b/src/main/java/com/maxmind/geoip2/model/IspResponse.java
@@ -1,6 +1,5 @@
package com.maxmind.geoip2.model;
-import com.fasterxml.jackson.annotation.JacksonInject;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
diff --git a/src/main/java/com/maxmind/geoip2/record/City.java b/src/main/java/com/maxmind/geoip2/record/City.java
index e8902dcb2..2ba14b2c7 100644
--- a/src/main/java/com/maxmind/geoip2/record/City.java
+++ b/src/main/java/com/maxmind/geoip2/record/City.java
@@ -4,8 +4,6 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.maxmind.db.MaxMindDbParameter;
import com.maxmind.geoip2.NamedRecord;
-import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
From f5299b9cc24848916c5fea54eb441d20a730aa68 Mon Sep 17 00:00:00 2001
From: Gregory Oschwald
Date: Thu, 23 Oct 2025 12:05:07 -0700
Subject: [PATCH 09/17] Remove outdated distributionManagement section
---
pom.xml | 6 ------
1 file changed, 6 deletions(-)
diff --git a/pom.xml b/pom.xml
index 1ad623533..7b2efa971 100644
--- a/pom.xml
+++ b/pom.xml
@@ -294,10 +294,4 @@
-
-
- sonatype-nexus-staging
- https://oss.sonatype.org/service/local/staging/deploy/maven2/
-
-
From cb99a66165e35f59d1eba3d826240be88aa271b4 Mon Sep 17 00:00:00 2001
From: Gregory Oschwald
Date: Thu, 23 Oct 2025 12:08:50 -0700
Subject: [PATCH 10/17] Prepare for a snapshot release
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 7b2efa971..d85bfca90 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
com.maxmind.geoip2
geoip2
- 4.4.0
+ 5.0.0-SNAPSHOT
jar
MaxMind GeoIP2 API
GeoIP2 webservice client and database reader
From 9309fdce6940c9f7092a911a011f85fc3e9f0d7a Mon Sep 17 00:00:00 2001
From: Gregory Oschwald
Date: Thu, 23 Oct 2025 13:19:12 -0700
Subject: [PATCH 11/17] Fix documentation typos in record getters
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Corrected typos and style inconsistencies in deprecated getter javadocs
to match the param documentation:
- MaxMind: "queried" → "queries"
- Subdivision.getConfidence(): "This is a value" → "A value"
- Subdivision.getIsoCode(): "contain" → "containing", "3166-2code" → "3166-2 code"
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude
---
src/main/java/com/maxmind/geoip2/record/MaxMind.java | 2 +-
src/main/java/com/maxmind/geoip2/record/Subdivision.java | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/maxmind/geoip2/record/MaxMind.java b/src/main/java/com/maxmind/geoip2/record/MaxMind.java
index 18a0307a0..a9380b89d 100644
--- a/src/main/java/com/maxmind/geoip2/record/MaxMind.java
+++ b/src/main/java/com/maxmind/geoip2/record/MaxMind.java
@@ -26,7 +26,7 @@ public MaxMind() {
}
/**
- * @return The number of remaining queried in your account for the current
+ * @return The number of remaining queries in your account for the current
* web service. This returns {@code null} when called on a database.
* @deprecated Use {@link #queriesRemaining()} instead. This method will be removed in 6.0.0.
*/
diff --git a/src/main/java/com/maxmind/geoip2/record/Subdivision.java b/src/main/java/com/maxmind/geoip2/record/Subdivision.java
index 31c5c3fac..460fc6f11 100644
--- a/src/main/java/com/maxmind/geoip2/record/Subdivision.java
+++ b/src/main/java/com/maxmind/geoip2/record/Subdivision.java
@@ -83,7 +83,7 @@ public Subdivision(
}
/**
- * @return This is a value from 0-100 indicating MaxMind's confidence that
+ * @return A value from 0-100 indicating MaxMind's confidence that
* the subdivision is correct. This attribute is only available from
* the Insights web service and the GeoIP2 Enterprise database.
* @deprecated Use {@link #confidence()} instead. This method will be removed in 6.0.0.
@@ -95,10 +95,10 @@ public Integer getConfidence() {
}
/**
- * @return This is a string up to three characters long contain the
+ * @return A string up to three characters long containing the
* subdivision portion of the ISO
- * 3166-2code.
+ * 3166-2 code