diff --git a/src/main/java/no/nibio/vips/logic/modules/barleynetblotch/BarleyNetBlotchModelService.java b/src/main/java/no/nibio/vips/logic/modules/barleynetblotch/BarleyNetBlotchModelService.java index 0cb49d760cae85f053296a47d2499b1b2e0be94e..f0855bedd8805873eecd5ac3527731a052a0ea4d 100755 --- a/src/main/java/no/nibio/vips/logic/modules/barleynetblotch/BarleyNetBlotchModelService.java +++ b/src/main/java/no/nibio/vips/logic/modules/barleynetblotch/BarleyNetBlotchModelService.java @@ -137,7 +137,7 @@ public class BarleyNetBlotchModelService { public Response runModel( @PathParam("organizationId") Integer organizationId, @QueryParam("timeZone") String timeZoneStr, - @QueryParam("weatherdataType") String weatherdataType, + @QueryParam("weatherDataSourceType") String weatherDataSourceType, @QueryParam("latitude") String latitude, @QueryParam("longitude") String longitude, @QueryParam("weatherStationId") Integer weatherStationId, @@ -181,7 +181,7 @@ public class BarleyNetBlotchModelService { List<WeatherObservation> observations; - if (weatherdataType != null && "weatherstation".equals(weatherdataType.trim())) { + if (weatherDataSourceType != null && "weatherstation".equals(weatherDataSourceType.trim())) { PointOfInterestWeatherStation weatherStation = em.find(PointOfInterestWeatherStation.class, weatherStationId); LOGGER.info("Run model with weatherdata from weatherstation {}", weatherStation.getName()); @@ -223,6 +223,7 @@ public class BarleyNetBlotchModelService { new HashSet<>(Collections.singletonList(WeatherObservation.LOG_INTERVAL_ID_1H)) ); } catch (WeatherDataSourceException ex) { + LOGGER.error("Exception while getting observations for latitude={} longitude={}", latitude, longitude, ex); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ex.getMessage()).build(); } if (observations == null || observations.isEmpty()) { diff --git a/src/main/java/no/nibio/vips/logic/service/ModelFormService.java b/src/main/java/no/nibio/vips/logic/service/ModelFormService.java index c1c739baa829e0672830c473feb08357555712f5..f369d438e3c1bec942f9b19f8a80defcb60a5b55 100644 --- a/src/main/java/no/nibio/vips/logic/service/ModelFormService.java +++ b/src/main/java/no/nibio/vips/logic/service/ModelFormService.java @@ -53,6 +53,8 @@ import no.nibio.vips.util.ParseRESTParamUtil; import no.nibio.vips.util.WeatherUtil; import no.nibio.vips.util.XDate; import no.nibio.vips.util.weather.WeatherDataSourceUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * This is a collection of (one) service(s) for models run from forms (not as part of batch) @@ -62,7 +64,9 @@ import no.nibio.vips.util.weather.WeatherDataSourceUtil; @Path("rest/modelform") @Facet("restricted") public class ModelFormService { - + private static final Logger LOGGER = LoggerFactory.getLogger(ModelFormService.class); + + @EJB UserBean userBean; @EJB @@ -196,14 +200,15 @@ public class ModelFormService { Integer VIPSCoreUserId = organization.getDefaultVipsCoreUserId(); - List<Result>results = forecastBean.runForecast(mConf, VIPSCoreUserId); + List<Result> results = forecastBean.runForecast(mConf, VIPSCoreUserId); return Response.ok().entity(results).build(); } catch(PreprocessorException |RunModelException ex) { + LOGGER.error("Exception occurred when attempting to run the septoria humidity model", ex); return Response.serverError().entity(ex.getMessage()).build(); - } + } } private ForecastModelConfiguration getForecastModelConfiguration(String modelId, String key, String value)