8And Hilkiah the high priest said to Shaphan the secretary, "I have found the Book of the Law in the house of the LORD." And Hilkiah gave the book to Shaphan, and he read it. 9And Shaphan the secretary came to the king, and reported to the king, "Your servants have emptied out the money that was found in the house and have delivered it into the hand of the workmen who have the oversight of the house of the LORD." 10Then Shaphan the secretary told the king, "Hilkiah the priest has given me a book." And Shaphan read it before the king.
11When the king heard the words of the Book of the Law, he tore his clothes. 12And the king commanded Hilkiah the priest, and Ahikam the son of Shaphan, and Achbor the son of Micaiah, and Shaphan the secretary, and Asaiah the king's servant, saying, 13"Go, inquire of the LORD for me, and for the people, and for all Judah, concerning the words of this book that has been found. For great is the wrath of the LORD that is kindled against us, because our fathers have not obeyed the words of this book, to do according to all that is written concerning us."
This is definitely a Old Testament passage. The tearing of clothes is the sign of lament and repentance, of hearing news that drives you to your knees.
The high priests did that when they heard Jesus make messianic statements, for only the Messiah could make such statements and they were of the mindset that the Messiah was for the future, not now; anyone saying such things had to be crazy and blasphemous. There was one, and only one exception to that rule (the guy truly happen to be the Messiah) but they were conditioned to assume that He was crazy.
King Josiah recognized the Old Covenant pattern of God manifesting the effects of the sins of parents on their children; Josiah knew that there'd be hell to pay if he didn't get on his knees in repentance.
The New Covenant of Jesus' blood on the cross changes the dynamic somewhat, but we still see the effects of bad parents in their children's and grandchildren's lives. Even relatively good parents with blind spots can have dramatic effects on their kids; note the bad sons of Eli and Samuel. However, the Holy Spirit can help overcome such generational curses; that's something that Josiah didn't have a handle on.