mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
124579: If no ORIGINAL bundle exists, end the process gracefully instead of throwing NPE
(cherry picked from commit 046c1b5d05
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
6bf4d142a4
commit
6b4c7a773d
@@ -19,6 +19,7 @@ import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.Bitstream;
|
||||
import org.dspace.content.Bundle;
|
||||
@@ -99,7 +100,12 @@ public class ClamScan extends AbstractCurationTask {
|
||||
}
|
||||
|
||||
try {
|
||||
Bundle bundle = itemService.getBundles(item, "ORIGINAL").get(0);
|
||||
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);
|
||||
|
Reference in New Issue
Block a user