Skip to content
Snippets Groups Projects
Commit 679b35f2 authored by Mirco Nasuti's avatar Mirco Nasuti
Browse files

Unsupported variables message for Exareme

parent 1099df4e
No related branches found
No related tags found
No related merge requests found
......@@ -224,8 +224,12 @@ public class ExperimentApi {
experiment.setResult(results.toString().replace("\0", ""));
experiment.setHasError(code >= 400);
experiment.setHasServerError(code >= 500);
if(!isJSONValid(experiment.getResult()))
{
experiment.setResult("Unsupported variables !");
}
} catch (Exception e) {
e.printStackTrace();
experiment.setHasError(true);
experiment.setHasServerError(true);
experiment.setResult(e.getMessage());
......@@ -247,6 +251,16 @@ public class ExperimentApi {
}.start();
}
public boolean isJSONValid(String test) {
try {
new JsonParser().parse(test);
} catch (JsonParseException jpe)
{
return false;
}
return true;
}
private boolean isExaremeAlgo(Experiment experiment) {
JsonArray algorithms = new JsonParser().parse(experiment.getAlgorithms()).getAsJsonArray();
String algoCode = algorithms.get(0).getAsJsonObject().get("code").getAsString();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment