Skip to content

Commit 36bfdba

Browse files
oschwaldclaude
andcommitted
Update to maxmind-db 4.0.0 and use non-deprecated accessors
- Bump maxmind-db dependency from 3.2.0 to 4.0.0 - Update method calls to use record-style accessors instead of deprecated JavaBean-style getters in DatabaseReader.java and test files - Changes include: getDatabaseType() → databaseType(), getData() → data(), getNetwork() → network(), getNetworkAddress() → networkAddress(), getPrefixLength() → prefixLength() 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 98265c6 commit 36bfdba

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<dependency>
4141
<groupId>com.maxmind.db</groupId>
4242
<artifactId>maxmind-db</artifactId>
43-
<version>3.2.0</version>
43+
<version>4.0.0</version>
4444
</dependency>
4545
<dependency>
4646
<groupId>com.fasterxml.jackson.core</groupId>

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private DatabaseReader(Builder builder) throws IOException {
115115
}
116116

117117
private int getDatabaseType() {
118-
String databaseType = this.metadata().getDatabaseType();
118+
String databaseType = this.metadata().databaseType();
119119
int type = 0;
120120
if (databaseType.contains("GeoIP2-Anonymous-IP")) {
121121
type |= DatabaseType.ANONYMOUS_IP.type;
@@ -255,15 +255,15 @@ private <T> LookupResult<T> get(InetAddress ipAddress, Class<T> cls,
255255
String caller = Thread.currentThread().getStackTrace()[3]
256256
.getMethodName();
257257
throw new UnsupportedOperationException(
258-
"Invalid attempt to open a " + metadata().getDatabaseType()
258+
"Invalid attempt to open a " + metadata().databaseType()
259259
+ " database using the " + caller + " method");
260260
}
261261

262262
DatabaseRecord<T> record = reader.getRecord(ipAddress, cls);
263263

264-
T o = record.getData();
264+
T o = record.data();
265265

266-
return new LookupResult<>(o, ipAddress.getHostAddress(), record.getNetwork());
266+
return new LookupResult<>(o, ipAddress.getHostAddress(), record.network());
267267
}
268268

269269
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ private void testMemoryMode(DatabaseReader reader) throws IOException,
132132
public void metadata() throws IOException {
133133
DatabaseReader reader = new DatabaseReader.Builder(this.geoipFile)
134134
.fileMode(Reader.FileMode.MEMORY).build();
135-
assertEquals("GeoIP2-City", reader.metadata().getDatabaseType());
135+
assertEquals("GeoIP2-City", reader.metadata().databaseType());
136136
}
137137

138138
@Test

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ private static Network parse(String jsonString) throws IOException {
2323
}
2424
private static void assertNetwork(Network n, String addr, int prefix) throws Exception {
2525
assertNotNull(n);
26-
assertEquals(InetAddress.getByName(addr), n.getNetworkAddress());
27-
assertEquals(prefix, n.getPrefixLength());
26+
assertEquals(InetAddress.getByName(addr), n.networkAddress());
27+
assertEquals(prefix, n.prefixLength());
2828
}
2929

3030
@Test

0 commit comments

Comments
 (0)