public static void requireMatchingIds(final int id, final HasIntegerId object) {
        if (object == null) {
            throw badRequest("Object is null");
        }
        // Allow for the object not having an id in which case the int id wins
        if (object.getId() != null && object.getId() != id) {
            throw badRequest("Id " + id + " doesn't match id in object " + object.getId());
        }
    }
Used to validate a request argument and throw a {@link BadRequestException} if it is null
stroom-util/src/main/java/stroom/util/rest/RestUtil.java