Greg Sheremeta has uploaded a new change for review. Change subject: userportal, webadmin: fix Coverity issues related to tooltips ......................................................................
userportal, webadmin: fix Coverity issues related to tooltips * 1291168 Dereference null return value If the function actually returns a null value, a NullPointerException will be thrown. In org.ovirt.engine.ui.userportal.widget.QuotaProgressBar.setValues * 1289478 Missing call to superclass Whatever action the superclass method implements will not occur, if the superclass call is actually required. In org.ovirt.engine.ui.webadmin.widget.table.cell.MenuCell.onBrowserEvent * 1289477 Logically dead code The indicated dead code may have performed some action; that action will never occur. In org.ovirt.engine.ui.common.widget.table.cell.RadioboxCell.onBrowserEvent * 1289467, 1289468, 1289469, 1289470 Missing break in switch Execution falls through to the next case statement or default; this might indicate a common typo. In org.ovirt.engine.ui.webadmin.widget.table.column.VolumeStatusColumn.getTooltip * 1289466 Dereference null return value If the function actually returns a null value, a NullPointerException will be thrown. In org.ovirt.engine.ui.common.widget.uicommon.popup.vm. VmSnapshotCustomPreviewPopupWidget$10.getTooltip * 1289462, 1289463, 1289464, 1289465 Unused value An assigned value that is never used may represent unnecessary computation, an incorrect algorithm, or possibly the need for cleanup or refactoring. In org.ovirt.engine.ui.webadmin.widget.table.column.VolumeStatusColumn.getTooltip * 1289461 Useless call A function call that seems to have an intended effect has no actual effect on the logic of the program. In org.ovirt.engine.ui.userportal.widget.table.column.AbstractMaskedVmImageColumn. render * 1289460 SF: Switch case falls through In org.ovirt.engine.ui.webadmin.widget.table.column.VolumeStatusColumn.getTooltip * 1289459 SIC: Inner class could be made static This class is an inner class, but does not use its embedded reference to the object which created it. Change-Id: Iec6a015fb0083cec224290b31b7e981cc9841ffb Signed-off-by: Greg Sheremeta <[email protected]> --- M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/RadioboxCell.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmSnapshotCustomPreviewPopupWidget.java M frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/tab/extended/SideTabExtendedVirtualMachineView.java M frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/widget/QuotaProgressBar.java M frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/widget/table/column/AbstractMaskedVmImageColumn.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/MenuCell.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/VolumeStatusColumn.java 7 files changed, 17 insertions(+), 10 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/13/39113/1 diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/RadioboxCell.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/RadioboxCell.java index d4f3cab..a76a72f 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/RadioboxCell.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/RadioboxCell.java @@ -81,7 +81,7 @@ && event.getKeyCode() == KeyCodes.KEY_ENTER; if (BrowserEvents.CHANGE.equals(type) || enterPressed) { InputElement input = parent.getFirstChild().cast(); - Boolean isChecked = input.isChecked(); + boolean isChecked = input.isChecked(); /* * Toggle the value if the enter key was pressed and the cell handles selection or doesn't depend on @@ -97,8 +97,8 @@ * Save the new value. However, if the cell depends on the selection, then do not save the value because we * can get into an inconsistent state. */ - if ((value == null ? false : value.booleanValue()) != - (isChecked == null ? false : isChecked.booleanValue()) && !dependsOnSelection()) { + + if (value.booleanValue() != isChecked && !dependsOnSelection()) { setViewData(context.getKey(), isChecked); } else { clearViewData(context.getKey()); diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmSnapshotCustomPreviewPopupWidget.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmSnapshotCustomPreviewPopupWidget.java index 1d26160..08bb8a5 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmSnapshotCustomPreviewPopupWidget.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmSnapshotCustomPreviewPopupWidget.java @@ -253,9 +253,11 @@ @Override public SafeHtml getTooltip(SnapshotModel model) { - DiskImage image = model.getImageByDiskId(disk.getId()); - if (image.getImageStatus() == ImageStatus.ILLEGAL) { - return SafeHtmlUtils.fromSafeConstant(constants.illegalStatus()); + if (disk != null && disk.getId() != null) { + DiskImage image = model.getImageByDiskId(disk.getId()); + if (image != null && image.getImageStatus() == ImageStatus.ILLEGAL) { + return SafeHtmlUtils.fromSafeConstant(constants.illegalStatus()); + } } return null; } diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/tab/extended/SideTabExtendedVirtualMachineView.java b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/tab/extended/SideTabExtendedVirtualMachineView.java index 5fca85a..8930a63 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/tab/extended/SideTabExtendedVirtualMachineView.java +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/tab/extended/SideTabExtendedVirtualMachineView.java @@ -58,7 +58,7 @@ ViewIdHandler idHandler = GWT.create(ViewIdHandler.class); } - protected abstract class AbstractVmButtonsImageButtonCell extends ImageButtonCell<UserPortalItemModel> { + protected static abstract class AbstractVmButtonsImageButtonCell extends ImageButtonCell<UserPortalItemModel> { public AbstractVmButtonsImageButtonCell(ImageResource enabledImage, ImageResource disabledImage) { super(enabledImage, resources.sideTabExtendedVmStyle().vmButtonEnabled(), diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/widget/QuotaProgressBar.java b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/widget/QuotaProgressBar.java index c269c9f..82bbffc 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/widget/QuotaProgressBar.java +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/widget/QuotaProgressBar.java @@ -78,7 +78,7 @@ } // update tooltip - tooltip.setText(getTooltip().asString()); + tooltip.setHtml(getTooltip()); tooltip.reconfigure(); } diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/widget/table/column/AbstractMaskedVmImageColumn.java b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/widget/table/column/AbstractMaskedVmImageColumn.java index ada5bce..85a6c92 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/widget/table/column/AbstractMaskedVmImageColumn.java +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/widget/table/column/AbstractMaskedVmImageColumn.java @@ -48,7 +48,7 @@ if (showMask.showMask(object)) { // TODO why hardcode to 19px left here? sb.appendHtmlConstant("<div style=\"position: absolute; left: 19px\" >"); //$NON-NLS-1$ - SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(mask).getHTML()); + sb.append(SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(mask).getHTML())); sb.appendHtmlConstant("</div>"); //$NON-NLS-1$ } super.render(context, object, sb); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/MenuCell.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/MenuCell.java index 4823461..cf80036 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/MenuCell.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/MenuCell.java @@ -66,7 +66,8 @@ SafeHtml tooltipValue, NativeEvent event, ValueUpdater<T> valueUpdater) { - super.onBrowserEvent(context, parent, value, event, valueUpdater); + super.onBrowserEvent(context, parent, value, tooltipValue, event, valueUpdater); + int eventX = event.getClientX(); int eventY = event.getClientY(); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/VolumeStatusColumn.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/VolumeStatusColumn.java index c084e51..042e0e3 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/VolumeStatusColumn.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/VolumeStatusColumn.java @@ -36,12 +36,16 @@ switch (status) { case DOWN: tooltip = constants.down(); + break; case UP: tooltip = constants.up(); + break; case SOME_BRICKS_DOWN: tooltip = constants.volumeBricksDown(); + break; case ALL_BRICKS_DOWN: tooltip = constants.volumeAllBricksDown(); + break; default: tooltip = constants.down(); } -- To view, visit https://gerrit.ovirt.org/39113 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iec6a015fb0083cec224290b31b7e981cc9841ffb Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Greg Sheremeta <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
