In the short story "The Cop and the Anthem" by O. Henry, the character Soapy attempts to break the law in a variety of ways in an effort to go to jail to survive the harsh winter. This plan has worked for a few years for Soapy.
At the start of the story, Soapy is having a difficult time getting arrested for his minor misdemeanors. He attempts to steal an umbrella, but the victim he has chosen had already stolen the umbrella and therefore gives it up without a fight. At another point, Soapy tries to harass a streetwalker, but she fails to reject his approaches and thus his plan is thwarted. In his dismay, he comes upon a church and hears the bells chime.
It is at this moment that he thinks God is speaking to him, and he plans to reform his ways. However, because of his constant transgressions, he has come to be viewed as a vagrant. While standing outside the church, he is arrested and sent to jail for loitering, with the irony being that in this case he did nothing to warrant such an arrest.
Henry wrote the short story in December of 1904. The real name of O. Henry was William Sydney Porter. Other works of his include "The Gift of the Magi" and "The Ransom of Red Chief."