Michael Kublin has uploaded a new change for review. Change subject: engine: Fixing possible NPE at ApproveVdsCommand ......................................................................
engine: Fixing possible NPE at ApproveVdsCommand The following patch is fixing a possible NPE at ApproveVdsCommand during canDoAction. Also some unused variable removed Change-Id: I3b0e0b5699003ad89858520dead4b8fe3aa3465c Signed-off-by: Michael Kublin <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ApproveVdsCommand.java 1 file changed, 8 insertions(+), 15 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/74/12674/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ApproveVdsCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ApproveVdsCommand.java index c2562b3..766184e 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ApproveVdsCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ApproveVdsCommand.java @@ -20,24 +20,19 @@ @Override protected boolean canDoAction() { boolean returnValue = true; - if (getVds().getVdsType() != VDSType.oVirtNode) { + if (getVds() == null) { + addCanDoActionMessage(VdcBllMessages.VDS_APPROVE_VDS_NOT_FOUND); + returnValue = false; + } else if (getVds().getVdsType() != VDSType.oVirtNode) { addCanDoActionMessage(VdcBllMessages.VDS_APPROVE_WRONG_VDS_TYPE); returnValue = false; - } else { - if (getVds() == null) { - addCanDoActionMessage(VdcBllMessages.VDS_APPROVE_VDS_NOT_FOUND); - returnValue = false; - } else if (getVds().getStatus() != VDSStatus.PendingApproval - && getVds().getStatus() != VDSStatus.InstallFailed) { - getReturnValue().getCanDoActionMessages() - .add(VdcBllMessages.VDS_APPROVE_VDS_IN_WRONG_STATUS.toString()); - returnValue = false; - } + } else if (getVds().getStatus() != VDSStatus.PendingApproval + && getVds().getStatus() != VDSStatus.InstallFailed) { + addCanDoActionMessage(VdcBllMessages.VDS_APPROVE_VDS_IN_WRONG_STATUS.toString()); + returnValue = false; } return returnValue ? super.canDoAction() : false; } - - private AuditLogType _failureLogTypeValue = AuditLogType.forValue(0); @Override public AuditLogType getAuditLogTypeValue() { @@ -50,14 +45,12 @@ @Override protected void executeCommand() { - _failureLogTypeValue = AuditLogType.VDS_INSTALL_FAILED; if (Config.<Boolean> GetValue(ConfigValues.PowerClientAutoInstallCertificateOnApprove)) { super.executeCommand(); } else { setSucceeded(true); } if (getSucceeded()) { - _failureLogTypeValue = AuditLogType.VDS_APPROVE_FAILED; Backend.getInstance() .getResourceManager() .RunVdsCommand(VDSCommandType.SetVdsStatus, -- To view, visit http://gerrit.ovirt.org/12674 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3b0e0b5699003ad89858520dead4b8fe3aa3465c Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Michael Kublin <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
