Juan Hernandez has uploaded a new change for review. Change subject: Revert "restapi: Fix NPE in request for CDROMs of wrong VM" ......................................................................
Revert "restapi: Fix NPE in request for CDROMs of wrong VM" This reverts part of commit 8d5aa3646e2402a48f88a0532a70d9bb50347e57, as it breaks listing of empty collections of VM devices. Change-Id: I14333ee4b8f43da4da287a70304107b225990c44 Bug-Url: https://bugzilla.redhat.com/1159642 Related-To: https://bugzilla.redhat.com/1150953 Signed-off-by: Juan Hernandez <juan.hernan...@redhat.com> (cherry picked from commit 25215cefbd56b4d9b03d9622f886f762d2570fae) --- M backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/AbstractBackendReadOnlyDevicesResource.java 1 file changed, 1 insertion(+), 11 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/74/34774/1 diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/AbstractBackendReadOnlyDevicesResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/AbstractBackendReadOnlyDevicesResource.java index 3e4155a..5a516bf 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/AbstractBackendReadOnlyDevicesResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/AbstractBackendReadOnlyDevicesResource.java @@ -3,10 +3,8 @@ import java.lang.reflect.Method; import java.util.List; -import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; -import org.apache.commons.collections.CollectionUtils; import org.ovirt.engine.api.model.BaseDevice; import org.ovirt.engine.api.model.BaseDevices; import org.ovirt.engine.api.model.VM; @@ -42,15 +40,7 @@ @Override public C list() { - // This query is loading the collection of containers of the devices, not the devices themselves. For example, - // when requesting the CDROMs of a VM this query will actually load a collection contain the VM, not the CDROMs. - // The result will be null if there is no such VM (if the user provided an incorrect id, or if the VM has been - // removed) and in that case we need to respond with the 404 error code. - List<Q> collection = getBackendCollection(queryType, queryParams); - if (CollectionUtils.isEmpty(collection)) { - throw new WebApplicationException(Response.Status.NOT_FOUND); - } - return mapCollection(collection); + return mapCollection(getBackendCollection(queryType, queryParams)); } @Override -- To view, visit http://gerrit.ovirt.org/34774 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I14333ee4b8f43da4da287a70304107b225990c44 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5 Gerrit-Owner: Juan Hernandez <juan.hernan...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches