From 5cca30492b44bbe482cb854c4b3398533e5a5bbc Mon Sep 17 00:00:00 2001 From: Kai Kreuzer Date: Sun, 18 Oct 2020 20:03:55 +0200 Subject: [PATCH] [mapdb] Avoid ArrayIndexOutOfBoundsExceptions being thrown (#8792) Signed-off-by: Kai Kreuzer --- .../persistence/mapdb/internal/StateTypeAdapter.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bundles/org.openhab.persistence.mapdb/src/main/java/org/openhab/persistence/mapdb/internal/StateTypeAdapter.java b/bundles/org.openhab.persistence.mapdb/src/main/java/org/openhab/persistence/mapdb/internal/StateTypeAdapter.java index c650fcf5052..eadd8469ddf 100644 --- a/bundles/org.openhab.persistence.mapdb/src/main/java/org/openhab/persistence/mapdb/internal/StateTypeAdapter.java +++ b/bundles/org.openhab.persistence.mapdb/src/main/java/org/openhab/persistence/mapdb/internal/StateTypeAdapter.java @@ -43,11 +43,12 @@ public class StateTypeAdapter extends TypeAdapter { return null; } String value = reader.nextString(); - String[] parts = value.split(TYPE_SEPARATOR); - String valueTypeName = parts[0]; - String valueAsString = parts[1]; try { + String[] parts = value.split(TYPE_SEPARATOR); + String valueTypeName = parts[0]; + String valueAsString = parts[1]; + @SuppressWarnings("unchecked") Class valueType = (Class) Class.forName(valueTypeName); List> types = Collections.singletonList(valueType);