Skip to content

[IDEA] Response objects should not be allowed to have a null Status #222

@tonygermano

Description

@tonygermano

Is your feature request related to a problem? Please describe.
Allowing a null Status presents a lot of edge cases to check for, when it does not make sense to have a Response (a donkey response or the User API wrapper) without a Status.

Additional context
Doing some preliminary checks, I can't find any code that explicitly checks for null. In the fixStatus method below, null is converted to ERROR and returns an "invalid status" message. Not all code calls this method to fix the status.

public String fixStatus(boolean queueEnabled) {
Status status = getStatus();
if (status != Status.ERROR && status != Status.SENT && status != Status.QUEUED) {
// If the response is invalid for a final destination status, change the status to ERROR
setStatus(Status.ERROR);
return "Invalid response status: " + status + ". Status updated to ERROR.";
} else if (!queueEnabled && status == Status.QUEUED) {
// If the status is QUEUED and queuing is disabled, change the status to ERROR
setStatus(Status.ERROR);
return "Invalid response status. Cannot set status to QUEUED while queuing is disabled. Status updated to ERROR.";
}
return null;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions