A judge praised the actions of a quick-thinking resident who helped to catch a burglar in the act.