Logging in Java 8 Optional

Make it a lambda with a body enclosed by curly braces and a return statement instead of an expression lambda:

Organ organ = organRepository.findById(organId)
                .orElseThrow(() -> {
                    LOG.log(Level.SEVERE,"Organ with id "+organId + "not found");
                    return new ResourceNotFoundException("organ", "id", organId);
                });

You have to use return

Organ organ = organRepository.findById(organId)
        .orElseThrow(() -> {
            LOG.log(Level.SEVERE,"Organ with id "+organId + "not found");
            return new ResourceNotFoundException("organ", "id", organId);
        });