Commit 9bd483f5 authored by Matija Obreza's avatar Matija Obreza

Fixed #53: error "cropName must be a String" reported when null is provided

parent d4c814d7
......@@ -559,10 +559,6 @@ public class BatchRESTServiceImpl implements BatchRESTService {
private boolean updateCrop(Accession accession, JsonNode value) throws RESTApiDataTypeException {
if (value != null) {
if (!value.isTextual()) {
throw new RESTApiDataTypeException("cropName must be a String");
}
if (value.isNull()) {
if (!StringUtils.equals(null, accession.getCropName())) {
accession.setCropName(null);
......@@ -571,6 +567,10 @@ public class BatchRESTServiceImpl implements BatchRESTService {
}
}
if (!value.isTextual()) {
throw new RESTApiDataTypeException("cropName must be a String");
}
final String cropName = value.textValue().trim();
if (!StringUtils.equals(cropName, accession.getCropName())) {
accession.setCropName(cropName);
......
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