When it is proven to the satisfaction of said committee that any person, not a legally qualified voter, voted at any such contested election, it shall be lawful for said committee to compel said voter to disclose, under oath, for which of the respective candidates he voted; but when the committee examines the witness on oath as to the person or persons for whom he voted, and said witness on such examination discloses the names of the persons for whom he voted at such election, he shall not afterwards be prosecuted for having illegally voted at such election.
25 P.S. § 3326