Page 1 of 1

Why did my applet can not throw exception?

Posted: Fri Dec 11, 2015 4:42 am
by corleoner
I have finished a simple applet. But I faced a problem. I can select it successfully, but when I sent "00000000", it didn't have any reaction.
My applet can not throw exception 0x8080. It seemed that it couldn't run to this line at all.
ISOException.throwIt((short) 0x8080);
.
Kindly help please. What's wrong?
APDU:


Code:

Code: Select all

package test002;

import javacard.framework.*;

public class test extends Applet
{

   public static void install(byte[] bArray, short bOffset, byte bLength)
   {
      new test().register(bArray, (short) (bOffset + 1), bArray[bOffset]);
   }

   public void process(APDU apdu)
   {
      if (selectingApplet())
      {
         return;
      }

      byte[] buf = apdu.getBuffer();
      switch (buf[ISO7816.OFFSET_INS])
      {
      default:
         ISOException.throwIt((short) 0x8080);

      }
   }

}

Re: Why did my applet can not throw exception?

Posted: Sun Dec 20, 2015 10:50 pm
by mabel
Your problem is with the status word used.

The exception status word must conform to the 7816 specification.
ISO7816-4 said that:
any value different from '6XXX' and '9XXX' is invalid; any value '60XX' is also invalid.


So try a few in the 61xx ranges. Hope it helps!