Skip to content

Commit

Permalink
Update FullTextContentStreams.java
Browse files Browse the repository at this point in the history
Add additional NPE checks
  • Loading branch information
amgciadev authored Jul 14, 2023
1 parent 4cf019f commit e645d0f
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ private void buildFullTextList(Item parentItem) {
if (StringUtils.equals(FULLTEXT_BUNDLE, myBundle.getName())) {
// a-ha! grab the text out of the bitstreams
List<Bitstream> bitstreams = myBundle.getBitstreams();

log.debug("Processing full-text bitstreams. Item handle: " + sourceInfo);

for (Bitstream fulltextBitstream : emptyIfNull(bitstreams)) {
Expand Down Expand Up @@ -164,16 +163,16 @@ public FullTextBitstream(final String parentHandle, final Bitstream file) {
}

public String getContentType(final Context context) throws SQLException {
BitstreamFormat format = bitstream.getFormat(context);
BitstreamFormat format = bitstream != null ? bitstream.getFormat(context) : null;
return format == null ? null : StringUtils.trimToEmpty(format.getMIMEType());
}

public String getFileName() {
return StringUtils.trimToEmpty(bitstream.getName());
return bitstream != null ? StringUtils.trimToEmpty(bitstream.getName()) : null;
}

public long getSize() {
return bitstream.getSizeBytes();
return bitstream != null ? bitstream.getSizeBytes() : -1;
}

public InputStream getInputStream() throws SQLException, IOException, AuthorizeException {
Expand Down

0 comments on commit e645d0f

Please sign in to comment.