Skip to content

KeePassJava2 3.1.0

Latest

Choose a tag to compare

@jorabin jorabin released this 05 Oct 11:49
· 5 commits to v3-master since this release

A release of version 3 with two breaking changes, made early while version 3 has few users: it needs Java 17, and times are java.time.Instant. It also adds read and write, which leave your streams open. It is on Maven Central.

Version 2 is still maintained for now, with bug and security fixes; its current release is 2.2.6, on the master branch. Version 3 is developed on v3-develop, and v3-master holds the latest 3.x release.

Changes you may need to act on

Upgrading from 3.0.0:

  • Java 17 is required (3.0.0 needed Java 11).
  • Times are Instant (#111). getCreationTime(), getLastModificationTime(), getLastAccessTime() and getExpiryTime() on Entry and Group return java.time.Instant, and setExpiryTime(...) takes one. Where you need a Date, convert at the call:
    Date created = Date.from(entry.getCreationTime());
    entry.setExpiryTime(expiryDate.toInstant());
    The times stored in files are unchanged. Helpers.toDate/fromDate are now toInstant/fromInstant.
  • save and load are deprecated (#109). They close the stream they're given, which you may not expect. Use write and read, which leave it open, and close it yourself:
    try (InputStream inputStream = Files.newInputStream(path)) {
        database = KdbxDatabase.read(credentials, inputStream);
    }
    save and load still work, and still close the stream. loadXml is replaced by readXml, which throws IOException rather than Exception, and the saveNx/loadNx methods are deprecated too.
  • Util.listDatabase no longer closes the output stream it's given.

The readme has upgrade notes, for 3.0 to 3.1 and for 2.x to 3.0.

New

  • read and write that leave the stream open (#109): Database.write, KdbxDatabase.read, KdbxDatabase.readXml and KdbDatabase.read, and read/write on StreamFormat, SerializableDatabase and BasicDatabaseSerializer. Existing implementations of those interfaces get them as default methods, so they keep working.

Other changes

  • The examples, tests and readme use read/write with try-with-resources.
  • The getPassword/setPassword implementations are marked deprecated, like the Entry methods they implement; the KDB reader no longer uses them, and they're tested.
  • Jackson's deprecated setSerializationInclusion is replaced by setDefaultPropertyInclusion, which does the same.

Maven

<dependency>
    <groupId>org.linguafranca.pwdb</groupId>
    <artifactId>KeePassJava2.kdbx.database</artifactId>
    <version>3.1.0</version>
</dependency>

Or KeePassJava2 for the KDBX and KDB implementations together.

See the CHANGELOG for the full history.