Juan Hernandez 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(a)redhat.com>
---
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:
Eli Mesika: Looks good to me, but someone else must approve
Juan Hernandez: Verified; Looks good to me, approved
Jenkins CI: Passed CI tests
--
To view, visit
https://gerrit.ovirt.org/60316
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I13a174699e66833d6b31f50d0bb03967c178458e
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <juan.hernandez(a)redhat.com>
Gerrit-Reviewer: Eli Mesika <emesika(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Juan Hernandez <juan.hernandez(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>