Skip to content

Commit

Permalink
Avoid NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
abollini committed Mar 14, 2024
1 parent dfec33a commit 9e30df5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void setDisplayMetadata(String displayMetadata) {
public Optional<ExternalDataObject> getExternalDataObject(String id) {
try {
ExternalDataObject externalDataObject = getExternalDataObject(querySource.getRecord(id));
return Optional.of(externalDataObject);
return Optional.ofNullable(externalDataObject);
} catch (MetadataSourceException e) {
throw new RuntimeException(
"The live import provider " + querySource.getImportSource() + " throws an exception", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,13 @@ public void consume(Context ctx, Event event) throws Exception {

private void addToCacheEviction(DSpaceObject subject, DSpaceObject subject2, int type) {
if (type == Constants.BITSTREAM) {
toEvictFromCanvasCache.add(subject2);
if (subject2 != null) {
toEvictFromCanvasCache.add(subject2);
}
}
if (subject != null) {
toEvictFromManifestCache.add(subject);
}
toEvictFromManifestCache.add(subject);
}

@Override
Expand Down

0 comments on commit 9e30df5

Please sign in to comment.