Skip to content

TagController DELETE methods should return 404 or 410 not 500 for absent tags or projects #132

@lonnie-intercax

Description

@lonnie-intercax

return buildResult(tag.orElse(null), request, new ProjectContainmentParameters(projectId));

If a client application sends an HTTP DELETE to the /projects/{projectId}/tags/{tagId} endpoint and no such tag exists for the given tagId in the given projectId then the code as it is will send a null element into the JSON serializer for the response. This will lead to an NPE and eventually to an HTTP 500 Server Exception being sent back to the client application.

Rather, the code should check if the request tag can be located and, if not, then either an HTTP 404 (Not Found) or a 410 (Gone) should be returned.

This oversight was discovered running a small coverage test available in one of Ed Seidewitz's repositories against a running instance of this build of the pilot implementation.

Very likely, the code pattern appears throughout the Controllers and all of the DELETE handlers need to be able to handle this situation.

v/r
Lonnie.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions