Change in ovirt-engine[ovirt-engine-3.4]: restapi: Don't use inner classes in LinkBuilder

Oved Ourfali has submitted this change and it was merged. Change subject: restapi: Don't use inner classes in LinkBuilder ...................................................................... restapi: Don't use inner classes in LinkBuilder We use anonymous classes in a rather unusual way in the LinkBuilder, we do the follwing: whatever.setBody(new Body(){{setType(type);}}); Instead of this: Body body = new Body(); body.setType(type); whatever.setBody(body); The former is probably nicer syntax, but it has the side effect of introducing a synthetic field in the subclass of Body that the compiler generates automatically. This synthetic field is a reference to the outer LinkHelper class. When Jackson tries to convert this object to JSON it finds the synthetic field, and tries to serialize it as well. This fails because the LinkHelper class doesn't have a suitable constructor. The net effect is an error when the server tries to return an error message to the user. The solution is to avoid completely the anonymous classes, and thus the synthetic fields. Change-Id: I10e0ecb68b3e0d412de486c3a38dbefa3c4dd9d2 Bug-Url: https://bugzilla.redhat.com/1093755 Signed-off-by: Juan Hernandez <juan.hernandez@redhat.com> (cherry picked from commit 3e2af7c52118061c058aacf4abfb52162a8a282c) --- M backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/rsdl/LinkBuilder.java M backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/rsdl/RsdlBuilder.java 2 files changed, 16 insertions(+), 6 deletions(-) Approvals: Juan Hernandez: Verified; Looks good to me, approved -- To view, visit http://gerrit.ovirt.org/27420 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I10e0ecb68b3e0d412de486c3a38dbefa3c4dd9d2 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.4 Gerrit-Owner: Juan Hernandez <juan.hernandez@redhat.com> Gerrit-Reviewer: Juan Hernandez <juan.hernandez@redhat.com> Gerrit-Reviewer: Oved Ourfali <oourfali@redhat.com> Gerrit-Reviewer: automation@ovirt.org Gerrit-Reviewer: oVirt Jenkins CI Server
participants (1)
-
oourfali@redhat.com