Tomas Jelinek has uploaded a new change for review.

Change subject: restapi: NPE on new VM
......................................................................

restapi: NPE on new VM

The problem was that the Console.enabled and VirtIO_SCSI.enabled
were "Boolean" (capital 'B') while the getters returned boolean
(small 'b'). If the "enabled" was null, the getEnabled failed
on NPE.

This happened only for JSON because it tryed to create the default
value (PropertyBuilder.getDefaultValue) and this does not take into
account the possibility that the bean needs to be inited first.

Fixed by setting the default value directly in api.xsd.

Change-Id: Ib9cbc0634f2bb8a0c80efb40f1db4a0a904d2ac2
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1045350
Signed-off-by: Tomas Jelinek <tjeli...@redhat.com>
---
M 
backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/93/22593/1

diff --git 
a/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd
 
b/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd
index e261939..34687a5 100644
--- 
a/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd
+++ 
b/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd
@@ -1199,13 +1199,13 @@
   <xs:element name="console" type="Console"/>
 
   <xs:complexType name="Console">
-    <xs:attribute name="enabled" type="xs:boolean"/>
+    <xs:attribute name="enabled" type="xs:boolean" default="false"/>
   </xs:complexType>
 
   <xs:element name="virtio_scsi" type="VirtIO_SCSI"/>
 
   <xs:complexType name="VirtIO_SCSI">
-    <xs:attribute name="enabled" type="xs:boolean"/>
+    <xs:attribute name="enabled" type="xs:boolean" default="false"/>
   </xs:complexType>
 
   <xs:complexType name="SchedulingPolicyThresholds">


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib9cbc0634f2bb8a0c80efb40f1db4a0a904d2ac2
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Tomas Jelinek <tjeli...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to