Skip to content

Openstack client does not throw exceptions on void operations with jersey connector #163

@tokle

Description

@tokle

When using the jersey connector the openstack client does not throw exceptions on errors from the backend when the operation has a void return type.
E.g: deleting a node will return ok from the nova client even if the backend operation fails with a 401 Unathorized. The problematic code is in the OpenStackClient:

public <T> T execute(OpenStackRequest<T> request) {
    OpenStackResponse response =  request(request);
    return (request.returnType() != null && request.returnType() != Void.class) ? response.getEntity(request.returnType()) : null;
}

The last line of the execute method will return null regardless of having a non-ok status code. If the return type is not void, the response.getEntity method will throw an exception in case of a non ok status code (at least this is true in the case of the jersey connector).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions