[DS-742] Embargo Fails with Null Pointer Exception on Item Install.

git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5739 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Mark Diggory
2010-11-05 20:47:49 +00:00
parent 1dd547a909
commit ac94a16211

View File

@@ -155,7 +155,14 @@ public class EmbargoManager
{
init();
DCValue terms[] = item.getMetadata(terms_schema, terms_element, terms_qualifier, Item.ANY);
DCDate result = setter.parseTerms(context, item, terms.length > 0 ? terms[0].value : null);
DCDate result = null;
// Its poor form to blindly use an object that could be null...
if(terms != null && terms[0] != null)
{
result = setter.parseTerms(context, item, terms.length > 0 ? terms[0].value : null);
}
// sanity check: do not allow an embargo lift date in the past.
if (result != null && result.toDate().before(new Date()))