Vojtech Szocs has uploaded a new change for review. Change subject: webadmin, userportal: Avoid uncaught exceptions in UiCommonEditorVisitor ......................................................................
webadmin, userportal: Avoid uncaught exceptions in UiCommonEditorVisitor If a setter method is missing or has wrong argument type, EditorContext.setInModel (generated) implementation will look like this: @Override public void setInModel(EDITED_TYPE data) { throw new UnsupportedOperationException(); } See AbstractEditorDriverGenerator:296 for details. In above mentioned situation, EditorContext.canSetInModel (generated) implementation will return false. In short, we should always call canSetInModel before attempting to call setInModel, otherwise uncaught exception might break the application. Change-Id: I4b7fc601bad9470eab7fbfa0e291f69f2cabae03 Signed-off-by: Vojtech Szocs <vsz...@redhat.com> --- M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/editor/UiCommonEditorVisitor.java 1 file changed, 7 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/29/18429/1 diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/editor/UiCommonEditorVisitor.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/editor/UiCommonEditorVisitor.java index 71f85dd..1eb64ce 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/editor/UiCommonEditorVisitor.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/editor/UiCommonEditorVisitor.java @@ -58,7 +58,10 @@ ((HasValueChangeHandlers<T>) editor).addValueChangeHandler(new ValueChangeHandler<T>() { @Override public void onValueChange(ValueChangeEvent<T> event) { - ctx.setInModel(event.getValue()); + // Set value in model + if (ctx.canSetInModel()) { + ctx.setInModel(event.getValue()); + } } }); } @@ -76,7 +79,9 @@ public void onKeyPress(KeyPressEvent event) { if (KeyCodes.KEY_ENTER == event.getNativeEvent().getKeyCode()) { // Set value in model - ctx.setInModel(editor.getValue()); + if (ctx.canSetInModel()) { + ctx.setInModel(editor.getValue()); + } } } }); -- To view, visit http://gerrit.ovirt.org/18429 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4b7fc601bad9470eab7fbfa0e291f69f2cabae03 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Vojtech Szocs <vsz...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches