Skip to content

JacksonDatabase cannot load a file SimpleDatabase saved after loading one with history: Unrecognized field "class" (JacksonHistory) #100

Description

@astrapi69

Version 2.2.4.

Steps, measured:

  1. SimpleDatabase.load a KDBX file whose entries have history (reproduced with a KDBX 3.1 file and with a KDBX 4 file written by KeePassXC 2.7.10).
  2. save it with SimpleDatabase.
  3. JacksonDatabase.load the saved file.

Result:

com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "class" (class org.linguafranca.pwdb.kdbx.jackson.JacksonHistory), not marked as ignorable (one known property: "Entry"])

The exception names a field class on JacksonHistory, which knows only Entry - so the Simple serializer appears to write a class attribute on the History element (inferred from the exception, the XML itself was not inspected). SimpleDatabase.load reads the file. A file written by SimpleDatabase from new entries (no history) loads in JacksonDatabase without error.

So the two serializers of the same library do not read each other's output once history is involved. Ignoring unknown properties on JacksonHistory, or not writing the attribute from Simple, would resolve it.

Context: astrapi69/mystic-crypt-ui#407.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions