(a) Appellate review not waived and appeal not withdrawn.--If a sentence extends to dismissal or a dishonorable or bad-conduct discharge, the right of the accused to appellate review is not waived and an appeal is not withdrawn, that part of the sentence extending to dismissal or a dishonorable or bad-conduct discharge may not be executed until there is a final judgment as to the legality of the proceedings. A judgment as to the legality of the proceedings is final in such cases when review is completed by the Superior Court under section 5910 (relating to review by Superior Court) and is deemed final by the law of state where the judgment was had.
(b) Appellate review waived or appeal withdrawn.--If a sentence extends to dismissal or a dishonorable or bad-conduct discharge, the right of the accused to appellate review is waived or an appeal is withdrawn, that part of the sentence extending to dismissal or a dishonorable or bad-conduct discharge may not be executed until review of the case by the State Judge Advocate and any action on that review is completed. Any other part of a court-martial sentence may be ordered executed by the convening authority or other authorized party when approved under section 5906 (relating to approval by convening authority).