Alexander Wels has uploaded a new change for review. Change subject: engine,webadmin: various coverity issues ......................................................................
engine,webadmin: various coverity issues - Fixed various noted coverity issues (CIDs): - 1062151 - 1201855 - 1201865 - 1201860 - 1201857 Change-Id: Ib3833e8420ab7040c02600f97e439c21487f2466 Signed-off-by: Alexander Wels <aw...@redhat.com> --- M backend/manager/modules/branding/src/test/java/org/ovirt/engine/core/branding/BrandingServletTest.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/dialog/tab/DialogTab.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java 5 files changed, 15 insertions(+), 30 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/36/26936/1 diff --git a/backend/manager/modules/branding/src/test/java/org/ovirt/engine/core/branding/BrandingServletTest.java b/backend/manager/modules/branding/src/test/java/org/ovirt/engine/core/branding/BrandingServletTest.java index fef3a15..50ef9b8 100644 --- a/backend/manager/modules/branding/src/test/java/org/ovirt/engine/core/branding/BrandingServletTest.java +++ b/backend/manager/modules/branding/src/test/java/org/ovirt/engine/core/branding/BrandingServletTest.java @@ -42,7 +42,6 @@ ServletOutputStream mockResponseOutputStream; BrandingServlet testServlet; - File testFile; @Before public void setUp() throws Exception { @@ -52,9 +51,6 @@ when(mockFile.getAbsolutePath()).thenReturn("/abs/test"); //$NON-NLS-1$ when(mockRequest.getPathInfo()).thenReturn("/test/something.txt"); //$NON-NLS-1$ when(mockResponse.getOutputStream()).thenReturn(mockResponseOutputStream); - testFile = new File(this.getClass().getClassLoader(). - getResource("./org/ovirt/engine/core/branding/BrandingServletTest.class") //$NON-NLS-1$ - .toURI().getPath()); } @Test diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/dialog/tab/DialogTab.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/dialog/tab/DialogTab.java index c83b851..d3e0106 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/dialog/tab/DialogTab.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/dialog/tab/DialogTab.java @@ -57,6 +57,7 @@ @Override public void markAsValid() { + super.markAsValid(); getValidatedWidgetStyle().clearBorderColor(); tabContainer.getElement().addClassName(isActive ? style.obrand_active() : style.inactive()); } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java index 97a4bdb..aa2960c 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java @@ -47,7 +47,7 @@ import org.ovirt.engine.ui.uicompat.IEventListener; import org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs; -public class ClusterModel extends EntityModel +public class ClusterModel extends EntityModel<VDSGroup> { private Map<Guid, PolicyUnit> policyUnitMap; private ListModel<ClusterPolicy> clusterPolicy; @@ -104,19 +104,6 @@ public void setDefaultMemoryOvercommit(int value) { privateDefaultMemoryOvercommit = value; - } - - private VDSGroup privateEntity; - - @Override - public VDSGroup getEntity() - { - return privateEntity; - } - - public void setEntity(VDSGroup value) - { - privateEntity = value; } private boolean privateIsEdit; @@ -1396,9 +1383,9 @@ } private void updateMigrateOnError() { - ServerCpu cpu = (ServerCpu) getCPU().getSelectedItem(); + ServerCpu cpu = getCPU().getSelectedItem(); - Version version = (Version) getVersion().getSelectedItem(); + Version version = getVersion().getSelectedItem(); if (version == null) { return; @@ -1443,7 +1430,7 @@ } ArchitectureType oldSelectedArch = - (ArchitectureType) clusterModel.getArchitecture().getSelectedItem(); + clusterModel.getArchitecture().getSelectedItem(); if (oldSelectedArch != null) { getArchitecture().setSelectedItem(oldSelectedArch); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java index d5d420c..9f05c4e 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java @@ -1,5 +1,10 @@ package org.ovirt.engine.ui.uicommonweb.models.vms; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + import org.ovirt.engine.core.common.action.RunVmOnceParams; import org.ovirt.engine.core.common.businessentities.Disk; import org.ovirt.engine.core.common.businessentities.DisplayType; @@ -33,11 +38,6 @@ import org.ovirt.engine.ui.uicompat.EventArgs; import org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs; import org.ovirt.engine.ui.uicompat.UIConstants; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; public abstract class RunOnceModel extends Model { @@ -755,7 +755,7 @@ params.setVmInit(getVmInit().buildCloudInitParameters(this)); } - EntityModel<? extends DisplayType> displayProtocolSelectedItem = (EntityModel<? extends DisplayType>) getDisplayProtocol().getSelectedItem(); + EntityModel<? extends DisplayType> displayProtocolSelectedItem = getDisplayProtocol().getSelectedItem(); params.setUseVnc(displayProtocolSelectedItem.getEntity() == DisplayType.vnc); if (getDisplayConsole_Vnc_IsSelected().getEntity() || getDisplayConsole_Spice_IsSelected().getEntity()) @@ -1096,6 +1096,7 @@ @Override public void executeCommand(UICommand command) { + super.executeCommand(command); if (command == runOnceCommand) { if (validate()) { diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java index 7860496..68ea44f 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java @@ -54,7 +54,7 @@ private final UIConstants constants = ConstantsManager.getInstance().getConstants(); private TModel privateModel; - private HashMap<Guid, List<VmTemplate>> baseTemplateToSubTemplates = new HashMap<Guid, List<VmTemplate>>(); + private final HashMap<Guid, List<VmTemplate>> baseTemplateToSubTemplates = new HashMap<Guid, List<VmTemplate>>(); public TModel getModel() { return privateModel; @@ -147,7 +147,7 @@ } } - for (List<VmTemplate> subversions : (Collection<List<VmTemplate>>) baseTemplateToSubTemplates.values()) { + for (List<VmTemplate> subversions : baseTemplateToSubTemplates.values()) { Collections.sort(subversions, new Comparator<VmTemplate>() { @Override public int compare(VmTemplate o1, VmTemplate o2) { @@ -930,7 +930,7 @@ int numOfSockets = extractIntFromListModel(getModel().getNumOfSockets()); int totalCpuCores = getTotalCpuCores(); - if (numOfSockets == 0 || numOfSockets == 0) { + if (numOfSockets == 0) { return; } -- To view, visit http://gerrit.ovirt.org/26936 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib3833e8420ab7040c02600f97e439c21487f2466 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Alexander Wels <aw...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches