Details
-
Sub-task
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
Per hive_metastore.thrift, the "events" list inside NotificationEventResponse is a required field that cannot be null.
struct NotificationEventResponse { 1: required list<NotificationEvent> events, }
However, per ObjectStore.java, this events field can be uninitialized if the events retrieved from the metastore is empty instead of null:
NotificationEventResponse result = new NotificationEventResponse(); int maxEvents = rqst.getMaxEvents() > 0 ? rqst.getMaxEvents() : Integer.MAX_VALUE; int numEvents = 0; while (i.hasNext() && numEvents++ < maxEvents) { result.addToEvents(translateDbToThrift(i.next())); } return result;
The fix is simple enough - we need to call result.setEvents(new ArrayList<NotificationEvent>()) before we begin the iteration to do result.addToEvents(...).