It does seem a fine line the judge is drawing here. Because the book was published just three days after the PJ Files were released, the judge decided the information was confidential when Amaral used it to write his book. Clearly that's true.
The question then is can a policeman use confidential information gained through his job to write something down which he keeps to himself? If no-one knows what he's written then I guess he can do that because no-one knows. If the PJ Files hadn't been released and Amaral as a result hadn't published his book no-one would have known what was in it.
So Amaral did use confidential information to write the book, but it wasn't confidential when he published the book. A fine line.
When he left, he must have taken documents with him, or arranged to get hold of a copy. While quite possibly against police rules, if he kept them under lock and key while he wrote his draft, then presumably that wouldn't be a breach of secrecy as such.
There was most definitely a breach of secrecy, however. It's impossible to have a book edited, proof-read, police photos photoshopped, the contents laid out, printed and on the shelves in three days.