Allon Mureinik has uploaded a new change for review.

Change subject: core: Remove member init in action return values
......................................................................

core: Remove member init in action return values

Since the upgrade to GWT 2.5.1, we've seen several cases of GWT pruning
member initialization.

To prevent these (and future) bugs, this series of patches removes all
such initializations from the packages that should be compiled by GWT.
These initialization are either moved to the appropriate
constructor(s), or removed them completely if they are redundant.
Constants with the wrong modifiers are amended to have static final, and
are allowed to be initialized directly.

As a side bonus, this patch offers a minor performance improvement, as
some of these members are now only initialized once instead of twice
(once in the member initialization and then again via a constructor
parameter).

This patch takes care of the action return value  parameter classes.

Change-Id: I0d25e6f202cb9cc8888d7a7822384adf284ffee8
Signed-off-by: Allon Mureinik <[email protected]>
---
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcLoginReturnValueBase.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcReturnValueBase.java
2 files changed, 18 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/39/18139/1

diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcLoginReturnValueBase.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcLoginReturnValueBase.java
index 09d7644..b8b5f00 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcLoginReturnValueBase.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcLoginReturnValueBase.java
@@ -5,7 +5,7 @@
 public class VdcLoginReturnValueBase extends VdcReturnValueBase implements 
Serializable {
     private static final long serialVersionUID = 9209472242567186348L;
 
-    private LoginResult _loginResult = LoginResult.forValue(0);
+    private LoginResult _loginResult;
 
     public LoginResult getLoginResult() {
         return _loginResult;
@@ -16,5 +16,6 @@
     }
 
     public VdcLoginReturnValueBase() {
+        _loginResult = LoginResult.Autheticated;
     }
 }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcReturnValueBase.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcReturnValueBase.java
index 24f59de..26d5891 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcReturnValueBase.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcReturnValueBase.java
@@ -11,32 +11,38 @@
     private static final long serialVersionUID = 6063371142273092365L;
 
     private boolean canDoAction;
-    private ArrayList<String> canDoActionMessages = new ArrayList<String>();
+    private ArrayList<String> canDoActionMessages;
     private boolean succeeded;
     private boolean isSyncronious;
     private Object returnValue;
-    private String description = "";
+    private String description;
     /**
-     * Holds the ids of the async task place holders in the database.
-     * On server restart this list  used to clean up and fail all the tasks
-     * that have place holders but don't have a vdsm task id.
+     * Holds the ids of the async task place holders in the database. On 
server restart this list used to clean up and
+     * fail all the tasks that have place holders but don't have a vdsm task 
id.
      */
-    private ArrayList<Guid> taskPlaceHolderIdList = new ArrayList<Guid>();
+    private ArrayList<Guid> taskPlaceHolderIdList;
     /**
      * The list of vdsm task ids associated with a command
      */
-    private ArrayList<Guid> vdsmTaskIdList = new ArrayList<Guid>();
+    private ArrayList<Guid> vdsmTaskIdList;
     /**
      * The list of vdsm task ids associated directly with a command
      */
-    private ArrayList<Guid> internalVdsmTaskIdList = new ArrayList<Guid>();
-    private boolean endActionTryAgain = true;
-    private ArrayList<String> executeFailedMessages = new ArrayList<String>();
+    private ArrayList<Guid> internalVdsmTaskIdList;
+    private boolean endActionTryAgain;
+    private ArrayList<String> executeFailedMessages;
     private VdcFault fault;
     private String correlationId;
     private Guid jobId;
 
     public VdcReturnValueBase() {
+        canDoActionMessages = new ArrayList<String>();
+        description = "";
+        taskPlaceHolderIdList = new ArrayList<Guid>();
+        vdsmTaskIdList = new ArrayList<Guid>();
+        internalVdsmTaskIdList = new ArrayList<Guid>();
+        endActionTryAgain = true;
+        executeFailedMessages = new ArrayList<String>();
     }
 
     public VdcFault getFault() {


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0d25e6f202cb9cc8888d7a7822384adf284ffee8
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to