
    Kelley Lumber Company, Respondent, v. The Otselic Valley Railroad Company and Others, Appellants, Impleaded with Harvey Kelley, Defendant, and Albert E. La Salle and Others, Respondents.
    Third Department,
    December 30, 1909.
    Trial — judgment must be according to evidence— appeal — direction of judgment on facts found — mecbanicsUiens — pleading — admission of defendants’ liens—when rights of parties should be determined.
    Where the court has overruled an objection that evidence of mechanics’ liens filed by defendants is not within the pleadings, it cannot refuse to consider the evidence received in deciding the case.
    Where the trial court has found facts, but has committed an error of law in rendering judgment thereon, the Appellate Division will direct the judgment warranted by the findings.
    Where a complaint to foreclose a mechanic’s lien alleges that the defendants have filed liens and prays that the respective rights and priorities of all- parties be determined, and the answers admit such allegations without asking that any of the liens be declared invalid, the court should receive evidence of the defendants’ liens and determine the respective rights of all parties.
    Sewell, J., dissented.
    Appeal by the defendants, .The Otselic Valley Railroad ¡Company and others, from a judgment of the Supreme Court in favor of the plaintiff and certain of the defendants, entered in the office of the clerk of -the county of Madison on the 20th day of July, 1908, upon the decision of the court rendered after a trial at the Madison Special Term.
    The action was brought to foreclose a mechanic’s lien upon certain rights of way owned by the railroad company. The notice of lien was filed January 14, 1907. The plaintiff stated in the complaint,, after the proper allegations in reference to its lien, that the defendant Bufhans & Black Company filed a mechanic’s lien against the property January 9,. 1907, for $996.53, and that the defendant Floyd Currier filed a mechanic’s lien against the property January 19, 1907, for $1,042.34. The defendant Burlians & Black Company interposed an answer, putting in issue the material allegations of the complaint other than the allegation as to the said lien filed by it .as aforesaid January 9, 1907, for $996,53, which it alleged was prior and superior to the lien of the plaintiff, which was filed January 14, 1907, and that all the lienors, including the plaintiff, were junior lienors and subordinate to the rights' of said defendant, and that it is entitled to the payment of its lien and interest from the .proceeds of such sale prior to the other lienors. It prayed that the relief asked for in the complaint be granted in so far as the same does not conflict with the rights and interests of this defendant, and that out of the proceeds of said sale there shall be paid to this defendant the sum of $996.53 before application is made of any portion of the proceeds of said sale for the payment of plaintiff’s claim herein.
    The defendant Currier admitted all the allegations of the complaint, and alleged that he filed the lien against the Otselic Valley Eailroad Company in the offices of the county clerks of. Madison and Chenango counties on the 19th day of January, 1907, for $1,042.34, as alleged in the complaint; that said lien was thereafter and within ten days served on the Otselic Valley Eailroad Company, as. required by statute, and that said lien was sworn to, and in all things complied with the requirements of the statute.
    Upon the trial the court admitted, over objection and exception, evidence tending to show the material furnished by the defendants Currier and Burhans & Black Company, the agreed price or value of the same, and the other facts required by section 9 of the Lien Law. (See Laws of 1897, chap. 418, § 9, as amd. by Laws of 1905, chap. 96.) The court found facts sufficient to establish the liens of these defendants, but found as a conclusion of law that neither of these defendants was entitled to any relief or judgment in this action. The reason assigned for this conclusion was that “ The answer of each of the defendants, Burhans & Black Company * * * and Currier, is insufficient to warrant either an enforcement thereof in the decree of foreclosure or to warrant a judgment for the amount of their claims, respectively.”
    
      Hubert O. Stratton, for the appellant The Otselic Valley Eailroad Company.
    
      John F. Nash, for the appellant Burhans & Black Company.
    
      Arthur N. Mawson, for the appellant Floyd Currier.
    
      
      M. H. Kiley, for the respondent Kelley Lumber Company.
    
      Cleveland J. Kenyon, for the respondents Cuyle and others.
   Kellogg, J.:

The evidence fairly sustained the judgment against the railroad company, and no error is found to its prejudice.

It is clear that the .practice pursued by the court with reference to the defendants Burhans & Black Company and Currier was erroneous. It could not receive evidence of their liens over the objection that it was not within the pleadings and then refuse to consider such evidence in deciding the case. This procedure is not warranted by law and must destroy a judgment based upon it. (Ewald v. Poates, 107 App. Div. 242; Robinson v. N. Y. Elevated R. R. Co., 175 N. Y. 219.)

The court, therefore, erroneously found that neither the Burhans & Black Company nor Currier was' entitled to relief. Upon the facts found the Burhans & Black Company had a valid lien which was superior to the plaintiff’s lien, and the defendant Currier had a valid lien which was subsequent to the liens of the Burhans & Black Company and the plaintiff and prior to the other lienors. The judgment upon the facts found should have so provided. The court having found all of the facts in their favor and having committed an error of law in not giving them the benefit thereof, we may order the judgment which should have been granted at the trial upon the facts found. (Sayre v. State, 123 N. Y. 291; Bryant v. Turner, No. 2, 126 App. Div. 598.)

It would be useless formality, however for us to direct judgmént upon the facts found if the court erred in receiving the evidence upon which such findings are based. It, therefore, becomes important to determine whéther the trial court committed error in receiving evidence of such liens over the objection that it was inadmissible under the pleadings. Section 3402 of the Code of Civil Procedure, which was in force at the time, required that all parties other than plaintiff having liens shall be made parties, defendant, and section 3403 provides that the court may adjust and determine the equities of all the parties and the order of priority of different liens and determine all the issues raised by any defense or counter claim. The allegation in the complaint that each of said parties had filed a mechanic’s lien against the property on the date and for the amount stated, and the prayer for relief that all the rights, interests and priority of the plaintiff and of the defendants be ascertained and determined, and the answers of the said defendants, do not leave them in the position described in subdivision 3 of section 3403 of the Code of Civil Procedure of waiving their liens. Under that subdivision every defendant who is a lienor must set forth his lien, or he will be deemed to have waived it “ unless the lien is admitted in the complaint and not contested by another defendant.” These liens were substantially admitted in the complaint; the lienors were made parties, not as persons claiming liens, but as persons having liens, and the plaintiff sought an adjudication as to priority. The answer of each of said defendants, read in connection with the complaint which it referred to, was a sufficient allegation of their liens when objected to for the first time upon the trial. A defendant whose rights are substantially admitted in the complaint may safely rely upon that fact. He is not in a position to know, and it is not necessary for him to inquire what the status of the pleadings is between the plaintiff and other .defendants. The lien being substantially admitted by the complaint is not to be deemed controverted so as to visit upon him the penalty of subdivision 3 above unless the defendant controverts it by serving upon him an answer under section 521 of the Code of Civil Procedure challenging his rights. All parties appeared before the court for trial; the plaintiff having substantially admitted the existence of the defendants’ liens, asserted its own lien and sought the determination of' the court as to priority of liens; the defendant lienors were there to protect their priority of liens, the railroad company to question all the liens. If the railroad company had served upon the other defendant lienors an answer asking that their liens be declared invalid, that would have required the said lienors to set forth their lien in proper issuable form. In the absence of such answer the defendant lienors were entitled to introduce, their evidence and have their liens declared. The bringing of an action to foreclose a lien brings all the parties before the court, and if a lien is established the court is to distribute the fund among the lienors according to their respective rights. The judgment should, therefore, be modified as above, and as modified affirmed, with costs to the plaintiff against the railroad, company and with costs to the Burhans & Black Company and Currier to be paid by the respondents. '

All concurred, except Sewell, J., dissenting.

Judgment modified as per opinion, and as so modified affirmed, with costs to the plaintiff against the railroad company, and with costs to Burhans & Black Company and Currier to be paid by the respondents.  