Releases: maxmind/MaxMind-DB-Reader-java
Releases · maxmind/MaxMind-DB-Reader-java
4.1.0
Immutable
release. Only release title and notes can be modified.
- Fixed unbounded off-heap memory growth when initializing the reader in
FileMode.MEMORY. The previous implementation read the database via
FileChannel.read()into a heap buffer, which causes the JDK to cache
temporary direct ByteBuffers in per-thread storage
(sun.nio.ch.Util.BufferCache). Repeated initialization across different
threads could grow this cache without bound. The reader now uses
FileInputStreamforMEMORYmode, which bypasses the cache.
FileMode.MEMORY_MAPPEDwas unaffected. - Fixed a latent short-read bug in the multi-chunk
FileMode.MEMORY
load path introduced in 4.0.0.FileChannel.read(ByteBuffer)is not
contractually obligated to fully fill the destination buffer; a
short read could have caused silent truncation of an in-memory
database. Affects databases larger than ~2GB (the default chunk
size). The new chunked read loop retries until each chunk is fully
populated.
4.0.2
Immutable
release. Only release title and notes can be modified.
- Fixed a bug where enums with
@MaxMindDbCreatorwould throw
ConstructorNotFoundExceptionwhen the data was stored via a pointer
in the database. This commonly occurred with deduplicated data in larger
databases. Reported by Fabrice Bacchella. GitHub #644 in GeoIP2-java. - Improved error messages when constructor invocation fails. The error now
correctly identifies null values being passed to primitive parameters
instead of reporting misleading boxed/primitive type mismatches.
4.0.1
Immutable
release. Only release title and notes can be modified.
4.0.0
This is a major release with several breaking changes. Please see
UPGRADING.md for detailed migration instructions.
- Java 17 or greater is now required.
- Added support for MaxMind DB files larger than 2GB. The library now uses
an internal Buffer abstraction that can handle databases exceeding the
2GB ByteBuffer limit. Files under 2GB continue to use a single ByteBuffer
for optimal performance. Requested by nonetallt. GitHub #154. Fixed by
Silvano Cerza. GitHub #289. Metadata.getBuildDate()has been replaced withbuildTime(), which returns
java.time.Instantinstead ofjava.util.Date. The instant represents the
database build time in UTC.DatabaseRecord,Metadata,Network, and internalDecodedValueclasses
have been converted to records. The following API changes were made:DatabaseRecord.getData()andDatabaseRecord.getNetwork()have been
replaced with record accessor methodsdata()andnetwork().- Simple getter methods on
Metadata(e.g.,getBinaryFormatMajorVersion(),
getDatabaseType(), etc.) have been replaced with their corresponding record
accessor methods (e.g.,binaryFormatMajorVersion(),databaseType(), etc.). Network.getNetworkAddress()andNetwork.getPrefixLength()have been
replaced with record accessor methodsnetworkAddress()andprefixLength().- Removed the legacy
DatabaseRecord(T, InetAddress, int)constructor; pass a
Networkwhen constructing records manually.
- Deserialization improvements:
- If no constructor is annotated with
@MaxMindDbConstructor, records now
use their canonical constructor automatically. For non‑record classes with
a single public constructor, that constructor is used by default. @MaxMindDbParameterannotations are now optional when parameter names
match field names in the database: for records, component names are used;
for classes, Java parameter names are used (when compiled with
-parameters). Annotations still take precedence when present.- Added
@MaxMindDbIpAddressand@MaxMindDbNetworkannotations to inject
the lookup IP address and resulting network into constructors. Annotation
metadata is cached per type to avoid repeated reflection overhead.
- If no constructor is annotated with