Roy Golan has uploaded a new change for review.

Change subject: core: fix JSON serialization issues in VmPayload
......................................................................

core: fix JSON serialization issues in VmPayload

Added JsonIgnore to getSpecParams as its not a field
Changed "files" member type to HashMap as it will fail in
deserialization

See also Bug 996005

Change-Id: Ief9e04e12a05b39cb5d2bceea5a23fbb05d01b09
Signed-off-by: Roy Golan <[email protected]>
Bug-Url: https://bugzilla.redhat.com/985008
---
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmPayload.java
1 file changed, 10 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/09/18009/1

diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmPayload.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmPayload.java
index 4417c9d..e993ecf 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmPayload.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmPayload.java
@@ -4,6 +4,7 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.codehaus.jackson.annotate.JsonIgnore;
 import org.ovirt.engine.core.common.config.Config;
 import org.ovirt.engine.core.common.config.ConfigValues;
 import org.ovirt.engine.core.common.utils.VmDeviceType;
@@ -17,7 +18,7 @@
 
     private VmDeviceType type;
     private String volumeId;
-    private Map<String, String> files; // file data is base64-encoded
+    private HashMap<String, String> files; // file data is base64-encoded
 
     public VmPayload() {
         this.type = VmDeviceType.CDROM;
@@ -31,7 +32,7 @@
 
         Map<String, Object> payload = (Map<String, 
Object>)specParams.get(SpecParamsPayload);
         this.volumeId = (String)payload.get(SpecParamsVolumeIdType);
-        this.files = (Map<String, String>)payload.get(SpecParamsFileType);
+        this.files = (HashMap<String, String>)payload.get(SpecParamsFileType);
     }
 
     public static boolean isPayload(Map<String, Object> specParams) {
@@ -65,10 +66,16 @@
      *
      * @return Map of files in this payload
      */
-    public Map<String, String> getFiles() {
+    public HashMap<String, String> getFiles() {
         return files;
     }
 
+    /**
+     * this is a calculated field our of the inner members.
+     * no need to de-serialize this as it is not a getter of a field.
+     * @return
+     */
+    @JsonIgnore
     public Map<String, Object> getSpecParams() {
         // function produce something like that:
         // 
vmPayload={volumeId:volume-id,file:{filename:content,filename2:content2,...}}


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

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

Reply via email to