Except he wasn't wearing a fake uniform and decorations, he was only claiming to have earned the medals. That is why the judge ruled the law unconstitutional: because it literally criminalizes any speech that is untrue according to the government.
This case isn't about impersonating a soldier or officer which already is illegal. It is about whether or not the government has the right to prosecute citizens for not telling the truth. Quite different, unless you're dense as a brick.
In fact, the real issue here is that the law is badly written and in effect functions as a blanket criminalization of untrue speech. I'm all for punishing morons who claim to be war heroes but any such law needs to be written specifically for that crime. But politicians and officials LOVE zero-tolerance type blanket bans because they do not require any complex thinking to enforce. Just point at the book and sentence, and they're helped by the kind of idiotic knee-jerk reactions as displayed in this thread.