Change in ovirt-engine[ovirt-engine-4.0]: restapi: Avoid NPE when external event has link but not id

tnisan at redhat.com tnisan at redhat.com
Mon Jul 11 14:39:24 UTC 2016


Tal Nisan has submitted this change and it was merged.

Change subject: restapi: Avoid NPE when external event has link but not id
......................................................................


restapi: Avoid NPE when external event has link but not id

Currently when an external event is added we support links to specific
objects, for examaple, to add an event with a link to a specific virtual
machine we accept the following event:

  <event>
    <description>File system /home is full</description>
    <severity>alert</severity>
    <origin>mymonitor</origin>
    <custom_id>1467879754</custom_id>
    <vm id="aae98225-5b73-490d-a252-899209af17e9"/>
  </event>

But we don't check if the "id" attribute of the link is actually
populated, which generates a NPE. For example, if the caller sends the
name instead of the id:

  <event>
    <description>File system /home is full</description>
    <severity>alert</severity>
    <origin>mymonitor</origin>
    <custom_id>1467879754</custom_id>
    <vm>
      <name>myvm</name>
    </vm>
  </event>

This isn't supported at the moment, but it shound't generate a NPE, it
should just be ignored.

This patch changes the event mapper so that it checks if the id is
present.

Change-Id: I13a174699e66833d6b31f50d0bb03967c178458e
Bug-Url: https://bugzilla.redhat.com/1353460
Signed-off-by: Juan Hernandez <juan.hernandez at redhat.com>
(cherry picked from commit 195ac1b2e655629416373e8106cbcdb516b2ae3a)
---
M backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/EventMapper.java
1 file changed, 35 insertions(+), 21 deletions(-)

Approvals:
  Juan Hernandez: Verified; Looks good to me, approved
  Jenkins CI: Passed CI tests



-- 
To view, visit https://gerrit.ovirt.org/60515
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I13a174699e66833d6b31f50d0bb03967c178458e
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-4.0
Gerrit-Owner: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Tal Nisan <tnisan at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>



More information about the Engine-commits mailing list