if (match && r.getCandidate().isPresent()) {
// Durations are in nanoseconds, we don't need this kind of precision
candidateTimer.record(r.getCandidate().get().getDuration(), TimeUnit.NANOSECONDS);
This is a transcript of the code.
Sonar asks me to call isPresent(), which is called one line before.