Improve debug logging and correct null pointer errors in Browse and Search Consumers.

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@3010 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Mark Diggory
2008-07-30 05:55:06 +00:00
parent 23acebe943
commit 11f50df64a
2 changed files with 17 additions and 16 deletions

View File

@@ -93,7 +93,8 @@ public class BrowseConsumer implements Consumer
toUpdate = new HashSet<Item>();
}
DSpaceObject subj = event.getSubject(ctx);
log.debug("consume() evaluating event: " + event.toString());
int st = event.getSubjectType();
int et = event.getEventType();
@@ -101,9 +102,17 @@ public class BrowseConsumer implements Consumer
switch (st)
{
// If an Item is created or modified..
// If an Item is created or its metadata is modified..
case Constants.ITEM:
toUpdate.add((Item)subj);
if(et == Event.MODIFY_METADATA || et == Event.CREATE)
{
DSpaceObject subj = event.getSubject(ctx);
if (subj != null)
{
log.debug("consume() adding event to update queue: " + event.toString());
toUpdate.add((Item)subj);
}
}
break;
// track ADD and REMOVE from collections, that changes browse index.
case Constants.COLLECTION:
@@ -112,12 +121,14 @@ public class BrowseConsumer implements Consumer
{
Item obj = (Item)event.getObject(ctx);
if (obj != null)
{
log.debug("consume() adding event to update queue: " + event.toString());
toUpdate.add(obj);
}
}
break;
default:
log.warn("consume() got unrecognized event: " + event.toString());
log.debug("consume() ingnoring event: " + event.toString());
}
}

View File

@@ -105,17 +105,7 @@ public class SearchConsumer implements Consumer
}
DSpaceObject subject = event.getSubject(ctx);
int obj = event.getSubjectType();
if (!(obj == Constants.ITEM || obj == Constants.BUNDLE
|| obj == Constants.COLLECTION || obj == Constants.COMMUNITY))
{
log
.warn("SearchConsumer should not have been given this kind of Object in an event, skipping: "
+ event.toString());
return;
}
DSpaceObject object = event.getObject(ctx);