Skip to content

Spring Boot 1.4.0: HTTP Status Issue #6548

@ghost

Description

Bug

I have a GlobalExceptionHandler that catches exceptions and returns a HTTP Error codes.

@ControllerAdvice
@Component
public class GlobalExceptionHandler {

    private static final Logger logger = LoggerFactory.getLogger(GlobalExceptionHandler.class);

    ...

    // 404 - Not Found
    @ExceptionHandler(NoHandlerFoundException.class)
    @ResponseStatus(HttpStatus.NOT_FOUND)
    public void requestHandlingNoHandlerFound(HttpServletRequest request, Exception exception) {
        logger.error("Error Not Found (404): " + exception.getMessage());
    }

    ...

}

This works correctly and responds with a 404. But the HTTP response looks like this:

HTTP/1.1 404 
X-Application-Context: application:8080
Content-Length: 0
Date: Wed, 03 Aug 2016 14:36:52 GMT

But should return:

HTTP/1.1 404 Not Found
X-Application-Context: application:8080
Content-Length: 0
Date: Wed, 03 Aug 2016 14:36:52 GMT

The Not Found part is missing. This is the same for other errors. e.g. 500 - Internal Server Error

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: invalidAn issue that we don't feel is valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions