I'm not sure this is really worth bothering with, but the references to harassment and "racially aggravated" here are references to a specific charge and a legal definition rather than definitions in the colloquial sense
Neither were convicted of harassment as far as I'm aware, and the point the judge was making was that - although it seems clear he is racist - the boy who killed this man did not attack him specifically because of his race (presumably instead because he was an easy target and, as the judge said, he thought it would impress the girl) and so in that sense it was not - legally - considered a racially aggravated offence
The sentences are, of course, a fucking abomination