Juan Hernandez has uploaded a new change for review. Change subject: restapi: NPE when mapping watchdog without id ......................................................................
restapi: NPE when mapping watchdog without id Currently the operation to add a watchdog to a VM fails if the id isn't provided, as this triggers a NPE. This adds a check to prevent that NPE. Change-Id: Ib526525b37e74e2e4d863e4418dfb852a7ca4200 Bug-Url: https://bugzilla.redhat.com/1129781 Signed-off-by: Juan Hernandez <[email protected]> --- M backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/WatchdogMapper.java 1 file changed, 3 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/63/31663/1 diff --git a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/WatchdogMapper.java b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/WatchdogMapper.java index a971f87..c3083f9 100644 --- a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/WatchdogMapper.java +++ b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/WatchdogMapper.java @@ -12,6 +12,9 @@ @Mapping(from = WatchDog.class, to = VmWatchdog.class) public static VmWatchdog map(WatchDog model, VmWatchdog template) { VmWatchdog entity = template == null ? new VmWatchdog() : template; + if (model.isSetId()) { + entity.setId(GuidUtils.asGuid(model.getId())); + } if (model.isSetAction()) { WatchdogAction wdAction = WatchdogAction.fromValue(model.getAction()); if (wdAction != null) { @@ -24,8 +27,6 @@ entity.setModel(map(wdModel, null)); } } - entity.setModel(VmWatchdogType.getByName(model.getModel())); - entity.setId(GuidUtils.asGuid(model.getId())); return entity; } -- To view, visit http://gerrit.ovirt.org/31663 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib526525b37e74e2e4d863e4418dfb852a7ca4200 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Juan Hernandez <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
