I said the same words 37 years ago and as much as I hate to see this kids Military career in the crapper, he knew what he was up against..
I, (NAME), do solemnly swear (or affirm) that I will support and defend the Constitution of the United States against all enemies, foreign and domestic; that I will bear true faith and allegiance to the same; and that I will obey the orders of the President of the United States and the orders of the officers appointed over me, according to regulations and the Uniform Code of Military Justice. So help me God.
It's pretty clear he didn't plan on living up to those words. The UCMJ doesn't require you to obey an unlawful order but you better be damn sure of what you're doing!