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