Change in ovirt-engine[master]: restapi: Don't use inner classes in LinkBuilder
juan.hernandez at redhat.com
juan.hernandez at redhat.com
Tue May 6 14:38:38 UTC 2014
Juan Hernandez 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 anonymous 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 at redhat.com>
---
M backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/RsdlBuilder.java
1 file changed, 8 insertions(+), 7 deletions(-)
Approvals:
Ravi Nori: Looks good to me, but someone else must approve
Juan Hernandez: Verified; Looks good to me, approved
--
To view, visit http://gerrit.ovirt.org/27380
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I10e0ecb68b3e0d412de486c3a38dbefa3c4dd9d2
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Ori Liel <oliel at redhat.com>
Gerrit-Reviewer: Ravi Nori <rnori at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
More information about the Engine-commits
mailing list