Many legal plot holes
When he was first arrested for suspicion of stealing the shoes, he was not provided a public defender. Under the law, "you have the right to an attorney, if you cannot afford one, the court will provide one for you."
Also, after he was found guilty, he was sentenced far too harshly. The reason for his harsh sentence was because the shoes were valuable and because the shoes were being donated to a charity. First of all, the shoes have very little intrinsic value, so thus he should have only been charged with 'petty theft' rather than 'grand theft' since the intrinsic value of the shoes was basically zero. Second, theft is punished by the intrinsic value of the item, rather than where it was stolen from.
Finally, at the end of the movie when Stanley finds the chest, it is declared to be his because it had his name on it. There are so many problems with this, but the main one is that having identifying information on property does not prove ownership. Under property abandonment law, property is considered abandoned when it is left on public property for more than fifty years.
I am aware that very few people reading this forum even care about the law, but I like to show off my knowledge whenever possible.