When he came as part of a delegation to the Messenger of Allah ﷺ, he heard them addressing Hani by the nickname Abu al-Hakam. The Messenger of Allah ﷺ called him over and said to him, "Allah alone is al-Hakam, the Judge, and to Him belongs all judgment. Why then are you given the nickname Abu al-Hakam?"He replied, "When my people disagree about something, they come to me and I judge between them, and both parties are pleased with my decision."The Messenger of Allah ﷺ said, "How excellent this is. Do you have any children?"He said, "I have Shurayh, Abdullah, and Muslim."He asked, "Which of them is the eldest?"He answered, "Shurayh."The Messenger of Allah ﷺ said, "Then you are Abu Shurayh." And he supplicated for him and his children.
أخبرنا قتيبة قال حدثنا يزيد وهو ابن المقدام بن شريح عن شريح بن هانئ
أنه لما وفد إلى رسول الله ﷺ سمعه وهم يكنون هانئا أبا الحكم فدعاه رسول الله ﷺ فقال له إن الله هو الحكم وإليه الحكم فلم تكنى أبا الحكم فقال إن قومي إذا اختلفوا في شيء أتوني فحكمت بينهم فرضي كلا الفريقين قال ما أحسن من هذا فما لك من الولد قال لي شريح وعبد الله ومسلم قال فمن أكبرهم قال شريح قال فأنت أبو شريح فدعا له ولولده
[Its chain of transmission is hasan] Narrated by Abu Dawud, in the Book of Etiquette, chapter on changing an ugly name, hadith no. 4955, from the hadith of Yazid bin Miqdam by this wording. It is also found in Sunan al-Kubra, hadith no. 5940. Ibn Hibban graded it sahih, no. 1957, Hakim strengthened it, 1/23, as did Dhahabi, and Iraqi graded it hasan in his Amali.