The basic rule is you are subject to the system of justice of the planet you're visiting. I'd only intervene if the sentence was grossly excessive, like Wesley Crusher in "Justice". My engineer is sentenced to one year, not death, and the engineer was an adult, not a juvenile. (If the confinement were like Roddenberry's fantasy planet on "Justice" in which everyone wears skanty clothing and has sex at the drop of a hat, the engineer might even consider it to be a fantasy year.)