Skip to content
Snippets Groups Projects
Commit 682853a6 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Bugfix avoiding concurrentmodificationexception

parent aaddbf15
No related branches found
No related tags found
No related merge requests found
...@@ -207,6 +207,15 @@ public class OatFloweringModel extends I18nImpl implements Model{ ...@@ -207,6 +207,15 @@ public class OatFloweringModel extends I18nImpl implements Model{
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
List<WeatherObservation> observations = mapper.convertValue(config.getConfigParameter("observations"), new TypeReference<List<WeatherObservation>>(){}); List<WeatherObservation> observations = mapper.convertValue(config.getConfigParameter("observations"), new TypeReference<List<WeatherObservation>>(){});
// Must be complete set of daily mean temperatures
WeatherUtil wUtil = new WeatherUtil();
Date potentialHole = wUtil.findFirstHoleInObservationSeries(observations, WeatherObservation.LOG_INTERVAL_ID_1D, OatFloweringModel.DEFAULT_TIME_ZONE);
if(potentialHole != null)
{
throw new ConfigValidationException("Hole found in temperature series at = " + potentialHole);
}
for(WeatherObservation o:observations) for(WeatherObservation o:observations)
{ {
switch(o.getElementMeasurementTypeId()) switch(o.getElementMeasurementTypeId())
...@@ -221,17 +230,9 @@ public class OatFloweringModel extends I18nImpl implements Model{ ...@@ -221,17 +230,9 @@ public class OatFloweringModel extends I18nImpl implements Model{
// TODO: Throw validation error? // TODO: Throw validation error?
break; break;
} }
// Must be complete set of daily mean temperatures
WeatherUtil wUtil = new WeatherUtil();
Date potentialHole = wUtil.findFirstHoleInObservationSeries(observations, WeatherObservation.LOG_INTERVAL_ID_1D, OatFloweringModel.DEFAULT_TIME_ZONE);
if(potentialHole != null)
{
throw new ConfigValidationException("Hole found in temperature series at = " + potentialHole);
}
} }
if(config.getConfigParameter("dateOfSowing") != null) if(config.getConfigParameter("dateOfSowing") != null)
{ {
this.dateOfSowing = mapper.convertValue(config.getConfigParameter("dateOfSowing"), new TypeReference<Date>(){}); this.dateOfSowing = mapper.convertValue(config.getConfigParameter("dateOfSowing"), new TypeReference<Date>(){});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment