
411 A.2d 304 (1980)
Fred BOROZNY
v.
Claudette A. PAINE, Treasurer.
No. 77-450-Appeal.
Supreme Court of Rhode Island.
February 15, 1980.
*305 George M. Prescott, Oster, Fay, Groff & Prescott, Lincoln, for plaintiff.
John Quattrocchi III, Town Sol., Lincoln, for defendant.

OPINION
WEISBERGER, Justice.
This case comes before us on appeal from an order of the Superior Court, which order held the plaintiff in contempt for failure to comply with a previous order of the Superior Court which had required the plaintiff to correct certain housing code violations in respect to a house owned by him in the town of Lincoln. This dispute has had a long and tortuous history in our judicial system. The salient features are as follows.
On July 10, 1970, the Minimum Housing Inspector of the town of Lincoln sent plaintiff a notice of housing code violations in respect to the subject premises. The violations were not corrected. On March 20, 1974, the town Building and Minimum Housing Inspectors issued an order to demolish plaintiff's building. The plaintiff brought the present action to enjoin the demolition. A justice of the Superior Court enjoined the town from demolishing the building but ordered that plaintiff bring his property into compliance with the standards of the code by September 15, 1974. This order was entered on May 21, 1974, by consent. On March 11, 1975, the town filed an answer to plaintiff's complaint. The town alleged that plaintiff had failed to comply with the consent order, and requested vacation of the order and forfeiture of the security that plaintiff had posted to cover demolition costs. On May 6, 1976, another justice of the Superior Court entered a modified order, also by consent, which set September 18, 1976, as the new deadline for completion of repairs. The required repairs were not accomplished, and on July 6, 1977, the town solicitor moved to adjudge plaintiff in contempt and sought permission to demolish the building.
On August 26, 1977, plaintiff filed a motion to vacate the order of May 6, 1976, on the ground that the court lacked subject matter jurisdiction. He based this claim upon an allegation that the minimum housing standards ordinance was invalid by reason of defective procedure in its adoption and failure to conform to the enabling legislation. The trial justice denied plaintiff's motion to vacate the prior order and granted the town's motion to hold plaintiff in contempt of court. On December 7, 1977, a written order was entered adjudging plaintiff in contempt, ordering him to turn over to his attorney the keys to his building, ordering an inspection, and allowing plaintiff to purge himself of contempt by presenting a reasonable plan for repair and rehabilitation of his building. The order also provided that if plaintiff did not purge himself of contempt, the building would be demolished. The plaintiff appeals from this order.
In this appeal plaintiff asserts lack of subject matter jurisdiction in the Superior *306 Court to enter the order of May 6, 1976, by reason of the alleged invalidity of the Lincoln minimum housing standards ordinance.
The general rule is that collateral attack upon an order is not allowed on review of a judgment of civil contempt for disobedience of the order. When the court has jurisdiction of the parties and of the subject matter, a party will not be permitted to urge in defense of his alleged misconduct that the court erred in entering the order. Hartt v. Hartt, R.I., 397 A.2d 518, 521 (1979); Menard v. Woonsocket Teachers' Guild-AFT 951, 117 R.I. 121, 129-30, 363 A.2d 1349, 1354 (1976); Brown v. Brown, 114 R.I. 117, 119, 329 A.2d 200, 201 (1974); Dupras v. Dupras, 103 R.I. 239, 240-41, 236 A.2d 260, 261 (1967); Ciallella v. Ciallella, 81 R.I. 320, 325-26, 103 A.2d 77, 79 (1954); Starkweather v. Williams, 31 R.I. 134, 135, 76 A. 662, 663 (1910); see Walker v. City of Birmingham, 388 U.S. 307, 87 S.Ct. 1824, 18 L.Ed.2d 1210 (1967); United States v. United Mine Workers of America, 330 U.S. 258, 67 S.Ct. 677, 91 L.Ed. 884 (1947). As we pointed out in Hartt v. Hartt, supra, "This is really another statement of the rule that a valid final judgment, even though erroneous, is not subject to collateral attack." 397 A.2d at 521.
In the case at bar, the order of May 21, 1974, which required that repairs to the property be made, was entered by consent. The order of May 6, 1976, which extended the deadline for completion of repairs, was also entered by consent. The issue of the court's subject matter jurisdiction was not raised until the motion to vacate was filed on August 26, 1977. Later, on October 5, 1977, plaintiff filed an amended complaint by permission of the court and reiterated the issue of the ordinance's invalidity. Lack of subject matter jurisdiction is the only basis upon which the earlier consent orders could have been collaterally attacked. See Hartt v. Hartt, 397 A.2d at 521; Mayer v. Mayer, 36 Del.Ch. 457, 463-64, 132 A.2d 617, 621 (1957); 1B Moore's Federal Practice ¶ 0.405[4.-1] at 635 (2d ed. 1974). The thrust of plaintiff's argument is based upon the alleged invalidity of the Lincoln ordinance. He contends that the subject matter jurisdiction of the Superior Court is controlled by the validity of the ordinance that is enforced by the order. This contention is clearly without merit.
In Walker v. City of Birmingham, supra, the petitioners were enjoined from participating in or encouraging mass street parades without having obtained a permit as required by the Birmingham parade ordinance. They violated the injunction and were brought before the Alabama circuit court to show cause why they should not be adjudged in contempt. At the contempt hearing, the petitioners sought to challenge the constitutionality of the injunction and the ordinance upon which it was based. The circuit judge refused to hear the contentions of unconstitutionality and found the petitioners in contempt. In passing upon the contempt finding, the Supreme Court of the United States, although conceding that substantial constitutional issues might have been raised concerning the generality of the language contained in the Birmingham parade ordinance and the breadth and vagueness of the injunction itself, refused to permit a collateral attack upon the injunction by way of a challenge to the contempt order. The Court pointed out that the Alabama tribunal had, as a court of equity, jurisdiction over the petitioners and over the subject matter of the controversy. This jurisdiction was not vitiated by reason of a constitutional challenge to the ordinance upon which the injunction was based. Similarly in the case at bar, the Superior Court's jurisdiction of the subject matter did not depend upon the validity of the Lincoln housing ordinance. Perhaps this principle is best stated in Howat v. Kansas, 258 U.S. 181, 42 S.Ct. 277, 66 L.Ed. 550 (1922):
"An injunction duly issuing out of a court of general jurisdiction with equity powers, upon pleadings properly invoking its action, and served upon persons made parties therein and within the jurisdiction, must be obeyed by them however erroneous the action of the court may be, even if the error be in the assumption of *307 the validity of a seeming but void law going to the merits of the case. It is for the court of first instance to determine the question of the validity of the law, and until its decision is reversed for error by orderly review, either by itself or by a higher court, its orders based on its decision are to be respected, and disobedience of them is contempt of its lawful authority, to be punished." Id. at 189-90, 42 S.Ct. at 280-81, 66 L.Ed. at 559.
The plaintiff sought relief from the Superior Court by a complaint that asked that the town be enjoined from demolishing his building. The Superior Court is a trial court of general jurisdiction and has been clothed by the Legislature with "exclusive original jurisdiction of suits and proceedings of an equitable character and of statutory proceedings following the course of equity." General Laws 1956 (1969 Reenactment) § 8-2-13; see Concannon v. Concannon, 116 R.I. 323, 328, 356 A.2d 487, 491 (1976). The court's equitable powers were supplemented by G.L.1956 (1970 Reenactment) § 45-24.2-8, which specifically authorized the Superior Court to proceed according to the course of equity "to order the repair, vacation or demolition of any dwelling existing in violation of the provisions of any ordinance * * * adopted pursuant to the authority hereof."[1] Therefore, there can be no question of the jurisdiction of the Superior Court to determine the validity of the ordinance in question and, if the ordinance is found to be valid, to enforce its provisions.
Inherent in the jurisdiction to determine the validity of an ordinance is the possibility that a court may reach an erroneous determination. However, a collateral attack is not permitted upon a final judgment, even though it may be alleged to be erroneous. This rule is followed even in cases in which the error is egregious. Kriesel v. Kriesel, 35 Wis.2d 134, 139, 150 N.W.2d 416, 419 (1967). The Supreme Court of the United States has aptly stated this principle in Maggio v. Zeitz, 333 U.S. 56, 68 S.Ct. 401, 92 L.Ed. 476 (1948):
"It would be a disservice to the law if we were to depart from the long-standing rule that a contempt proceeding does not open to reconsideration the legal or factual basis of the order alleged to have been disobeyed and thus became a retrial of the original controversy. The procedure to enforce a court's order commanding or forbidding an act should not be so inconclusive as to foster experimentation with disobedience." Id. at 69, 68 S.Ct. at 408, 92 L.Ed. at 487.
Thus, in view of the posture in which this case is presented to us, we are precluded from reviewing the validity of the Lincoln ordinance, though we observe that it was purportedly adopted in accordance with the provisions of the enabling legislation.
The plaintiff also challenges the contempt finding on the ground that his disobedience was not willful. In light of the plaintiff's failure over a period in excess of three years to comply with orders to which he had given his consent, it can scarcely be contended that the Superior Court was clearly wrong in finding that the plaintiff had not established inability to perform or any other justification for noncompliance. See Hartt v. Hartt, 397 A.2d at 524; Andrews v. Andrews, 134 Vt. 47, 349 A.2d 239 (1975). The questions of willfulness and ability to perform are essentially questions of fact. A determination of such facts by a trial justice is entitled to great weight and cannot be set aside by this court unless the trial justice is clearly wrong. Menard, 117 R.I. at 129, 363 A.2d at 1354; Abilheira v. Faria, 102 R.I. 214, 219, 229 A.2d 758, 762 (1967). In the case at bar the evidence amply supports the factual findings of the trial justice.
For the reasons stated, the appeal is denied and dismissed, the order appealed from is affirmed, and the case is remanded to the Superior Court for further proceedings.
NOTES
[1]  The authority to enforce such ordinances was conferred upon the District Court by P.L.1977, ch. 277, § 5. However, P.L.1977, ch. 277, § 7 provides that all proceedings commenced prior to the amendment's effective date of October 1, 1977, shall be governed by the law in effect prior to that date. The present proceedings are thus unaffected by this transfer of jurisdiction.
