
613 S.E.2d 432 (2005)
270 Va. 14
Atif CHARLES
v.
COMMONWEALTH of Virginia.
Record No. 041919.
Supreme Court of Virginia.
June 9, 2005.
Joseph R. Winston, Special Appellate Counsel (Virginia Indigent Defense Commission, on briefs), for appellant.
Leah A. Darron, Assistant Attorney General (Judith Williams Jagdmann, Attorney General, on brief), for appellee.
Present: All the Justices.
LACY, Justice.
In this appeal, we consider whether participation in the Detention Center Incarceration Program (the Program), Code § 19.2-316.2, *433 is incarceration and whether a probationer is entitled to credit for time served in the Program when his probation is later revoked.

Facts
On October 16, 1997, Atif A. Charles was sentenced to five years imprisonment with four years suspended following his conviction for possession of heroin with the intent to distribute, under Code § 18.2-248. After serving his one-year active sentence, Charles was placed on probation. When he violated conditions of probation, the trial court revoked the suspended sentence, resuspended the sentence and placed Charles on probation. One condition of Charles' second probation was that he enter and complete the Program. Charles completed the Program in five months but then violated other conditions of his probation. The trial court revoked his second probation and imposed the unserved four years of his original five-year sentence.
Charles appealed to the Court of Appeals of Virginia, arguing that his four-year sentence should have been reduced by the five months he served in the Program. Conceding that he had not raised this issue in the trial court as required by the contemporaneous objection rule, Rule 5A:18, Charles argued that the matter should be considered by the Court of Appeals under the ends of justice exception to that Rule. The Court of Appeals declined to apply the ends of justice exception, finding that participation in the Program was a condition of probation, not incarceration. Charles v. Commonwealth, No. 0616-03-1, slip op. at 5-6, 2004 WL 1607469 (Va.Ct.App. July 20, 2004). Furthermore, construing Code § 19.2-316.2, the Court of Appeals determined that whether participation in the Program should be credited against an outstanding sentence was a matter within the trial court's discretion. Id., slip op. at 7. We awarded Charles an appeal.

Discussion
Charles argues that the Court of Appeals erred in refusing to apply the ends of justice exception because his participation in the Program was incarceration and, by failing to provide credit for that period of incarceration, the trial court effectively altered the sentence imposed in his October 16, 1997 sentencing order, a final order under Rule 1:1.[*]
Rule 5A:18, like our Rule 5:25, allows an appellate court to consider a matter not preserved by objection in the trial court "to attain the ends of justice." Application of the ends of justice exception is appropriate when the judgment of the trial court was error and application of the exception is necessary to avoid a grave injustice or the denial of essential rights. Cooper v. Commonwealth, 205 Va. 883, 889, 140 S.E.2d 688, 693 (1965). In reviewing the Court of Appeal's judgment, we begin by determining whether that Court was correct in holding that there was no error in the trial court's judgment. Tucker v. Commonwealth, 268 Va. 490, 493, 604 S.E.2d 66, 67-68 (2004).

A. Trial Court Error Participation in the Program as Incarceration
The Commonwealth argues, and the Court of Appeals held, that, pursuant to Code § 19.2-316.2, participation in the Program is a condition of probation and therefore such participation is not incarceration. Designating an activity as an authorized condition of probation, however, is not a description of the nature of the activity. Indeed, the Commonwealth acknowledges this fact by suggesting that additional evidence is necessary in this case to determine whether conditions of the Program "are strongly similar to traditional incarceration or whether they more closely resemble some lesser form of restraint." Additional evidence is not required, as the Commonwealth suggests, because the statutes addressing the Program are dispositive of the issue in this case.
Code § 53.1-67.8 authorizes the Department of Corrections to "maintain a system of residential detention centers to provide a highly structured, short-term period of incarceration for individuals committed to the Department *434 under the provisions of § 19.2-316.2" (emphasis added). Code § 19.2-316.2 specifically labels the program as an "incarceration" program; it refers to "facilities available for confinement," release from "confinement," and a "detention center incarceration program" that required "more security or supervision" than other programs. We do not consider these references to "incarceration" to be inadvertent; by describing the Program in this manner, the General Assembly has determined that participation in the Program is incarceration.
Accordingly, we hold that Charles was incarcerated when he participated in the Program. Therefore, when Charles' second probation was revoked, he had been incarcerated for one year and five months. By sentencing him to four years imprisonment, the trial court added five months incarceration to Charles' original five-year sentence.

