mirror of
https://github.com/ilri/cgspace-java-helpers.git
synced 2024-11-22 23:05:12 +01:00
src: fix npe on null description
In FixLowQualityThumbnails we need to make sure that bitstream de- scriptions are not null or empty before trying to evaluate them.
This commit is contained in:
parent
6772145bec
commit
f0754ab419
@ -124,6 +124,10 @@ public class FixLowQualityThumbnails {
|
||||
for (Bitstream thumbnailBitstream : thumbnailBundleBitstreams) {
|
||||
String thumbnailDescription = thumbnailBitstream.getDescription();
|
||||
|
||||
if (StringUtils.isEmpty(thumbnailDescription)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check if this item has a bitstream in the THUMBNAIL bundle with description "IM
|
||||
// Thumbnail", but only if we haven't already seen one in another iteration for this
|
||||
// bundle.
|
||||
@ -140,6 +144,10 @@ public class FixLowQualityThumbnails {
|
||||
String thumbnailName = thumbnailBitstream.getName();
|
||||
String thumbnailDescription = thumbnailBitstream.getDescription();
|
||||
|
||||
if (StringUtils.isEmpty(thumbnailDescription)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// If this item has a "Generated Thumbnail" we can remove it, because those
|
||||
// typically come from other JPEGs in the ORIGINAL bundle and we would prefer
|
||||
// the IM Thumbnail generated from a PDF anyway. The DSpace-generated descri-
|
||||
@ -225,6 +233,10 @@ public class FixLowQualityThumbnails {
|
||||
String originalDescription = originalBitstream.getDescription();
|
||||
String originalFormat = originalBitstream.getFormat(context).getMIMEType();
|
||||
|
||||
if (StringUtils.isEmpty(originalDescription)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
- check if the bitstream is a JPEG based on its MIME Type
|
||||
- check if the bitstream's name or description is "Thumbnail"
|
||||
|
Loading…
Reference in New Issue
Block a user