This would be the case if copyright wasn't transferable. AFAIK, he wrote it while working for Google, thus the owner of his code was Google, which then transferred/donated the ownership to Sun. He testified that he copied the code which he didn't own anymore.
This is all pretty fucked up, but that's what the law is.