RequestHeader.path() is unsafe

I have Play 2.3.6 Java app. In it I have my own error handler for handling bad requests, method looks like:

    public Promise<play.mvc.Result> onBadRequest(RequestHeader request, String error {
        Logger.debug("400 error: " + error + ", " + request.path() + ", " + request.remoteAddress());
        return Promise.<play.mvc.Result> pure(badRequest(views.html.error404.render()));
    }
When an error occurs, instead of my own error page I am getting standard error page. It turns out problem is in request.path() method which is supposed to return string. But if the URL is incorrect it throws an exception and breaks my error handling code. 

An example of bad request causing it looks like this: https://www.playframework.com/documentation/2.3.x/Home%
(with % at the end of url).