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

Handling a Model returning NULL from getResult()

parent a04c5aa8
No related branches found
No related tags found
No related merge requests found
......@@ -254,7 +254,12 @@ public class ModelResourceImpl implements ModelResource{
{
Model calledModel = ModelFactory.getInstance().getModelInstance(config.getModelId());
calledModel.setConfiguration(config);
return Response.ok().entity(calledModel.getResult()).build();
List<Result> retVal = calledModel.getResult();
if(retVal != null)
{
return Response.ok().entity(calledModel.getResult()).build();
}
else throw new ModelExcecutionException("Model returned NULL Result");
}
catch(InstantiationException | IllegalAccessException | ConfigValidationException | ModelExcecutionException | NoSuchModelException | DuplicateModelIdException ex)
{
......@@ -276,8 +281,12 @@ public class ModelResourceImpl implements ModelResource{
{
Model calledModel = ModelFactory.getInstance().getModelInstance(modelId);
calledModel.setConfiguration(config);
List<Result> results = calledModel.getResult();
return Response.ok().entity(results).build();
List<Result> results = calledModel.getResult();
if(results != null)
{
return Response.ok().entity(results).build();
}
else throw new ModelExcecutionException("Model returned NULL Result");
}
catch(Exception ex)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment