Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Only fetch the bitstream bundle for an Item, (coll, comm logo's exempt)
Otherwise, I was getting NPE
  • Loading branch information
peterdietz committed Oct 20, 2013
1 parent 9949350 commit fee4188
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Expand Up @@ -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;
Expand Down Expand Up @@ -49,7 +50,13 @@ public void setup(org.dspace.content.Bitstream bitstream, String expand) throws
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() + "";
Expand Down
Expand Up @@ -168,4 +168,8 @@ public Community getParentCommunity() {
public void setParentCommunity(Community parentCommunity) {
this.parentCommunity = parentCommunity;
}

public Bitstream getLogo() {
return logo;
}
}

0 comments on commit fee4188

Please sign in to comment.