Fix UpgradeTool execution log (#3614)

It seems that in some cases GSON is not able to correctly serialize/deserialize ZonedDateTime. Since we do not depend on the value in any case (it's just informational), we can store a String instead.

A missing metadata database also failed the check when upgrading items. This has been fixed, too.

Signed-off-by: Jan N. Klug <github@klug.nrw>
This commit is contained in:
J-N-K 2023-05-14 18:43:43 +02:00 committed by GitHub
parent 55d6d21f1f
commit 6eb49577fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,7 +78,8 @@ public class Upgrader {
logger.error("Cannot access item database '{}', check path and access rights.", itemJsonDatabasePath);
return;
}
if (!Files.isWritable(metadataJsonDatabasePath)) {
// missing metadata database is also fine, we create one in that case
if (!Files.isWritable(metadataJsonDatabasePath) && Files.exists(metadataJsonDatabasePath)) {
logger.error("Cannot access metadata database '{}', check path and access rights.",
metadataJsonDatabasePath);
return;
@ -164,10 +165,10 @@ public class Upgrader {
}
private static class UpgradeRecord {
public final ZonedDateTime executionDate;
public final String executionDate;
public UpgradeRecord(ZonedDateTime executionDate) {
this.executionDate = executionDate;
this.executionDate = executionDate.toString();
}
}
}