diff --git a/dspace-api/src/main/java/org/dspace/versioning/ItemCorrectionProvider.java b/dspace-api/src/main/java/org/dspace/versioning/ItemCorrectionProvider.java index a4041d36a0d9..6e26d928c72f 100644 --- a/dspace-api/src/main/java/org/dspace/versioning/ItemCorrectionProvider.java +++ b/dspace-api/src/main/java/org/dspace/versioning/ItemCorrectionProvider.java @@ -191,30 +191,31 @@ private boolean isIgnoredWithQualifier(Set ignoredMetadataFields, Metada protected void updateBundlesAndBitstreams(Context c, Item itemNew, Item nativeItem) throws SQLException, AuthorizeException, IOException { + if (bundles != null && bundles.size() > 0) { + for (String bundleName : bundles) { + List nativeBundles = nativeItem.getBundles(bundleName); + List correctedBundles = itemNew.getBundles(bundleName); - for (String bundleName : bundles) { - List nativeBundles = nativeItem.getBundles(bundleName); - List correctedBundles = itemNew.getBundles(bundleName); + if (CollectionUtils.isEmpty(nativeBundles) && CollectionUtils.isEmpty(correctedBundles)) { + continue; + } - if (CollectionUtils.isEmpty(nativeBundles) && CollectionUtils.isEmpty(correctedBundles)) { - continue; - } + Bundle nativeBundle; + if (CollectionUtils.isEmpty(nativeBundles)) { + nativeBundle = bundleService.create(c, nativeItem, bundleName); + } else { + nativeBundle = nativeBundles.get(0); + } - Bundle nativeBundle; - if (CollectionUtils.isEmpty(nativeBundles)) { - nativeBundle = bundleService.create(c, nativeItem, bundleName); - } else { - nativeBundle = nativeBundles.get(0); - } + Bundle correctedBundle; + if (CollectionUtils.isEmpty(correctedBundles)) { + correctedBundle = bundleService.create(c, nativeItem, bundleName); + } else { + correctedBundle = correctedBundles.get(0); + } - Bundle correctedBundle; - if (CollectionUtils.isEmpty(correctedBundles)) { - correctedBundle = bundleService.create(c, nativeItem, bundleName); - } else { - correctedBundle = correctedBundles.get(0); + updateBundleAndBitstreams(c, nativeBundle, correctedBundle); } - - updateBundleAndBitstreams(c, nativeBundle, correctedBundle); } }