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