Alexander Kolbasov created HIVE-17737:
-----------------------------------------

             Summary: ObjectStore.getNotificationEventsCount may cause NPE
                 Key: HIVE-17737
                 URL: https://issues.apache.org/jira/browse/HIVE-17737
             Project: Hive
          Issue Type: Bug
          Components: Hive
    Affects Versions: 2.3.0, 3.0.0
            Reporter: Alexander Kolbasov


In ObjectStore.getNotificationEventsCount():

{code}
 public NotificationEventsCountResponse 
getNotificationEventsCount(NotificationEventsCountRequest rqst) {
    Long result = 0L;
    try {
      openTransaction();
      long fromEventId = rqst.getFromEventId();
      String inputDbName = rqst.getDbName();
      String queryStr = "select count(eventId) from " + 
MNotificationLog.class.getName()
                + " where eventId > fromEventId && dbName == inputDbName";
      query = pm.newQuery(queryStr);
      query.declareParameters("java.lang.Long fromEventId, java.lang.String 
inputDbName");
      result = (Long) query.execute(fromEventId, inputDbName); // <- Here
      commited = commitTransaction();
      return new NotificationEventsCountResponse(result.longValue());
    }
  }
{code}

It is possible that query.execute will return null in which case 
rsult.longValue() may throw NPE.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to