Commit 7464eb81 authored by Matija Obreza's avatar Matija Obreza
Browse files

Fixed NPE when { "storage": null } is provided

parent 9b1fc4fe
......@@ -467,17 +467,20 @@ public class BatchRESTServiceImpl implements BatchRESTService {
List<Integer> as = accession.getStoRage();
List<Integer> toRemove = new ArrayList<Integer>(as);
Iterator<JsonNode> it = arr.elements();
while (it.hasNext()) {
JsonNode storageElem = it.next();
int stor = Integer.parseInt(storageElem.asText());
if (!as.contains(stor)) {
updated = true;
as.add(stor);
} else {
// Cast needed to remove the object
toRemove.remove((Integer) stor);
// Sometimes { "storage": null } is provided.
if (arr != null) {
Iterator<JsonNode> it = arr.elements();
while (it.hasNext()) {
JsonNode storageElem = it.next();
int stor = Integer.parseInt(storageElem.asText());
if (!as.contains(stor)) {
updated = true;
as.add(stor);
} else {
// Cast needed to remove the object
toRemove.remove((Integer) stor);
}
}
}
......
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