
    John F. CURRY, Jr., Appellant, v. Lucy HADI, Secretary, Department of Children and Family Services, and Rick Harry, Executive Director, Florida Civil Commitment Center, Appellees.
    No. 2D03-5540.
    District Court of Appeal of Florida, Second District.
    April 29, 2005.
    
      John F. Curry, Jr., pro se.
    Charles J. Crist, Jr., Attorney General, Tallahassee, and Diana K. Bock, Assistant Attorney General, Tampa, for Appellees.
   FULMER, Judge.

John F. Curry, a detainee under the Jimmy Ryce Act, appeals from the dismissal of a Petition for Writ of Habeas Corpus. Although we conclude that the trial court erred in dismissing the petition for the reasons given in its order, we nevertheless affirm because the petition would have been properly denied had the trial court addressed the substance of the claims raised.

The trial court rested its dismissal on the rationale that the petition did not comply with section 394.9215, Florida Statutes (2003), a provision of the Jimmy Ryce Act authorizing a detainee to file a petition for habeas corpus to challenge conditions of confinement or the appropriateness of the secure facility in which the person is confined, after first exhausting administrative remedies. The court noted that Curry failed to meet the exhaustion requirement of the statute and found that the claims raised in Curry’s petition “[did] not fall into the limited category of grounds upon which the Petitioner may file a petition seeking a writ of habeas corpus.” Although Curry’s petition recited chapter 79, Florida Statutes, which governs habeas corpus relief generally, the trial court’s order makes no mention of that chapter.

On appeal, Curry argues that the trial court imposed an unconstitutional limitation on his right to seek habeas corpus relief. We conclude that the trial court erred in its interpretation of section 394.9215 as a limitation on the general habeas corpus rights of detainees under the Jimmy Ryce Act. We do not construe section 394.9215 as an attempt by the legislature to limit the rights of Jimmy Ryce detainees to invoke the writ of habeas corpus. Such a construction would raise constitutional questions. Instead, we construe that statute to simply specify the procedural mechanism for detainees to use when challenging certain issues relating to their confinement.

Although we conclude that the trial court erred in its justification for the dismissal, we affirm because Curry’s claims are facially without merit. Curry’s first claim is that by instituting the civil commitment proceedings the State violated the terms of a negotiated plea agreement in Curry’s underlying criminal case. This claim would have been properly denied on the merits because the supreme court has rejected just such a claim in State v. Harris, 881 So.2d 1079 (Fla.), cert. denied, — U.S.-, 125 S.Ct. 812, 160 L.Ed.2d 601 (2004), holding that neither a negotiated plea agreement nor the doctrine of equitable estoppel bars the State from initiating civil commitment proceedings under the Act. Curry’s second claim is that the prison sentence he received in his underlying criminal case was illegal because it exceeded the statutory maximum for the offense. This claim could not entitle Curry to the relief sought, re-sentencing in his criminal case, because an attack on the legality of a sentence in a criminal case, which could have been made on direct appeal or by postconviction motion, is not cognizable in a habeas corpus petition. See Anderson v. Chapman, 109 Fla. 54, 146 So. 675 (1933) (indicating that habeas corpus relief is generally not available for error or mistake in judgment or sentence which might have been corrected on appeal); Ferenc v. Thursby, 212 So.2d 887, 887 (Fla. 1st DCA 1968) (“A habeas corpus proceeding is not a substitute for the adequate remedy of appeal.”).

Accordingly, we affirm the dismissal of Curry’s petition.

ALTENBERND, C.J., and WHATLEY, J., Concur. 
      
      . §§ 394.910-394.931, Fla. Stat. (2003) (commonly referred to as the "Jimmy Ryce Act”).
     
      
      . The trial court concluded that this claim is moot because the sentence has already been served.
     