Credit for Time Served in the Program
We now consider whether the Court of Appeals' correctly held that the decision to grant Charles credit for the period of time he served in the Program was a matter of trial court discretion. The Court based this holding on its construction of Code § 19.2-316.2. Subsection (B)(3) of that section specifically directs the trial court not to credit time spent in the Program to parolees, but the statute is silent with regard to the treatment of such time for probationers. The Court of Appeals construed the General Assembly's silence in this regard as an affirmative election to place the crediting decision in the discretion of the trial court and concluded that, in this case, the trial court did not abuse its discretion in refusing to grant Charles credit for the time he served in the Program. Charles, slip op. at 9, 11.
We disagree with the Court of Appeals' construction of the statute and its conclusion. Rule 1:1 and long standing case law applying that rule preclude a trial court from entering a second sentencing order altering an original sentencing order that has become final. Robertson v. Superintendent of the Wise Correctional Unit, 248 Va. 232, 236, 445 S.E.2d 116, 118 (1994); Conner v. Commonwealth, 207 Va. 455, 457, 150 S.E.2d 478, 479 (1966). The policy of finality contained in Rule 1:1 is not absolute, however. The General Assembly has enacted various exceptions to this policy. See, e.g., Code § 19.2-303 (court may modify unserved portion of sentence at any time before defendant is transferred to Department of Corrections); Code § 8.01-428 (court may modify final order in certain listed circumstances).
Code § 19.2-612(B)(3) provides an exception to Rule 1:1. By denying a parolee credit for time incarcerated during the Program, the General Assembly has authorized a trial court to enter a second sentencing order upon revocation of parole that extends the length of incarceration imposed by the original sentencing order. The absence of such a provision for probationers indicates that the General Assembly knew that the trial court could not enter a second sentencing order that altered a sentencing order that had become final under Rule 1:1 and did not intend to alter the application of that Rule. Waterman v. Halverson, 261 Va. 203, 207, 540 S.E.2d 867, 869 (2001) (legislature presumed to be familiar with existing rules and case law when enacting legislation).
In the absence of any legislative exception to Rule 1:1, the trial court did not have the authority or the discretion to enter a second sentencing order that extended the period of incarceration beyond that imposed in Charles' October 1999 final sentencing order. See Robertson, 248 Va. at 236, 445 S.E.2d at 118. Accordingly, the Court of Appeals erred in holding that Code § 19.2-316.2 vested the trial court with the discretion to grant or deny Charles credit for the time he served in the Program.

B. Grave Injustice
Invoking the ends of justice exception to the contemporaneous objection rule requires a determination not only that there was error in the judgment of the trial court but also that application of the exception is necessary to avoid a grave injustice. The latter predicate is also met in this case.
In Deagle v. Commonwealth, 214 Va. 304, 199 S.E.2d 509 (1973), this Court considered whether a trial judge could shorten the sentence suggested by the jury because the jury's sentence exceeded that allowed by law. We stated:

*435 Where the sentence imposed is in excess of that prescribed by law, that part of the sentence which is excessive is invalid. Crutchfield v. Commonwealth, 187 Va. 291, 46 S.E.2d 340 (1948). A sentence in excess of one prescribed by law is not void ab initio because of the excess, but is good insofar as the power of the court extends, and is invalid only as to the excess. Royster v. Smith, 195 Va. 228, 77 S.E.2d 855 (1953).
Id. at 305, 199 S.E.2d at 510-11. Therefore, that portion of Charles' sentence beyond the five years imposed in the final sentencing order is void. Denying Charles his liberty on the basis of a void sentence would impose a grave injustice upon him. The application of the ends of justice exception is, therefore, fully justified in this case.

Conclusion
In conclusion, we hold that participation in the Detention Center Incarceration Program is incarceration. Even though such incarceration is served as a condition of probation, it cannot be used upon revocation of probation to enlarge the sentence imposed in a sentencing order that has become final under Rule 1:1. Therefore, to achieve the ends of justice, we will reverse the judgment of the Court of Appeals and remand this case with instructions to remand the case to the trial court for entry of an order consistent with this opinion.
Reversed and remanded.
NOTES
[*]  Unless otherwise provided by statute, see e.g., Code § 8.01-428, Rule 1:1 prohibits the modification of a final order more than 21 days after the date of entry.
