Skip to content

Commit c39a6e5

Browse files
committed
added null check for collection
1 parent 7a05180 commit c39a6e5

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/main/java/org/dspace/ctask/replicate/BagItRestoreFromAIP.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,13 @@ private void recoverCollection(Context ctx, File archive, String collId, String
256256
Community parentCommunity = (Community) handleService.resolveToObject(ctx, commId);
257257
Collection collection = collectionService.create(ctx, parentCommunity, collId);
258258

259-
// update with AIP data
260-
Packer packer = PackerFactory.instance(ctx, collection);
261-
packer.unpack(archive);
259+
if (collection != null) {
260+
// update with AIP data
261+
Packer packer = PackerFactory.instance(ctx, collection);
262+
packer.unpack(archive);
263+
} else {
264+
log.error("Unable to restore collection {} because it could not be found.", collId);
265+
}
262266
} else {
263267
log.error("Collection '{}' lacks parent community", collId);
264268
}

0 commit comments

Comments
 (0)