according to API Spec @
http://seek-for-android.googlecode.com/svn/trunk/doc/org/simalliance/openmobilea
pi/Session.html#openLogicalChannel(byte[]), when user call
Session.openLogicalChannel against an non-existing AID or non-multiselectable
AID, he/she should get NoSuchElementException according to following statement:
java.utils.NoSuchElementException - if an Applet with the defined AID does not
exist in the SE or a logical channel is already open to a non-multiselectable
applet
But they would not get it because in SEService.java openLogicalChannel, when
checkIfAppletAvailable() is called, NoSuchElementException got casted into
IOException, following is the solution:
private void checkIfAppletAvailable(SmartcardError error) throws IOException {
Exception exp = error.createException();
if (exp != null) {
if(exp instanceof NoSuchElementException) {
//wrong behavior against API spec
// start of solution
//throw new IOException("Applet with the defined aid does not exist in the SE");
throw new NoSuchElementException("Applet with the defined aid does not exist in the SE");
// end of solution
}
}
}
Original issue reported on code.google.com by tommypo...@gmail.com on 7 Jun 2012 at 9:17
Original issue reported on code.google.com by
tommypo...@gmail.com
on 7 Jun 2012 at 9:17