From 6eb49577fe9ad56ddb8f899c52d43b2c145d1dda Mon Sep 17 00:00:00 2001 From: J-N-K Date: Sun, 14 May 2023 18:43:43 +0200 Subject: [PATCH] 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 --- .../java/org/openhab/core/tools/internal/Upgrader.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/upgradetool/src/main/java/org/openhab/core/tools/internal/Upgrader.java b/tools/upgradetool/src/main/java/org/openhab/core/tools/internal/Upgrader.java index acf12f849..1492aef39 100644 --- a/tools/upgradetool/src/main/java/org/openhab/core/tools/internal/Upgrader.java +++ b/tools/upgradetool/src/main/java/org/openhab/core/tools/internal/Upgrader.java @@ -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(); } } }