An officer to whose charge a jury is committed by a court, who negligently or willfully, and without leave of the court, permits them, or any one of them, to receive a communication from a person, to make a communication to a person, to obtain or receive a book, paper, or refreshment, or to leave the jury room, is guilty of a misdemeanor.