mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
Improve debug logging and correct null pointer errors in Browse and Search Consumers.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@3009 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -132,11 +143,6 @@ public class BrowseConsumer implements Consumer
|
||||
// Update/Add items
|
||||
for (Item i : toUpdate)
|
||||
{
|
||||
if (i == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// FIXME: there is an exception handling problem here
|
||||
try
|
||||
{
|
||||
|
@@ -99,17 +99,6 @@ public class SearchConsumer implements Consumer
|
||||
int st = event.getSubjectType();
|
||||
if (!(st == Constants.ITEM || st == Constants.BUNDLE
|
||||
|| st == Constants.COLLECTION || st == Constants.COMMUNITY))
|
||||
{
|
||||
log.warn("SearchConsumer should not have been given this "
|
||||
+ "kind of Subject in an event, skipping: "
|
||||
+ event.toString());
|
||||
return;
|
||||
}
|
||||
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: "
|
||||
@@ -117,6 +106,8 @@ public class SearchConsumer implements Consumer
|
||||
return;
|
||||
}
|
||||
|
||||
DSpaceObject subject = event.getSubject(ctx);
|
||||
|
||||
DSpaceObject object = event.getObject(ctx);
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user