An Ontario judge has declared a Harper government measure on dangerous offenders to be unconstitutional.