Fix small bug in JSPUI RetrieveServlet accidentally caused by DS-426 patch. This patch modified RetrieveServlet to check which bundle a file is in before displaying it. This change was throwing an ArrayOutOfBoundsException for any logo bitstreams, as they have no bundles. Fixed the previous patch to work for logo bitstreams as well.

git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5670 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Tim Donohue
2010-10-27 18:33:35 +00:00
parent 4392bca23f
commit 28ede8f2a1

View File

@@ -133,17 +133,18 @@ public class RetrieveServlet extends DSpaceServlet
// Did we get a bitstream?
if (bitstream != null)
{
// Check whether we got a License and if it should be displayed
Bundle bundle = bitstream.getBundles()[0];
// (Note: list of bundles may be empty array, if a bitstream is a Community/Collection logo)
Bundle bundle = bitstream.getBundles().length>0 ? bitstream.getBundles()[0] : null;
if (bundle.getName().equals(Constants.LICENSE_BUNDLE_NAME) &&
if (bundle!=null &&
bundle.getName().equals(Constants.LICENSE_BUNDLE_NAME) &&
bitstream.getName().equals(Constants.LICENSE_BITSTREAM_NAME))
{
isLicense = true;
}
if (isLicense && !displayLicense && !AuthorizeManager.isAdmin(context))
{
throw new AuthorizeException();