As for being “caught in the act”, it may be true that that makes one’s sexual orientation known to command. While not exactly “telling”, it may be thought to eliminate command’s burden to “not ask”. None of that has anything to do with justice.
A friend was busted in a barracks sweep (his first indiscretion after years of playing it by the book). The many heterosexual couples busted on the same night got slaps on the wrist. The gay couple(s) lost their careers.