Judge apologizes for rape victim comments