Skip to content

Commit

Permalink
add a missing null-check before loading model-level annotations from …
Browse files Browse the repository at this point in the history
…JSON
  • Loading branch information
aurelien-naldi committed Oct 3, 2024
1 parent cb94f25 commit d8fdd9a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/java/org/colomoto/biolqm/metadata/Annotator.java
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,7 @@ public void readAnnotationsFromJSON(JSONObject json, Map<String, N> nodeMap) {
// metadataModel.importCollectionsMetadata(json.getJSONArray("collections"));
// }

JSONObject jmodel = json.optJSONObject("model");
this.onModel().addJSON(jmodel);

this.onModel().addJSON(json.optJSONObject("model"));
readNodesJSON(json.optJSONObject("nodes"), nodeMap);
readEdgesJSON(json.optJSONObject("edges"), nodeMap);
}
Expand Down Expand Up @@ -424,6 +422,9 @@ private void readEdgesJSON(JSONObject jedges, Map<String, N> nodeMap) {
}

private void addJSON(JSONObject json) {
if (json ==null) {
return;
}
addJSONNotes(json.optJSONObject("notes"));
addJSONAnnotations(json.optJSONArray("annotation"));
}
Expand Down

0 comments on commit d8fdd9a

Please sign in to comment.