mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
Only fetch the bitstream bundle for an Item, (coll, comm logo's exempt)
Otherwise, I was getting NPE
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
package org.dspace.rest.common;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.core.Constants;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import java.sql.SQLException;
|
||||
@@ -49,7 +50,13 @@ public class Bitstream extends DSpaceObject {
|
||||
expandFields = Arrays.asList(expand.split(","));
|
||||
}
|
||||
|
||||
bundleName = bitstream.getBundles()[0].getName();
|
||||
//A logo bitstream might not have a bundle...
|
||||
if(bitstream.getBundles() != null & bitstream.getBundles().length >= 0) {
|
||||
if(bitstream.getParentObject().getType() == Constants.ITEM) {
|
||||
bundleName = bitstream.getBundles()[0].getName();
|
||||
}
|
||||
}
|
||||
|
||||
description = bitstream.getDescription();
|
||||
format = bitstream.getFormatDescription();
|
||||
sizeBytes = bitstream.getSize() + "";
|
||||
|
@@ -168,4 +168,8 @@ public class Community extends DSpaceObject{
|
||||
public void setParentCommunity(Community parentCommunity) {
|
||||
this.parentCommunity = parentCommunity;
|
||||
}
|
||||
|
||||
public Bitstream getLogo() {
|
||||
return logo;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user