From 4ed955ad4f0b224b70b1e33f797d4ce363f03366 Mon Sep 17 00:00:00 2001 From: Hans Van Akelyen Date: Wed, 23 Oct 2024 12:02:25 +0200 Subject: [PATCH] Add support for double values in HopMetadataProperty, fixes #4469 --- .../apache/hop/metadata/serializer/xml/XmlMetadataUtil.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/src/main/java/org/apache/hop/metadata/serializer/xml/XmlMetadataUtil.java b/core/src/main/java/org/apache/hop/metadata/serializer/xml/XmlMetadataUtil.java index feda93b50a6..4e0a761c4ff 100644 --- a/core/src/main/java/org/apache/hop/metadata/serializer/xml/XmlMetadataUtil.java +++ b/core/src/main/java/org/apache/hop/metadata/serializer/xml/XmlMetadataUtil.java @@ -165,6 +165,8 @@ private static String serializeObjectToXml( } } else if (value instanceof Long longValue) { xml += XmlHandler.addTagValue(tag, longValue); + } else if (value instanceof Double doubleValue) { + xml += XmlHandler.addTagValue(tag, doubleValue); } else if (value instanceof Date date) { xml += XmlHandler.addTagValue(tag, date); } else if (value.getClass().isEnum()) { @@ -481,6 +483,10 @@ private static Object deSerializeFromXml( if (elementNode != null) { return Long.valueOf(elementString); } + } else if (fieldType.equals(double.class) || fieldType.equals(Double.class)) { + if (elementNode != null) { + return Double.valueOf(elementString); + } } else if (fieldType.equals(Date.class)) { if (elementNode != null) { return XmlHandler.stringToDate(elementString);