Ideally, the courts exist to make judgement calls on this case-by-case basis. That does mean going on trial, though, which has consequences even if you are ultimately exonerated.
The courts don't need to interrogate journalists and leakers to investigate the claims in their leaks when their leaks have been published and analyzed by multiple news organizations.
It's a tough call. I don't have a good answer.