Only fetch the bitstream bundle for an Item, (coll, comm logo's exempt)

Otherwise, I was getting NPE
This commit is contained in:
Peter Dietz
2013-10-19 22:30:59 -04:00
parent 994935082e
commit fee4188716
2 changed files with 12 additions and 1 deletions

View File

@@ -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() + "";

View File

@@ -168,4 +168,8 @@ public class Community extends DSpaceObject{
public void setParentCommunity(Community parentCommunity) {
this.parentCommunity = parentCommunity;
}
public Bitstream getLogo() {
return logo;
}
}