Commit 2d9dc832 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

param validation added

parent 47febf5b
......@@ -130,6 +130,9 @@ public class ReferenceGenomeController extends BaseController {
throw new QueryException("Unknown taxonomy organism: " + organismId);
}
MiriamData organism = new MiriamData(MiriamType.TAXONOMY, organismId);
if (genomeType==null) {
throw new QueryException("Unknown genome type");
}
String url = referenceGenomeService.getUrlForGenomeVersion(genomeType, organism, version);
List<RemoteUrl> result = new ArrayList<>();
......@@ -218,6 +221,9 @@ public class ReferenceGenomeController extends BaseController {
if (organismId == null || organismId.isEmpty()) {
throw new QueryException("Unknown taxonomy organism: " + organismId);
}
if (genomeType == null) {
throw new QueryException("Unknown genome type.");
}
MiriamData organism = new MiriamData(MiriamType.TAXONOMY, organismId);
try {
List<OrganismTypeVersion> result = new ArrayList<>();
......
......@@ -137,12 +137,16 @@ public class ModelController extends BaseController {
if (modelId.equals("*")) {
return getModels(projectId);
} else {
ModelData result = modelService.getModelByMapId(projectId, Integer.valueOf(modelId));
if (result == null) {
throw new ObjectNotFoundException("Map with given id doesn't exist");
}
try {
ModelData result = modelService.getModelByMapId(projectId, Integer.valueOf(modelId));
if (result == null) {
throw new ObjectNotFoundException("Map with given id doesn't exist");
}
return result;
return result;
} catch (NumberFormatException e) {
throw new QueryException("Invalid modelId", e);
}
}
}
......
Markdown is supported
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