As Sunk advises, it's less a matter of the judge's 'common sense', which implies that he has some personal influence in the actions of his court - clearly he does not - and the fact that the legal process did not stack up in terms of the trial being allowed to continue.
It's clear that legal flaws were in place, and therefore visible to the CPS, well before the trial reached the stage it did, and it is far less clear why those flaws were not considered and acted upon, leading to either the trial being halted fare earlier, or ideally not being commenced in the first place.