Skip to content

Commit

Permalink
Merge branch 'w2p-124579_fix-clamAV-exception-issues' into w2p-124579…
Browse files Browse the repository at this point in the history
…_fix-clamAV-exception-issues-latest-main
  • Loading branch information
Jens Vannerum committed Jan 22, 2025
2 parents 16b9fa7 + 046c1b5 commit 36ca5db
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions dspace-api/src/main/java/org/dspace/ctask/general/ClamScan.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.collections4.ListUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.authorize.AuthorizeException;
Expand Down Expand Up @@ -99,8 +100,13 @@ public int perform(DSpaceObject dso) throws IOException {
}

try {
Bundle bundle = itemService.getBundles(item, "ORIGINAL").get(0);
results = new ArrayList<>();
List<Bundle> bundles = itemService.getBundles(item, "ORIGINAL");
if (ListUtils.emptyIfNull(bundles).isEmpty()) {
setResult("No ORIGINAL bundle found for item: " + getItemHandle(item));
return Curator.CURATE_SKIP;
}
Bundle bundle = bundles.get(0);
results = new ArrayList<String>();
for (Bitstream bitstream : bundle.getBitstreams()) {
InputStream inputstream = bitstreamService.retrieve(Curator.curationContext(), bitstream);
logDebugMessage("Scanning " + bitstream.getName() + " . . . ");
Expand Down

0 comments on commit 36ca5db

Please sign in to comment.