Ori Liel has posted comments on this change. Change subject: restapi: Add a default value for SPM priority (#808629) ......................................................................
Patch Set 1: (1 inline comment) .................................................... File backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd Line 1063: </xs:attribute> We've seen this case before. JaxB generates an isSet() method and counts on it being used prior to getting. JSON 'naively' uses the getter method and gets null if the value is uninitialized. Why JaxB makes the getter return a primitive (int), while the underlying property is an object (Integer) - thus causing this danger of a NullPointerException - I don't know. But the way we deal with this is not by adding a default value, because this can be dangerous API-wise. If some day the default value will change, and we forget to update this in api.xsd, the client would keep passing the old value. The way we deal with this, is adding an annotation which tells JaxB not do generate an isSet() method for this attribute, which makes the getter return the object (Integer), not the primitive (int). Pasting an example: <xs:complexType name="CpuTopology"> <xs:attribute name="sockets" type="xs:int" use="optional"> <xs:annotation> <xs:appinfo> <jaxb:property generateIsSetMethod="false"/> </xs:appinfo> </xs:annotation> </xs:attribute> -- To view, visit http://gerrit.ovirt.org/3476 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I50f22ebd291601a95af084f75c5ab182b3b67b36 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Juan Hernandez <juan.hernan...@redhat.com> Gerrit-Reviewer: Adam Litke <a...@us.ibm.com> Gerrit-Reviewer: Ori Liel <ol...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches