swearing, shouting etc can lead to imprisonment and does.
Nakedness is just like anti social behaviour. Neither are strictly against the law. However doing it in certain ways or places, mos certainly is against the law and will land you in trouble. These. Laws have to be vague, a one law does not fit all. It's ok to hour, but continually. Shouting abuse at 2am is not. Just like being naked in a place you are unlikely to be seen or socially acceptable (like certain beaches) is fine, but stripping of and walking through town is likely to land you in trouble.
Perhaps the total sentence is so long as he has been arrested 14+ times for the same offence showing no rehabilitation and forcing judges to hand out ever harsher sentences. The only funny thing in this thread is people trying to make out the sentence is harsh, that no laws where broken and seem to think it was a one of court appearance. Not a massive string of offences.