From da5786423911c09539a3bb0446dc2c172152c54e Mon Sep 17 00:00:00 2001 From: Tor-Einar Skog <tor-einar.skog@nibio.no> Date: Tue, 28 Apr 2020 13:33:31 +0200 Subject: [PATCH] Serialization/deserialization issue fixed for good --- .../model/psilarosaetempmodel/PsilaRosaeTempModel.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/no/nibio/vips/model/psilarosaetempmodel/PsilaRosaeTempModel.java b/src/main/java/no/nibio/vips/model/psilarosaetempmodel/PsilaRosaeTempModel.java index f9f1317..5c8df33 100755 --- a/src/main/java/no/nibio/vips/model/psilarosaetempmodel/PsilaRosaeTempModel.java +++ b/src/main/java/no/nibio/vips/model/psilarosaetempmodel/PsilaRosaeTempModel.java @@ -223,8 +223,6 @@ public class PsilaRosaeTempModel extends I18nImpl implements Model { // Init data matrix this.dataMatrix = new DataMatrix(); - ObjectMapper mapper = new ObjectMapper(); - // Setting timezone this.timeZone = TimeZone.getTimeZone((String) config.getConfigParameter("timeZone")); //System.out.println("TimeZone=" + this.timeZone); @@ -232,7 +230,12 @@ public class PsilaRosaeTempModel extends I18nImpl implements Model { // Importing weather data, creating collections // Can accept both hourly and daily data WeatherUtil wUtil = new WeatherUtil(); - List<WeatherObservation> observations = mapper.convertValue(config.getConfigParameter("observations"), new TypeReference<List<WeatherObservation>>(){}); + + List<WeatherObservation> observations = modelUtil.extractWeatherObservationList(config.getConfigParameter("observations")); + if(observations == null || observations.isEmpty()) + { + throw new ConfigValidationException("Please provide weather data."); + } for(WeatherObservation o:observations) { switch(o.getElementMeasurementTypeId()) -- GitLab