Vojtech Szocs has uploaded a new change for review.

Change subject: webadmin,userportal: Fix AsyncQuery related NPE
......................................................................

webadmin,userportal: Fix AsyncQuery related NPE

AsyncQuery no-argument constructor is used throughout both
UiCommon and GWT UI code.

This constructor leaves 'asyncCallback' reference as null,
among other fields. It's therefore assumed that this reference
will be set after AsyncQuery constructor.

However, in some places, this is not the case. For example,
AboutPopupPresenterWidget invokes public GetConfigurationValue
query without setting 'asyncCallback' reference, and Frontend
query success handler fails on NPE with 'callback.getDel()'
returning null.

This patch modifies AsyncQuery no-argument constructor to fix
the above mentioned issue, using null object singleton that
represents an empty (no-op) query callback.

Change-Id: I57a3794c70b6c48e58285cf6366bcbfd4e84665d
Signed-off-by: Vojtech Szocs <vsz...@redhat.com>
---
M 
frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AsyncQuery.java
1 file changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/27/10727/1

diff --git 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AsyncQuery.java
 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AsyncQuery.java
index 2826dc4..5ed4b95 100644
--- 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AsyncQuery.java
+++ 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AsyncQuery.java
@@ -3,6 +3,17 @@
 import org.ovirt.engine.core.common.queries.VdcQueryReturnValue;
 
 public class AsyncQuery {
+
+    /**
+     * Null object singleton that represents an empty (no-op) query callback.
+     */
+    private static final INewAsyncCallback EMPTY_CALLBACK = new 
INewAsyncCallback() {
+        @Override
+        public void OnSuccess(Object model, Object returnValue) {
+            // Empty
+        }
+    };
+
     public Object Model;
     public INewAsyncCallback asyncCallback;
     public IAsyncConverter converterCallback;
@@ -12,6 +23,7 @@
     private String context;
 
     public AsyncQuery() {
+        this.asyncCallback = EMPTY_CALLBACK;
     }
 
     public AsyncQuery(Object target, INewAsyncCallback asyncCallback) {
@@ -82,4 +94,5 @@
     public IAsyncConverter getConverter() {
         return converterCallback;
     }
+
 }


--
To view, visit http://gerrit.ovirt.org/10727
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I57a3794c70b6c48e58285cf6366bcbfd4e84665d
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

Reply via email to