From ea5dd0576951557b35f5f24096d115a860faf8f3 Mon Sep 17 00:00:00 2001
From: Tor-Einar Skog <tor-einar.skog@nibio.no>
Date: Tue, 28 Apr 2020 17:24:01 +0200
Subject: [PATCH] Fixing deserialization of Weather data

---
 .../model/negativeprognosismodel/NegativePrognosisModel.java   | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/main/java/no/nibio/vips/model/negativeprognosismodel/NegativePrognosisModel.java b/src/main/java/no/nibio/vips/model/negativeprognosismodel/NegativePrognosisModel.java
index 945cc08..1347d04 100755
--- a/src/main/java/no/nibio/vips/model/negativeprognosismodel/NegativePrognosisModel.java
+++ b/src/main/java/no/nibio/vips/model/negativeprognosismodel/NegativePrognosisModel.java
@@ -240,11 +240,10 @@ public class NegativePrognosisModel extends I18nImpl implements Model{
 
     @Override
     public void setConfiguration(ModelConfiguration config) throws ConfigValidationException {
-        ObjectMapper mapper = new ObjectMapper();
         // Setting timezone
         this.timeZone = TimeZone.getTimeZone((String) config.getConfigParameter("timeZone"));
         // Getting weather data
-        List<WeatherObservation> observations = mapper.convertValue(config.getConfigParameter("observations"), new TypeReference<List<WeatherObservation>>(){});
+        List<WeatherObservation> observations = this.modelUtil.extractWeatherObservationList(config.getConfigParameter("observations"));
         for(WeatherObservation o:observations)
         {
             this.dataMatrix.setParamDoubleValueForDate(o.getTimeMeasured(), o.getElementMeasurementTypeId(), o.getValue());
-- 
GitLab