It's interesting that in the case of David, he was actually stoned for being a murderer - it just happened a fair bit after the event and wasn't a successful execution because only one guy got in on the action:
5 As King David approached Bahurim, a man from the same clan as Saul’s family came out from there. His name was Shimei son of Gera, and he cursed as he came out. 6 He pelted David and all the king’s officials with stones, though all the troops and the special guard were on David’s right and left. 7 As he cursed, Shimei said, “Get out, get out, you murderer, you scoundrel! 8 The Lord has repaid you for all the blood you shed in the household of Saul, in whose place you have reigned. The Lord has given the kingdom into the hands of your son Absalom. You have come to ruin because you are a murderer!”
9 Then Abishai son of Zeruiah said to the king, “Why should this dead dog curse my lord the king? Let me go over and cut off his head.”
10 But the king said, “What does this have to do with you, you sons of Zeruiah? If he is cursing because the Lord said to him, ‘Curse David,’ who can ask, ‘Why do you do this?’”
11 David then said to Abishai and all his officials, “My son, my own flesh and blood, is trying to kill me. How much more, then, this Benjamite! Leave him alone; let him curse, for the Lord has told him to. 12 It may be that the Lord will look upon my misery and restore to me his covenant blessing instead of his curse today.”
13 So David and his men continued along the road while Shimei was going along the hillside opposite him, cursing as he went and throwing stones at him and showering him with dirt. 14 The king and all the people with him arrived at their destination exhausted. And there he refreshed himself. - 2 Samuel 16:5-13 NIV
It seems that David didn't challenge in any way the legitimacy of this treatment, but instead asserted that Shimei was following the Lord's will. Rather than excusing himself from such treatment, David trusted in God's mercy to rescue him from what was a righteous judgment.