Why cant I just call throw to return the status word?
Created May 7, 2012
Julien SIMON
In standard Java, youd do something like throw new MyException(). The problem is that Java Card doesnt support garbage collection. Hence, its highly undesirable to create many short-lived objects, whose memory will NOT be reclaimed. Here, many really means one for each APDU!
Instead, you must call ISOException.throwIt(). This class extends the Exception class and implements the well-known Singleton pattern, so theres only one instance of the ISOException class, which is reused. This way, applets can throw and catch exceptions, but still conserve memory.